diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-06-16 08:28:46 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-06-16 08:28:46 +0000 |
commit | 351a2ec15fa0855b2dc29dfbb62113f71e4e6a76 (patch) | |
tree | 28a8489608bf9f5eb77be1a478cbc997d8b3e1d4 | |
parent | a7780603923fddec225c9f4b0990fede4c2695a9 (diff) | |
download | upstream-351a2ec15fa0855b2dc29dfbb62113f71e4e6a76.tar.gz upstream-351a2ec15fa0855b2dc29dfbb62113f71e4e6a76.tar.bz2 upstream-351a2ec15fa0855b2dc29dfbb62113f71e4e6a76.zip |
bcm53xx: use USB patches sent upstream by Hauke
This stabilizes USB support. The old patch was handling initialization
in a different order that was causing some problems with few USB 3.0
devices. Some weren't detected, some were working unstable, sometimes
USB 3.0 could hang the whole controller.
A still known issue (but not a regression) is controller hang triggered
by connecting USB 1.1 device when not having OHCI controller enabled
(kmod-usb-ohci).
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 45997
8 files changed, 383 insertions, 162 deletions
diff --git a/target/linux/bcm53xx/patches-3.18/180-USB-bcma-remove-chip-id-check.patch b/target/linux/bcm53xx/patches-3.18/180-USB-bcma-remove-chip-id-check.patch new file mode 100644 index 0000000000..56e962d793 --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/180-USB-bcma-remove-chip-id-check.patch @@ -0,0 +1,39 @@ +From baf3d128e5bdf9d322539609133a15b493b0c2ef Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:35 +0200 +Subject: [PATCH] USB: bcma: remove chip id check + +I have never seen any bcma device with an USB host core which was not a +SoC, the bcma devices have an USB device core with a different core id. +Some SoC have IDs with 47XX and 53XX in decimal form which would be +rejected by this check. Instead of fixing this check just remove it. + +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index cd6d0af..080587e 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -214,16 +214,11 @@ err_alloc: + static int bcma_hcd_probe(struct bcma_device *dev) + { + int err; +- u16 chipid_top; + u32 ohci_addr; + struct bcma_hcd_device *usb_dev; + struct bcma_chipinfo *chipinfo; + + chipinfo = &dev->bus->chipinfo; +- /* USBcores are only connected on embedded devices. */ +- chipid_top = (chipinfo->id & 0xFF00); +- if (chipid_top != 0x4700 && chipid_top != 0x5300) +- return -ENODEV; + + /* TODO: Probably need checks here; is the core connected? */ + +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/181-USB-bcma-replace-numbers-with-constants.patch b/target/linux/bcm53xx/patches-3.18/181-USB-bcma-replace-numbers-with-constants.patch new file mode 100644 index 0000000000..1e18fcfca2 --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/181-USB-bcma-replace-numbers-with-constants.patch @@ -0,0 +1,29 @@ +From f5bc834917a8b1b9487749bdfe8eda52a01967b4 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:36 +0200 +Subject: [PATCH] USB: bcma: replace numbers with constants + +The constants for these numbers were added long time ago, use them. + +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index 080587e..853bf9d 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -233,7 +233,8 @@ static int bcma_hcd_probe(struct bcma_device *dev) + + /* In AI chips EHCI is addrspace 0, OHCI is 1 */ + ohci_addr = dev->addr_s[0]; +- if ((chipinfo->id == 0x5357 || chipinfo->id == 0x4749) ++ if ((chipinfo->id == BCMA_CHIP_ID_BCM5357 || ++ chipinfo->id == BCMA_CHIP_ID_BCM4749) + && chipinfo->rev == 0) + ohci_addr = 0x18009000; + +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/182-USB-bcma-use-devm_kzalloc.patch b/target/linux/bcm53xx/patches-3.18/182-USB-bcma-use-devm_kzalloc.patch new file mode 100644 index 0000000000..32a17653de --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/182-USB-bcma-use-devm_kzalloc.patch @@ -0,0 +1,52 @@ +From 93724affb195149df6f7630901d878f6e273fa02 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:37 +0200 +Subject: [PATCH] USB: bcma: use devm_kzalloc + +Instead of manually handling the frees use devm. There was also a free +missing in the unregister call which is not needed with devm. + +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index 853bf9d..d7ea50d 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -225,7 +225,8 @@ static int bcma_hcd_probe(struct bcma_device *dev) + if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) + return -EOPNOTSUPP; + +- usb_dev = kzalloc(sizeof(struct bcma_hcd_device), GFP_KERNEL); ++ usb_dev = devm_kzalloc(&dev->dev, sizeof(struct bcma_hcd_device), ++ GFP_KERNEL); + if (!usb_dev) + return -ENOMEM; + +@@ -239,10 +240,8 @@ static int bcma_hcd_probe(struct bcma_device *dev) + ohci_addr = 0x18009000; + + usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr); +- if (IS_ERR(usb_dev->ohci_dev)) { +- err = PTR_ERR(usb_dev->ohci_dev); +- goto err_free_usb_dev; +- } ++ if (IS_ERR(usb_dev->ohci_dev)) ++ return PTR_ERR(usb_dev->ohci_dev); + + usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr); + if (IS_ERR(usb_dev->ehci_dev)) { +@@ -255,8 +254,6 @@ static int bcma_hcd_probe(struct bcma_device *dev) + + err_unregister_ohci_dev: + platform_device_unregister(usb_dev->ohci_dev); +-err_free_usb_dev: +- kfree(usb_dev); + return err; + } + +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/183-USB-bcma-fix-error-handling-in-bcma_hcd_create_pdev.patch b/target/linux/bcm53xx/patches-3.18/183-USB-bcma-fix-error-handling-in-bcma_hcd_create_pdev.patch new file mode 100644 index 0000000000..799c93ef41 --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/183-USB-bcma-fix-error-handling-in-bcma_hcd_create_pdev.patch @@ -0,0 +1,38 @@ +From 232996d1ba3002e7e80b18075e2838fc86f21412 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:38 +0200 +Subject: [PATCH] USB: bcma: fix error handling in bcma_hcd_create_pdev() + +This patch makes bcma_hcd_create_pdev() not return NULL, but a prober +error code in case of an error. + +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index d7ea50d..8a38313 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -169,7 +169,7 @@ static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, boo + { + struct platform_device *hci_dev; + struct resource hci_res[2]; +- int ret = -ENOMEM; ++ int ret; + + memset(hci_res, 0, sizeof(hci_res)); + +@@ -183,7 +183,7 @@ static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, boo + hci_dev = platform_device_alloc(ohci ? "ohci-platform" : + "ehci-platform" , 0); + if (!hci_dev) +- return NULL; ++ return ERR_PTR(-ENOMEM); + + hci_dev->dev.parent = &dev->dev; + hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/184-USB-bcma-add-bcm53xx-support.patch b/target/linux/bcm53xx/patches-3.18/184-USB-bcma-add-bcm53xx-support.patch new file mode 100644 index 0000000000..d7980fa4fa --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/184-USB-bcma-add-bcm53xx-support.patch @@ -0,0 +1,138 @@ +From b65851f41c22b8c69b8fe9ca7782d19ed2155efc Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:39 +0200 +Subject: [PATCH] USB: bcma: add bcm53xx support + +The Broadcom ARM SoCs with this usb core need a different +initialization and they have a different core id. This patch adds +support for these USB 2.0 core. + +Signed-off-by: Felix Fietkau <nbd@openwrt.org> +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 81 +++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 78 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index 8a38313..983bc67 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -2,7 +2,8 @@ + * Broadcom specific Advanced Microcontroller Bus + * Broadcom USB-core driver (BCMA bus glue) + * +- * Copyright 2011-2012 Hauke Mehrtens <hauke@hauke-m.de> ++ * Copyright 2011-2015 Hauke Mehrtens <hauke@hauke-m.de> ++ * Copyright 2015 Felix Fietkau <nbd@openwrt.org> + * + * Based on ssb-ohci driver + * Copyright 2007 Michael Buesch <m@bues.ch> +@@ -88,7 +89,7 @@ static void bcma_hcd_4716wa(struct bcma_device *dev) + } + + /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */ +-static void bcma_hcd_init_chip(struct bcma_device *dev) ++static void bcma_hcd_init_chip_mips(struct bcma_device *dev) + { + u32 tmp; + +@@ -159,6 +160,70 @@ static void bcma_hcd_init_chip(struct bcma_device *dev) + } + } + ++static void bcma_hcd_init_chip_arm_phy(struct bcma_device *dev) ++{ ++ struct bcma_device *arm_core; ++ void __iomem *dmu; ++ ++ arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9); ++ if (!arm_core) { ++ dev_err(&dev->dev, "can not find ARM Cortex A9 ihost core\n"); ++ return; ++ } ++ ++ dmu = ioremap_nocache(arm_core->addr_s[0], 0x1000); ++ if (!dmu) { ++ dev_err(&dev->dev, "can not map ARM Cortex A9 ihost core\n"); ++ return; ++ } ++ ++ /* Unlock DMU PLL settings */ ++ iowrite32(0x0000ea68, dmu + 0x180); ++ ++ /* Write USB 2.0 PLL control setting */ ++ iowrite32(0x00dd10c3, dmu + 0x164); ++ ++ /* Lock DMU PLL settings */ ++ iowrite32(0x00000000, dmu + 0x180); ++ ++ iounmap(dmu); ++} ++ ++static void bcma_hcd_init_chip_arm_hc(struct bcma_device *dev) ++{ ++ u32 val; ++ ++ /* ++ * Delay after PHY initialized to ensure HC is ready to be configured ++ */ ++ usleep_range(1000, 2000); ++ ++ /* Set packet buffer OUT threshold */ ++ val = bcma_read32(dev, 0x94); ++ val &= 0xffff; ++ val |= 0x80 << 16; ++ bcma_write32(dev, 0x94, val); ++ ++ /* Enable break memory transfer */ ++ val = bcma_read32(dev, 0x9c); ++ val |= 1; ++ bcma_write32(dev, 0x9c, val); ++} ++ ++static void bcma_hcd_init_chip_arm(struct bcma_device *dev) ++{ ++ bcma_core_enable(dev, 0); ++ ++ if (dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM4707 || ++ dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM53018) { ++ if (dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4707 || ++ dev->bus->chipinfo.pkg == BCMA_PKG_ID_BCM4708) ++ bcma_hcd_init_chip_arm_phy(dev); ++ ++ bcma_hcd_init_chip_arm_hc(dev); ++ } ++} ++ + static const struct usb_ehci_pdata ehci_pdata = { + }; + +@@ -230,7 +295,16 @@ static int bcma_hcd_probe(struct bcma_device *dev) + if (!usb_dev) + return -ENOMEM; + +- bcma_hcd_init_chip(dev); ++ switch (dev->id.id) { ++ case BCMA_CORE_NS_USB20: ++ bcma_hcd_init_chip_arm(dev); ++ break; ++ case BCMA_CORE_USB20_HOST: ++ bcma_hcd_init_chip_mips(dev); ++ break; ++ default: ++ return -ENODEV; ++ } + + /* In AI chips EHCI is addrspace 0, OHCI is 1 */ + ohci_addr = dev->addr_s[0]; +@@ -299,6 +373,7 @@ static int bcma_hcd_resume(struct bcma_device *dev) + + 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_CORETABLE_END + }; + MODULE_DEVICE_TABLE(bcma, bcma_hcd_table); +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/185-USB-bcma-add-support-for-controlling-bus-power-throu.patch b/target/linux/bcm53xx/patches-3.18/185-USB-bcma-add-support-for-controlling-bus-power-throu.patch new file mode 100644 index 0000000000..8a00141b8f --- /dev/null +++ b/target/linux/bcm53xx/patches-3.18/185-USB-bcma-add-support-for-controlling-bus-power-throu.patch @@ -0,0 +1,87 @@ +From f3cf44a313b3687efd55ba091558e20a4d218c31 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Thu, 11 Jun 2015 22:57:40 +0200 +Subject: [PATCH] USB: bcma: add support for controlling bus power through GPIO + +On some boards a GPIO is needed to activate USB controller. Make it +possible to specify such a GPIO in device tree. + +Signed-off-by: Felix Fietkau <nbd@openwrt.org> +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +--- + drivers/usb/host/bcma-hcd.c | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + +diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c +index 983bc67..a01c6ce 100644 +--- a/drivers/usb/host/bcma-hcd.c ++++ b/drivers/usb/host/bcma-hcd.c +@@ -24,6 +24,8 @@ + #include <linux/platform_device.h> + #include <linux/module.h> + #include <linux/slab.h> ++#include <linux/of.h> ++#include <linux/of_gpio.h> + #include <linux/usb/ehci_pdriver.h> + #include <linux/usb/ohci_pdriver.h> + +@@ -224,6 +226,23 @@ static void bcma_hcd_init_chip_arm(struct bcma_device *dev) + } + } + ++static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val) ++{ ++ int gpio; ++ ++ gpio = of_get_named_gpio(dev->dev.of_node, "vcc-gpio", 0); ++ if (!gpio_is_valid(gpio)) ++ return; ++ ++ if (val) { ++ gpio_request(gpio, "bcma-hcd-gpio"); ++ gpio_set_value(gpio, 1); ++ } else { ++ gpio_set_value(gpio, 0); ++ gpio_free(gpio); ++ } ++} ++ + static const struct usb_ehci_pdata ehci_pdata = { + }; + +@@ -295,6 +314,8 @@ static int bcma_hcd_probe(struct bcma_device *dev) + if (!usb_dev) + return -ENOMEM; + ++ bcma_hci_platform_power_gpio(dev, true); ++ + switch (dev->id.id) { + case BCMA_CORE_NS_USB20: + bcma_hcd_init_chip_arm(dev); +@@ -347,6 +368,7 @@ static void bcma_hcd_remove(struct bcma_device *dev) + + static void bcma_hcd_shutdown(struct bcma_device *dev) + { ++ bcma_hci_platform_power_gpio(dev, false); + bcma_core_disable(dev, 0); + } + +@@ -354,6 +376,7 @@ static void bcma_hcd_shutdown(struct bcma_device *dev) + + static int bcma_hcd_suspend(struct bcma_device *dev) + { ++ bcma_hci_platform_power_gpio(dev, false); + bcma_core_disable(dev, 0); + + return 0; +@@ -361,6 +384,7 @@ static int bcma_hcd_suspend(struct bcma_device *dev) + + static int bcma_hcd_resume(struct bcma_device *dev) + { ++ bcma_hci_platform_power_gpio(dev, true); + bcma_core_enable(dev, 0); + + return 0; +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.18/190-bcma_hcd_add_bcm5301x_support.patch b/target/linux/bcm53xx/patches-3.18/190-bcma_hcd_add_bcm5301x_support.patch deleted file mode 100644 index bffb7ae052..0000000000 --- a/target/linux/bcm53xx/patches-3.18/190-bcma_hcd_add_bcm5301x_support.patch +++ /dev/null @@ -1,100 +0,0 @@ -Subject: [PATCH] bcma-hcd: add BCM5301x platform support - -Signed-off-by: Felix Fietkau <nbd@openwrt.org> ---- ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -88,7 +88,7 @@ static void bcma_hcd_4716wa(struct bcma_ - } - - /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */ --static void bcma_hcd_init_chip(struct bcma_device *dev) -+static void bcma_hcd_init_chip_mips(struct bcma_device *dev) - { - u32 tmp; - -@@ -159,6 +159,52 @@ static void bcma_hcd_init_chip(struct bc - } - } - -+static void bcma_hcd_init_chip_arm(struct bcma_device *dev) -+{ -+ struct bcma_device *arm_core; -+ void __iomem *dmu; -+ u32 val; -+ -+ bcma_core_disable(dev, 0); -+ bcma_core_enable(dev, 0); -+ -+ msleep(1); -+ -+ /* Set packet buffer OUT threshold */ -+ val = bcma_read32(dev, 0x94); -+ val &= 0xffff; -+ val |= 0x80 << 16; -+ bcma_write32(dev, 0x94, val); -+ -+ /* Enable break memory transfer */ -+ val = bcma_read32(dev, 0x9c); -+ val |= 1; -+ bcma_write32(dev, 0x9c, val); -+ -+ if (dev->bus->chipinfo.pkg != BCMA_PKG_ID_BCM4707 && -+ dev->bus->chipinfo.pkg != BCMA_PKG_ID_BCM4708) -+ return; -+ -+ arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9); -+ if (!arm_core) -+ return; -+ -+ dmu = ioremap_nocache(arm_core->addr_s[0], 0x1000); -+ if (!dmu) -+ return; -+ -+ /* Unlock DMU PLL settings */ -+ iowrite32(0x0000ea68, dmu + 0x180); -+ -+ /* Write USB 2.0 PLL control setting */ -+ iowrite32(0x00dd10c3, dmu + 0x164); -+ -+ /* Lock DMU PLL settings */ -+ iowrite32(0x00000000, dmu + 0x180); -+ -+ iounmap(dmu); -+} -+ - static const struct usb_ehci_pdata ehci_pdata = { - }; - -@@ -222,7 +268,8 @@ static int bcma_hcd_probe(struct bcma_de - chipinfo = &dev->bus->chipinfo; - /* USBcores are only connected on embedded devices. */ - chipid_top = (chipinfo->id & 0xFF00); -- if (chipid_top != 0x4700 && chipid_top != 0x5300) -+ if (chipid_top != 0x4700 && chipid_top != 0x5300 && -+ chipinfo->id != BCMA_CHIP_ID_BCM4707) - return -ENODEV; - - /* TODO: Probably need checks here; is the core connected? */ -@@ -234,7 +281,12 @@ static int bcma_hcd_probe(struct bcma_de - if (!usb_dev) - return -ENOMEM; - -- bcma_hcd_init_chip(dev); -+ if (IS_BUILTIN(CONFIG_ARCH_BCM_5301X) && -+ chipinfo->id == BCMA_CHIP_ID_BCM4707) { -+ bcma_hcd_init_chip_arm(dev); -+ } else if(IS_BUILTIN(CONFIG_BCM47XX)) { -+ bcma_hcd_init_chip_mips(dev); -+ } - - /* In AI chips EHCI is addrspace 0, OHCI is 1 */ - ohci_addr = dev->addr_s[0]; -@@ -306,6 +358,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_CORETABLE_END - }; - MODULE_DEVICE_TABLE(bcma, bcma_hcd_table); diff --git a/target/linux/bcm53xx/patches-3.18/191-bcma_hcd_add_gpio_power_control.patch b/target/linux/bcm53xx/patches-3.18/191-bcma_hcd_add_gpio_power_control.patch deleted file mode 100644 index 9c45556ec9..0000000000 --- a/target/linux/bcm53xx/patches-3.18/191-bcma_hcd_add_gpio_power_control.patch +++ /dev/null @@ -1,62 +0,0 @@ -Subject: [PATCH] bcma-hcd: add support for controlling bus power through GPIO - -Signed-off-by: Felix Fietkau <nbd@openwrt.org> ---- ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -23,6 +23,8 @@ - #include <linux/platform_device.h> - #include <linux/module.h> - #include <linux/slab.h> -+#include <linux/of.h> -+#include <linux/of_gpio.h> - #include <linux/usb/ehci_pdriver.h> - #include <linux/usb/ohci_pdriver.h> - -@@ -205,7 +207,38 @@ static void bcma_hcd_init_chip_arm(struc - iounmap(dmu); - } - -+static void bcma_hci_platform_power_gpio(struct platform_device *dev, bool val) -+{ -+ int gpio; -+ -+ gpio = of_get_named_gpio(dev->dev.of_node, "vcc-gpio", 0); -+ if (!gpio_is_valid(gpio)) -+ return; -+ -+ if (val) { -+ gpio_request(gpio, "bcma-hcd-gpio"); -+ gpio_set_value(gpio, 1); -+ } else { -+ gpio_set_value(gpio, 0); -+ gpio_free(gpio); -+ } -+} -+ -+static int bcma_hci_platform_power_on(struct platform_device *dev) -+{ -+ bcma_hci_platform_power_gpio(dev, true); -+ return 0; -+} -+ -+static void bcma_hci_platform_power_off(struct platform_device *dev) -+{ -+ bcma_hci_platform_power_gpio(dev, false); -+} -+ - static const struct usb_ehci_pdata ehci_pdata = { -+ .power_on = bcma_hci_platform_power_on, -+ .power_suspend = bcma_hci_platform_power_off, -+ .power_off = bcma_hci_platform_power_off, - }; - - static const struct usb_ohci_pdata ohci_pdata = { -@@ -233,6 +266,7 @@ static struct platform_device *bcma_hcd_ - - hci_dev->dev.parent = &dev->dev; - hci_dev->dev.dma_mask = &hci_dev->dev.coherent_dma_mask; -+ hci_dev->dev.of_node = dev->dev.of_node; - - ret = platform_device_add_resources(hci_dev, hci_res, - ARRAY_SIZE(hci_res)); |