From: Hauke Mehrtens Date: Sat, 31 Jul 2010 10:05:29 +0000 (+0000) Subject: brcm47xx: some fixes X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=96911f6b586e468d4524785a7b2e396379ff92de;p=openwrt%2Fstaging%2Fthess.git brcm47xx: some fixes * fix return codes of nvram_getenv. Now it behaves like cfe_getenv. * also check cfe for kernel_args param. * some style fixes SVN-Revision: 22424 --- diff --git a/target/linux/brcm47xx/patches-2.6.34/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch b/target/linux/brcm47xx/patches-2.6.34/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch index 98b12019c2..dfa4b41fbf 100644 --- a/target/linux/brcm47xx/patches-2.6.34/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch +++ b/target/linux/brcm47xx/patches-2.6.34/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch @@ -1,7 +1,7 @@ -From bf93090747e3d23e5354bd8da52f85d96c0f6606 Mon Sep 17 00:00:00 2001 +From f65eb52ea6c0ec939fd44e74b6b873e0b549e3c9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 12:49:41 +0200 -Subject: [PATCH 1/5] MIPS: BCM47xx: Really fix 128MB RAM problem +Subject: [PATCH 1/6] MIPS: BCM47xx: Really fix 128MB RAM problem The previews patch 84a6fcb368a080620d12fc4d79e07902dbee7335 was wrong, I got wrong success reports. diff --git a/target/linux/brcm47xx/patches-2.6.34/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch b/target/linux/brcm47xx/patches-2.6.34/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch index 426e3c35c4..e72b5d7418 100644 --- a/target/linux/brcm47xx/patches-2.6.34/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch +++ b/target/linux/brcm47xx/patches-2.6.34/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch @@ -1,13 +1,16 @@ -From fbdfca0b2489ad94c6a3bc90b47adfd5c8179a89 Mon Sep 17 00:00:00 2001 +From e5c5828063a55a752e2392d820383dd7a5da3737 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 13:34:32 +0200 -Subject: [PATCH 2/5] MIPS: BCM47xx: Fill values for b43 into ssb sprom +Subject: [PATCH 2/6] MIPS: BCM47xx: Fill values for b43 into ssb sprom Most of the values are stored in the nvram and not in the CFE. At first the nvram should be read and if there is no value it should look into the CFE. Now more values are read out because the b43 and b43legacy drivers needs them. +Some parts of this patch have been in OpenWRT for a long time and were +made by Michael Buesch. + Signed-off-by: Hauke Mehrtens --- arch/mips/bcm47xx/setup.c | 131 +++++++++++++++++++++++++++++++++----------- diff --git a/target/linux/brcm47xx/patches-2.6.34/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch b/target/linux/brcm47xx/patches-2.6.34/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch index 6bcd55f4c9..05e9d2ec01 100644 --- a/target/linux/brcm47xx/patches-2.6.34/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch +++ b/target/linux/brcm47xx/patches-2.6.34/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch @@ -1,7 +1,7 @@ -From e6feb5dc2c1bb28582fa3e1445f9d90114e39724 Mon Sep 17 00:00:00 2001 +From e0039e622e53a22b14fce4d2f0cb3febc75cd58b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 13:58:09 +0200 -Subject: [PATCH 3/5] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default +Subject: [PATCH 3/6] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default The b43_pci_bridge is needed to use the b43 driver with brcm47xx. Activate it by default if pci is available. diff --git a/target/linux/brcm47xx/patches-2.6.34/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch b/target/linux/brcm47xx/patches-2.6.34/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch index ab23a366ae..0d241e656b 100644 --- a/target/linux/brcm47xx/patches-2.6.34/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch +++ b/target/linux/brcm47xx/patches-2.6.34/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch @@ -1,27 +1,18 @@ -From a41121d789e236fd637ab49beb5ce7b48763613a Mon Sep 17 00:00:00 2001 +From 9be402f069cc259ad5795b77567d66c4e7f6bef6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 14:59:24 +0200 -Subject: [PATCH 4/5] MIPS: BCM47xx: Setup and register serial early +Subject: [PATCH 4/6] MIPS: BCM47xx: Setup and register serial early Swap the first and second serial if console=ttyS1 was set. Set it up and register it for early serial support. +This patch has been in OpenWRT for a long time. + Signed-off-by: Hauke Mehrtens --- - arch/mips/Kconfig | 1 - - arch/mips/bcm47xx/setup.c | 37 ++++++++++++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 2 deletions(-) + arch/mips/bcm47xx/setup.c | 39 ++++++++++++++++++++++++++++++++++++++- + 1 files changed, 38 insertions(+), 1 deletions(-) ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -65,7 +65,6 @@ config BCM47XX - select SSB_B43_PCI_BRIDGE if PCI - select SSB_PCICORE_HOSTMODE if PCI - select GENERIC_GPIO -- select SYS_HAS_EARLY_PRINTK - select CFE - help - Support for BCM47XX based boards --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -28,6 +28,8 @@ @@ -33,7 +24,7 @@ Signed-off-by: Hauke Mehrtens #include #include #include -@@ -190,12 +192,45 @@ static int bcm47xx_get_invariants(struct +@@ -190,12 +192,47 @@ static int bcm47xx_get_invariants(struct void __init plat_mem_setup(void) { @@ -48,16 +39,18 @@ Signed-off-by: Hauke Mehrtens panic("Failed to initialize SSB bus (err %d)\n", err); + mcore = &ssb_bcm47xx.mipscore; + -+ nvram_getenv("kernel_args", buf, sizeof(buf)); -+ if (!strncmp(buf, "console=ttyS1", 13)) { -+ struct ssb_serial_port port; ++ if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0 || ++ cfe_getenv("kernel_args", buf, sizeof(buf)) >= 0) { ++ if (strstr(buf, "console=ttyS1")) { ++ struct ssb_serial_port port; + -+ printk(KERN_DEBUG "Swapping serial ports!\n"); -+ /* swap serial ports */ -+ memcpy(&port, &mcore->serial_ports[0], sizeof(port)); -+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], -+ sizeof(port)); -+ memcpy(&mcore->serial_ports[1], &port, sizeof(port)); ++ printk(KERN_DEBUG "Swapping serial ports!\n"); ++ /* swap serial ports */ ++ memcpy(&port, &mcore->serial_ports[0], sizeof(port)); ++ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], ++ sizeof(port)); ++ memcpy(&mcore->serial_ports[1], &port, sizeof(port)); ++ } + } + + for (i = 0; i < mcore->nr_serial_ports; i++) { diff --git a/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-Remove-CFE-console.patch b/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-Remove-CFE-console.patch deleted file mode 100644 index 4a365fde84..0000000000 --- a/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-Remove-CFE-console.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 83b4ed2d1789609565822335ea27026d46fbb477 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jul 2010 15:11:26 +0200 -Subject: [PATCH 5/5] MIPS: BCM47xx: Remove CFE console - -Do not use the CFE console. It causes hangs on some devices like the -Buffalo WHR-HP-G54. -This was reported in https://dev.openwrt.org/ticket/4061 and -https://forum.openwrt.org/viewtopic.php?id=17063 - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/bcm47xx/prom.c | 82 +++------------------------------------------ - 1 files changed, 6 insertions(+), 76 deletions(-) - ---- a/arch/mips/bcm47xx/prom.c -+++ b/arch/mips/bcm47xx/prom.c -@@ -31,96 +31,28 @@ - #include - #include - --static int cfe_cons_handle; -- - const char *get_system_type(void) - { - return "Broadcom BCM47XX"; - } - --void prom_putchar(char c) --{ -- while (cfe_write(cfe_cons_handle, &c, 1) == 0) -- ; --} -- --static __init void prom_init_cfe(void) -+static __init int prom_init_cfe(void) - { - uint32_t cfe_ept; - uint32_t cfe_handle; - uint32_t cfe_eptseal; -- int argc = fw_arg0; -- char **envp = (char **) fw_arg2; -- int *prom_vec = (int *) fw_arg3; -- -- /* -- * Check if a loader was used; if NOT, the 4 arguments are -- * what CFE gives us (handle, 0, EPT and EPTSEAL) -- */ -- if (argc < 0) { -- cfe_handle = (uint32_t)argc; -- cfe_ept = (uint32_t)envp; -- cfe_eptseal = (uint32_t)prom_vec; -- } else { -- if ((int)prom_vec < 0) { -- /* -- * Old loader; all it gives us is the handle, -- * so use the "known" entrypoint and assume -- * the seal. -- */ -- cfe_handle = (uint32_t)prom_vec; -- cfe_ept = 0xBFC00500; -- cfe_eptseal = CFE_EPTSEAL; -- } else { -- /* -- * Newer loaders bundle the handle/ept/eptseal -- * Note: prom_vec is in the loader's useg -- * which is still alive in the TLB. -- */ -- cfe_handle = prom_vec[0]; -- cfe_ept = prom_vec[2]; -- cfe_eptseal = prom_vec[3]; -- } -- } -+ -+ cfe_eptseal = (uint32_t) fw_arg3; -+ cfe_handle = (uint32_t) fw_arg0; -+ cfe_ept = (uint32_t) fw_arg2; - - if (cfe_eptseal != CFE_EPTSEAL) { -- /* too early for panic to do any good */ - printk(KERN_ERR "CFE's entrypoint seal doesn't match."); -- while (1) ; -+ return -1; - } - - cfe_init(cfe_handle, cfe_ept); --} -- --static __init void prom_init_console(void) --{ -- /* Initialize CFE console */ -- cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); --} -- --static __init void prom_init_cmdline(void) --{ -- static char buf[COMMAND_LINE_SIZE] __initdata; -- -- /* Get the kernel command line from CFE */ -- if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) { -- buf[COMMAND_LINE_SIZE - 1] = 0; -- strcpy(arcs_cmdline, buf); -- } -- -- /* Force a console handover by adding a console= argument if needed, -- * as CFE is not available anymore later in the boot process. */ -- if ((strstr(arcs_cmdline, "console=")) == NULL) { -- /* Try to read the default serial port used by CFE */ -- if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0) -- || (strncmp("uart", buf, 4))) -- /* Default to uart0 */ -- strcpy(buf, "uart0"); -- -- /* Compute the new command line */ -- snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200", -- arcs_cmdline, buf[4]); -- } -+ return 0; - } - - static __init void prom_init_mem(void) -@@ -161,8 +93,6 @@ static __init void prom_init_mem(void) - void __init prom_init(void) - { - prom_init_cfe(); -- prom_init_console(); -- prom_init_cmdline(); - prom_init_mem(); - } - diff --git a/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch b/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch new file mode 100644 index 0000000000..161cd61d83 --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.34/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch @@ -0,0 +1,33 @@ +From c5cb2459ff124c1a928e2056bc1fe2da7b6ab6ba Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 30 Jul 2010 17:45:20 +0200 +Subject: [PATCH 5/6] MIPS: BCM47xx: nvram_getenv fix return value. + +nvram_getenv should behave like cfe_getenv. For now it is used like +cfe_getenv. cfe_getenv returns 0 on success and -1 in case of an error. +Change nvram_getenv to do the same. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/bcm47xx/nvram.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/bcm47xx/nvram.c ++++ b/arch/mips/bcm47xx/nvram.c +@@ -69,7 +69,7 @@ int nvram_getenv(char *name, char *val, + char *var, *value, *end, *eq; + + if (!name) +- return 1; ++ return -8; + + if (!nvram_buf[0]) + early_nvram_init(); +@@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val, + return 0; + } + } +- return 1; ++ return -9; + } + EXPORT_SYMBOL(nvram_getenv); diff --git a/target/linux/brcm47xx/patches-2.6.34/016-MIPS-BCM47xx-Remove-CFE-console.patch b/target/linux/brcm47xx/patches-2.6.34/016-MIPS-BCM47xx-Remove-CFE-console.patch new file mode 100644 index 0000000000..329560740b --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.34/016-MIPS-BCM47xx-Remove-CFE-console.patch @@ -0,0 +1,141 @@ +From 5219981646071abb6731634bf47781a53e248764 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 18 Jul 2010 15:11:26 +0200 +Subject: [PATCH 6/6] MIPS: BCM47xx: Remove CFE console + +Do not use the CFE console. It causes hangs on some devices like the +Buffalo WHR-HP-G54. +This was reported in https://dev.openwrt.org/ticket/4061 and +https://forum.openwrt.org/viewtopic.php?id=17063 + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/Kconfig | 1 - + arch/mips/bcm47xx/prom.c | 82 +++------------------------------------------ + 2 files changed, 6 insertions(+), 77 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -65,7 +65,6 @@ config BCM47XX + select SSB_B43_PCI_BRIDGE if PCI + select SSB_PCICORE_HOSTMODE if PCI + select GENERIC_GPIO +- select SYS_HAS_EARLY_PRINTK + select CFE + help + Support for BCM47XX based boards +--- a/arch/mips/bcm47xx/prom.c ++++ b/arch/mips/bcm47xx/prom.c +@@ -31,96 +31,28 @@ + #include + #include + +-static int cfe_cons_handle; +- + const char *get_system_type(void) + { + return "Broadcom BCM47XX"; + } + +-void prom_putchar(char c) +-{ +- while (cfe_write(cfe_cons_handle, &c, 1) == 0) +- ; +-} +- +-static __init void prom_init_cfe(void) ++static __init int prom_init_cfe(void) + { + uint32_t cfe_ept; + uint32_t cfe_handle; + uint32_t cfe_eptseal; +- int argc = fw_arg0; +- char **envp = (char **) fw_arg2; +- int *prom_vec = (int *) fw_arg3; +- +- /* +- * Check if a loader was used; if NOT, the 4 arguments are +- * what CFE gives us (handle, 0, EPT and EPTSEAL) +- */ +- if (argc < 0) { +- cfe_handle = (uint32_t)argc; +- cfe_ept = (uint32_t)envp; +- cfe_eptseal = (uint32_t)prom_vec; +- } else { +- if ((int)prom_vec < 0) { +- /* +- * Old loader; all it gives us is the handle, +- * so use the "known" entrypoint and assume +- * the seal. +- */ +- cfe_handle = (uint32_t)prom_vec; +- cfe_ept = 0xBFC00500; +- cfe_eptseal = CFE_EPTSEAL; +- } else { +- /* +- * Newer loaders bundle the handle/ept/eptseal +- * Note: prom_vec is in the loader's useg +- * which is still alive in the TLB. +- */ +- cfe_handle = prom_vec[0]; +- cfe_ept = prom_vec[2]; +- cfe_eptseal = prom_vec[3]; +- } +- } ++ ++ cfe_eptseal = (uint32_t) fw_arg3; ++ cfe_handle = (uint32_t) fw_arg0; ++ cfe_ept = (uint32_t) fw_arg2; + + if (cfe_eptseal != CFE_EPTSEAL) { +- /* too early for panic to do any good */ + printk(KERN_ERR "CFE's entrypoint seal doesn't match."); +- while (1) ; ++ return -1; + } + + cfe_init(cfe_handle, cfe_ept); +-} +- +-static __init void prom_init_console(void) +-{ +- /* Initialize CFE console */ +- cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); +-} +- +-static __init void prom_init_cmdline(void) +-{ +- static char buf[COMMAND_LINE_SIZE] __initdata; +- +- /* Get the kernel command line from CFE */ +- if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) { +- buf[COMMAND_LINE_SIZE - 1] = 0; +- strcpy(arcs_cmdline, buf); +- } +- +- /* Force a console handover by adding a console= argument if needed, +- * as CFE is not available anymore later in the boot process. */ +- if ((strstr(arcs_cmdline, "console=")) == NULL) { +- /* Try to read the default serial port used by CFE */ +- if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0) +- || (strncmp("uart", buf, 4))) +- /* Default to uart0 */ +- strcpy(buf, "uart0"); +- +- /* Compute the new command line */ +- snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200", +- arcs_cmdline, buf[4]); +- } ++ return 0; + } + + static __init void prom_init_mem(void) +@@ -161,8 +93,6 @@ static __init void prom_init_mem(void) + void __init prom_init(void) + { + prom_init_cfe(); +- prom_init_console(); +- prom_init_cmdline(); + prom_init_mem(); + } + diff --git a/target/linux/brcm47xx/patches-2.6.34/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch b/target/linux/brcm47xx/patches-2.6.34/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch index 91eadaade4..413558120f 100644 --- a/target/linux/brcm47xx/patches-2.6.34/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch +++ b/target/linux/brcm47xx/patches-2.6.34/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch @@ -1,32 +1,32 @@ -From cb33ffbdd8491c58b35958ec74c39b3a5c7fabe8 Mon Sep 17 00:00:00 2001 +From ca00adabb88dd1194891624836d7574aab2d7c05 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 21:25:03 +0200 Subject: [PATCH 1/2] USB: Add USB 2.0 to ssb ohci driver This adds USB 2.0 support to ssb ohci driver. -This work was done based on Braodcom source code in the OpenWRT project. +This patch was used in OpenWRT for a long time now. +CC: Steve Brown Signed-off-by: Hauke Mehrtens --- - drivers/usb/host/ohci-ssb.c | 55 ++++++++++++++++++++++++++++++++++++++++-- - 1 files changed, 52 insertions(+), 3 deletions(-) + drivers/usb/host/ohci-ssb.c | 52 ++++++++++++++++++++++++++++++++++++++++-- + 1 files changed, 49 insertions(+), 3 deletions(-) --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c -@@ -92,9 +92,12 @@ static const struct hc_driver ssb_ohci_h - static void ssb_ohci_detach(struct ssb_device *dev) +@@ -93,8 +93,11 @@ static void ssb_ohci_detach(struct ssb_d { struct usb_hcd *hcd = ssb_get_drvdata(dev); + + if (hcd->driver->shutdown) + hcd->driver->shutdown(hcd); - usb_remove_hcd(hcd); iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); ssb_device_disable(dev, 0); } -@@ -106,10 +109,55 @@ static int ssb_ohci_attach(struct ssb_de +@@ -106,10 +109,52 @@ static int ssb_ohci_attach(struct ssb_de int err = -ENOMEM; u32 tmp, flags = 0; @@ -45,12 +45,9 @@ Signed-off-by: Hauke Mehrtens + /* + * USB 2.0 special considerations: + * -+ * 1. Since the core supports both ehci and EHCI functions, it must -+ * only be reset once. -+ * -+ * 2. In addition to the standard SSB reset sequence, the Host Control -+ * Register must be programmed to bring the USB core and various -+ * phy components out of reset. ++ * In addition to the standard SSB reset sequence, the Host ++ * Control Register must be programmed to bring the USB core ++ * and various phy components out of reset. + */ + ssb_device_enable(dev, 0); + ssb_write32(dev, 0x200, 0x7ff); @@ -70,7 +67,7 @@ Signed-off-by: Hauke Mehrtens + udelay(1); + + /* Work around for 5354 failures */ -+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) { ++ if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { + /* Change syn01 reg */ + tmp = 0x00fe00fe; + ssb_write32(dev, 0x894, tmp); @@ -85,7 +82,7 @@ Signed-off-by: Hauke Mehrtens hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, dev_name(dev->dev)); -@@ -200,6 +248,7 @@ static int ssb_ohci_resume(struct ssb_de +@@ -200,6 +245,7 @@ static int ssb_ohci_resume(struct ssb_de static const struct ssb_device_id ssb_ohci_table[] = { SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV), SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV), diff --git a/target/linux/brcm47xx/patches-2.6.34/022-USB-Add-ehci-ssb-driver.patch b/target/linux/brcm47xx/patches-2.6.34/022-USB-Add-ehci-ssb-driver.patch index 10cefac639..1e5092cf7e 100644 --- a/target/linux/brcm47xx/patches-2.6.34/022-USB-Add-ehci-ssb-driver.patch +++ b/target/linux/brcm47xx/patches-2.6.34/022-USB-Add-ehci-ssb-driver.patch @@ -1,4 +1,4 @@ -From cb269cf1f97c316a5184080814a751687c72b718 Mon Sep 17 00:00:00 2001 +From ad224c0d5fa0fc05f8aaef3c19fc9b4eb275a5d2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 21:29:40 +0200 Subject: [PATCH 2/2] USB: Add ehci ssb driver @@ -8,9 +8,9 @@ Support for the Sonics Silicon Backplane (SSB) attached Broadcom USB EHCI core. Signed-off-by: Hauke Mehrtens --- drivers/usb/host/Kconfig | 13 ++ - drivers/usb/host/ehci-hcd.c | 23 ++++- - drivers/usb/host/ehci-ssb.c | 258 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 292 insertions(+), 2 deletions(-) + drivers/usb/host/ehci-hcd.c | 22 ++++- + drivers/usb/host/ehci-ssb.c | 255 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-ssb.c --- a/drivers/usb/host/Kconfig @@ -75,19 +75,19 @@ Signed-off-by: Hauke Mehrtens clean3: #endif #ifdef PS3_SYSTEM_BUS_DRIVER -@@ -1256,6 +1272,9 @@ static void __exit ehci_hcd_cleanup(void - #ifdef PS3_SYSTEM_BUS_DRIVER - ps3_ehci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); - #endif +@@ -1244,6 +1260,9 @@ module_init(ehci_hcd_init); + + static void __exit ehci_hcd_cleanup(void) + { +#ifdef SSB_EHCI_DRIVER + ssb_driver_unregister(&SSB_EHCI_DRIVER); +#endif - #ifdef DEBUG - debugfs_remove(ehci_debug_root); + #ifdef OF_PLATFORM_DRIVER + of_unregister_platform_driver(&OF_PLATFORM_DRIVER); #endif --- /dev/null +++ b/drivers/usb/host/ehci-ssb.c -@@ -0,0 +1,258 @@ +@@ -0,0 +1,255 @@ +/* + * Sonics Silicon Backplane + * Broadcom USB-core EHCI driver (SSB bus glue) @@ -189,9 +189,9 @@ Signed-off-by: Hauke Mehrtens +static void ssb_ehci_detach(struct ssb_device *dev) +{ + struct usb_hcd *hcd = ssb_get_drvdata(dev); ++ + if (hcd->driver->shutdown) + hcd->driver->shutdown(hcd); -+ + usb_remove_hcd(hcd); + iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); @@ -213,12 +213,9 @@ Signed-off-by: Hauke Mehrtens + /* + * USB 2.0 special considerations: + * -+ * 1. Since the core supports both ehci and EHCI functions, it must -+ * only be reset once. -+ * -+ * 2. In addition to the standard SSB reset sequence, the Host Control -+ * Register must be programmed to bring the USB core and various -+ * phy components out of reset. ++ * In addition to the standard SSB reset sequence, the Host Control ++ * Register must be programmed to bring the USB core and various phy ++ * components out of reset. + */ + ssb_device_enable(dev, 0); + ssb_write32(dev, 0x200, 0x7ff); @@ -238,7 +235,7 @@ Signed-off-by: Hauke Mehrtens + udelay(1); + + /* Work around for 5354 failures */ -+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) { ++ if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { + /* Change syn01 reg */ + tmp = 0x00fe00fe; + ssb_write32(dev, 0x894, tmp); diff --git a/target/linux/brcm47xx/patches-2.6.35/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch b/target/linux/brcm47xx/patches-2.6.35/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch index 98b12019c2..dfa4b41fbf 100644 --- a/target/linux/brcm47xx/patches-2.6.35/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch +++ b/target/linux/brcm47xx/patches-2.6.35/011-MIPS-BCM47xx-Really-fix-128MB-RAM-problem.patch @@ -1,7 +1,7 @@ -From bf93090747e3d23e5354bd8da52f85d96c0f6606 Mon Sep 17 00:00:00 2001 +From f65eb52ea6c0ec939fd44e74b6b873e0b549e3c9 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 12:49:41 +0200 -Subject: [PATCH 1/5] MIPS: BCM47xx: Really fix 128MB RAM problem +Subject: [PATCH 1/6] MIPS: BCM47xx: Really fix 128MB RAM problem The previews patch 84a6fcb368a080620d12fc4d79e07902dbee7335 was wrong, I got wrong success reports. diff --git a/target/linux/brcm47xx/patches-2.6.35/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch b/target/linux/brcm47xx/patches-2.6.35/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch index 426e3c35c4..e72b5d7418 100644 --- a/target/linux/brcm47xx/patches-2.6.35/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch +++ b/target/linux/brcm47xx/patches-2.6.35/012-MIPS-BCM47xx-Fill-values-for-b43-into-ssb-sprom.patch @@ -1,13 +1,16 @@ -From fbdfca0b2489ad94c6a3bc90b47adfd5c8179a89 Mon Sep 17 00:00:00 2001 +From e5c5828063a55a752e2392d820383dd7a5da3737 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 13:34:32 +0200 -Subject: [PATCH 2/5] MIPS: BCM47xx: Fill values for b43 into ssb sprom +Subject: [PATCH 2/6] MIPS: BCM47xx: Fill values for b43 into ssb sprom Most of the values are stored in the nvram and not in the CFE. At first the nvram should be read and if there is no value it should look into the CFE. Now more values are read out because the b43 and b43legacy drivers needs them. +Some parts of this patch have been in OpenWRT for a long time and were +made by Michael Buesch. + Signed-off-by: Hauke Mehrtens --- arch/mips/bcm47xx/setup.c | 131 +++++++++++++++++++++++++++++++++----------- diff --git a/target/linux/brcm47xx/patches-2.6.35/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch b/target/linux/brcm47xx/patches-2.6.35/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch index 6bcd55f4c9..05e9d2ec01 100644 --- a/target/linux/brcm47xx/patches-2.6.35/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch +++ b/target/linux/brcm47xx/patches-2.6.35/013-MIPS-BCM47xx-Activate-SSB_B43_PCI_BRIDGE-by-default.patch @@ -1,7 +1,7 @@ -From e6feb5dc2c1bb28582fa3e1445f9d90114e39724 Mon Sep 17 00:00:00 2001 +From e0039e622e53a22b14fce4d2f0cb3febc75cd58b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 13:58:09 +0200 -Subject: [PATCH 3/5] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default +Subject: [PATCH 3/6] MIPS: BCM47xx: Activate SSB_B43_PCI_BRIDGE by default The b43_pci_bridge is needed to use the b43 driver with brcm47xx. Activate it by default if pci is available. diff --git a/target/linux/brcm47xx/patches-2.6.35/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch b/target/linux/brcm47xx/patches-2.6.35/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch index ab23a366ae..0d241e656b 100644 --- a/target/linux/brcm47xx/patches-2.6.35/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch +++ b/target/linux/brcm47xx/patches-2.6.35/014-MIPS-BCM47xx-Setup-and-register-serial-early.patch @@ -1,27 +1,18 @@ -From a41121d789e236fd637ab49beb5ce7b48763613a Mon Sep 17 00:00:00 2001 +From 9be402f069cc259ad5795b77567d66c4e7f6bef6 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 14:59:24 +0200 -Subject: [PATCH 4/5] MIPS: BCM47xx: Setup and register serial early +Subject: [PATCH 4/6] MIPS: BCM47xx: Setup and register serial early Swap the first and second serial if console=ttyS1 was set. Set it up and register it for early serial support. +This patch has been in OpenWRT for a long time. + Signed-off-by: Hauke Mehrtens --- - arch/mips/Kconfig | 1 - - arch/mips/bcm47xx/setup.c | 37 ++++++++++++++++++++++++++++++++++++- - 2 files changed, 36 insertions(+), 2 deletions(-) + arch/mips/bcm47xx/setup.c | 39 ++++++++++++++++++++++++++++++++++++++- + 1 files changed, 38 insertions(+), 1 deletions(-) ---- a/arch/mips/Kconfig -+++ b/arch/mips/Kconfig -@@ -65,7 +65,6 @@ config BCM47XX - select SSB_B43_PCI_BRIDGE if PCI - select SSB_PCICORE_HOSTMODE if PCI - select GENERIC_GPIO -- select SYS_HAS_EARLY_PRINTK - select CFE - help - Support for BCM47XX based boards --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -28,6 +28,8 @@ @@ -33,7 +24,7 @@ Signed-off-by: Hauke Mehrtens #include #include #include -@@ -190,12 +192,45 @@ static int bcm47xx_get_invariants(struct +@@ -190,12 +192,47 @@ static int bcm47xx_get_invariants(struct void __init plat_mem_setup(void) { @@ -48,16 +39,18 @@ Signed-off-by: Hauke Mehrtens panic("Failed to initialize SSB bus (err %d)\n", err); + mcore = &ssb_bcm47xx.mipscore; + -+ nvram_getenv("kernel_args", buf, sizeof(buf)); -+ if (!strncmp(buf, "console=ttyS1", 13)) { -+ struct ssb_serial_port port; ++ if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0 || ++ cfe_getenv("kernel_args", buf, sizeof(buf)) >= 0) { ++ if (strstr(buf, "console=ttyS1")) { ++ struct ssb_serial_port port; + -+ printk(KERN_DEBUG "Swapping serial ports!\n"); -+ /* swap serial ports */ -+ memcpy(&port, &mcore->serial_ports[0], sizeof(port)); -+ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], -+ sizeof(port)); -+ memcpy(&mcore->serial_ports[1], &port, sizeof(port)); ++ printk(KERN_DEBUG "Swapping serial ports!\n"); ++ /* swap serial ports */ ++ memcpy(&port, &mcore->serial_ports[0], sizeof(port)); ++ memcpy(&mcore->serial_ports[0], &mcore->serial_ports[1], ++ sizeof(port)); ++ memcpy(&mcore->serial_ports[1], &port, sizeof(port)); ++ } + } + + for (i = 0; i < mcore->nr_serial_ports; i++) { diff --git a/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-Remove-CFE-console.patch b/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-Remove-CFE-console.patch deleted file mode 100644 index 4a365fde84..0000000000 --- a/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-Remove-CFE-console.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 83b4ed2d1789609565822335ea27026d46fbb477 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 18 Jul 2010 15:11:26 +0200 -Subject: [PATCH 5/5] MIPS: BCM47xx: Remove CFE console - -Do not use the CFE console. It causes hangs on some devices like the -Buffalo WHR-HP-G54. -This was reported in https://dev.openwrt.org/ticket/4061 and -https://forum.openwrt.org/viewtopic.php?id=17063 - -Signed-off-by: Hauke Mehrtens ---- - arch/mips/bcm47xx/prom.c | 82 +++------------------------------------------ - 1 files changed, 6 insertions(+), 76 deletions(-) - ---- a/arch/mips/bcm47xx/prom.c -+++ b/arch/mips/bcm47xx/prom.c -@@ -31,96 +31,28 @@ - #include - #include - --static int cfe_cons_handle; -- - const char *get_system_type(void) - { - return "Broadcom BCM47XX"; - } - --void prom_putchar(char c) --{ -- while (cfe_write(cfe_cons_handle, &c, 1) == 0) -- ; --} -- --static __init void prom_init_cfe(void) -+static __init int prom_init_cfe(void) - { - uint32_t cfe_ept; - uint32_t cfe_handle; - uint32_t cfe_eptseal; -- int argc = fw_arg0; -- char **envp = (char **) fw_arg2; -- int *prom_vec = (int *) fw_arg3; -- -- /* -- * Check if a loader was used; if NOT, the 4 arguments are -- * what CFE gives us (handle, 0, EPT and EPTSEAL) -- */ -- if (argc < 0) { -- cfe_handle = (uint32_t)argc; -- cfe_ept = (uint32_t)envp; -- cfe_eptseal = (uint32_t)prom_vec; -- } else { -- if ((int)prom_vec < 0) { -- /* -- * Old loader; all it gives us is the handle, -- * so use the "known" entrypoint and assume -- * the seal. -- */ -- cfe_handle = (uint32_t)prom_vec; -- cfe_ept = 0xBFC00500; -- cfe_eptseal = CFE_EPTSEAL; -- } else { -- /* -- * Newer loaders bundle the handle/ept/eptseal -- * Note: prom_vec is in the loader's useg -- * which is still alive in the TLB. -- */ -- cfe_handle = prom_vec[0]; -- cfe_ept = prom_vec[2]; -- cfe_eptseal = prom_vec[3]; -- } -- } -+ -+ cfe_eptseal = (uint32_t) fw_arg3; -+ cfe_handle = (uint32_t) fw_arg0; -+ cfe_ept = (uint32_t) fw_arg2; - - if (cfe_eptseal != CFE_EPTSEAL) { -- /* too early for panic to do any good */ - printk(KERN_ERR "CFE's entrypoint seal doesn't match."); -- while (1) ; -+ return -1; - } - - cfe_init(cfe_handle, cfe_ept); --} -- --static __init void prom_init_console(void) --{ -- /* Initialize CFE console */ -- cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); --} -- --static __init void prom_init_cmdline(void) --{ -- static char buf[COMMAND_LINE_SIZE] __initdata; -- -- /* Get the kernel command line from CFE */ -- if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) { -- buf[COMMAND_LINE_SIZE - 1] = 0; -- strcpy(arcs_cmdline, buf); -- } -- -- /* Force a console handover by adding a console= argument if needed, -- * as CFE is not available anymore later in the boot process. */ -- if ((strstr(arcs_cmdline, "console=")) == NULL) { -- /* Try to read the default serial port used by CFE */ -- if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0) -- || (strncmp("uart", buf, 4))) -- /* Default to uart0 */ -- strcpy(buf, "uart0"); -- -- /* Compute the new command line */ -- snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200", -- arcs_cmdline, buf[4]); -- } -+ return 0; - } - - static __init void prom_init_mem(void) -@@ -161,8 +93,6 @@ static __init void prom_init_mem(void) - void __init prom_init(void) - { - prom_init_cfe(); -- prom_init_console(); -- prom_init_cmdline(); - prom_init_mem(); - } - diff --git a/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch b/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch new file mode 100644 index 0000000000..161cd61d83 --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.35/015-MIPS-BCM47xx-nvram_getenv-fix-return-value.patch @@ -0,0 +1,33 @@ +From c5cb2459ff124c1a928e2056bc1fe2da7b6ab6ba Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Fri, 30 Jul 2010 17:45:20 +0200 +Subject: [PATCH 5/6] MIPS: BCM47xx: nvram_getenv fix return value. + +nvram_getenv should behave like cfe_getenv. For now it is used like +cfe_getenv. cfe_getenv returns 0 on success and -1 in case of an error. +Change nvram_getenv to do the same. + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/bcm47xx/nvram.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/mips/bcm47xx/nvram.c ++++ b/arch/mips/bcm47xx/nvram.c +@@ -69,7 +69,7 @@ int nvram_getenv(char *name, char *val, + char *var, *value, *end, *eq; + + if (!name) +- return 1; ++ return -8; + + if (!nvram_buf[0]) + early_nvram_init(); +@@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val, + return 0; + } + } +- return 1; ++ return -9; + } + EXPORT_SYMBOL(nvram_getenv); diff --git a/target/linux/brcm47xx/patches-2.6.35/016-MIPS-BCM47xx-Remove-CFE-console.patch b/target/linux/brcm47xx/patches-2.6.35/016-MIPS-BCM47xx-Remove-CFE-console.patch new file mode 100644 index 0000000000..329560740b --- /dev/null +++ b/target/linux/brcm47xx/patches-2.6.35/016-MIPS-BCM47xx-Remove-CFE-console.patch @@ -0,0 +1,141 @@ +From 5219981646071abb6731634bf47781a53e248764 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 18 Jul 2010 15:11:26 +0200 +Subject: [PATCH 6/6] MIPS: BCM47xx: Remove CFE console + +Do not use the CFE console. It causes hangs on some devices like the +Buffalo WHR-HP-G54. +This was reported in https://dev.openwrt.org/ticket/4061 and +https://forum.openwrt.org/viewtopic.php?id=17063 + +Signed-off-by: Hauke Mehrtens +--- + arch/mips/Kconfig | 1 - + arch/mips/bcm47xx/prom.c | 82 +++------------------------------------------ + 2 files changed, 6 insertions(+), 77 deletions(-) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -65,7 +65,6 @@ config BCM47XX + select SSB_B43_PCI_BRIDGE if PCI + select SSB_PCICORE_HOSTMODE if PCI + select GENERIC_GPIO +- select SYS_HAS_EARLY_PRINTK + select CFE + help + Support for BCM47XX based boards +--- a/arch/mips/bcm47xx/prom.c ++++ b/arch/mips/bcm47xx/prom.c +@@ -31,96 +31,28 @@ + #include + #include + +-static int cfe_cons_handle; +- + const char *get_system_type(void) + { + return "Broadcom BCM47XX"; + } + +-void prom_putchar(char c) +-{ +- while (cfe_write(cfe_cons_handle, &c, 1) == 0) +- ; +-} +- +-static __init void prom_init_cfe(void) ++static __init int prom_init_cfe(void) + { + uint32_t cfe_ept; + uint32_t cfe_handle; + uint32_t cfe_eptseal; +- int argc = fw_arg0; +- char **envp = (char **) fw_arg2; +- int *prom_vec = (int *) fw_arg3; +- +- /* +- * Check if a loader was used; if NOT, the 4 arguments are +- * what CFE gives us (handle, 0, EPT and EPTSEAL) +- */ +- if (argc < 0) { +- cfe_handle = (uint32_t)argc; +- cfe_ept = (uint32_t)envp; +- cfe_eptseal = (uint32_t)prom_vec; +- } else { +- if ((int)prom_vec < 0) { +- /* +- * Old loader; all it gives us is the handle, +- * so use the "known" entrypoint and assume +- * the seal. +- */ +- cfe_handle = (uint32_t)prom_vec; +- cfe_ept = 0xBFC00500; +- cfe_eptseal = CFE_EPTSEAL; +- } else { +- /* +- * Newer loaders bundle the handle/ept/eptseal +- * Note: prom_vec is in the loader's useg +- * which is still alive in the TLB. +- */ +- cfe_handle = prom_vec[0]; +- cfe_ept = prom_vec[2]; +- cfe_eptseal = prom_vec[3]; +- } +- } ++ ++ cfe_eptseal = (uint32_t) fw_arg3; ++ cfe_handle = (uint32_t) fw_arg0; ++ cfe_ept = (uint32_t) fw_arg2; + + if (cfe_eptseal != CFE_EPTSEAL) { +- /* too early for panic to do any good */ + printk(KERN_ERR "CFE's entrypoint seal doesn't match."); +- while (1) ; ++ return -1; + } + + cfe_init(cfe_handle, cfe_ept); +-} +- +-static __init void prom_init_console(void) +-{ +- /* Initialize CFE console */ +- cfe_cons_handle = cfe_getstdhandle(CFE_STDHANDLE_CONSOLE); +-} +- +-static __init void prom_init_cmdline(void) +-{ +- static char buf[COMMAND_LINE_SIZE] __initdata; +- +- /* Get the kernel command line from CFE */ +- if (cfe_getenv("LINUX_CMDLINE", buf, COMMAND_LINE_SIZE) >= 0) { +- buf[COMMAND_LINE_SIZE - 1] = 0; +- strcpy(arcs_cmdline, buf); +- } +- +- /* Force a console handover by adding a console= argument if needed, +- * as CFE is not available anymore later in the boot process. */ +- if ((strstr(arcs_cmdline, "console=")) == NULL) { +- /* Try to read the default serial port used by CFE */ +- if ((cfe_getenv("BOOT_CONSOLE", buf, COMMAND_LINE_SIZE) < 0) +- || (strncmp("uart", buf, 4))) +- /* Default to uart0 */ +- strcpy(buf, "uart0"); +- +- /* Compute the new command line */ +- snprintf(arcs_cmdline, COMMAND_LINE_SIZE, "%s console=ttyS%c,115200", +- arcs_cmdline, buf[4]); +- } ++ return 0; + } + + static __init void prom_init_mem(void) +@@ -161,8 +93,6 @@ static __init void prom_init_mem(void) + void __init prom_init(void) + { + prom_init_cfe(); +- prom_init_console(); +- prom_init_cmdline(); + prom_init_mem(); + } + diff --git a/target/linux/brcm47xx/patches-2.6.35/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch b/target/linux/brcm47xx/patches-2.6.35/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch index 91eadaade4..413558120f 100644 --- a/target/linux/brcm47xx/patches-2.6.35/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch +++ b/target/linux/brcm47xx/patches-2.6.35/021-USB-Add-USB-2.0-to-ssb-ohci-driver.patch @@ -1,32 +1,32 @@ -From cb33ffbdd8491c58b35958ec74c39b3a5c7fabe8 Mon Sep 17 00:00:00 2001 +From ca00adabb88dd1194891624836d7574aab2d7c05 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 21:25:03 +0200 Subject: [PATCH 1/2] USB: Add USB 2.0 to ssb ohci driver This adds USB 2.0 support to ssb ohci driver. -This work was done based on Braodcom source code in the OpenWRT project. +This patch was used in OpenWRT for a long time now. +CC: Steve Brown Signed-off-by: Hauke Mehrtens --- - drivers/usb/host/ohci-ssb.c | 55 ++++++++++++++++++++++++++++++++++++++++-- - 1 files changed, 52 insertions(+), 3 deletions(-) + drivers/usb/host/ohci-ssb.c | 52 ++++++++++++++++++++++++++++++++++++++++-- + 1 files changed, 49 insertions(+), 3 deletions(-) --- a/drivers/usb/host/ohci-ssb.c +++ b/drivers/usb/host/ohci-ssb.c -@@ -92,9 +92,12 @@ static const struct hc_driver ssb_ohci_h - static void ssb_ohci_detach(struct ssb_device *dev) +@@ -93,8 +93,11 @@ static void ssb_ohci_detach(struct ssb_d { struct usb_hcd *hcd = ssb_get_drvdata(dev); + + if (hcd->driver->shutdown) + hcd->driver->shutdown(hcd); - usb_remove_hcd(hcd); iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); ssb_device_disable(dev, 0); } -@@ -106,10 +109,55 @@ static int ssb_ohci_attach(struct ssb_de +@@ -106,10 +109,52 @@ static int ssb_ohci_attach(struct ssb_de int err = -ENOMEM; u32 tmp, flags = 0; @@ -45,12 +45,9 @@ Signed-off-by: Hauke Mehrtens + /* + * USB 2.0 special considerations: + * -+ * 1. Since the core supports both ehci and EHCI functions, it must -+ * only be reset once. -+ * -+ * 2. In addition to the standard SSB reset sequence, the Host Control -+ * Register must be programmed to bring the USB core and various -+ * phy components out of reset. ++ * In addition to the standard SSB reset sequence, the Host ++ * Control Register must be programmed to bring the USB core ++ * and various phy components out of reset. + */ + ssb_device_enable(dev, 0); + ssb_write32(dev, 0x200, 0x7ff); @@ -70,7 +67,7 @@ Signed-off-by: Hauke Mehrtens + udelay(1); + + /* Work around for 5354 failures */ -+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) { ++ if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { + /* Change syn01 reg */ + tmp = 0x00fe00fe; + ssb_write32(dev, 0x894, tmp); @@ -85,7 +82,7 @@ Signed-off-by: Hauke Mehrtens hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev, dev_name(dev->dev)); -@@ -200,6 +248,7 @@ static int ssb_ohci_resume(struct ssb_de +@@ -200,6 +245,7 @@ static int ssb_ohci_resume(struct ssb_de static const struct ssb_device_id ssb_ohci_table[] = { SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV), SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV), diff --git a/target/linux/brcm47xx/patches-2.6.35/022-USB-Add-ehci-ssb-driver.patch b/target/linux/brcm47xx/patches-2.6.35/022-USB-Add-ehci-ssb-driver.patch index 4fd4be3018..6b32df2b42 100644 --- a/target/linux/brcm47xx/patches-2.6.35/022-USB-Add-ehci-ssb-driver.patch +++ b/target/linux/brcm47xx/patches-2.6.35/022-USB-Add-ehci-ssb-driver.patch @@ -1,4 +1,4 @@ -From cb269cf1f97c316a5184080814a751687c72b718 Mon Sep 17 00:00:00 2001 +From ad224c0d5fa0fc05f8aaef3c19fc9b4eb275a5d2 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 18 Jul 2010 21:29:40 +0200 Subject: [PATCH 2/2] USB: Add ehci ssb driver @@ -8,9 +8,9 @@ Support for the Sonics Silicon Backplane (SSB) attached Broadcom USB EHCI core. Signed-off-by: Hauke Mehrtens --- drivers/usb/host/Kconfig | 13 ++ - drivers/usb/host/ehci-hcd.c | 23 ++++- - drivers/usb/host/ehci-ssb.c | 258 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 292 insertions(+), 2 deletions(-) + drivers/usb/host/ehci-hcd.c | 22 ++++- + drivers/usb/host/ehci-ssb.c | 255 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 288 insertions(+), 2 deletions(-) create mode 100644 drivers/usb/host/ehci-ssb.c --- a/drivers/usb/host/Kconfig @@ -53,7 +53,7 @@ Signed-off-by: Hauke Mehrtens #error "missing bus glue for ehci-hcd" #endif -@@ -1220,10 +1225,21 @@ static int __init ehci_hcd_init(void) +@@ -1220,10 +1225,20 @@ static int __init ehci_hcd_init(void) if (retval < 0) goto clean4; #endif @@ -63,7 +63,6 @@ Signed-off-by: Hauke Mehrtens + if (retval < 0) + goto clean5; +#endif -+ return retval; +#ifdef SSB_EHCI_DRIVER @@ -76,7 +75,7 @@ Signed-off-by: Hauke Mehrtens clean4: #endif #ifdef OF_PLATFORM_DRIVER -@@ -1254,6 +1270,9 @@ module_init(ehci_hcd_init); +@@ -1254,6 +1269,9 @@ module_init(ehci_hcd_init); static void __exit ehci_hcd_cleanup(void) { @@ -88,7 +87,7 @@ Signed-off-by: Hauke Mehrtens #endif --- /dev/null +++ b/drivers/usb/host/ehci-ssb.c -@@ -0,0 +1,258 @@ +@@ -0,0 +1,255 @@ +/* + * Sonics Silicon Backplane + * Broadcom USB-core EHCI driver (SSB bus glue) @@ -190,9 +189,9 @@ Signed-off-by: Hauke Mehrtens +static void ssb_ehci_detach(struct ssb_device *dev) +{ + struct usb_hcd *hcd = ssb_get_drvdata(dev); ++ + if (hcd->driver->shutdown) + hcd->driver->shutdown(hcd); -+ + usb_remove_hcd(hcd); + iounmap(hcd->regs); + release_mem_region(hcd->rsrc_start, hcd->rsrc_len); @@ -214,12 +213,9 @@ Signed-off-by: Hauke Mehrtens + /* + * USB 2.0 special considerations: + * -+ * 1. Since the core supports both ehci and EHCI functions, it must -+ * only be reset once. -+ * -+ * 2. In addition to the standard SSB reset sequence, the Host Control -+ * Register must be programmed to bring the USB core and various -+ * phy components out of reset. ++ * In addition to the standard SSB reset sequence, the Host Control ++ * Register must be programmed to bring the USB core and various phy ++ * components out of reset. + */ + ssb_device_enable(dev, 0); + ssb_write32(dev, 0x200, 0x7ff); @@ -239,7 +235,7 @@ Signed-off-by: Hauke Mehrtens + udelay(1); + + /* Work around for 5354 failures */ -+ if ((dev->id.revision == 2) && (dev->bus->chip_id == 0x5354)) { ++ if (dev->id.revision == 2 && dev->bus->chip_id == 0x5354) { + /* Change syn01 reg */ + tmp = 0x00fe00fe; + ssb_write32(dev, 0x894, tmp);