diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-11 13:09:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-11 13:09:45 -0400 |
commit | 7cc4e87f912bbefa440a51856b8d076e5d1f554a (patch) | |
tree | 1b8df8683f3de37d2e8211ffa8d151f60d59af62 /drivers/usb | |
parent | 5ba2f67afb02c5302b2898949ed6fc3b3d37dcf1 (diff) | |
parent | 69fc7eed5f56bce15b239e5110de2575a6970df4 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (236 commits)
[ARM] 5300/1: fixup spitz reset during boot
[ARM] 5295/1: make ZONE_DMA optional
[ARM] 5239/1: Palm Zire 72 power management support
[ARM] 5298/1: Drop desc_handle_irq()
[ARM] 5297/1: [KS8695] Fix two compile-time warnings
[ARM] 5296/1: [KS8695] Replace macro's with trailing underscores.
[ARM] pxa: allow multi-machine PCMCIA builds
[ARM] pxa: add preliminary CPUFREQ support for PXA3xx
[ARM] pxa: add missing ACCR bit definitions to pxa3xx-regs.h
[ARM] pxa: rename cpu-pxa.c to cpufreq-pxa2xx.c
[ARM] pxa/zylonite: add support for USB OHCI
[ARM] ohci-pxa27x: use ioremap() and offset for register access
[ARM] ohci-pxa27x: introduce pxa27x_clear_otgph()
[ARM] ohci-pxa27x: use platform_get_{irq,resource} for the resource
[ARM] ohci-pxa27x: move OHCI controller specific registers into the driver
[ARM] ohci-pxa27x: introduce flags to avoid direct access to OHCI registers
[ARM] pxa: move I2S register and bit definitions into pxa2xx-i2s.c
[ARM] pxa: simplify DMA register definitions
[ARM] pxa: make additional DCSR bits valid for PXA3xx
[ARM] pxa: move i2c register and bit definitions into i2c-pxa.c
...
Fixed up conflicts in
arch/arm/mach-versatile/core.c
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/pxa/pxa2xx-i2s.c
manually.
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 259 |
1 files changed, 205 insertions, 54 deletions
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 7f0f35c78185..e294d430733b 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -23,17 +23,90 @@ | |||
23 | #include <linux/signal.h> | 23 | #include <linux/signal.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | |||
27 | #include <mach/hardware.h> | ||
28 | #include <mach/pxa-regs.h> | ||
29 | #include <mach/pxa2xx-regs.h> /* FIXME: for PSSR */ | ||
30 | #include <mach/ohci.h> | 26 | #include <mach/ohci.h> |
31 | 27 | ||
28 | /* | ||
29 | * UHC: USB Host Controller (OHCI-like) register definitions | ||
30 | */ | ||
31 | #define UHCREV (0x0000) /* UHC HCI Spec Revision */ | ||
32 | #define UHCHCON (0x0004) /* UHC Host Control Register */ | ||
33 | #define UHCCOMS (0x0008) /* UHC Command Status Register */ | ||
34 | #define UHCINTS (0x000C) /* UHC Interrupt Status Register */ | ||
35 | #define UHCINTE (0x0010) /* UHC Interrupt Enable */ | ||
36 | #define UHCINTD (0x0014) /* UHC Interrupt Disable */ | ||
37 | #define UHCHCCA (0x0018) /* UHC Host Controller Comm. Area */ | ||
38 | #define UHCPCED (0x001C) /* UHC Period Current Endpt Descr */ | ||
39 | #define UHCCHED (0x0020) /* UHC Control Head Endpt Descr */ | ||
40 | #define UHCCCED (0x0024) /* UHC Control Current Endpt Descr */ | ||
41 | #define UHCBHED (0x0028) /* UHC Bulk Head Endpt Descr */ | ||
42 | #define UHCBCED (0x002C) /* UHC Bulk Current Endpt Descr */ | ||
43 | #define UHCDHEAD (0x0030) /* UHC Done Head */ | ||
44 | #define UHCFMI (0x0034) /* UHC Frame Interval */ | ||
45 | #define UHCFMR (0x0038) /* UHC Frame Remaining */ | ||
46 | #define UHCFMN (0x003C) /* UHC Frame Number */ | ||
47 | #define UHCPERS (0x0040) /* UHC Periodic Start */ | ||
48 | #define UHCLS (0x0044) /* UHC Low Speed Threshold */ | ||
49 | |||
50 | #define UHCRHDA (0x0048) /* UHC Root Hub Descriptor A */ | ||
51 | #define UHCRHDA_NOCP (1 << 12) /* No over current protection */ | ||
52 | #define UHCRHDA_OCPM (1 << 11) /* Over Current Protection Mode */ | ||
53 | #define UHCRHDA_POTPGT(x) \ | ||
54 | (((x) & 0xff) << 24) /* Power On To Power Good Time */ | ||
55 | |||
56 | #define UHCRHDB (0x004C) /* UHC Root Hub Descriptor B */ | ||
57 | #define UHCRHS (0x0050) /* UHC Root Hub Status */ | ||
58 | #define UHCRHPS1 (0x0054) /* UHC Root Hub Port 1 Status */ | ||
59 | #define UHCRHPS2 (0x0058) /* UHC Root Hub Port 2 Status */ | ||
60 | #define UHCRHPS3 (0x005C) /* UHC Root Hub Port 3 Status */ | ||
61 | |||
62 | #define UHCSTAT (0x0060) /* UHC Status Register */ | ||
63 | #define UHCSTAT_UPS3 (1 << 16) /* USB Power Sense Port3 */ | ||
64 | #define UHCSTAT_SBMAI (1 << 15) /* System Bus Master Abort Interrupt*/ | ||
65 | #define UHCSTAT_SBTAI (1 << 14) /* System Bus Target Abort Interrupt*/ | ||
66 | #define UHCSTAT_UPRI (1 << 13) /* USB Port Resume Interrupt */ | ||
67 | #define UHCSTAT_UPS2 (1 << 12) /* USB Power Sense Port 2 */ | ||
68 | #define UHCSTAT_UPS1 (1 << 11) /* USB Power Sense Port 1 */ | ||
69 | #define UHCSTAT_HTA (1 << 10) /* HCI Target Abort */ | ||
70 | #define UHCSTAT_HBA (1 << 8) /* HCI Buffer Active */ | ||
71 | #define UHCSTAT_RWUE (1 << 7) /* HCI Remote Wake Up Event */ | ||
72 | |||
73 | #define UHCHR (0x0064) /* UHC Reset Register */ | ||
74 | #define UHCHR_SSEP3 (1 << 11) /* Sleep Standby Enable for Port3 */ | ||
75 | #define UHCHR_SSEP2 (1 << 10) /* Sleep Standby Enable for Port2 */ | ||
76 | #define UHCHR_SSEP1 (1 << 9) /* Sleep Standby Enable for Port1 */ | ||
77 | #define UHCHR_PCPL (1 << 7) /* Power control polarity low */ | ||
78 | #define UHCHR_PSPL (1 << 6) /* Power sense polarity low */ | ||
79 | #define UHCHR_SSE (1 << 5) /* Sleep Standby Enable */ | ||
80 | #define UHCHR_UIT (1 << 4) /* USB Interrupt Test */ | ||
81 | #define UHCHR_SSDC (1 << 3) /* Simulation Scale Down Clock */ | ||
82 | #define UHCHR_CGR (1 << 2) /* Clock Generation Reset */ | ||
83 | #define UHCHR_FHR (1 << 1) /* Force Host Controller Reset */ | ||
84 | #define UHCHR_FSBIR (1 << 0) /* Force System Bus Iface Reset */ | ||
85 | |||
86 | #define UHCHIE (0x0068) /* UHC Interrupt Enable Register*/ | ||
87 | #define UHCHIE_UPS3IE (1 << 14) /* Power Sense Port3 IntEn */ | ||
88 | #define UHCHIE_UPRIE (1 << 13) /* Port Resume IntEn */ | ||
89 | #define UHCHIE_UPS2IE (1 << 12) /* Power Sense Port2 IntEn */ | ||
90 | #define UHCHIE_UPS1IE (1 << 11) /* Power Sense Port1 IntEn */ | ||
91 | #define UHCHIE_TAIE (1 << 10) /* HCI Interface Transfer Abort | ||
92 | Interrupt Enable*/ | ||
93 | #define UHCHIE_HBAIE (1 << 8) /* HCI Buffer Active IntEn */ | ||
94 | #define UHCHIE_RWIE (1 << 7) /* Remote Wake-up IntEn */ | ||
95 | |||
96 | #define UHCHIT (0x006C) /* UHC Interrupt Test register */ | ||
97 | |||
32 | #define PXA_UHC_MAX_PORTNUM 3 | 98 | #define PXA_UHC_MAX_PORTNUM 3 |
33 | 99 | ||
34 | #define UHCRHPS(x) __REG2( 0x4C000050, (x)<<2 ) | 100 | struct pxa27x_ohci { |
101 | /* must be 1st member here for hcd_to_ohci() to work */ | ||
102 | struct ohci_hcd ohci; | ||
103 | |||
104 | struct device *dev; | ||
105 | struct clk *clk; | ||
106 | void __iomem *mmio_base; | ||
107 | }; | ||
35 | 108 | ||
36 | static struct clk *usb_clk; | 109 | #define to_pxa27x_ohci(hcd) (struct pxa27x_ohci *)hcd_to_ohci(hcd) |
37 | 110 | ||
38 | /* | 111 | /* |
39 | PMM_NPS_MODE -- PMM Non-power switching mode | 112 | PMM_NPS_MODE -- PMM Non-power switching mode |
@@ -45,30 +118,35 @@ static struct clk *usb_clk; | |||
45 | PMM_PERPORT_MODE -- PMM per port switching mode | 118 | PMM_PERPORT_MODE -- PMM per port switching mode |
46 | Ports are powered individually. | 119 | Ports are powered individually. |
47 | */ | 120 | */ |
48 | static int pxa27x_ohci_select_pmm( int mode ) | 121 | static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *ohci, int mode) |
49 | { | 122 | { |
50 | switch ( mode ) { | 123 | uint32_t uhcrhda = __raw_readl(ohci->mmio_base + UHCRHDA); |
124 | uint32_t uhcrhdb = __raw_readl(ohci->mmio_base + UHCRHDB); | ||
125 | |||
126 | switch (mode) { | ||
51 | case PMM_NPS_MODE: | 127 | case PMM_NPS_MODE: |
52 | UHCRHDA |= RH_A_NPS; | 128 | uhcrhda |= RH_A_NPS; |
53 | break; | 129 | break; |
54 | case PMM_GLOBAL_MODE: | 130 | case PMM_GLOBAL_MODE: |
55 | UHCRHDA &= ~(RH_A_NPS & RH_A_PSM); | 131 | uhcrhda &= ~(RH_A_NPS & RH_A_PSM); |
56 | break; | 132 | break; |
57 | case PMM_PERPORT_MODE: | 133 | case PMM_PERPORT_MODE: |
58 | UHCRHDA &= ~(RH_A_NPS); | 134 | uhcrhda &= ~(RH_A_NPS); |
59 | UHCRHDA |= RH_A_PSM; | 135 | uhcrhda |= RH_A_PSM; |
60 | 136 | ||
61 | /* Set port power control mask bits, only 3 ports. */ | 137 | /* Set port power control mask bits, only 3 ports. */ |
62 | UHCRHDB |= (0x7<<17); | 138 | uhcrhdb |= (0x7<<17); |
63 | break; | 139 | break; |
64 | default: | 140 | default: |
65 | printk( KERN_ERR | 141 | printk( KERN_ERR |
66 | "Invalid mode %d, set to non-power switch mode.\n", | 142 | "Invalid mode %d, set to non-power switch mode.\n", |
67 | mode ); | 143 | mode ); |
68 | 144 | ||
69 | UHCRHDA |= RH_A_NPS; | 145 | uhcrhda |= RH_A_NPS; |
70 | } | 146 | } |
71 | 147 | ||
148 | __raw_writel(uhcrhda, ohci->mmio_base + UHCRHDA); | ||
149 | __raw_writel(uhcrhdb, ohci->mmio_base + UHCRHDB); | ||
72 | return 0; | 150 | return 0; |
73 | } | 151 | } |
74 | 152 | ||
@@ -76,57 +154,110 @@ extern int usb_disabled(void); | |||
76 | 154 | ||
77 | /*-------------------------------------------------------------------------*/ | 155 | /*-------------------------------------------------------------------------*/ |
78 | 156 | ||
79 | static int pxa27x_start_hc(struct device *dev) | 157 | static inline void pxa27x_setup_hc(struct pxa27x_ohci *ohci, |
158 | struct pxaohci_platform_data *inf) | ||
159 | { | ||
160 | uint32_t uhchr = __raw_readl(ohci->mmio_base + UHCHR); | ||
161 | uint32_t uhcrhda = __raw_readl(ohci->mmio_base + UHCRHDA); | ||
162 | |||
163 | if (inf->flags & ENABLE_PORT1) | ||
164 | uhchr &= ~UHCHR_SSEP1; | ||
165 | |||
166 | if (inf->flags & ENABLE_PORT2) | ||
167 | uhchr &= ~UHCHR_SSEP2; | ||
168 | |||
169 | if (inf->flags & ENABLE_PORT3) | ||
170 | uhchr &= ~UHCHR_SSEP3; | ||
171 | |||
172 | if (inf->flags & POWER_CONTROL_LOW) | ||
173 | uhchr |= UHCHR_PCPL; | ||
174 | |||
175 | if (inf->flags & POWER_SENSE_LOW) | ||
176 | uhchr |= UHCHR_PSPL; | ||
177 | |||
178 | if (inf->flags & NO_OC_PROTECTION) | ||
179 | uhcrhda |= UHCRHDA_NOCP; | ||
180 | |||
181 | if (inf->flags & OC_MODE_PERPORT) | ||
182 | uhcrhda |= UHCRHDA_OCPM; | ||
183 | |||
184 | if (inf->power_on_delay) { | ||
185 | uhcrhda &= ~UHCRHDA_POTPGT(0xff); | ||
186 | uhcrhda |= UHCRHDA_POTPGT(inf->power_on_delay / 2); | ||
187 | } | ||
188 | |||
189 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | ||
190 | __raw_writel(uhcrhda, ohci->mmio_base + UHCRHDA); | ||
191 | } | ||
192 | |||
193 | static inline void pxa27x_reset_hc(struct pxa27x_ohci *ohci) | ||
194 | { | ||
195 | uint32_t uhchr = __raw_readl(ohci->mmio_base + UHCHR); | ||
196 | |||
197 | __raw_writel(uhchr | UHCHR_FHR, ohci->mmio_base + UHCHR); | ||
198 | udelay(11); | ||
199 | __raw_writel(uhchr & ~UHCHR_FHR, ohci->mmio_base + UHCHR); | ||
200 | } | ||
201 | |||
202 | #ifdef CONFIG_CPU_PXA27x | ||
203 | extern void pxa27x_clear_otgph(void); | ||
204 | #else | ||
205 | #define pxa27x_clear_otgph() do {} while (0) | ||
206 | #endif | ||
207 | |||
208 | static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev) | ||
80 | { | 209 | { |
81 | int retval = 0; | 210 | int retval = 0; |
82 | struct pxaohci_platform_data *inf; | 211 | struct pxaohci_platform_data *inf; |
212 | uint32_t uhchr; | ||
83 | 213 | ||
84 | inf = dev->platform_data; | 214 | inf = dev->platform_data; |
85 | 215 | ||
86 | clk_enable(usb_clk); | 216 | clk_enable(ohci->clk); |
87 | 217 | ||
88 | UHCHR |= UHCHR_FHR; | 218 | pxa27x_reset_hc(ohci); |
89 | udelay(11); | 219 | |
90 | UHCHR &= ~UHCHR_FHR; | 220 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) | UHCHR_FSBIR; |
221 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | ||
91 | 222 | ||
92 | UHCHR |= UHCHR_FSBIR; | 223 | while (__raw_readl(ohci->mmio_base + UHCHR) & UHCHR_FSBIR) |
93 | while (UHCHR & UHCHR_FSBIR) | ||
94 | cpu_relax(); | 224 | cpu_relax(); |
95 | 225 | ||
226 | pxa27x_setup_hc(ohci, inf); | ||
227 | |||
96 | if (inf->init) | 228 | if (inf->init) |
97 | retval = inf->init(dev); | 229 | retval = inf->init(dev); |
98 | 230 | ||
99 | if (retval < 0) | 231 | if (retval < 0) |
100 | return retval; | 232 | return retval; |
101 | 233 | ||
102 | UHCHR &= ~UHCHR_SSE; | 234 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; |
103 | 235 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | |
104 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); | 236 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); |
105 | 237 | ||
106 | /* Clear any OTG Pin Hold */ | 238 | /* Clear any OTG Pin Hold */ |
107 | if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH)) | 239 | pxa27x_clear_otgph(); |
108 | PSSR |= PSSR_OTGPH; | ||
109 | |||
110 | return 0; | 240 | return 0; |
111 | } | 241 | } |
112 | 242 | ||
113 | static void pxa27x_stop_hc(struct device *dev) | 243 | static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev) |
114 | { | 244 | { |
115 | struct pxaohci_platform_data *inf; | 245 | struct pxaohci_platform_data *inf; |
246 | uint32_t uhccoms; | ||
116 | 247 | ||
117 | inf = dev->platform_data; | 248 | inf = dev->platform_data; |
118 | 249 | ||
119 | if (inf->exit) | 250 | if (inf->exit) |
120 | inf->exit(dev); | 251 | inf->exit(dev); |
121 | 252 | ||
122 | UHCHR |= UHCHR_FHR; | 253 | pxa27x_reset_hc(ohci); |
123 | udelay(11); | ||
124 | UHCHR &= ~UHCHR_FHR; | ||
125 | 254 | ||
126 | UHCCOMS |= 1; | 255 | /* Host Controller Reset */ |
256 | uhccoms = __raw_readl(ohci->mmio_base + UHCCOMS) | 0x01; | ||
257 | __raw_writel(uhccoms, ohci->mmio_base + UHCCOMS); | ||
127 | udelay(10); | 258 | udelay(10); |
128 | 259 | ||
129 | clk_disable(usb_clk); | 260 | clk_disable(ohci->clk); |
130 | } | 261 | } |
131 | 262 | ||
132 | 263 | ||
@@ -147,18 +278,22 @@ static void pxa27x_stop_hc(struct device *dev) | |||
147 | */ | 278 | */ |
148 | int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) | 279 | int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) |
149 | { | 280 | { |
150 | int retval; | 281 | int retval, irq; |
151 | struct usb_hcd *hcd; | 282 | struct usb_hcd *hcd; |
152 | struct pxaohci_platform_data *inf; | 283 | struct pxaohci_platform_data *inf; |
284 | struct pxa27x_ohci *ohci; | ||
285 | struct resource *r; | ||
286 | struct clk *usb_clk; | ||
153 | 287 | ||
154 | inf = pdev->dev.platform_data; | 288 | inf = pdev->dev.platform_data; |
155 | 289 | ||
156 | if (!inf) | 290 | if (!inf) |
157 | return -ENODEV; | 291 | return -ENODEV; |
158 | 292 | ||
159 | if (pdev->resource[1].flags != IORESOURCE_IRQ) { | 293 | irq = platform_get_irq(pdev, 0); |
160 | pr_debug ("resource[1] is not IORESOURCE_IRQ"); | 294 | if (irq < 0) { |
161 | return -ENOMEM; | 295 | pr_err("no resource of IORESOURCE_IRQ"); |
296 | return -ENXIO; | ||
162 | } | 297 | } |
163 | 298 | ||
164 | usb_clk = clk_get(&pdev->dev, "USBCLK"); | 299 | usb_clk = clk_get(&pdev->dev, "USBCLK"); |
@@ -168,8 +303,16 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
168 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); | 303 | hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); |
169 | if (!hcd) | 304 | if (!hcd) |
170 | return -ENOMEM; | 305 | return -ENOMEM; |
171 | hcd->rsrc_start = pdev->resource[0].start; | 306 | |
172 | hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; | 307 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
308 | if (!r) { | ||
309 | pr_err("no resource of IORESOURCE_MEM"); | ||
310 | retval = -ENXIO; | ||
311 | goto err1; | ||
312 | } | ||
313 | |||
314 | hcd->rsrc_start = r->start; | ||
315 | hcd->rsrc_len = resource_size(r); | ||
173 | 316 | ||
174 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | 317 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { |
175 | pr_debug("request_mem_region failed"); | 318 | pr_debug("request_mem_region failed"); |
@@ -184,24 +327,30 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
184 | goto err2; | 327 | goto err2; |
185 | } | 328 | } |
186 | 329 | ||
187 | if ((retval = pxa27x_start_hc(&pdev->dev)) < 0) { | 330 | /* initialize "struct pxa27x_ohci" */ |
331 | ohci = (struct pxa27x_ohci *)hcd_to_ohci(hcd); | ||
332 | ohci->dev = &pdev->dev; | ||
333 | ohci->clk = usb_clk; | ||
334 | ohci->mmio_base = (void __iomem *)hcd->regs; | ||
335 | |||
336 | if ((retval = pxa27x_start_hc(ohci, &pdev->dev)) < 0) { | ||
188 | pr_debug("pxa27x_start_hc failed"); | 337 | pr_debug("pxa27x_start_hc failed"); |
189 | goto err3; | 338 | goto err3; |
190 | } | 339 | } |
191 | 340 | ||
192 | /* Select Power Management Mode */ | 341 | /* Select Power Management Mode */ |
193 | pxa27x_ohci_select_pmm(inf->port_mode); | 342 | pxa27x_ohci_select_pmm(ohci, inf->port_mode); |
194 | 343 | ||
195 | if (inf->power_budget) | 344 | if (inf->power_budget) |
196 | hcd->power_budget = inf->power_budget; | 345 | hcd->power_budget = inf->power_budget; |
197 | 346 | ||
198 | ohci_hcd_init(hcd_to_ohci(hcd)); | 347 | ohci_hcd_init(hcd_to_ohci(hcd)); |
199 | 348 | ||
200 | retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED); | 349 | retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); |
201 | if (retval == 0) | 350 | if (retval == 0) |
202 | return retval; | 351 | return retval; |
203 | 352 | ||
204 | pxa27x_stop_hc(&pdev->dev); | 353 | pxa27x_stop_hc(ohci, &pdev->dev); |
205 | err3: | 354 | err3: |
206 | iounmap(hcd->regs); | 355 | iounmap(hcd->regs); |
207 | err2: | 356 | err2: |
@@ -228,12 +377,14 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
228 | */ | 377 | */ |
229 | void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev) | 378 | void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev) |
230 | { | 379 | { |
380 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); | ||
381 | |||
231 | usb_remove_hcd(hcd); | 382 | usb_remove_hcd(hcd); |
232 | pxa27x_stop_hc(&pdev->dev); | 383 | pxa27x_stop_hc(ohci, &pdev->dev); |
233 | iounmap(hcd->regs); | 384 | iounmap(hcd->regs); |
234 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 385 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
235 | usb_put_hcd(hcd); | 386 | usb_put_hcd(hcd); |
236 | clk_put(usb_clk); | 387 | clk_put(ohci->clk); |
237 | } | 388 | } |
238 | 389 | ||
239 | /*-------------------------------------------------------------------------*/ | 390 | /*-------------------------------------------------------------------------*/ |
@@ -266,7 +417,7 @@ ohci_pxa27x_start (struct usb_hcd *hcd) | |||
266 | static const struct hc_driver ohci_pxa27x_hc_driver = { | 417 | static const struct hc_driver ohci_pxa27x_hc_driver = { |
267 | .description = hcd_name, | 418 | .description = hcd_name, |
268 | .product_desc = "PXA27x OHCI", | 419 | .product_desc = "PXA27x OHCI", |
269 | .hcd_priv_size = sizeof(struct ohci_hcd), | 420 | .hcd_priv_size = sizeof(struct pxa27x_ohci), |
270 | 421 | ||
271 | /* | 422 | /* |
272 | * generic hardware linkage | 423 | * generic hardware linkage |
@@ -330,13 +481,13 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) | |||
330 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) | 481 | static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_t state) |
331 | { | 482 | { |
332 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 483 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
333 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 484 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
334 | 485 | ||
335 | if (time_before(jiffies, ohci->next_statechange)) | 486 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
336 | msleep(5); | 487 | msleep(5); |
337 | ohci->next_statechange = jiffies; | 488 | ohci->ohci.next_statechange = jiffies; |
338 | 489 | ||
339 | pxa27x_stop_hc(&pdev->dev); | 490 | pxa27x_stop_hc(ohci, &pdev->dev); |
340 | hcd->state = HC_STATE_SUSPENDED; | 491 | hcd->state = HC_STATE_SUSPENDED; |
341 | 492 | ||
342 | return 0; | 493 | return 0; |
@@ -345,14 +496,14 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_ | |||
345 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) | 496 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) |
346 | { | 497 | { |
347 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 498 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
348 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 499 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
349 | int status; | 500 | int status; |
350 | 501 | ||
351 | if (time_before(jiffies, ohci->next_statechange)) | 502 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
352 | msleep(5); | 503 | msleep(5); |
353 | ohci->next_statechange = jiffies; | 504 | ohci->ohci.next_statechange = jiffies; |
354 | 505 | ||
355 | if ((status = pxa27x_start_hc(&pdev->dev)) < 0) | 506 | if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0) |
356 | return status; | 507 | return status; |
357 | 508 | ||
358 | ohci_finish_controller_resume(hcd); | 509 | ohci_finish_controller_resume(hcd); |