diff options
author | Bob Liu <lliubbo@gmail.com> | 2010-09-24 06:44:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:21:54 -0400 |
commit | ae9b2ad2eea729b907ef5dd5e25d1ff8443d03fc (patch) | |
tree | 5e23c0650a4213127362b02353c736df1566df56 /drivers/usb/musb/musb_core.c | |
parent | 496dda704bca1208e08773ba39b29a69536f5381 (diff) |
usb: musb: Change to direct addr in context save/restore
Since not all platforms are using the same offset 0x10 in
musb_save/restore_context() eg Blackfin the offset is 0x40,
Change the indexed address to direct.
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb/musb_core.c')
-rw-r--r-- | drivers/usb/musb/musb_core.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 540c766c4f86..d4f18bbc8f8f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2266,6 +2266,7 @@ void musb_save_context(struct musb *musb) | |||
2266 | { | 2266 | { |
2267 | int i; | 2267 | int i; |
2268 | void __iomem *musb_base = musb->mregs; | 2268 | void __iomem *musb_base = musb->mregs; |
2269 | void __iomem *epio; | ||
2269 | 2270 | ||
2270 | if (is_host_enabled(musb)) { | 2271 | if (is_host_enabled(musb)) { |
2271 | musb_context.frame = musb_readw(musb_base, MUSB_FRAME); | 2272 | musb_context.frame = musb_readw(musb_base, MUSB_FRAME); |
@@ -2279,16 +2280,16 @@ void musb_save_context(struct musb *musb) | |||
2279 | musb_context.index = musb_readb(musb_base, MUSB_INDEX); | 2280 | musb_context.index = musb_readb(musb_base, MUSB_INDEX); |
2280 | musb_context.devctl = musb_readb(musb_base, MUSB_DEVCTL); | 2281 | musb_context.devctl = musb_readb(musb_base, MUSB_DEVCTL); |
2281 | 2282 | ||
2282 | for (i = 0; i < MUSB_C_NUM_EPS; ++i) { | 2283 | for (i = 0; i < musb->config->num_eps; ++i) { |
2283 | musb_writeb(musb_base, MUSB_INDEX, i); | 2284 | epio = musb->endpoints[i].regs; |
2284 | musb_context.index_regs[i].txmaxp = | 2285 | musb_context.index_regs[i].txmaxp = |
2285 | musb_readw(musb_base, 0x10 + MUSB_TXMAXP); | 2286 | musb_readw(epio, MUSB_TXMAXP); |
2286 | musb_context.index_regs[i].txcsr = | 2287 | musb_context.index_regs[i].txcsr = |
2287 | musb_readw(musb_base, 0x10 + MUSB_TXCSR); | 2288 | musb_readw(epio, MUSB_TXCSR); |
2288 | musb_context.index_regs[i].rxmaxp = | 2289 | musb_context.index_regs[i].rxmaxp = |
2289 | musb_readw(musb_base, 0x10 + MUSB_RXMAXP); | 2290 | musb_readw(epio, MUSB_RXMAXP); |
2290 | musb_context.index_regs[i].rxcsr = | 2291 | musb_context.index_regs[i].rxcsr = |
2291 | musb_readw(musb_base, 0x10 + MUSB_RXCSR); | 2292 | musb_readw(epio, MUSB_RXCSR); |
2292 | 2293 | ||
2293 | if (musb->dyn_fifo) { | 2294 | if (musb->dyn_fifo) { |
2294 | musb_context.index_regs[i].txfifoadd = | 2295 | musb_context.index_regs[i].txfifoadd = |
@@ -2302,13 +2303,13 @@ void musb_save_context(struct musb *musb) | |||
2302 | } | 2303 | } |
2303 | if (is_host_enabled(musb)) { | 2304 | if (is_host_enabled(musb)) { |
2304 | musb_context.index_regs[i].txtype = | 2305 | musb_context.index_regs[i].txtype = |
2305 | musb_readb(musb_base, 0x10 + MUSB_TXTYPE); | 2306 | musb_readb(epio, MUSB_TXTYPE); |
2306 | musb_context.index_regs[i].txinterval = | 2307 | musb_context.index_regs[i].txinterval = |
2307 | musb_readb(musb_base, 0x10 + MUSB_TXINTERVAL); | 2308 | musb_readb(epio, MUSB_TXINTERVAL); |
2308 | musb_context.index_regs[i].rxtype = | 2309 | musb_context.index_regs[i].rxtype = |
2309 | musb_readb(musb_base, 0x10 + MUSB_RXTYPE); | 2310 | musb_readb(epio, MUSB_RXTYPE); |
2310 | musb_context.index_regs[i].rxinterval = | 2311 | musb_context.index_regs[i].rxinterval = |
2311 | musb_readb(musb_base, 0x10 + MUSB_RXINTERVAL); | 2312 | musb_readb(epio, MUSB_RXINTERVAL); |
2312 | 2313 | ||
2313 | musb_context.index_regs[i].txfunaddr = | 2314 | musb_context.index_regs[i].txfunaddr = |
2314 | musb_read_txfunaddr(musb_base, i); | 2315 | musb_read_txfunaddr(musb_base, i); |
@@ -2326,8 +2327,6 @@ void musb_save_context(struct musb *musb) | |||
2326 | } | 2327 | } |
2327 | } | 2328 | } |
2328 | 2329 | ||
2329 | musb_writeb(musb_base, MUSB_INDEX, musb_context.index); | ||
2330 | |||
2331 | musb_platform_save_context(musb, &musb_context); | 2330 | musb_platform_save_context(musb, &musb_context); |
2332 | } | 2331 | } |
2333 | 2332 | ||
@@ -2336,6 +2335,7 @@ void musb_restore_context(struct musb *musb) | |||
2336 | int i; | 2335 | int i; |
2337 | void __iomem *musb_base = musb->mregs; | 2336 | void __iomem *musb_base = musb->mregs; |
2338 | void __iomem *ep_target_regs; | 2337 | void __iomem *ep_target_regs; |
2338 | void __iomem *epio; | ||
2339 | 2339 | ||
2340 | musb_platform_restore_context(musb, &musb_context); | 2340 | musb_platform_restore_context(musb, &musb_context); |
2341 | 2341 | ||
@@ -2350,15 +2350,15 @@ void musb_restore_context(struct musb *musb) | |||
2350 | musb_writeb(musb_base, MUSB_INTRUSBE, musb_context.intrusbe); | 2350 | musb_writeb(musb_base, MUSB_INTRUSBE, musb_context.intrusbe); |
2351 | musb_writeb(musb_base, MUSB_DEVCTL, musb_context.devctl); | 2351 | musb_writeb(musb_base, MUSB_DEVCTL, musb_context.devctl); |
2352 | 2352 | ||
2353 | for (i = 0; i < MUSB_C_NUM_EPS; ++i) { | 2353 | for (i = 0; i < musb->config->num_eps; ++i) { |
2354 | musb_writeb(musb_base, MUSB_INDEX, i); | 2354 | epio = musb->endpoints[i].regs; |
2355 | musb_writew(musb_base, 0x10 + MUSB_TXMAXP, | 2355 | musb_writew(epio, MUSB_TXMAXP, |
2356 | musb_context.index_regs[i].txmaxp); | 2356 | musb_context.index_regs[i].txmaxp); |
2357 | musb_writew(musb_base, 0x10 + MUSB_TXCSR, | 2357 | musb_writew(epio, MUSB_TXCSR, |
2358 | musb_context.index_regs[i].txcsr); | 2358 | musb_context.index_regs[i].txcsr); |
2359 | musb_writew(musb_base, 0x10 + MUSB_RXMAXP, | 2359 | musb_writew(epio, MUSB_RXMAXP, |
2360 | musb_context.index_regs[i].rxmaxp); | 2360 | musb_context.index_regs[i].rxmaxp); |
2361 | musb_writew(musb_base, 0x10 + MUSB_RXCSR, | 2361 | musb_writew(epio, MUSB_RXCSR, |
2362 | musb_context.index_regs[i].rxcsr); | 2362 | musb_context.index_regs[i].rxcsr); |
2363 | 2363 | ||
2364 | if (musb->dyn_fifo) { | 2364 | if (musb->dyn_fifo) { |
@@ -2373,13 +2373,13 @@ void musb_restore_context(struct musb *musb) | |||
2373 | } | 2373 | } |
2374 | 2374 | ||
2375 | if (is_host_enabled(musb)) { | 2375 | if (is_host_enabled(musb)) { |
2376 | musb_writeb(musb_base, 0x10 + MUSB_TXTYPE, | 2376 | musb_writeb(epio, MUSB_TXTYPE, |
2377 | musb_context.index_regs[i].txtype); | 2377 | musb_context.index_regs[i].txtype); |
2378 | musb_writeb(musb_base, 0x10 + MUSB_TXINTERVAL, | 2378 | musb_writeb(epio, MUSB_TXINTERVAL, |
2379 | musb_context.index_regs[i].txinterval); | 2379 | musb_context.index_regs[i].txinterval); |
2380 | musb_writeb(musb_base, 0x10 + MUSB_RXTYPE, | 2380 | musb_writeb(epio, MUSB_RXTYPE, |
2381 | musb_context.index_regs[i].rxtype); | 2381 | musb_context.index_regs[i].rxtype); |
2382 | musb_writeb(musb_base, 0x10 + MUSB_RXINTERVAL, | 2382 | musb_writeb(epio, MUSB_RXINTERVAL, |
2383 | 2383 | ||
2384 | musb_context.index_regs[i].rxinterval); | 2384 | musb_context.index_regs[i].rxinterval); |
2385 | musb_write_txfunaddr(musb_base, i, | 2385 | musb_write_txfunaddr(musb_base, i, |
@@ -2400,8 +2400,6 @@ void musb_restore_context(struct musb *musb) | |||
2400 | musb_context.index_regs[i].rxhubport); | 2400 | musb_context.index_regs[i].rxhubport); |
2401 | } | 2401 | } |
2402 | } | 2402 | } |
2403 | |||
2404 | musb_writeb(musb_base, MUSB_INDEX, musb_context.index); | ||
2405 | } | 2403 | } |
2406 | 2404 | ||
2407 | static int musb_suspend(struct device *dev) | 2405 | static int musb_suspend(struct device *dev) |