mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 13:48:06 +00:00
bcm53xx: add USB 2.0 support
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 45450
This commit is contained in:
parent
f1119373f2
commit
83e31eb7e7
@ -310,7 +310,9 @@ $(eval $(call KernelPackage,usb-uhci,1))
|
||||
|
||||
define KernelPackage/usb-ohci
|
||||
TITLE:=Support for OHCI controllers
|
||||
DEPENDS:=+TARGET_brcm47xx:kmod-usb-brcm47xx
|
||||
DEPENDS:= \
|
||||
+TARGET_brcm47xx:kmod-usb-bcma \
|
||||
+TARGET_brcm47xx:kmod-usb-ssb
|
||||
KCONFIG:= \
|
||||
CONFIG_USB_OHCI \
|
||||
CONFIG_USB_OHCI_HCD \
|
||||
@ -385,11 +387,34 @@ endef
|
||||
|
||||
$(eval $(call KernelPackage,usb2-omap))
|
||||
|
||||
define KernelPackage/usb-bcma
|
||||
TITLE:=Support for BCMA USB controllers
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx||TARGET_bcm53xx
|
||||
KCONFIG:=CONFIG_USB_HCD_BCMA
|
||||
FILES:= \
|
||||
$(if $(CONFIG_USB_HCD_BCMA),$(LINUX_DIR)/drivers/usb/host/bcma-hcd.ko)
|
||||
AUTOLOAD:=$(call AutoLoad,19,$(if $(CONFIG_USB_HCD_BCMA),bcma-hcd),1)
|
||||
$(call AddDepends/usb)
|
||||
endef
|
||||
$(eval $(call KernelPackage,usb-bcma))
|
||||
|
||||
define KernelPackage/usb-ssb
|
||||
TITLE:=Support for SSB USB controllers
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx
|
||||
KCONFIG:=CONFIG_USB_HCD_SSB
|
||||
FILES:= \
|
||||
$(if $(CONFIG_USB_HCD_SSB),$(LINUX_DIR)/drivers/usb/host/ssb-hcd.ko)
|
||||
AUTOLOAD:=$(call AutoLoad,19,$(if $(CONFIG_USB_HCD_SSB),ssb-hcd),1)
|
||||
$(call AddDepends/usb)
|
||||
endef
|
||||
$(eval $(call KernelPackage,usb-ssb))
|
||||
|
||||
define KernelPackage/usb2
|
||||
TITLE:=Support for USB2 controllers
|
||||
DEPENDS:=\
|
||||
+TARGET_brcm47xx:kmod-usb-brcm47xx \
|
||||
+TARGET_brcm47xx:kmod-usb-bcma \
|
||||
+TARGET_brcm47xx:kmod-usb-ssb \
|
||||
+TARGET_bcm53xx:kmod-usb-bcma \
|
||||
+TARGET_mpc85xx:kmod-usb2-fsl
|
||||
KCONFIG:=\
|
||||
CONFIG_USB_EHCI_HCD \
|
||||
|
@ -0,0 +1,122 @@
|
||||
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,18 +281,23 @@ static int bcma_hcd_probe(struct bcma_de
|
||||
if (!usb_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
- bcma_hcd_init_chip(dev);
|
||||
-
|
||||
- /* In AI chips EHCI is addrspace 0, OHCI is 1 */
|
||||
- ohci_addr = dev->addr_s[0];
|
||||
- if ((chipinfo->id == 0x5357 || chipinfo->id == 0x4749)
|
||||
- && chipinfo->rev == 0)
|
||||
- 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_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];
|
||||
+ if ((chipinfo->id == 0x5357 || chipinfo->id == 0x4749)
|
||||
+ && chipinfo->rev == 0)
|
||||
+ 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;
|
||||
+ }
|
||||
}
|
||||
|
||||
usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr);
|
||||
@@ -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);
|
@ -0,0 +1,62 @@
|
||||
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));
|
@ -5,25 +5,6 @@
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
define KernelPackage/usb-brcm47xx
|
||||
SUBMENU:=$(USB_MENU)
|
||||
TITLE:=Support for USB on bcm47xx
|
||||
DEPENDS:=@USB_SUPPORT @TARGET_brcm47xx
|
||||
KCONFIG:= \
|
||||
CONFIG_USB_HCD_BCMA \
|
||||
CONFIG_USB_HCD_SSB
|
||||
FILES:= \
|
||||
$(if $(CONFIG_USB_HCD_BCMA),$(LINUX_DIR)/drivers/usb/host/bcma-hcd.ko) \
|
||||
$(if $(CONFIG_USB_HCD_SSB),$(LINUX_DIR)/drivers/usb/host/ssb-hcd.ko)
|
||||
AUTOLOAD:=$(call AutoLoad,19, \
|
||||
$(if $(CONFIG_USB_HCD_BCMA),bcma-hcd) \
|
||||
$(if $(CONFIG_USB_HCD_SSB),ssb-hcd),1)
|
||||
$(call AddDepends/usb)
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,usb-brcm47xx))
|
||||
|
||||
|
||||
define KernelPackage/ocf-ubsec-ssb
|
||||
TITLE:=BCM5365P IPSec Core driver
|
||||
DEPENDS:=@TARGET_brcm47xx @!TARGET_brcm47xx_mips74k +kmod-crypto-ocf
|
||||
|
Loading…
Reference in New Issue
Block a user