From 93a0a2c28863ff520d4c4603f6262de8804606ab Mon Sep 17 00:00:00 2001 From: hauke Date: Tue, 27 Mar 2012 15:38:56 +0000 Subject: [PATCH] brcm47xx: update usb driver to the version send for mainline kernel integartion git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31089 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...ct-for-ehci-and-ohci-platform-driver.patch | 48 ---------- ...dd-a-generic-platform-device-driver.patch} | 76 +++++++++++---- ...dd-a-generic-platform-device-driver.patch} | 96 ++++++++++++------- ...82-bcma-scan-for-extra-address-space.patch | 45 +++++++++ ...183-USB-Add-driver-for-the-bcma-bus.patch} | 53 ++++------ ...83-bcma-scan-for-extra-address-space.patch | 61 ------------ ... 184-USB-Add-driver-for-the-ssb-bus.patch} | 56 ++++------- ...USB-OHCI-remove-old-SSB-OHCI-driver.patch} | 47 +++------ 8 files changed, 215 insertions(+), 267 deletions(-) delete mode 100644 target/linux/brcm47xx/patches-3.2/180-USB-HCI-add-struct-for-ehci-and-ohci-platform-driver.patch rename target/linux/brcm47xx/patches-3.2/{181-USB-OHCI-Add-a-generic-platform-device-driver.patch => 180-USB-OHCI-Add-a-generic-platform-device-driver.patch} (72%) rename target/linux/brcm47xx/patches-3.2/{182-USB-EHCI-Add-a-generic-platform-device-driver.patch => 181-USB-EHCI-Add-a-generic-platform-device-driver.patch} (70%) create mode 100644 target/linux/brcm47xx/patches-3.2/182-bcma-scan-for-extra-address-space.patch rename target/linux/brcm47xx/patches-3.2/{184-USB-Add-driver-for-the-bcma-bus.patch => 183-USB-Add-driver-for-the-bcma-bus.patch} (84%) delete mode 100644 target/linux/brcm47xx/patches-3.2/183-bcma-scan-for-extra-address-space.patch rename target/linux/brcm47xx/patches-3.2/{185-USB-Add-driver-for-the-ssb-bus.patch => 184-USB-Add-driver-for-the-ssb-bus.patch} (81%) rename target/linux/brcm47xx/patches-3.2/{186-USB-OHCI-remove-old-SSB-OHCI-driver.patch => 185-USB-OHCI-remove-old-SSB-OHCI-driver.patch} (87%) diff --git a/target/linux/brcm47xx/patches-3.2/180-USB-HCI-add-struct-for-ehci-and-ohci-platform-driver.patch b/target/linux/brcm47xx/patches-3.2/180-USB-HCI-add-struct-for-ehci-and-ohci-platform-driver.patch deleted file mode 100644 index 73d79a369..000000000 --- a/target/linux/brcm47xx/patches-3.2/180-USB-HCI-add-struct-for-ehci-and-ohci-platform-driver.patch +++ /dev/null @@ -1,48 +0,0 @@ -From d85bba4eb399a8273aabaef5c21c89820d7a0514 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Thu, 9 Feb 2012 23:14:57 +0100 -Subject: [PATCH 180/186] USB: HCI: add struct for ehci and ohci platform - driver - - -Signed-off-by: Hauke Mehrtens ---- - include/linux/usb/hci_driver.h | 32 ++++++++++++++++++++++++++++++++ - 1 files changed, 32 insertions(+), 0 deletions(-) - create mode 100644 include/linux/usb/hci_driver.h - ---- /dev/null -+++ b/include/linux/usb/hci_driver.h -@@ -0,0 +1,32 @@ -+/* -+ * Copyright (C) 2012 Hauke Mehrtens -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU General Public License as published by the -+ * Free Software Foundation; either version 2 of the License, or (at your -+ * option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -+ * for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software Foundation, -+ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ */ -+ -+#ifndef __USB_CORE_HCI_PDRIVER_H -+#define __USB_CORE_HCI_PDRIVER_H -+ -+#define USB_HCI_PDATA_PORT_POWER_SET (1 << 0) -+#define USB_HCI_PDATA_HAS_TT_SET (1 << 1) -+ -+struct usb_hci_pdata { -+ int flags; -+ int caps_offset; -+ unsigned has_tt:1; -+ unsigned power_set_is_on:1; -+}; -+ -+#endif /* __USB_CORE_HCI_PDRIVER_H */ diff --git a/target/linux/brcm47xx/patches-3.2/181-USB-OHCI-Add-a-generic-platform-device-driver.patch b/target/linux/brcm47xx/patches-3.2/180-USB-OHCI-Add-a-generic-platform-device-driver.patch similarity index 72% rename from target/linux/brcm47xx/patches-3.2/181-USB-OHCI-Add-a-generic-platform-device-driver.patch rename to target/linux/brcm47xx/patches-3.2/180-USB-OHCI-Add-a-generic-platform-device-driver.patch index 8832f22fa..0349006de 100644 --- a/target/linux/brcm47xx/patches-3.2/181-USB-OHCI-Add-a-generic-platform-device-driver.patch +++ b/target/linux/brcm47xx/patches-3.2/180-USB-OHCI-Add-a-generic-platform-device-driver.patch @@ -1,21 +1,3 @@ -From 2232a2ab6015496fecdfad68a9d6794312a9b2f2 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 26 Nov 2011 21:20:54 +0100 -Subject: [PATCH 181/186] USB: OHCI: Add a generic platform device driver - -This adds a generic driver for platform devices. It works like the PCI -driver and is based on it. This is for devices which do not have an own -bus but their OHCI controller works like a PCI controller. It will be -used for the Broadcom bcma and ssb USB OHCI controller. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/host/Kconfig | 10 ++ - drivers/usb/host/ohci-hcd.c | 5 + - drivers/usb/host/ohci-platform.c | 183 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 198 insertions(+), 0 deletions(-) - create mode 100644 drivers/usb/host/ohci-platform.c - --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -378,6 +378,16 @@ config USB_CNS3XXX_OHCI @@ -23,7 +5,7 @@ Signed-off-by: Hauke Mehrtens It is needed for low-speed USB 1.0 device support. +config USB_OHCI_HCD_PLATFORM -+ bool "OHCI driver for a platform device" ++ bool "Generic OHCI driver for a platform device" + depends on USB_OHCI_HCD && EXPERIMENTAL + default n + ---help--- @@ -51,7 +33,7 @@ Signed-off-by: Hauke Mehrtens !defined(OMAP1_PLATFORM_DRIVER) && \ --- /dev/null +++ b/drivers/usb/host/ohci-platform.c -@@ -0,0 +1,183 @@ +@@ -0,0 +1,194 @@ +/* + * Generic platform ohci driver + * @@ -68,13 +50,22 @@ Signed-off-by: Hauke Mehrtens + * Licensed under the GNU/GPL. See COPYING for details. + */ +#include -+#include ++#include + +static int ohci_platform_reset(struct usb_hcd *hcd) +{ ++ struct platform_device *pdev = to_platform_device(hcd->self.controller); ++ struct usb_ohci_pdata *pdata = pdev->dev.platform_data; + struct ohci_hcd *ohci = hcd_to_ohci(hcd); + int err; + ++ if (pdata->big_endian_desc) ++ ohci->flags |= OHCI_QUIRK_BE_DESC; ++ if (pdata->big_endian_mmio) ++ ohci->flags |= OHCI_QUIRK_BE_MMIO; ++ if (pdata->no_big_frame_no) ++ ohci->flags |= OHCI_QUIRK_FRAME_NO; ++ + ohci_hcd_init(ohci); + err = ohci_init(ohci); + @@ -131,6 +122,8 @@ Signed-off-by: Hauke Mehrtens + int irq; + int err = -ENOMEM; + ++ BUG_ON(!dev->dev.platform_data); ++ + if (usb_disabled()) + return -ENODEV; + @@ -235,3 +228,44 @@ Signed-off-by: Hauke Mehrtens + .pm = &ohci_platform_pm_ops, + } +}; +--- /dev/null ++++ b/include/linux/usb/ohci_pdriver.h +@@ -0,0 +1,38 @@ ++/* ++ * Copyright (C) 2012 Hauke Mehrtens ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#ifndef __USB_CORE_OHCI_PDRIVER_H ++#define __USB_CORE_OHCI_PDRIVER_H ++ ++/** ++ * struct usb_ohci_pdata - platform_data for generic ohci driver ++ * ++ * @big_endian_desc: BE descriptors ++ * @big_endian_mmio: BE registers ++ * @no_big_frame_no: no big endian frame_no shift ++ * ++ * These are general configuration options for the OHCI controller. All of ++ * these options are activating more or less workarounds for some hardware. ++ */ ++struct usb_ohci_pdata { ++ unsigned big_endian_desc:1; ++ unsigned big_endian_mmio:1; ++ unsigned no_big_frame_no:1; ++}; ++ ++#endif /* __USB_CORE_OHCI_PDRIVER_H */ diff --git a/target/linux/brcm47xx/patches-3.2/182-USB-EHCI-Add-a-generic-platform-device-driver.patch b/target/linux/brcm47xx/patches-3.2/181-USB-EHCI-Add-a-generic-platform-device-driver.patch similarity index 70% rename from target/linux/brcm47xx/patches-3.2/182-USB-EHCI-Add-a-generic-platform-device-driver.patch rename to target/linux/brcm47xx/patches-3.2/181-USB-EHCI-Add-a-generic-platform-device-driver.patch index 9a8b0cd0f..586a2ed38 100644 --- a/target/linux/brcm47xx/patches-3.2/182-USB-EHCI-Add-a-generic-platform-device-driver.patch +++ b/target/linux/brcm47xx/patches-3.2/181-USB-EHCI-Add-a-generic-platform-device-driver.patch @@ -1,21 +1,3 @@ -From 1be00523336ac484c52681f838dfb8a76e8531cd Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 26 Nov 2011 21:28:56 +0100 -Subject: [PATCH 182/186] USB: EHCI: Add a generic platform device driver - -This adds a generic driver for platform devices. It works like the PCI -driver and is based on it. This is for devices which do not have an own -bus but their EHCI controller works like a PCI controller. It will be -used for the Broadcom bcma and ssb USB EHCI controller. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/host/Kconfig | 10 ++ - drivers/usb/host/ehci-hcd.c | 5 + - drivers/usb/host/ehci-platform.c | 199 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 214 insertions(+), 0 deletions(-) - create mode 100644 drivers/usb/host/ehci-platform.c - --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -388,6 +388,16 @@ config USB_OHCI_HCD_PLATFORM @@ -51,7 +33,7 @@ Signed-off-by: Hauke Mehrtens !defined(XILINX_OF_PLATFORM_DRIVER) --- /dev/null +++ b/drivers/usb/host/ehci-platform.c -@@ -0,0 +1,199 @@ +@@ -0,0 +1,198 @@ +/* + * Generic platform ehci driver + * @@ -73,32 +55,29 @@ Signed-off-by: Hauke Mehrtens + * Licensed under the GNU/GPL. See COPYING for details. + */ +#include -+#include ++#include + +static int ehci_platform_reset(struct usb_hcd *hcd) +{ + struct platform_device *pdev = to_platform_device(hcd->self.controller); -+ struct usb_hci_pdata *pdata = pdev->dev.platform_data; ++ struct usb_ehci_pdata *pdata = pdev->dev.platform_data; + struct ehci_hcd *ehci = hcd_to_ehci(hcd); -+ int caps_offset = 0; -+ int flags = 0; + int retval; + -+ if (pdata) { -+ caps_offset = pdata->caps_offset; -+ flags = pdata->flags; -+ } -+ -+ if (flags & USB_HCI_PDATA_HAS_TT_SET) -+ hcd->has_tt = pdata->has_tt; ++ hcd->has_tt = pdata->has_tt; ++ ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug; ++ ehci->big_endian_desc = pdata->big_endian_desc; ++ ehci->big_endian_mmio = pdata->big_endian_mmio; + -+ ehci->caps = hcd->regs + caps_offset; ++ ehci->caps = hcd->regs + pdata->caps_offset; + retval = ehci_setup(hcd); + if (retval) + return retval; + -+ if (flags & USB_HCI_PDATA_PORT_POWER_SET) -+ ehci_port_power(ehci, pdata->power_set_is_on); ++ if (pdata->port_power_on) ++ ehci_port_power(ehci, 1); ++ if (pdata->port_power_off) ++ ehci_port_power(ehci, 0); + + return 0; +} @@ -144,6 +123,8 @@ Signed-off-by: Hauke Mehrtens + int irq; + int err = -ENOMEM; + ++ BUG_ON(!dev->dev.platform_data); ++ + if (usb_disabled()) + return -ENODEV; + @@ -251,3 +232,52 @@ Signed-off-by: Hauke Mehrtens + .pm = &ehci_platform_pm_ops, + } +}; +--- /dev/null ++++ b/include/linux/usb/ehci_pdriver.h +@@ -0,0 +1,46 @@ ++/* ++ * Copyright (C) 2012 Hauke Mehrtens ++ * ++ * This program is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License as published by the ++ * Free Software Foundation; either version 2 of the License, or (at your ++ * option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ */ ++ ++#ifndef __USB_CORE_EHCI_PDRIVER_H ++#define __USB_CORE_EHCI_PDRIVER_H ++ ++/** ++ * struct usb_ehci_pdata - platform_data for generic ehci driver ++ * ++ * @caps_offset: offset of the EHCI Capability Registers to the start of ++ * the io memory region provided to the driver. ++ * @has_tt: set to 1 if TT is integrated in root hub. ++ * @port_power_on: set to 1 if the controller needs a power up after ++ * initialization. ++ * @port_power_off: set to 1 if the controller needs to be powered down ++ * after initialization. ++ * ++ * These are general configuration options for the EHCI controller. All of ++ * these options are activating more or less workarounds for some hardware. ++ */ ++struct usb_ehci_pdata { ++ int caps_offset; ++ unsigned has_tt:1; ++ unsigned has_synopsys_hc_bug:1; ++ unsigned big_endian_desc:1; ++ unsigned big_endian_mmio:1; ++ unsigned port_power_on:1; ++ unsigned port_power_off:1; ++}; ++ ++#endif /* __USB_CORE_EHCI_PDRIVER_H */ diff --git a/target/linux/brcm47xx/patches-3.2/182-bcma-scan-for-extra-address-space.patch b/target/linux/brcm47xx/patches-3.2/182-bcma-scan-for-extra-address-space.patch new file mode 100644 index 000000000..6e68f0cc8 --- /dev/null +++ b/target/linux/brcm47xx/patches-3.2/182-bcma-scan-for-extra-address-space.patch @@ -0,0 +1,45 @@ +--- a/drivers/bcma/scan.c ++++ b/drivers/bcma/scan.c +@@ -297,6 +297,23 @@ static int bcma_get_next_core(struct bcm + return -EILSEQ; + } + ++ /* First Slave Address Descriptor should be port 0: ++ * the main register space for the core ++ */ ++ tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); ++ if (tmp <= 0) { ++ /* Try again to see if it is a bridge */ ++ tmp = bcma_erom_get_addr_desc(bus, eromptr, ++ SCAN_ADDR_TYPE_BRIDGE, 0); ++ if (tmp <= 0) { ++ return -EILSEQ; ++ } else { ++ pr_info("Bridge found\n"); ++ return -ENXIO; ++ } ++ } ++ core->addr = tmp; ++ + /* get & parse slave ports */ + for (i = 0; i < ports[1]; i++) { + for (j = 0; ; j++) { +@@ -309,7 +326,7 @@ static int bcma_get_next_core(struct bcm + break; + } else { + if (i == 0 && j == 0) +- core->addr = tmp; ++ core->addr1 = tmp; + } + } + } +--- a/include/linux/bcma/bcma.h ++++ b/include/linux/bcma/bcma.h +@@ -139,6 +139,7 @@ struct bcma_device { + u8 core_unit; + + u32 addr; ++ u32 addr1; + u32 wrap; + + void __iomem *io_addr; diff --git a/target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-bcma-bus.patch b/target/linux/brcm47xx/patches-3.2/183-USB-Add-driver-for-the-bcma-bus.patch similarity index 84% rename from target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-bcma-bus.patch rename to target/linux/brcm47xx/patches-3.2/183-USB-Add-driver-for-the-bcma-bus.patch index 259af4f1a..630167cee 100644 --- a/target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-bcma-bus.patch +++ b/target/linux/brcm47xx/patches-3.2/183-USB-Add-driver-for-the-bcma-bus.patch @@ -1,24 +1,3 @@ -From 70fc4b2a6200ef7a1b99a6aa28234b919f23b43c Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 26 Nov 2011 21:33:41 +0100 -Subject: [PATCH 184/186] USB: Add driver for the bcma bus - -This adds a USB driver using the generic platform device driver for the -USB controller found on the Broadcom bcma bus. The bcma bus just -exposes one device which serves the OHCI and the EHCI controller at the -same time. This driver probes for this USB controller and creates and -registers two new platform devices which will be probed by the new -generic platform device driver. This makes it possible to use the EHCI -and the OCHI controller on the bcma bus at the same time. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/host/Kconfig | 12 ++ - drivers/usb/host/Makefile | 1 + - drivers/usb/host/bcma-hcd.c | 328 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 341 insertions(+), 0 deletions(-) - create mode 100644 drivers/usb/host/bcma-hcd.c - --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -618,3 +618,15 @@ config USB_PXA168_EHCI @@ -46,12 +25,12 @@ Signed-off-by: Hauke Mehrtens +obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o --- /dev/null +++ b/drivers/usb/host/bcma-hcd.c -@@ -0,0 +1,328 @@ +@@ -0,0 +1,334 @@ +/* + * Broadcom specific Advanced Microcontroller Bus + * Broadcom USB-core driver (BCMA bus glue) + * -+ * Copyright 2011 Hauke Mehrtens ++ * Copyright 2011-2012 Hauke Mehrtens + * + * Based on ssb-ohci driver + * Copyright 2007 Michael Buesch @@ -71,7 +50,8 @@ Signed-off-by: Hauke Mehrtens +#include +#include +#include -+#include ++#include ++#include + +MODULE_AUTHOR("Hauke Mehrtens"); +MODULE_DESCRIPTION("Common USB driver for BCMA Bus"); @@ -206,13 +186,14 @@ Signed-off-by: Hauke Mehrtens + } +} + -+static const struct usb_hci_pdata p_data = { -+ .flags = USB_HCI_PDATA_PORT_POWER_SET, -+ .power_set_is_on = 1, ++static const struct usb_ehci_pdata ehci_pdata = { ++}; ++ ++static const struct usb_ohci_pdata ohci_pdata = { +}; + +static struct platform_device * __devinit -+bcma_hcd_create_pdev(struct bcma_device *dev, char *name, u32 addr) ++bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr) +{ + struct platform_device *hci_dev; + struct resource hci_res[2]; @@ -227,7 +208,8 @@ Signed-off-by: Hauke Mehrtens + hci_res[1].start = dev->irq; + hci_res[1].flags = IORESOURCE_IRQ; + -+ hci_dev = platform_device_alloc(name, 0); ++ hci_dev = platform_device_alloc(ohci ? "ohci-platform" : ++ "ehci-platform" , 0); + if (!hci_dev) + return NULL; + @@ -238,7 +220,12 @@ Signed-off-by: Hauke Mehrtens + ARRAY_SIZE(hci_res)); + if (ret) + goto err_alloc; -+ ret = platform_device_add_data(hci_dev, &p_data, sizeof(p_data)); ++ if (ohci) ++ ret = platform_device_add_data(hci_dev, &ohci_pdata, ++ sizeof(ohci_pdata)); ++ else ++ ret = platform_device_add_data(hci_dev, &ehci_pdata, ++ sizeof(ehci_pdata)); + if (ret) + goto err_alloc; + ret = platform_device_add(hci_dev); @@ -284,15 +271,13 @@ Signed-off-by: Hauke Mehrtens + && chipinfo->rev == 0) + ohci_addr = 0x18009000; + -+ usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, "ohci-platform", -+ ohci_addr); ++ 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, "ehci-platform", -+ dev->addr); ++ usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr); + if (IS_ERR(usb_dev->ehci_dev)) { + err = PTR_ERR(usb_dev->ehci_dev); + goto err_unregister_ohci_dev; diff --git a/target/linux/brcm47xx/patches-3.2/183-bcma-scan-for-extra-address-space.patch b/target/linux/brcm47xx/patches-3.2/183-bcma-scan-for-extra-address-space.patch deleted file mode 100644 index 29fdfce20..000000000 --- a/target/linux/brcm47xx/patches-3.2/183-bcma-scan-for-extra-address-space.patch +++ /dev/null @@ -1,61 +0,0 @@ -From adebff2358c2b631fc04e31ba87eee48e546c655 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 20 Nov 2011 18:22:35 +0100 -Subject: [PATCH 183/186] bcma: scan for extra address space - -Some cores like the USB core have two address spaces. In the USB host -controller one address space is used for the OHCI and the other for the -EHCI controller interface. The USB controller is the only core I found -with two address spaces. This code is based on the AI scan function -ai_scan() in shared/aiutils.c i the Broadcom SDK. - -Signed-off-by: Hauke Mehrtens ---- - drivers/bcma/scan.c | 18 +++++++++++++++++- - include/linux/bcma/bcma.h | 1 + - 2 files changed, 18 insertions(+), 1 deletions(-) - ---- a/drivers/bcma/scan.c -+++ b/drivers/bcma/scan.c -@@ -297,6 +297,22 @@ static int bcma_get_next_core(struct bcm - return -EILSEQ; - } - -+ -+ /* First Slave Address Descriptor should be port 0: -+ * the main register space for the core -+ */ -+ tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); -+ if (tmp <= 0) { -+ /* Try again to see if it is a bridge */ -+ tmp = bcma_erom_get_addr_desc(bus, eromptr, -+ SCAN_ADDR_TYPE_BRIDGE, 0); -+ if (tmp > 0) { -+ pr_info("found bridge"); -+ return -ENXIO; -+ } -+ } -+ core->addr = tmp; -+ - /* get & parse slave ports */ - for (i = 0; i < ports[1]; i++) { - for (j = 0; ; j++) { -@@ -309,7 +325,7 @@ static int bcma_get_next_core(struct bcm - break; - } else { - if (i == 0 && j == 0) -- core->addr = tmp; -+ core->addr1 = tmp; - } - } - } ---- a/include/linux/bcma/bcma.h -+++ b/include/linux/bcma/bcma.h -@@ -139,6 +139,7 @@ struct bcma_device { - u8 core_unit; - - u32 addr; -+ u32 addr1; - u32 wrap; - - void __iomem *io_addr; diff --git a/target/linux/brcm47xx/patches-3.2/185-USB-Add-driver-for-the-ssb-bus.patch b/target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-ssb-bus.patch similarity index 81% rename from target/linux/brcm47xx/patches-3.2/185-USB-Add-driver-for-the-ssb-bus.patch rename to target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-ssb-bus.patch index d13fb998d..7b3016892 100644 --- a/target/linux/brcm47xx/patches-3.2/185-USB-Add-driver-for-the-ssb-bus.patch +++ b/target/linux/brcm47xx/patches-3.2/184-USB-Add-driver-for-the-ssb-bus.patch @@ -1,27 +1,3 @@ -From 1840ddf07a452e640549fbd82e2f570da28e377f Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 26 Nov 2011 21:35:17 +0100 -Subject: [PATCH 185/186] USB: Add driver for the ssb bus - -This adds a USB driver using the generic platform device driver for the -USB controller found on the Broadcom ssb bus. The ssb bus just -exposes one device which serves the OHCI and the EHCI controller at the -same time. This driver probes for this USB controller and creates and -registers two new platform devices which will be probed by the new -generic platform device driver. This makes it possible to use the EHCI -and the OCHI controller on the ssb bus at the same time. - -The old ssb OHCI USB driver will be removed in the next step as this -driver also provide an OHCI driver and an EHCI for the cores supporting -it. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/host/Kconfig | 12 ++ - drivers/usb/host/Makefile | 1 + - drivers/usb/host/ssb-hcd.c | 273 ++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 286 insertions(+), 0 deletions(-) - create mode 100644 drivers/usb/host/ssb-hcd.c --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -50,12 +26,12 @@ Signed-off-by: Hauke Mehrtens +obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o --- /dev/null +++ b/drivers/usb/host/ssb-hcd.c -@@ -0,0 +1,273 @@ +@@ -0,0 +1,279 @@ +/* + * Sonics Silicon Backplane + * Broadcom USB-core driver (SSB bus glue) + * -+ * Copyright 2011 Hauke Mehrtens ++ * Copyright 2011-2012 Hauke Mehrtens + * + * Based on ssb-ohci driver + * Copyright 2007 Michael Buesch @@ -75,7 +51,8 @@ Signed-off-by: Hauke Mehrtens +#include +#include +#include -+#include ++#include ++#include + +MODULE_AUTHOR("Hauke Mehrtens"); +MODULE_DESCRIPTION("Common USB driver for SSB Bus"); @@ -146,13 +123,14 @@ Signed-off-by: Hauke Mehrtens + return flags; +} + -+static const struct usb_hci_pdata p_data = { -+ .flags = USB_HCI_PDATA_PORT_POWER_SET, -+ .power_set_is_on = 1, ++static const struct usb_ehci_pdata ehci_pdata = { ++}; ++ ++static const struct usb_ohci_pdata ohci_pdata = { +}; + +static struct platform_device * __devinit -+ssb_hcd_create_pdev(struct ssb_device *dev, char *name, u32 addr, u32 len) ++ssb_hcd_create_pdev(struct ssb_device *dev, bool ohci, u32 addr, u32 len) +{ + struct platform_device *hci_dev; + struct resource hci_res[2]; @@ -167,7 +145,8 @@ Signed-off-by: Hauke Mehrtens + hci_res[1].start = dev->irq; + hci_res[1].flags = IORESOURCE_IRQ; + -+ hci_dev = platform_device_alloc(name, 0); ++ hci_dev = platform_device_alloc(ohci ? "ohci-platform" : ++ "ehci-platform" , 0); + if (!hci_dev) + return NULL; + @@ -178,7 +157,12 @@ Signed-off-by: Hauke Mehrtens + ARRAY_SIZE(hci_res)); + if (ret) + goto err_alloc; -+ ret = platform_device_add_data(hci_dev, &p_data, sizeof(p_data)); ++ if (ohci) ++ ret = platform_device_add_data(hci_dev, &ohci_pdata, ++ sizeof(ohci_pdata)); ++ else ++ ret = platform_device_add_data(hci_dev, &ehci_pdata, ++ sizeof(ehci_pdata)); + if (ret) + goto err_alloc; + ret = platform_device_add(hci_dev); @@ -226,8 +210,7 @@ Signed-off-by: Hauke Mehrtens + + start = ssb_admatch_base(tmp); + len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp); -+ usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, "ohci-platform", start, -+ len); ++ usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, true, start, len); + if (IS_ERR(usb_dev->ohci_dev)) { + err = PTR_ERR(usb_dev->ohci_dev); + goto err_free_usb_dev; @@ -235,8 +218,7 @@ Signed-off-by: Hauke Mehrtens + + if (coreid == SSB_DEV_USB20_HOST) { + start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */ -+ usb_dev->ehci_dev = ssb_hcd_create_pdev(dev, "ehci-platform", -+ start, len); ++ usb_dev->ehci_dev = ssb_hcd_create_pdev(dev, false, start, len); + if (IS_ERR(usb_dev->ehci_dev)) { + err = PTR_ERR(usb_dev->ehci_dev); + goto err_unregister_ohci_dev; diff --git a/target/linux/brcm47xx/patches-3.2/186-USB-OHCI-remove-old-SSB-OHCI-driver.patch b/target/linux/brcm47xx/patches-3.2/185-USB-OHCI-remove-old-SSB-OHCI-driver.patch similarity index 87% rename from target/linux/brcm47xx/patches-3.2/186-USB-OHCI-remove-old-SSB-OHCI-driver.patch rename to target/linux/brcm47xx/patches-3.2/185-USB-OHCI-remove-old-SSB-OHCI-driver.patch index 89a7df9ea..ba3fc9dcc 100644 --- a/target/linux/brcm47xx/patches-3.2/186-USB-OHCI-remove-old-SSB-OHCI-driver.patch +++ b/target/linux/brcm47xx/patches-3.2/185-USB-OHCI-remove-old-SSB-OHCI-driver.patch @@ -1,41 +1,22 @@ -From 57857d7df6c22eaf11e3c67042d55a9546415059 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sat, 26 Nov 2011 21:36:50 +0100 -Subject: [PATCH 186/186] USB: OHCI: remove old SSB OHCI driver - -This is now replaced by the new ssb USB driver, which also supports -devices with an EHCI controller. - -Signed-off-by: Hauke Mehrtens ---- - drivers/usb/host/Kconfig | 13 -- - drivers/usb/host/ohci-hcd.c | 21 +---- - drivers/usb/host/ohci-ssb.c | 260 ------------------------------------------- - 3 files changed, 1 insertions(+), 293 deletions(-) - delete mode 100644 drivers/usb/host/ohci-ssb.c - --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig -@@ -351,19 +351,6 @@ config USB_OHCI_HCD_PCI - Enables support for PCI-bus plug-in USB controller cards. +@@ -352,10 +352,15 @@ config USB_OHCI_HCD_PCI If unsure, say Y. --config USB_OHCI_HCD_SSB + config USB_OHCI_HCD_SSB - bool "OHCI support for Broadcom SSB OHCI core" -- depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL -- default n -- ---help--- -- Support for the Sonics Silicon Backplane (SSB) attached -- Broadcom USB OHCI core. -- -- This device is present in some embedded devices with -- Broadcom based SSB bus. -- -- If unsure, say N. -- - config USB_OHCI_SH - bool "OHCI support for SuperH USB controller" - depends on USB_OHCI_HCD && SUPERH ++ bool "OHCI support for Broadcom SSB OHCI core (DEPRECATED)" + depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL ++ select USB_HCD_SSB ++ select USB_OHCI_HCD_PLATFORM + default n + ---help--- ++ This option is deprecated now and the driver was removed, use ++ USB_HCD_SSB and USB_OHCI_HCD_PLATFORM instead. ++ + Support for the Sonics Silicon Backplane (SSB) attached + Broadcom USB OHCI core. + --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1076,11 +1076,6 @@ MODULE_LICENSE ("GPL"); -- 2.20.1