2 drivers/usb/host/Kconfig | 13 ++
3 drivers/usb/host/ehci-hcd.c | 12 ++
4 drivers/usb/host/ehci-ssb.c | 201 ++++++++++++++++++++++++++++++++++++++++++++
5 drivers/usb/host/ohci-ssb.c | 23 +++++
6 4 files changed, 247 insertions(+), 2 deletions(-)
8 --- a/drivers/usb/host/Kconfig
9 +++ b/drivers/usb/host/Kconfig
10 @@ -150,6 +150,19 @@ config USB_OXU210HP_HCD
11 To compile this driver as a module, choose M here: the
12 module will be called oxu210hp-hcd.
14 +config USB_EHCI_HCD_SSB
15 + bool "EHCI support for Broadcom SSB EHCI core"
16 + depends on USB_EHCI_HCD && SSB && EXPERIMENTAL
19 + Support for the Sonics Silicon Backplane (SSB) attached
20 + Broadcom USB EHCI core.
22 + This device is present in some embedded devices with
23 + Broadcom based SSB bus.
27 config USB_ISP116X_HCD
28 tristate "ISP116X HCD support"
30 --- a/drivers/usb/host/ehci-hcd.c
31 +++ b/drivers/usb/host/ehci-hcd.c
32 @@ -1158,6 +1158,11 @@ MODULE_LICENSE ("GPL");
33 #define PLATFORM_DRIVER ehci_atmel_driver
36 +#ifdef CONFIG_USB_EHCI_HCD_SSB
37 +#include "ehci-ssb.c"
38 +#define SSB_EHCI_DRIVER ssb_ehci_driver
41 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
42 !defined(PS3_SYSTEM_BUS_DRIVER) && !defined(OF_PLATFORM_DRIVER) && \
43 !defined(XILINX_OF_PLATFORM_DRIVER)
45 +++ b/drivers/usb/host/ehci-ssb.c
48 + * Sonics Silicon Backplane
49 + * Broadcom USB-core EHCI driver (SSB bus glue)
51 + * Copyright 2007 Steven Brown <sbrown@cortland.com>
53 + * Derived from the OHCI-SSB driver
54 + * Copyright 2007 Michael Buesch <mb@bu3sch.de>
56 + * Derived from the EHCI-PCI driver
57 + * Copyright (c) 2000-2004 by David Brownell
59 + * Derived from the OHCI-PCI driver
60 + * Copyright 1999 Roman Weissgaerber
61 + * Copyright 2000-2002 David Brownell
62 + * Copyright 1999 Linus Torvalds
63 + * Copyright 1999 Gregory P. Smith
65 + * Derived from the USBcore related parts of Broadcom-SB
66 + * Copyright 2005 Broadcom Corporation
68 + * Licensed under the GNU/GPL. See COPYING for details.
70 +#include <linux/ssb/ssb.h>
72 +#define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
74 +struct ssb_ehci_device {
75 + struct ehci_hcd ehci; /* _must_ be at the beginning. */
81 +struct ssb_ehci_device *hcd_to_ssb_ehci(struct usb_hcd *hcd)
83 + return (struct ssb_ehci_device *)(hcd->hcd_priv);
86 +static int ssb_ehci_reset(struct usb_hcd *hcd)
88 + struct ehci_hcd *ehci = hcd_to_ehci(hcd);
91 + ehci->caps = hcd->regs;
92 + ehci->regs = hcd->regs +
93 + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
95 + dbg_hcs_params(ehci, "reset");
96 + dbg_hcc_params(ehci, "reset");
98 + ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
100 + err = ehci_halt(ehci);
105 + err = ehci_init(hcd);
115 +static const struct hc_driver ssb_ehci_hc_driver = {
116 + .description = "ssb-usb-ehci",
117 + .product_desc = "SSB EHCI Controller",
118 + .hcd_priv_size = sizeof(struct ssb_ehci_device),
121 + .flags = HCD_MEMORY | HCD_USB2,
123 + .reset = ssb_ehci_reset,
126 + .shutdown = ehci_shutdown,
128 + .urb_enqueue = ehci_urb_enqueue,
129 + .urb_dequeue = ehci_urb_dequeue,
130 + .endpoint_disable = ehci_endpoint_disable,
131 + .endpoint_reset = ehci_endpoint_reset,
133 + .get_frame_number = ehci_get_frame,
135 + .hub_status_data = ehci_hub_status_data,
136 + .hub_control = ehci_hub_control,
137 + .bus_suspend = ehci_bus_suspend,
138 + .bus_resume = ehci_bus_resume,
139 + .relinquish_port = ehci_relinquish_port,
140 + .port_handed_over = ehci_port_handed_over,
142 + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
145 +static void ssb_ehci_detach(struct ssb_device *dev, struct usb_hcd *hcd)
147 + if (hcd->driver->shutdown)
148 + hcd->driver->shutdown(hcd);
150 + usb_remove_hcd(hcd);
152 + iounmap(hcd->regs);
153 + release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
157 +EXPORT_SYMBOL_GPL(ssb_ehci_detach);
159 +static int ssb_ehci_attach(struct ssb_device *dev, struct usb_hcd **ehci_hcd)
161 + struct ssb_ehci_device *ehcidev;
162 + struct usb_hcd *hcd;
164 + u32 tmp, flags = 0;
166 + hcd = usb_create_hcd(&ssb_ehci_hc_driver, dev->dev,
167 + dev_name(dev->dev));
169 + goto err_dev_disable;
171 + ehcidev = hcd_to_ssb_ehci(hcd);
172 + ehcidev->enable_flags = flags;
173 + tmp = ssb_read32(dev, SSB_ADMATCH0);
174 + hcd->rsrc_start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */
175 + hcd->rsrc_len = 0x100; /* ehci reg block size */
177 + * start & size modified per sbutils.c
179 + hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
182 + err = usb_add_hcd(hcd, dev->irq, IRQF_SHARED | IRQF_DISABLED);
191 + iounmap(hcd->regs);
195 + ssb_device_disable(dev, flags);
198 +EXPORT_SYMBOL_GPL(ssb_ehci_attach);
200 +static const struct ssb_device_id ssb_ehci_table[] = {
201 + SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
204 +MODULE_DEVICE_TABLE(ssb, ssb_ehci_table);
205 --- a/drivers/usb/host/ohci-ssb.c
206 +++ b/drivers/usb/host/ohci-ssb.c
209 #include <linux/ssb/ssb.h>
211 +extern int ssb_ehci_attach(struct ssb_device *dev, struct usb_hcd **hcd);
212 +extern void ssb_ehci_detach(struct ssb_device *dev, struct usb_hcd *hcd);
214 #define SSB_OHCI_TMSLOW_HOSTMODE (1 << 29)
216 @@ -24,6 +26,7 @@ struct ssb_ohci_device {
217 struct ohci_hcd ohci; /* _must_ be at the beginning. */
220 + struct usb_hcd *ehci_hcd;
224 @@ -92,13 +95,25 @@ static const struct hc_driver ssb_ohci_h
225 static void ssb_ohci_detach(struct ssb_device *dev)
227 struct usb_hcd *hcd = ssb_get_drvdata(dev);
228 +#ifdef CONFIG_USB_EHCI_HCD_SSB
229 + struct ssb_ohci_device *ohcidev = hcd_to_ssb_ohci(hcd);
236 +#ifdef CONFIG_USB_EHCI_HCD_SSB
238 + * Also detach ehci function
240 + if (dev->id.coreid == SSB_DEV_USB20_HOST)
241 + ssb_ehci_detach(dev, ohcidev->ehci_hcd);
243 ssb_device_disable(dev, 0);
247 static int ssb_ohci_attach(struct ssb_device *dev)
249 struct ssb_ohci_device *ohcidev;
250 @@ -165,6 +180,14 @@ static int ssb_ohci_attach(struct ssb_de
252 ssb_set_drvdata(dev, hcd);
254 +#ifdef CONFIG_USB_EHCI_HCD_SSB
256 + * attach ehci function in this core
258 + if (dev->id.coreid == SSB_DEV_USB20_HOST)
259 + err = ssb_ehci_attach(dev, &(ohcidev->ehci_hcd));