From 62c5f68095d0cb53c7a7b7d48cda40de23f35394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Sun, 14 Aug 2016 12:41:32 +0200 Subject: [PATCH] bcm53xx: backport USB 3.0 controller init patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rafał Miłecki --- ...tialize-Northstar-USB-3.0-controller.patch | 67 +++++++++++++++++++ .../197-USB-bcma-add-USB-3.0-support.patch | 54 +++++---------- ...-USB-2.0-PHY-support-for-BCM4709-and.patch | 8 +-- 3 files changed, 87 insertions(+), 42 deletions(-) create mode 100644 target/linux/bcm53xx/patches-4.4/082-0001-USB-bcma-initialize-Northstar-USB-3.0-controller.patch diff --git a/target/linux/bcm53xx/patches-4.4/082-0001-USB-bcma-initialize-Northstar-USB-3.0-controller.patch b/target/linux/bcm53xx/patches-4.4/082-0001-USB-bcma-initialize-Northstar-USB-3.0-controller.patch new file mode 100644 index 0000000000..a1075b3a43 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.4/082-0001-USB-bcma-initialize-Northstar-USB-3.0-controller.patch @@ -0,0 +1,67 @@ +From 3cc7e7b7872ebd0f200b5450f5471bc3700de141 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 8 Jul 2016 14:02:50 +0200 +Subject: [PATCH] USB: bcma: initialize Northstar USB 3.0 controller +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's a rather simple controller, we just need to make sure USB is +powered (using GPIO pin) and reset bus core. Once this is done it's +safe to register XHCI controller and let it init PHY and do its magic. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/bcma-hcd.c | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -27,6 +27,7 @@ + #include + #include + #include ++#include + #include + #include + +@@ -338,6 +339,18 @@ err_unregister_ohci_dev: + return err; + } + ++static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd) ++{ ++ struct bcma_device *core = bcma_hcd->core; ++ struct device *dev = &core->dev; ++ ++ bcma_core_enable(core, 0); ++ ++ of_platform_default_populate(dev->of_node, NULL, dev); ++ ++ return 0; ++} ++ + static int bcma_hcd_probe(struct bcma_device *core) + { + int err; +@@ -362,6 +375,11 @@ static int bcma_hcd_probe(struct bcma_de + if (err) + return err; + break; ++ case BCMA_CORE_NS_USB30: ++ err = bcma_hcd_usb30_init(usb_dev); ++ if (err) ++ return err; ++ break; + default: + return -ENODEV; + } +@@ -416,6 +434,7 @@ static int bcma_hcd_resume(struct bcma_d + static const struct bcma_device_id bcma_hcd_table[] = { + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS), + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS), ++ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB30, BCMA_ANY_REV, BCMA_ANY_CLASS), + {}, + }; + MODULE_DEVICE_TABLE(bcma, bcma_hcd_table); diff --git a/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch b/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch index 946b8e5efc..a86dfc1b95 100644 --- a/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch +++ b/target/linux/bcm53xx/patches-4.4/197-USB-bcma-add-USB-3.0-support.patch @@ -14,15 +14,15 @@ Signed-off-by: Hauke Mehrtens --- a/drivers/usb/host/bcma-hcd.c +++ b/drivers/usb/host/bcma-hcd.c -@@ -29,6 +29,7 @@ - #include +@@ -30,6 +30,7 @@ + #include #include #include +#include MODULE_AUTHOR("Hauke Mehrtens"); MODULE_DESCRIPTION("Common USB driver for BCMA Bus"); -@@ -38,6 +39,7 @@ struct bcma_hcd_device { +@@ -39,6 +40,7 @@ struct bcma_hcd_device { struct bcma_device *core; struct platform_device *ehci_dev; struct platform_device *ohci_dev; @@ -30,7 +30,7 @@ Signed-off-by: Hauke Mehrtens struct gpio_desc *gpio_desc; }; -@@ -245,6 +247,10 @@ static const struct usb_ehci_pdata ehci_ +@@ -246,6 +248,10 @@ static const struct usb_ehci_pdata ehci_ static const struct usb_ohci_pdata ohci_pdata = { }; @@ -41,7 +41,7 @@ Signed-off-by: Hauke Mehrtens static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, const char *name, u32 addr, const void *data, -@@ -338,6 +344,167 @@ err_unregister_ohci_dev: +@@ -339,6 +345,150 @@ err_unregister_ohci_dev: return err; } @@ -189,12 +189,13 @@ Signed-off-by: Hauke Mehrtens + iounmap(dmu); +} + -+static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd) -+{ -+ struct bcma_device *core = bcma_hcd->core; -+ -+ bcma_core_enable(core, 0); -+ + static int bcma_hcd_usb30_init(struct bcma_hcd_device *bcma_hcd) + { + struct bcma_device *core = bcma_hcd->core; +@@ -346,6 +496,14 @@ static int bcma_hcd_usb30_init(struct bc + + bcma_core_enable(core, 0); + + bcma_hcd_usb30_phy_init(bcma_hcd); + + bcma_hcd->xhci_dev = bcma_hcd_create_pdev(core, "xhci-hcd", core->addr, @@ -203,25 +204,10 @@ Signed-off-by: Hauke Mehrtens + if (IS_ERR(bcma_hcd->ohci_dev)) + return PTR_ERR(bcma_hcd->ohci_dev); + -+ return 0; -+} -+ - static int bcma_hcd_probe(struct bcma_device *core) - { - int err; -@@ -362,6 +529,11 @@ static int bcma_hcd_probe(struct bcma_de - if (err) - return err; - break; -+ case BCMA_CORE_NS_USB30: -+ err = bcma_hcd_usb30_init(usb_dev); -+ if (err) -+ return err; -+ break; - default: - return -ENODEV; - } -@@ -375,11 +547,14 @@ static void bcma_hcd_remove(struct bcma_ + of_platform_default_populate(dev->of_node, NULL, dev); + + return 0; +@@ -393,11 +551,14 @@ static void bcma_hcd_remove(struct bcma_ struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); struct platform_device *ohci_dev = usb_dev->ohci_dev; struct platform_device *ehci_dev = usb_dev->ehci_dev; @@ -236,11 +222,3 @@ Signed-off-by: Hauke Mehrtens bcma_core_disable(dev, 0); } -@@ -416,6 +591,7 @@ static int bcma_hcd_resume(struct bcma_d - static const struct bcma_device_id bcma_hcd_table[] = { - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS), - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS), -+ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB30, BCMA_ANY_REV, BCMA_ANY_CLASS), - {}, - }; - MODULE_DEVICE_TABLE(bcma, bcma_hcd_table); diff --git a/target/linux/bcm53xx/patches-4.4/811-USB-bcma-improve-USB-2.0-PHY-support-for-BCM4709-and.patch b/target/linux/bcm53xx/patches-4.4/811-USB-bcma-improve-USB-2.0-PHY-support-for-BCM4709-and.patch index b4d8d38e50..02cac54c3d 100644 --- a/target/linux/bcm53xx/patches-4.4/811-USB-bcma-improve-USB-2.0-PHY-support-for-BCM4709-and.patch +++ b/target/linux/bcm53xx/patches-4.4/811-USB-bcma-improve-USB-2.0-PHY-support-for-BCM4709-and.patch @@ -9,7 +9,7 @@ Signed-off-by: Rafał Miłecki --- --- a/drivers/usb/host/bcma-hcd.c +++ b/drivers/usb/host/bcma-hcd.c -@@ -31,6 +31,17 @@ +@@ -32,6 +32,17 @@ #include #include @@ -27,7 +27,7 @@ Signed-off-by: Rafał Miłecki MODULE_AUTHOR("Hauke Mehrtens"); MODULE_DESCRIPTION("Common USB driver for BCMA Bus"); MODULE_LICENSE("GPL"); -@@ -167,10 +178,35 @@ static void bcma_hcd_init_chip_mips(stru +@@ -168,10 +179,35 @@ static void bcma_hcd_init_chip_mips(stru } } @@ -63,7 +63,7 @@ Signed-off-by: Rafał Miłecki arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9); if (!arm_core) { -@@ -184,14 +220,29 @@ static void bcma_hcd_init_chip_arm_phy(s +@@ -185,14 +221,29 @@ static void bcma_hcd_init_chip_arm_phy(s return; } @@ -96,7 +96,7 @@ Signed-off-by: Rafał Miłecki iounmap(dmu); } -@@ -219,15 +270,17 @@ static void bcma_hcd_init_chip_arm_hc(st +@@ -220,15 +271,17 @@ static void bcma_hcd_init_chip_arm_hc(st static void bcma_hcd_init_chip_arm(struct bcma_device *dev) {