summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-12-09 16:11:52 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-12-09 16:11:52 +0000
commit9ae7818ff789a1cdf94ecd1487f350567007d7b7 (patch)
tree114a7b6c07d73fdeeebca458d1605c8af316c19e
parent8afdee9032d0499aea1369d690e8dedc3d874bb4 (diff)
Add bcm5354 patches from #2757
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9685 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/brcm47xx/patches-2.6.23/230-ohci-ssb.patch347
-rw-r--r--target/linux/brcm47xx/patches-2.6.23/240-ohci-ssb-pm.patch30
-rw-r--r--target/linux/brcm47xx/patches-2.6.23/250-ohci-ssb-usb2.patch72
-rw-r--r--target/linux/brcm47xx/patches-2.6.23/260-ohci-set-dma-mask.patch14
4 files changed, 463 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-2.6.23/230-ohci-ssb.patch b/target/linux/brcm47xx/patches-2.6.23/230-ohci-ssb.patch
new file mode 100644
index 0000000000..1db627f37d
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.23/230-ohci-ssb.patch
@@ -0,0 +1,347 @@
+From: Michael Buesch <mb@bu3sch.de>
+Date: Wed, 10 Oct 2007 06:47:17 +0000 (-0700)
+Subject: USB: ohci SSB bus glue
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fralf%2Flinux.git;a=commitdiff_plain;h=c604e851486eabcbeb73e984279d436ce121fd5d
+
+USB: ohci SSB bus glue
+
+This adds SSB bus glue for the USB OHCI HCD.
+
+Signed-off-by: Michael Buesch <mb@bu3sch.de>
+Signed-off-by: John W. Linville <linville@tuxdriver.com>
+Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+
+diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
+index 565d6ef..c978d62 100644
+--- a/drivers/usb/host/Kconfig
++++ b/drivers/usb/host/Kconfig
+@@ -154,6 +154,19 @@ config USB_OHCI_HCD_PCI
+ Enables support for PCI-bus plug-in USB controller cards.
+ If unsure, say Y.
+
++config USB_OHCI_HCD_SSB
++ bool "OHCI support for Broadcom SSB OHCI core"
++ depends on USB_OHCI_HCD && SSB && 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_BIG_ENDIAN_DESC
+ bool
+ depends on USB_OHCI_HCD
+diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
+index f7c6ced..240c7f5 100644
+--- a/drivers/usb/host/ohci-hcd.c
++++ b/drivers/usb/host/ohci-hcd.c
+@@ -1033,11 +1033,17 @@ MODULE_LICENSE ("GPL");
+ #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
+ #endif
+
++#ifdef CONFIG_USB_OHCI_HCD_SSB
++#include "ohci-ssb.c"
++#define SSB_OHCI_DRIVER ssb_ohci_driver
++#endif
++
+ #if !defined(PCI_DRIVER) && \
+ !defined(PLATFORM_DRIVER) && \
+ !defined(OF_PLATFORM_DRIVER) && \
+ !defined(SA1111_DRIVER) && \
+- !defined(PS3_SYSTEM_BUS_DRIVER)
++ !defined(PS3_SYSTEM_BUS_DRIVER) && \
++ !defined(SSB_OHCI_DRIVER)
+ #error "missing bus glue for ohci-hcd"
+ #endif
+
+@@ -1082,10 +1088,20 @@ static int __init ohci_hcd_mod_init(void)
+ goto error_pci;
+ #endif
+
++#ifdef SSB_OHCI_DRIVER
++ retval = ssb_driver_register(&SSB_OHCI_DRIVER);
++ if (retval)
++ goto error_ssb;
++#endif
++
+ return retval;
+
+ /* Error path */
++#ifdef SSB_OHCI_DRIVER
++ error_ssb:
++#endif
+ #ifdef PCI_DRIVER
++ pci_unregister_driver(&PCI_DRIVER);
+ error_pci:
+ #endif
+ #ifdef SA1111_DRIVER
+@@ -1110,6 +1126,9 @@ module_init(ohci_hcd_mod_init);
+
+ static void __exit ohci_hcd_mod_exit(void)
+ {
++#ifdef SSB_OHCI_DRIVER
++ ssb_driver_unregister(&SSB_OHCI_DRIVER);
++#endif
+ #ifdef PCI_DRIVER
+ pci_unregister_driver(&PCI_DRIVER);
+ #endif
+diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
+new file mode 100644
+index 0000000..bc3e785
+--- /dev/null
++++ b/drivers/usb/host/ohci-ssb.c
+@@ -0,0 +1,247 @@
++/*
++ * Sonics Silicon Backplane
++ * Broadcom USB-core OHCI driver
++ *
++ * Copyright 2007 Michael Buesch <mb@bu3sch.de>
++ *
++ * Derived from the OHCI-PCI driver
++ * Copyright 1999 Roman Weissgaerber
++ * Copyright 2000-2002 David Brownell
++ * Copyright 1999 Linus Torvalds
++ * Copyright 1999 Gregory P. Smith
++ *
++ * Derived from the USBcore related parts of Broadcom-SB
++ * Copyright 2005 Broadcom Corporation
++ *
++ * Licensed under the GNU/GPL. See COPYING for details.
++ */
++#include <linux/ssb/ssb.h>
++
++
++#define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
++
++struct ssb_ohci_device {
++ struct ohci_hcd ohci; /* _must_ be at the beginning. */
++
++ u32 enable_flags;
++};
++
++static inline
++struct ssb_ohci_device *hcd_to_ssb_ohci(struct usb_hcd *hcd)
++{
++ return (struct ssb_ohci_device *)(hcd->hcd_priv);
++}
++
++
++static int ssb_ohci_reset(struct usb_hcd *hcd)
++{
++ struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
++ struct ohci_hcd *ohci = &ohcidev->ohci;
++ int err;
++
++ ohci_hcd_init(ohci);
++ err = ohci_init(ohci);
++
++ return err;
++}
++
++static int ssb_ohci_start(struct usb_hcd *hcd)
++{
++ struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
++ struct ohci_hcd *ohci = &ohcidev->ohci;
++ int err;
++
++ err = ohci_run(ohci);
++ if (err < 0) {
++ ohci_err(ohci, "can't start\n");
++ ohci_stop(hcd);
++ }
++
++ return err;
++}
++
++#ifdef CONFIG_PM
++static int ssb_ohci_hcd_suspend(struct usb_hcd *hcd, pm_message_t message)
++{
++ struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
++ struct ohci_hcd *ohci = &ohcidev->ohci;
++ unsigned long flags;
++
++ spin_lock_irqsave(&ohci->lock, flags);
++
++ ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
++ ohci_readl(ohci, &ohci->regs->intrdisable); /* commit write */
++
++ /* make sure snapshot being resumed re-enumerates everything */
++ if (message.event == PM_EVENT_PRETHAW)
++ ohci_usb_reset(ohci);
++
++ clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
++
++ spin_unlock_irqrestore(&ohci->lock, flags);
++ return 0;
++}
++
++static int ssb_ohci_hcd_resume(struct usb_hcd *hcd)
++{
++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
++ usb_hcd_resume_root_hub(hcd);
++ return 0;
++}
++#endif /* CONFIG_PM */
++
++static const struct hc_driver ssb_ohci_hc_driver = {
++ .description = "ssb-usb-ohci",
++ .product_desc = "SSB OHCI Controller",
++ .hcd_priv_size = sizeof(struct ssb_ohci_device),
++
++ .irq = ohci_irq,
++ .flags = HCD_MEMORY | HCD_USB11,
++
++ .reset = ssb_ohci_reset,
++ .start = ssb_ohci_start,
++ .stop = ohci_stop,
++ .shutdown = ohci_shutdown,
++
++#ifdef CONFIG_PM
++ .suspend = ssb_ohci_hcd_suspend,
++ .resume = ssb_ohci_hcd_resume,
++#endif
++
++ .urb_enqueue = ohci_urb_enqueue,
++ .urb_dequeue = ohci_urb_dequeue,
++ .endpoint_disable = ohci_endpoint_disable,
++
++ .get_frame_number = ohci_get_frame,
++
++ .hub_status_data = ohci_hub_status_data,
++ .hub_control = ohci_hub_control,
++ .hub_irq_enable = ohci_rhsc_enable,
++ .bus_suspend = ohci_bus_suspend,
++ .bus_resume = ohci_bus_resume,
++
++ .start_port_reset = ohci_start_port_reset,
++};
++
++static void ssb_ohci_detach(struct ssb_device *dev)
++{
++ struct usb_hcd *hcd = ssb_get_drvdata(dev);
++
++ usb_remove_hcd(hcd);
++ iounmap(hcd->regs);
++ usb_put_hcd(hcd);
++ ssb_device_disable(dev, 0);
++}
++
++static int ssb_ohci_attach(struct ssb_device *dev)
++{
++ struct ssb_ohci_device *ohcidev;
++ struct usb_hcd *hcd;
++ int err = -ENOMEM;
++ u32 tmp, flags = 0;
++
++ if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV)
++ flags |= SSB_OHCI_TMSLOW_HOSTMODE;
++
++ ssb_device_enable(dev, flags);
++
++ hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
++ dev->dev->bus_id);
++ if (!hcd)
++ goto err_dev_disable;
++ ohcidev = hcd_to_ssb_ohci(hcd);
++ ohcidev->enable_flags = flags;
++
++ tmp = ssb_read32(dev, SSB_ADMATCH0);
++ hcd->rsrc_start = ssb_admatch_base(tmp);
++ hcd->rsrc_len = ssb_admatch_size(tmp);
++ hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
++ if (!hcd->regs)
++ goto err_put_hcd;
++ err = usb_add_hcd(hcd, dev->irq, IRQF_SHARED);
++ if (err)
++ goto err_iounmap;
++
++ ssb_set_drvdata(dev, hcd);
++
++ return err;
++
++err_iounmap:
++ iounmap(hcd->regs);
++err_put_hcd:
++ usb_put_hcd(hcd);
++err_dev_disable:
++ ssb_device_disable(dev, flags);
++ return err;
++}
++
++static int ssb_ohci_probe(struct ssb_device *dev,
++ const struct ssb_device_id *id)
++{
++ int err;
++ u16 chipid_top;
++
++ /* USBcores are only connected on embedded devices. */
++ chipid_top = (dev->bus->chip_id & 0xFF00);
++ if (chipid_top != 0x4700 && chipid_top != 0x5300)
++ return -ENODEV;
++
++ /* TODO: Probably need checks here; is the core connected? */
++
++ if (usb_disabled())
++ return -ENODEV;
++
++ /* We currently always attach SSB_DEV_USB11_HOSTDEV
++ * as HOST OHCI. If we want to attach it as Client device,
++ * we must branch here and call into the (yet to
++ * be written) Client mode driver. Same for remove(). */
++
++ err = ssb_ohci_attach(dev);
++
++ return err;
++}
++
++static void ssb_ohci_remove(struct ssb_device *dev)
++{
++ ssb_ohci_detach(dev);
++}
++
++#ifdef CONFIG_PM
++
++static int ssb_ohci_suspend(struct ssb_device *dev, pm_message_t state)
++{
++ ssb_device_disable(dev, 0);
++
++ return 0;
++}
++
++static int ssb_ohci_resume(struct ssb_device *dev)
++{
++ struct usb_hcd *hcd = ssb_get_drvdata(dev);
++ struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
++
++ ssb_device_enable(dev, ohcidev->enable_flags);
++
++ return 0;
++}
++
++#else /* !CONFIG_PM */
++#define ssb_ohci_suspend NULL
++#define ssb_ohci_resume NULL
++#endif /* CONFIG_PM */
++
++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),
++ SSB_DEVTABLE_END
++};
++MODULE_DEVICE_TABLE(ssb, ssb_ohci_table);
++
++static struct ssb_driver ssb_ohci_driver = {
++ .name = KBUILD_MODNAME,
++ .id_table = ssb_ohci_table,
++ .probe = ssb_ohci_probe,
++ .remove = ssb_ohci_remove,
++ .suspend = ssb_ohci_suspend,
++ .resume = ssb_ohci_resume,
++};
+
diff --git a/target/linux/brcm47xx/patches-2.6.23/240-ohci-ssb-pm.patch b/target/linux/brcm47xx/patches-2.6.23/240-ohci-ssb-pm.patch
new file mode 100644
index 0000000000..81ba45bee8
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.23/240-ohci-ssb-pm.patch
@@ -0,0 +1,30 @@
+From: Al Viro <viro@ftp.linux.org.uk>
+Date: Sat, 13 Oct 2007 21:29:47 +0000 (+0100)
+Subject: Fix ohci-ssb with !CONFIG_PM
+X-Git-Tag: linux-2.6.24-rc1~57^2~38
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Fralf%2Flinux.git;a=commitdiff_plain;h=4735b37cf434175c2b7b36b3b68f1e60e8ec8527;hp=d773b33972a663cfaf066e966f87922a74088a1e
+
+Fix ohci-ssb with !CONFIG_PM
+
+ohci_bus_{suspend,resume} exists only if we have CONFIG_PM; do the same
+thing as other subdrivers...
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+---
+
+diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c
+index bc3e785..fe70e72 100644
+--- a/drivers/usb/host/ohci-ssb.c
++++ b/drivers/usb/host/ohci-ssb.c
+@@ -117,8 +117,10 @@ static const struct hc_driver ssb_ohci_hc_driver = {
+ .hub_status_data = ohci_hub_status_data,
+ .hub_control = ohci_hub_control,
+ .hub_irq_enable = ohci_rhsc_enable,
++#ifdef CONFIG_PM
+ .bus_suspend = ohci_bus_suspend,
+ .bus_resume = ohci_bus_resume,
++#endif
+
+ .start_port_reset = ohci_start_port_reset,
+ };
diff --git a/target/linux/brcm47xx/patches-2.6.23/250-ohci-ssb-usb2.patch b/target/linux/brcm47xx/patches-2.6.23/250-ohci-ssb-usb2.patch
new file mode 100644
index 0000000000..45493958b2
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.23/250-ohci-ssb-usb2.patch
@@ -0,0 +1,72 @@
+--- a/drivers/usb/host/ohci-ssb.c 2007-11-05 07:56:56.000000000 -0800
++++ b/drivers/usb/host/ohci-ssb.c 2007-11-05 08:26:15.000000000 -0800
+@@ -142,10 +142,59 @@
+ int err = -ENOMEM;
+ u32 tmp, flags = 0;
+
+- if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV)
++ /*
++ * THE FOLLOWING COMMENTS PRESERVED FROM GPL SOURCE RELEASE
++ *
++ * The USB core requires a special bit to be set during core
++ * reset to enable host (OHCI) mode. Resetting the SB core in
++ * pcibios_enable_device() is a hack for compatibility with
++ * vanilla usb-ohci so that it does not have to know about
++ * SB. A driver that wants to use the USB core in device mode
++ * should know about SB and should reset the bit back to 0
++ * after calling pcibios_enable_device().
++ */
++
++ if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) {
+ flags |= SSB_OHCI_TMSLOW_HOSTMODE;
++ ssb_device_enable(dev, flags);
++ }
++
++ /*
++ * USB 2.0 special considerations:
++ *
++ * 1. Since the core supports both OHCI and EHCI functions, it must
++ * only be reset once.
++ *
++ * 2. In addition to the standard SB reset sequence, the Host Control
++ * Register must be programmed to bring the USB core and various
++ * phy components out of reset.
++ */
++
++ else if (dev->id.coreid == SSB_DEV_USB20_HOST) {
++#warning FIX ME need test for core being up & exit
++ ssb_device_enable(dev, 0);
++ ssb_write32(dev, 0x200, 0x7ff);
++ udelay(1);
++ if (dev->id.revision == 1) { // bug in rev 1
++
++ /* Change Flush control reg */
++ tmp = ssb_read32(dev, 0x400);
++ tmp &= ~8;
++ ssb_write32(dev, 0x400, tmp);
++ tmp = ssb_read32(dev, 0x400);
++ printk("USB20H fcr: 0x%0x\n", tmp);
++
++ /* Change Shim control reg */
++ tmp = ssb_read32(dev, 0x304);
++ tmp &= ~0x100;
++ ssb_write32(dev, 0x304, tmp);
++ tmp = ssb_read32(dev, 0x304);
++ printk("USB20H shim: 0x%0x\n", tmp);
++ }
++ }
++ else
++ ssb_device_enable(dev, 0);
+
+- ssb_device_enable(dev, flags);
+
+ hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
+ dev->dev->bus_id);
+@@ -235,6 +284,7 @@
+ 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),
++ SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
+ SSB_DEVTABLE_END
+ };
+ MODULE_DEVICE_TABLE(ssb, ssb_ohci_table);
diff --git a/target/linux/brcm47xx/patches-2.6.23/260-ohci-set-dma-mask.patch b/target/linux/brcm47xx/patches-2.6.23/260-ohci-set-dma-mask.patch
new file mode 100644
index 0000000000..5c2d5223e9
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.23/260-ohci-set-dma-mask.patch
@@ -0,0 +1,14 @@
+--- linux-2.6.23.1/drivers/usb/host/ohci-ssb.c 2007-11-26 14:01:22.000000000 -0500
++++ linux-2.6.23.1.new/drivers/usb/host/ohci-ssb.c 2007-11-26 14:16:08.000000000 -0500
+@@ -195,6 +195,11 @@
+ else
+ ssb_device_enable(dev, 0);
+
++ /*
++ * Set dma mask - 32 bit mask is just an assumption
++ */
++ if (ssb_dma_set_mask(dev, DMA_32BIT_MASK))
++ return -EOPNOTSUPP;
+
+ hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
+ dev->dev->bus_id);