]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
usb: uhci: Add Aspeed AST2700 support
authorRyan Chen <ryan_chen@aspeedtech.com>
Mon, 22 Sep 2025 05:20:45 +0000 (13:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Oct 2025 07:11:49 +0000 (09:11 +0200)
Unlike earlier Aspeed SoCs (AST2400/2500/2600) which are limited to
32-bit DMA addressing, the UHCI controller in AST2700 supports 64-bit
DMA. Update the platform UHCI driver to select the appropriate DMA
mask based on the device tree compatible string.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
Reviewed-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20250922052045.2421480-5-ryan_chen@aspeedtech.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/uhci-platform.c

index aa75b546672b5eca8d215b54fa6174a2f64f168d..37607f985cc012a5b947294373bf6c348f70e6da 100644 (file)
@@ -65,9 +65,13 @@ static const struct hc_driver uhci_platform_hc_driver = {
        .hub_control =          uhci_hub_control,
 };
 
+static const u64 dma_mask_32 = DMA_BIT_MASK(32);
+static const u64 dma_mask_64 = DMA_BIT_MASK(64);
+
 static int uhci_hcd_platform_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
+       const u64 *dma_mask_ptr;
        struct usb_hcd *hcd;
        struct uhci_hcd *uhci;
        struct resource *res;
@@ -81,7 +85,11 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
         * Since shared usb code relies on it, set it here for now.
         * Once we have dma capability bindings this can go away.
         */
-       ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev);
+       if (!dma_mask_ptr)
+               dma_mask_ptr = &dma_mask_32;
+
+       ret = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr);
        if (ret)
                return ret;
 
@@ -114,7 +122,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev)
                }
                if (of_device_is_compatible(np, "aspeed,ast2400-uhci") ||
                    of_device_is_compatible(np, "aspeed,ast2500-uhci") ||
-                   of_device_is_compatible(np, "aspeed,ast2600-uhci")) {
+                   of_device_is_compatible(np, "aspeed,ast2600-uhci") ||
+                   of_device_is_compatible(np, "aspeed,ast2700-uhci")) {
                        uhci->is_aspeed = 1;
                        dev_info(&pdev->dev,
                                 "Enabled Aspeed implementation workarounds\n");
@@ -191,6 +200,7 @@ static void uhci_hcd_platform_shutdown(struct platform_device *op)
 static const struct of_device_id platform_uhci_ids[] = {
        { .compatible = "generic-uhci", },
        { .compatible = "platform-uhci", },
+       { .compatible = "aspeed,ast2700-uhci", .data = &dma_mask_64},
        {}
 };
 MODULE_DEVICE_TABLE(of, platform_uhci_ids);