c33af0071d866cddf92a17baf69116dd9fdfa785
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-2.6.25 / 250-ohci-ssb-usb2.patch
1 Index: linux-2.6.25.4/drivers/usb/host/ohci-ssb.c
2 ===================================================================
3 --- linux-2.6.25.4.orig/drivers/usb/host/ohci-ssb.c
4 +++ linux-2.6.25.4/drivers/usb/host/ohci-ssb.c
5 @@ -142,10 +142,59 @@ static int ssb_ohci_attach(struct ssb_de
6 int err = -ENOMEM;
7 u32 tmp, flags = 0;
8
9 - if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV)
10 + /*
11 + * THE FOLLOWING COMMENTS PRESERVED FROM GPL SOURCE RELEASE
12 + *
13 + * The USB core requires a special bit to be set during core
14 + * reset to enable host (OHCI) mode. Resetting the SB core in
15 + * pcibios_enable_device() is a hack for compatibility with
16 + * vanilla usb-ohci so that it does not have to know about
17 + * SB. A driver that wants to use the USB core in device mode
18 + * should know about SB and should reset the bit back to 0
19 + * after calling pcibios_enable_device().
20 + */
21 +
22 + if (dev->id.coreid == SSB_DEV_USB11_HOSTDEV) {
23 flags |= SSB_OHCI_TMSLOW_HOSTMODE;
24 + ssb_device_enable(dev, flags);
25 + }
26 +
27 + /*
28 + * USB 2.0 special considerations:
29 + *
30 + * 1. Since the core supports both OHCI and EHCI functions, it must
31 + * only be reset once.
32 + *
33 + * 2. In addition to the standard SB reset sequence, the Host Control
34 + * Register must be programmed to bring the USB core and various
35 + * phy components out of reset.
36 + */
37 +
38 + else if (dev->id.coreid == SSB_DEV_USB20_HOST) {
39 +#warning FIX ME need test for core being up & exit
40 + ssb_device_enable(dev, 0);
41 + ssb_write32(dev, 0x200, 0x7ff);
42 + udelay(1);
43 + if (dev->id.revision == 1) { // bug in rev 1
44 +
45 + /* Change Flush control reg */
46 + tmp = ssb_read32(dev, 0x400);
47 + tmp &= ~8;
48 + ssb_write32(dev, 0x400, tmp);
49 + tmp = ssb_read32(dev, 0x400);
50 + printk("USB20H fcr: 0x%0x\n", tmp);
51 +
52 + /* Change Shim control reg */
53 + tmp = ssb_read32(dev, 0x304);
54 + tmp &= ~0x100;
55 + ssb_write32(dev, 0x304, tmp);
56 + tmp = ssb_read32(dev, 0x304);
57 + printk("USB20H shim: 0x%0x\n", tmp);
58 + }
59 + }
60 + else
61 + ssb_device_enable(dev, 0);
62
63 - ssb_device_enable(dev, flags);
64
65 hcd = usb_create_hcd(&ssb_ohci_hc_driver, dev->dev,
66 dev->dev->bus_id);
67 @@ -236,6 +285,7 @@ static int ssb_ohci_resume(struct ssb_de
68 static const struct ssb_device_id ssb_ohci_table[] = {
69 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOSTDEV, SSB_ANY_REV),
70 SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB11_HOST, SSB_ANY_REV),
71 + SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_USB20_HOST, SSB_ANY_REV),
72 SSB_DEVTABLE_END
73 };
74 MODULE_DEVICE_TABLE(ssb, ssb_ohci_table);