diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-10-04 00:57:21 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-10-07 14:12:58 -0400 |
commit | 0c392ed9a78cbe0f54955ea4716ade8bc22eb00d (patch) | |
tree | 9f56d8ff633f6bb93be7a8510eda42b030e992d3 | |
parent | 0cb0b0d3c6ebb8215500685a1f70a45bbbdc8e47 (diff) |
[ARM] ohci-pxa27x: use ioremap() and offset for register access
This avoid the pre-mapping of OHCI controller register space, and the
mapping is made only when necessary (OHCI is probed).
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-pxa/generic.c | 5 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 188 |
2 files changed, 109 insertions, 84 deletions
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index cbbf30097920..85ed0b33331f 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c | |||
@@ -88,11 +88,6 @@ static struct map_desc standard_io_desc[] __initdata = { | |||
88 | .pfn = __phys_to_pfn(0x48000000), | 88 | .pfn = __phys_to_pfn(0x48000000), |
89 | .length = 0x00200000, | 89 | .length = 0x00200000, |
90 | .type = MT_DEVICE | 90 | .type = MT_DEVICE |
91 | }, { /* USB host */ | ||
92 | .virtual = 0xf8000000, | ||
93 | .pfn = __phys_to_pfn(0x4c000000), | ||
94 | .length = 0x00100000, | ||
95 | .type = MT_DEVICE | ||
96 | }, { /* Camera */ | 91 | }, { /* Camera */ |
97 | .virtual = 0xfa000000, | 92 | .virtual = 0xfa000000, |
98 | .pfn = __phys_to_pfn(0x50000000), | 93 | .pfn = __phys_to_pfn(0x50000000), |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 1fd77933a4c6..e294d430733b 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -23,46 +23,43 @@ | |||
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/ohci.h> | 26 | #include <mach/ohci.h> |
29 | 27 | ||
30 | /* | 28 | /* |
31 | * UHC: USB Host Controller (OHCI-like) register definitions | 29 | * UHC: USB Host Controller (OHCI-like) register definitions |
32 | */ | 30 | */ |
33 | #define UHC_BASE_PHYS (0x4C000000) | 31 | #define UHCREV (0x0000) /* UHC HCI Spec Revision */ |
34 | #define UHCREV __REG(0x4C000000) /* UHC HCI Spec Revision */ | 32 | #define UHCHCON (0x0004) /* UHC Host Control Register */ |
35 | #define UHCHCON __REG(0x4C000004) /* UHC Host Control Register */ | 33 | #define UHCCOMS (0x0008) /* UHC Command Status Register */ |
36 | #define UHCCOMS __REG(0x4C000008) /* UHC Command Status Register */ | 34 | #define UHCINTS (0x000C) /* UHC Interrupt Status Register */ |
37 | #define UHCINTS __REG(0x4C00000C) /* UHC Interrupt Status Register */ | 35 | #define UHCINTE (0x0010) /* UHC Interrupt Enable */ |
38 | #define UHCINTE __REG(0x4C000010) /* UHC Interrupt Enable */ | 36 | #define UHCINTD (0x0014) /* UHC Interrupt Disable */ |
39 | #define UHCINTD __REG(0x4C000014) /* UHC Interrupt Disable */ | 37 | #define UHCHCCA (0x0018) /* UHC Host Controller Comm. Area */ |
40 | #define UHCHCCA __REG(0x4C000018) /* UHC Host Controller Comm. Area */ | 38 | #define UHCPCED (0x001C) /* UHC Period Current Endpt Descr */ |
41 | #define UHCPCED __REG(0x4C00001C) /* UHC Period Current Endpt Descr */ | 39 | #define UHCCHED (0x0020) /* UHC Control Head Endpt Descr */ |
42 | #define UHCCHED __REG(0x4C000020) /* UHC Control Head Endpt Descr */ | 40 | #define UHCCCED (0x0024) /* UHC Control Current Endpt Descr */ |
43 | #define UHCCCED __REG(0x4C000024) /* UHC Control Current Endpt Descr */ | 41 | #define UHCBHED (0x0028) /* UHC Bulk Head Endpt Descr */ |
44 | #define UHCBHED __REG(0x4C000028) /* UHC Bulk Head Endpt Descr */ | 42 | #define UHCBCED (0x002C) /* UHC Bulk Current Endpt Descr */ |
45 | #define UHCBCED __REG(0x4C00002C) /* UHC Bulk Current Endpt Descr */ | 43 | #define UHCDHEAD (0x0030) /* UHC Done Head */ |
46 | #define UHCDHEAD __REG(0x4C000030) /* UHC Done Head */ | 44 | #define UHCFMI (0x0034) /* UHC Frame Interval */ |
47 | #define UHCFMI __REG(0x4C000034) /* UHC Frame Interval */ | 45 | #define UHCFMR (0x0038) /* UHC Frame Remaining */ |
48 | #define UHCFMR __REG(0x4C000038) /* UHC Frame Remaining */ | 46 | #define UHCFMN (0x003C) /* UHC Frame Number */ |
49 | #define UHCFMN __REG(0x4C00003C) /* UHC Frame Number */ | 47 | #define UHCPERS (0x0040) /* UHC Periodic Start */ |
50 | #define UHCPERS __REG(0x4C000040) /* UHC Periodic Start */ | 48 | #define UHCLS (0x0044) /* UHC Low Speed Threshold */ |
51 | #define UHCLS __REG(0x4C000044) /* UHC Low Speed Threshold */ | 49 | |
52 | 50 | #define UHCRHDA (0x0048) /* UHC Root Hub Descriptor A */ | |
53 | #define UHCRHDA __REG(0x4C000048) /* UHC Root Hub Descriptor A */ | ||
54 | #define UHCRHDA_NOCP (1 << 12) /* No over current protection */ | 51 | #define UHCRHDA_NOCP (1 << 12) /* No over current protection */ |
55 | #define UHCRHDA_OCPM (1 << 11) /* Over Current Protection Mode */ | 52 | #define UHCRHDA_OCPM (1 << 11) /* Over Current Protection Mode */ |
56 | #define UHCRHDA_POTPGT(x) \ | 53 | #define UHCRHDA_POTPGT(x) \ |
57 | (((x) & 0xff) << 24) /* Power On To Power Good Time */ | 54 | (((x) & 0xff) << 24) /* Power On To Power Good Time */ |
58 | 55 | ||
59 | #define UHCRHDB __REG(0x4C00004C) /* UHC Root Hub Descriptor B */ | 56 | #define UHCRHDB (0x004C) /* UHC Root Hub Descriptor B */ |
60 | #define UHCRHS __REG(0x4C000050) /* UHC Root Hub Status */ | 57 | #define UHCRHS (0x0050) /* UHC Root Hub Status */ |
61 | #define UHCRHPS1 __REG(0x4C000054) /* UHC Root Hub Port 1 Status */ | 58 | #define UHCRHPS1 (0x0054) /* UHC Root Hub Port 1 Status */ |
62 | #define UHCRHPS2 __REG(0x4C000058) /* UHC Root Hub Port 2 Status */ | 59 | #define UHCRHPS2 (0x0058) /* UHC Root Hub Port 2 Status */ |
63 | #define UHCRHPS3 __REG(0x4C00005C) /* UHC Root Hub Port 3 Status */ | 60 | #define UHCRHPS3 (0x005C) /* UHC Root Hub Port 3 Status */ |
64 | 61 | ||
65 | #define UHCSTAT __REG(0x4C000060) /* UHC Status Register */ | 62 | #define UHCSTAT (0x0060) /* UHC Status Register */ |
66 | #define UHCSTAT_UPS3 (1 << 16) /* USB Power Sense Port3 */ | 63 | #define UHCSTAT_UPS3 (1 << 16) /* USB Power Sense Port3 */ |
67 | #define UHCSTAT_SBMAI (1 << 15) /* System Bus Master Abort Interrupt*/ | 64 | #define UHCSTAT_SBMAI (1 << 15) /* System Bus Master Abort Interrupt*/ |
68 | #define UHCSTAT_SBTAI (1 << 14) /* System Bus Target Abort Interrupt*/ | 65 | #define UHCSTAT_SBTAI (1 << 14) /* System Bus Target Abort Interrupt*/ |
@@ -73,7 +70,7 @@ | |||
73 | #define UHCSTAT_HBA (1 << 8) /* HCI Buffer Active */ | 70 | #define UHCSTAT_HBA (1 << 8) /* HCI Buffer Active */ |
74 | #define UHCSTAT_RWUE (1 << 7) /* HCI Remote Wake Up Event */ | 71 | #define UHCSTAT_RWUE (1 << 7) /* HCI Remote Wake Up Event */ |
75 | 72 | ||
76 | #define UHCHR __REG(0x4C000064) /* UHC Reset Register */ | 73 | #define UHCHR (0x0064) /* UHC Reset Register */ |
77 | #define UHCHR_SSEP3 (1 << 11) /* Sleep Standby Enable for Port3 */ | 74 | #define UHCHR_SSEP3 (1 << 11) /* Sleep Standby Enable for Port3 */ |
78 | #define UHCHR_SSEP2 (1 << 10) /* Sleep Standby Enable for Port2 */ | 75 | #define UHCHR_SSEP2 (1 << 10) /* Sleep Standby Enable for Port2 */ |
79 | #define UHCHR_SSEP1 (1 << 9) /* Sleep Standby Enable for Port1 */ | 76 | #define UHCHR_SSEP1 (1 << 9) /* Sleep Standby Enable for Port1 */ |
@@ -86,7 +83,7 @@ | |||
86 | #define UHCHR_FHR (1 << 1) /* Force Host Controller Reset */ | 83 | #define UHCHR_FHR (1 << 1) /* Force Host Controller Reset */ |
87 | #define UHCHR_FSBIR (1 << 0) /* Force System Bus Iface Reset */ | 84 | #define UHCHR_FSBIR (1 << 0) /* Force System Bus Iface Reset */ |
88 | 85 | ||
89 | #define UHCHIE __REG(0x4C000068) /* UHC Interrupt Enable Register*/ | 86 | #define UHCHIE (0x0068) /* UHC Interrupt Enable Register*/ |
90 | #define UHCHIE_UPS3IE (1 << 14) /* Power Sense Port3 IntEn */ | 87 | #define UHCHIE_UPS3IE (1 << 14) /* Power Sense Port3 IntEn */ |
91 | #define UHCHIE_UPRIE (1 << 13) /* Port Resume IntEn */ | 88 | #define UHCHIE_UPRIE (1 << 13) /* Port Resume IntEn */ |
92 | #define UHCHIE_UPS2IE (1 << 12) /* Power Sense Port2 IntEn */ | 89 | #define UHCHIE_UPS2IE (1 << 12) /* Power Sense Port2 IntEn */ |
@@ -96,14 +93,20 @@ | |||
96 | #define UHCHIE_HBAIE (1 << 8) /* HCI Buffer Active IntEn */ | 93 | #define UHCHIE_HBAIE (1 << 8) /* HCI Buffer Active IntEn */ |
97 | #define UHCHIE_RWIE (1 << 7) /* Remote Wake-up IntEn */ | 94 | #define UHCHIE_RWIE (1 << 7) /* Remote Wake-up IntEn */ |
98 | 95 | ||
99 | #define UHCHIT __REG(0x4C00006C) /* UHC Interrupt Test register */ | 96 | #define UHCHIT (0x006C) /* UHC Interrupt Test register */ |
100 | |||
101 | 97 | ||
102 | #define PXA_UHC_MAX_PORTNUM 3 | 98 | #define PXA_UHC_MAX_PORTNUM 3 |
103 | 99 | ||
104 | #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; | ||
105 | 103 | ||
106 | static struct clk *usb_clk; | 104 | struct device *dev; |
105 | struct clk *clk; | ||
106 | void __iomem *mmio_base; | ||
107 | }; | ||
108 | |||
109 | #define to_pxa27x_ohci(hcd) (struct pxa27x_ohci *)hcd_to_ohci(hcd) | ||
107 | 110 | ||
108 | /* | 111 | /* |
109 | PMM_NPS_MODE -- PMM Non-power switching mode | 112 | PMM_NPS_MODE -- PMM Non-power switching mode |
@@ -115,30 +118,35 @@ static struct clk *usb_clk; | |||
115 | PMM_PERPORT_MODE -- PMM per port switching mode | 118 | PMM_PERPORT_MODE -- PMM per port switching mode |
116 | Ports are powered individually. | 119 | Ports are powered individually. |
117 | */ | 120 | */ |
118 | static int pxa27x_ohci_select_pmm( int mode ) | 121 | static int pxa27x_ohci_select_pmm(struct pxa27x_ohci *ohci, int mode) |
119 | { | 122 | { |
120 | 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) { | ||
121 | case PMM_NPS_MODE: | 127 | case PMM_NPS_MODE: |
122 | UHCRHDA |= RH_A_NPS; | 128 | uhcrhda |= RH_A_NPS; |
123 | break; | 129 | break; |
124 | case PMM_GLOBAL_MODE: | 130 | case PMM_GLOBAL_MODE: |
125 | UHCRHDA &= ~(RH_A_NPS & RH_A_PSM); | 131 | uhcrhda &= ~(RH_A_NPS & RH_A_PSM); |
126 | break; | 132 | break; |
127 | case PMM_PERPORT_MODE: | 133 | case PMM_PERPORT_MODE: |
128 | UHCRHDA &= ~(RH_A_NPS); | 134 | uhcrhda &= ~(RH_A_NPS); |
129 | UHCRHDA |= RH_A_PSM; | 135 | uhcrhda |= RH_A_PSM; |
130 | 136 | ||
131 | /* Set port power control mask bits, only 3 ports. */ | 137 | /* Set port power control mask bits, only 3 ports. */ |
132 | UHCRHDB |= (0x7<<17); | 138 | uhcrhdb |= (0x7<<17); |
133 | break; | 139 | break; |
134 | default: | 140 | default: |
135 | printk( KERN_ERR | 141 | printk( KERN_ERR |
136 | "Invalid mode %d, set to non-power switch mode.\n", | 142 | "Invalid mode %d, set to non-power switch mode.\n", |
137 | mode ); | 143 | mode ); |
138 | 144 | ||
139 | UHCRHDA |= RH_A_NPS; | 145 | uhcrhda |= RH_A_NPS; |
140 | } | 146 | } |
141 | 147 | ||
148 | __raw_writel(uhcrhda, ohci->mmio_base + UHCRHDA); | ||
149 | __raw_writel(uhcrhdb, ohci->mmio_base + UHCRHDB); | ||
142 | return 0; | 150 | return 0; |
143 | } | 151 | } |
144 | 152 | ||
@@ -146,10 +154,11 @@ extern int usb_disabled(void); | |||
146 | 154 | ||
147 | /*-------------------------------------------------------------------------*/ | 155 | /*-------------------------------------------------------------------------*/ |
148 | 156 | ||
149 | static inline void pxa27x_setup_hc(struct pxaohci_platform_data *inf) | 157 | static inline void pxa27x_setup_hc(struct pxa27x_ohci *ohci, |
158 | struct pxaohci_platform_data *inf) | ||
150 | { | 159 | { |
151 | uint32_t uhchr = UHCHR; | 160 | uint32_t uhchr = __raw_readl(ohci->mmio_base + UHCHR); |
152 | uint32_t uhcrhda = UHCRHDA; | 161 | uint32_t uhcrhda = __raw_readl(ohci->mmio_base + UHCRHDA); |
153 | 162 | ||
154 | if (inf->flags & ENABLE_PORT1) | 163 | if (inf->flags & ENABLE_PORT1) |
155 | uhchr &= ~UHCHR_SSEP1; | 164 | uhchr &= ~UHCHR_SSEP1; |
@@ -177,8 +186,17 @@ static inline void pxa27x_setup_hc(struct pxaohci_platform_data *inf) | |||
177 | uhcrhda |= UHCRHDA_POTPGT(inf->power_on_delay / 2); | 186 | uhcrhda |= UHCRHDA_POTPGT(inf->power_on_delay / 2); |
178 | } | 187 | } |
179 | 188 | ||
180 | UHCHR = uhchr; | 189 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); |
181 | UHCRHDA = uhcrhda; | 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); | ||
182 | } | 200 | } |
183 | 201 | ||
184 | #ifdef CONFIG_CPU_PXA27x | 202 | #ifdef CONFIG_CPU_PXA27x |
@@ -187,24 +205,25 @@ extern void pxa27x_clear_otgph(void); | |||
187 | #define pxa27x_clear_otgph() do {} while (0) | 205 | #define pxa27x_clear_otgph() do {} while (0) |
188 | #endif | 206 | #endif |
189 | 207 | ||
190 | static int pxa27x_start_hc(struct device *dev) | 208 | static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev) |
191 | { | 209 | { |
192 | int retval = 0; | 210 | int retval = 0; |
193 | struct pxaohci_platform_data *inf; | 211 | struct pxaohci_platform_data *inf; |
212 | uint32_t uhchr; | ||
194 | 213 | ||
195 | inf = dev->platform_data; | 214 | inf = dev->platform_data; |
196 | 215 | ||
197 | clk_enable(usb_clk); | 216 | clk_enable(ohci->clk); |
198 | 217 | ||
199 | UHCHR |= UHCHR_FHR; | 218 | pxa27x_reset_hc(ohci); |
200 | udelay(11); | ||
201 | UHCHR &= ~UHCHR_FHR; | ||
202 | 219 | ||
203 | UHCHR |= UHCHR_FSBIR; | 220 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) | UHCHR_FSBIR; |
204 | while (UHCHR & UHCHR_FSBIR) | 221 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); |
222 | |||
223 | while (__raw_readl(ohci->mmio_base + UHCHR) & UHCHR_FSBIR) | ||
205 | cpu_relax(); | 224 | cpu_relax(); |
206 | 225 | ||
207 | pxa27x_setup_hc(inf); | 226 | pxa27x_setup_hc(ohci, inf); |
208 | 227 | ||
209 | if (inf->init) | 228 | if (inf->init) |
210 | retval = inf->init(dev); | 229 | retval = inf->init(dev); |
@@ -212,32 +231,33 @@ static int pxa27x_start_hc(struct device *dev) | |||
212 | if (retval < 0) | 231 | if (retval < 0) |
213 | return retval; | 232 | return retval; |
214 | 233 | ||
215 | UHCHR &= ~UHCHR_SSE; | 234 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; |
216 | 235 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | |
217 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); | 236 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); |
218 | 237 | ||
219 | /* Clear any OTG Pin Hold */ | 238 | /* Clear any OTG Pin Hold */ |
220 | pxa27x_clear_otgph(); | 239 | pxa27x_clear_otgph(); |
221 | return 0; | 240 | return 0; |
222 | } | 241 | } |
223 | 242 | ||
224 | static void pxa27x_stop_hc(struct device *dev) | 243 | static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev) |
225 | { | 244 | { |
226 | struct pxaohci_platform_data *inf; | 245 | struct pxaohci_platform_data *inf; |
246 | uint32_t uhccoms; | ||
227 | 247 | ||
228 | inf = dev->platform_data; | 248 | inf = dev->platform_data; |
229 | 249 | ||
230 | if (inf->exit) | 250 | if (inf->exit) |
231 | inf->exit(dev); | 251 | inf->exit(dev); |
232 | 252 | ||
233 | UHCHR |= UHCHR_FHR; | 253 | pxa27x_reset_hc(ohci); |
234 | udelay(11); | ||
235 | UHCHR &= ~UHCHR_FHR; | ||
236 | 254 | ||
237 | UHCCOMS |= 1; | 255 | /* Host Controller Reset */ |
256 | uhccoms = __raw_readl(ohci->mmio_base + UHCCOMS) | 0x01; | ||
257 | __raw_writel(uhccoms, ohci->mmio_base + UHCCOMS); | ||
238 | udelay(10); | 258 | udelay(10); |
239 | 259 | ||
240 | clk_disable(usb_clk); | 260 | clk_disable(ohci->clk); |
241 | } | 261 | } |
242 | 262 | ||
243 | 263 | ||
@@ -261,7 +281,9 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
261 | int retval, irq; | 281 | int retval, irq; |
262 | struct usb_hcd *hcd; | 282 | struct usb_hcd *hcd; |
263 | struct pxaohci_platform_data *inf; | 283 | struct pxaohci_platform_data *inf; |
284 | struct pxa27x_ohci *ohci; | ||
264 | struct resource *r; | 285 | struct resource *r; |
286 | struct clk *usb_clk; | ||
265 | 287 | ||
266 | inf = pdev->dev.platform_data; | 288 | inf = pdev->dev.platform_data; |
267 | 289 | ||
@@ -305,13 +327,19 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
305 | goto err2; | 327 | goto err2; |
306 | } | 328 | } |
307 | 329 | ||
308 | 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) { | ||
309 | pr_debug("pxa27x_start_hc failed"); | 337 | pr_debug("pxa27x_start_hc failed"); |
310 | goto err3; | 338 | goto err3; |
311 | } | 339 | } |
312 | 340 | ||
313 | /* Select Power Management Mode */ | 341 | /* Select Power Management Mode */ |
314 | pxa27x_ohci_select_pmm(inf->port_mode); | 342 | pxa27x_ohci_select_pmm(ohci, inf->port_mode); |
315 | 343 | ||
316 | if (inf->power_budget) | 344 | if (inf->power_budget) |
317 | hcd->power_budget = inf->power_budget; | 345 | hcd->power_budget = inf->power_budget; |
@@ -322,7 +350,7 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
322 | if (retval == 0) | 350 | if (retval == 0) |
323 | return retval; | 351 | return retval; |
324 | 352 | ||
325 | pxa27x_stop_hc(&pdev->dev); | 353 | pxa27x_stop_hc(ohci, &pdev->dev); |
326 | err3: | 354 | err3: |
327 | iounmap(hcd->regs); | 355 | iounmap(hcd->regs); |
328 | err2: | 356 | err2: |
@@ -349,12 +377,14 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device | |||
349 | */ | 377 | */ |
350 | 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) |
351 | { | 379 | { |
380 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); | ||
381 | |||
352 | usb_remove_hcd(hcd); | 382 | usb_remove_hcd(hcd); |
353 | pxa27x_stop_hc(&pdev->dev); | 383 | pxa27x_stop_hc(ohci, &pdev->dev); |
354 | iounmap(hcd->regs); | 384 | iounmap(hcd->regs); |
355 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | 385 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); |
356 | usb_put_hcd(hcd); | 386 | usb_put_hcd(hcd); |
357 | clk_put(usb_clk); | 387 | clk_put(ohci->clk); |
358 | } | 388 | } |
359 | 389 | ||
360 | /*-------------------------------------------------------------------------*/ | 390 | /*-------------------------------------------------------------------------*/ |
@@ -387,7 +417,7 @@ ohci_pxa27x_start (struct usb_hcd *hcd) | |||
387 | static const struct hc_driver ohci_pxa27x_hc_driver = { | 417 | static const struct hc_driver ohci_pxa27x_hc_driver = { |
388 | .description = hcd_name, | 418 | .description = hcd_name, |
389 | .product_desc = "PXA27x OHCI", | 419 | .product_desc = "PXA27x OHCI", |
390 | .hcd_priv_size = sizeof(struct ohci_hcd), | 420 | .hcd_priv_size = sizeof(struct pxa27x_ohci), |
391 | 421 | ||
392 | /* | 422 | /* |
393 | * generic hardware linkage | 423 | * generic hardware linkage |
@@ -451,13 +481,13 @@ static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) | |||
451 | 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) |
452 | { | 482 | { |
453 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 483 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
454 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 484 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
455 | 485 | ||
456 | if (time_before(jiffies, ohci->next_statechange)) | 486 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
457 | msleep(5); | 487 | msleep(5); |
458 | ohci->next_statechange = jiffies; | 488 | ohci->ohci.next_statechange = jiffies; |
459 | 489 | ||
460 | pxa27x_stop_hc(&pdev->dev); | 490 | pxa27x_stop_hc(ohci, &pdev->dev); |
461 | hcd->state = HC_STATE_SUSPENDED; | 491 | hcd->state = HC_STATE_SUSPENDED; |
462 | 492 | ||
463 | return 0; | 493 | return 0; |
@@ -466,14 +496,14 @@ static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *pdev, pm_message_ | |||
466 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) | 496 | static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) |
467 | { | 497 | { |
468 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | 498 | struct usb_hcd *hcd = platform_get_drvdata(pdev); |
469 | struct ohci_hcd *ohci = hcd_to_ohci(hcd); | 499 | struct pxa27x_ohci *ohci = to_pxa27x_ohci(hcd); |
470 | int status; | 500 | int status; |
471 | 501 | ||
472 | if (time_before(jiffies, ohci->next_statechange)) | 502 | if (time_before(jiffies, ohci->ohci.next_statechange)) |
473 | msleep(5); | 503 | msleep(5); |
474 | ohci->next_statechange = jiffies; | 504 | ohci->ohci.next_statechange = jiffies; |
475 | 505 | ||
476 | if ((status = pxa27x_start_hc(&pdev->dev)) < 0) | 506 | if ((status = pxa27x_start_hc(ohci, &pdev->dev)) < 0) |
477 | return status; | 507 | return status; |
478 | 508 | ||
479 | ohci_finish_controller_resume(hcd); | 509 | ohci_finish_controller_resume(hcd); |