[mcs814x] add some ohci workarounds to make ohci work
[openwrt.git] / target / linux / mcs814x / patches-3.3 / 013-ohci_workarounds.patch
1 --- a/drivers/usb/host/ohci.h
2 +++ b/drivers/usb/host/ohci.h
3 @@ -114,7 +114,7 @@ struct td {
4         /* PSW is only for ISO.  Only 1 PSW entry is used, but on
5          * big-endian PPC hardware that's the second entry.
6          */
7 -#define MAXPSW 2
8 +#define MAXPSW 8
9         __hc16          hwPSW [MAXPSW];
10  
11         /* rest are purely for the driver's use */
12 --- a/drivers/usb/host/ohci-hcd.c
13 +++ b/drivers/usb/host/ohci-hcd.c
14 @@ -497,6 +497,7 @@ static int ohci_init (struct ohci_hcd *o
15  {
16         int ret;
17         struct usb_hcd *hcd = ohci_to_hcd(ohci);
18 +       u32 hcca_area;
19  
20         if (distrust_firmware)
21                 ohci->flags |= OHCI_QUIRK_HUB_POWER;
22 @@ -550,11 +551,13 @@ static int ohci_init (struct ohci_hcd *o
23         if (ohci->hcca)
24                 return 0;
25  
26 -       ohci->hcca = dma_alloc_coherent (hcd->self.controller,
27 -                       sizeof *ohci->hcca, &ohci->hcca_dma, 0);
28 +       hcca_area = ohci_readl(ohci, &ohci->regs->hcca);
29 +       ohci->hcca = ioremap_nocache(hcca_area, sizeof *ohci->hcca);
30         if (!ohci->hcca)
31                 return -ENOMEM;
32  
33 +       ohci->hcca_dma = hcca_area;
34 +
35         if ((ret = ohci_mem_init (ohci)) < 0)
36                 ohci_stop (hcd);
37         else {
38 @@ -572,6 +575,7 @@ static int ohci_init (struct ohci_hcd *o
39   */
40  static int ohci_run (struct ohci_hcd *ohci)
41  {
42 +       int                     i = 0;
43         u32                     mask, val;
44         int                     first = ohci->fminterval == 0;
45         struct usb_hcd          *hcd = ohci_to_hcd(ohci);
46 @@ -622,6 +626,8 @@ static int ohci_run (struct ohci_hcd *oh
47         msleep(val);
48  
49         memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
50 +       for (i = 0; i < NUM_INTS; i++)
51 +               ohci->hcca->int_table[i] = 0;
52  
53         /* 2msec timelimit here means no irqs/preempt */
54         spin_lock_irq (&ohci->lock);
55 @@ -909,9 +915,6 @@ static void ohci_stop (struct usb_hcd *h
56         remove_debug_files (ohci);
57         ohci_mem_cleanup (ohci);
58         if (ohci->hcca) {
59 -               dma_free_coherent (hcd->self.controller,
60 -                               sizeof *ohci->hcca,
61 -                               ohci->hcca, ohci->hcca_dma);
62                 ohci->hcca = NULL;
63                 ohci->hcca_dma = 0;
64         }