]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/linux-mtx-1-2.4.24/08-usb-nonpci-2.4.24.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / linux-mtx-1-2.4.24 / 08-usb-nonpci-2.4.24.patch
1 diff -Naru linux/drivers/usb/host/Config.in linux-new/drivers/usb/host/Config.in
2 --- linux/drivers/usb/host/Config.in    2003-11-16 20:07:42.000000000 -0500
3 +++ linux-new/drivers/usb/host/Config.in        2003-12-18 14:19:37.000000000 -0500
4 @@ -17,3 +17,4 @@
5     dep_tristate '  SL811HS Alternate (x86, StrongARM, isosynchronous mode)' CONFIG_USB_SL811HS_ALT $CONFIG_USB $CONFIG_EXPERIMENTAL
6     dep_tristate '  SL811HS (x86, StrongARM) support, old driver' CONFIG_USB_SL811HS $CONFIG_USB $CONFIG_EXPERIMENTAL
7  fi
8 +dep_tristate '    Non-PCI OHCI support' CONFIG_USB_NON_PCI_OHCI $CONFIG_USB_OHCI
9 diff -Naru linux/drivers/usb/host/usb-ohci.c linux-new/drivers/usb/host/usb-ohci.c
10 --- linux/drivers/usb/host/usb-ohci.c   2003-08-13 13:19:23.000000000 -0400
11 +++ linux-new/drivers/usb/host/usb-ohci.c       2003-12-18 14:19:53.000000000 -0500
12 @@ -2517,6 +2517,7 @@
13                 hc_release_ohci (ohci);
14                 return ret;
15         }
16 +#ifndef CONFIG_USB_NON_PCI_OHCI
17         ohci->flags = id->driver_data;
18         
19         /* Check for NSC87560. We have to look at the bridge (fn1) to identify
20 @@ -2535,6 +2536,7 @@
21                 printk (KERN_INFO __FILE__ ": Using NSC SuperIO setup\n");
22         if (ohci->flags & OHCI_QUIRK_AMD756)
23                 printk (KERN_INFO __FILE__ ": AMD756 erratum 4 workaround\n");
24 +#endif
25  
26         if (hc_reset (ohci) < 0) {
27                 hc_release_ohci (ohci);
28 @@ -2580,8 +2582,10 @@
29         int temp;
30         int i;
31  
32 +#ifndef CONFIG_USB_NON_PCI_OHCI
33         if (ohci->pci_latency)
34                 pci_write_config_byte (ohci->ohci_dev, PCI_LATENCY_TIMER, ohci->pci_latency);
35 +#endif
36  
37         ohci->disabled = 1;
38         ohci->sleeping = 0;
39 @@ -2611,6 +2615,7 @@
40  
41  /*-------------------------------------------------------------------------*/
42  
43 +#ifndef CONFIG_USB_NON_PCI_OHCI
44  /* configured so that an OHCI device is always provided */
45  /* always called with process context; sleeping is OK */
46  
47 @@ -2658,6 +2663,88 @@
48         }
49         return status;
50  } 
51 +#else  /* CONFIG_USB_NON_PCI_OHCI */
52 +
53 +// Boot options
54 +static int ohci_base=0, ohci_len=0;
55 +static int ohci_irq=-1;
56 +
57 +MODULE_PARM(ohci_base, "i");
58 +MODULE_PARM(ohci_len, "i");
59 +MODULE_PARM(ohci_irq, "i");
60 +MODULE_PARM_DESC(ohci_base, "IO Base address of OHCI Oper. registers");
61 +MODULE_PARM_DESC(ohci_len, "IO length of OHCI Oper. registers");
62 +MODULE_PARM_DESC(ohci_irq, "IRQ for OHCI interrupts");
63 +
64 +// bogus pci_dev
65 +static struct pci_dev bogus_pcidev;
66 +
67 +static struct pci_driver ohci_pci_driver = {
68 +       name:           "usb-ohci",
69 +};
70 +
71 +static int __devinit
72 +ohci_non_pci_init (void)
73 +{
74 +       void *mem_base;
75 +
76 +       if (!ohci_base || !ohci_len || (ohci_irq < 0)) 
77 +               return -ENODEV;
78 +
79 +       if (!request_mem_region (ohci_base, ohci_len, ohci_pci_driver.name)) {
80 +               dbg ("controller already in use");
81 +               return -EBUSY;
82 +       }
83 +
84 +       mem_base = ioremap_nocache (ohci_base, ohci_len);
85 +       if (!mem_base) {
86 +               err("Error mapping OHCI memory");
87 +               return -EFAULT;
88 +       }
89 +
90 +       /*
91 +       * Fill in the bogus pci_dev. Only those members actually
92 +       * dereferenced in this driver are initialized.
93 +       */
94 +       memset(&bogus_pcidev, 0, sizeof(struct pci_dev));
95 +       strcpy(bogus_pcidev.name, "non-PCI OHCI");
96 +       strcpy(bogus_pcidev.slot_name, "builtin");
97 +       bogus_pcidev.resource[0].name = "OHCI Operational Registers";
98 +       bogus_pcidev.resource[0].start = ohci_base;
99 +       bogus_pcidev.resource[0].end = ohci_base + ohci_len;
100 +       bogus_pcidev.resource[0].flags = 0;
101 +       bogus_pcidev.irq = ohci_irq;
102 +
103 +       return hc_found_ohci (&bogus_pcidev, bogus_pcidev.irq, mem_base, NULL);
104 +} 
105 +
106 +#ifndef MODULE
107 +
108 +static int __init
109 +ohci_setup (char* options)
110 +{
111 +       char* this_opt;
112 +
113 +       if (!options || !*options)
114 +               return 0;
115 +
116 +       for(this_opt=strtok(options,",");this_opt;this_opt=strtok(NULL,",")) {
117 +               if (!strncmp(this_opt, "base:", 5)) { 
118 +                       ohci_base = simple_strtoul(this_opt+5, NULL, 0);
119 +               } else if (!strncmp(this_opt, "len:", 4)) { 
120 +                       ohci_len = simple_strtoul(this_opt+4, NULL, 0);
121 +               } else if (!strncmp(this_opt, "irq:", 4)) { 
122 +                       ohci_irq = simple_strtoul(this_opt+4, NULL, 0);
123 +               }
124 +       }
125 +       return 0;
126 +}
127 +
128 +__setup("usb_ohci=", ohci_setup);
129 +
130 +#endif  /* !MODULE */
131 +
132 +#endif  /* CONFIG_USB_NON_PCI_OHCI */
133  
134  /*-------------------------------------------------------------------------*/
135  
136 @@ -2698,6 +2785,7 @@
137  }
138  
139  
140 +#ifndef CONFIG_USB_NON_PCI_OHCI
141  #ifdef CONFIG_PM
142  
143  /*-------------------------------------------------------------------------*/
144 @@ -2936,20 +3024,29 @@
145         resume:         ohci_pci_resume,
146  #endif /* PM */
147  };
148 +#endif /* CONFIG_USB_NON_PCI_OHCI */
149  
150   
151  /*-------------------------------------------------------------------------*/
152  
153  static int __init ohci_hcd_init (void) 
154  {
155 +#ifndef CONFIG_USB_NON_PCI_OHCI
156         return pci_module_init (&ohci_pci_driver);
157 +#else
158 +       return ohci_non_pci_init();
159 +#endif
160  }
161  
162  /*-------------------------------------------------------------------------*/
163  
164  static void __exit ohci_hcd_cleanup (void) 
165  {      
166 +#ifndef CONFIG_USB_NON_PCI_OHCI
167         pci_unregister_driver (&ohci_pci_driver);
168 +#else
169 +       ohci_pci_remove(&bogus_pcidev);
170 +#endif
171  }
172  
173  module_init (ohci_hcd_init);