aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_core.c4
-rw-r--r--drivers/usb/musb/musb_core.h12
-rw-r--r--drivers/usb/musb/omap2430.c48
-rw-r--r--drivers/usb/musb/omap2430.h32
4 files changed, 47 insertions, 49 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2c53da771318..a6dc18cde27b 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2234,7 +2234,7 @@ void musb_save_context(struct musb *musb)
2234 2234
2235 musb_writeb(musb_base, MUSB_INDEX, musb_context.index); 2235 musb_writeb(musb_base, MUSB_INDEX, musb_context.index);
2236 2236
2237 musb_platform_save_context(&musb_context); 2237 musb_platform_save_context(musb, &musb_context);
2238} 2238}
2239 2239
2240void musb_restore_context(struct musb *musb) 2240void musb_restore_context(struct musb *musb)
@@ -2243,7 +2243,7 @@ void musb_restore_context(struct musb *musb)
2243 void __iomem *musb_base = musb->mregs; 2243 void __iomem *musb_base = musb->mregs;
2244 void __iomem *ep_target_regs; 2244 void __iomem *ep_target_regs;
2245 2245
2246 musb_platform_restore_context(&musb_context); 2246 musb_platform_restore_context(musb, &musb_context);
2247 2247
2248 if (is_host_enabled(musb)) { 2248 if (is_host_enabled(musb)) {
2249 musb_writew(musb_base, MUSB_FRAME, musb_context.frame); 2249 musb_writew(musb_base, MUSB_FRAME, musb_context.frame);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 3d66c3e01dbd..74a55b95ecbb 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -482,13 +482,13 @@ struct musb_context_registers {
482}; 482};
483 483
484#if defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP2430) 484#if defined(CONFIG_ARCH_OMAP34XX) || defined(CONFIG_ARCH_OMAP2430)
485extern void musb_platform_save_context(struct musb_context_registers 485extern void musb_platform_save_context(struct musb *musb,
486 *musb_context); 486 struct musb_context_registers *musb_context);
487extern void musb_platform_restore_context(struct musb_context_registers 487extern void musb_platform_restore_context(struct musb *musb,
488 *musb_context); 488 struct musb_context_registers *musb_context);
489#else 489#else
490#define musb_platform_save_context(x) do {} while (0) 490#define musb_platform_save_context(m, x) do {} while (0)
491#define musb_platform_restore_context(x) do {} while (0) 491#define musb_platform_restore_context(m, x) do {} while (0)
492#endif 492#endif
493 493
494#endif 494#endif
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 15a3f27b5747..3fe16867b5a8 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -220,7 +220,7 @@ int __init musb_platform_init(struct musb *musb)
220 220
221 musb_platform_resume(musb); 221 musb_platform_resume(musb);
222 222
223 l = omap_readl(OTG_SYSCONFIG); 223 l = musb_readl(musb->mregs, OTG_SYSCONFIG);
224 l &= ~ENABLEWAKEUP; /* disable wakeup */ 224 l &= ~ENABLEWAKEUP; /* disable wakeup */
225 l &= ~NOSTDBY; /* remove possible nostdby */ 225 l &= ~NOSTDBY; /* remove possible nostdby */
226 l |= SMARTSTDBY; /* enable smart standby */ 226 l |= SMARTSTDBY; /* enable smart standby */
@@ -233,17 +233,19 @@ int __init musb_platform_init(struct musb *musb)
233 */ 233 */
234 if (!cpu_is_omap3430()) 234 if (!cpu_is_omap3430())
235 l |= AUTOIDLE; /* enable auto idle */ 235 l |= AUTOIDLE; /* enable auto idle */
236 omap_writel(l, OTG_SYSCONFIG); 236 musb_writel(musb->mregs, OTG_SYSCONFIG, l);
237 237
238 l = omap_readl(OTG_INTERFSEL); 238 l = musb_readl(musb->mregs, OTG_INTERFSEL);
239 l |= ULPI_12PIN; 239 l |= ULPI_12PIN;
240 omap_writel(l, OTG_INTERFSEL); 240 musb_writel(musb->mregs, OTG_INTERFSEL, l);
241 241
242 pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, " 242 pr_debug("HS USB OTG: revision 0x%x, sysconfig 0x%02x, "
243 "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n", 243 "sysstatus 0x%x, intrfsel 0x%x, simenable 0x%x\n",
244 omap_readl(OTG_REVISION), omap_readl(OTG_SYSCONFIG), 244 musb_readl(musb->mregs, OTG_REVISION),
245 omap_readl(OTG_SYSSTATUS), omap_readl(OTG_INTERFSEL), 245 musb_readl(musb->mregs, OTG_SYSCONFIG),
246 omap_readl(OTG_SIMENABLE)); 246 musb_readl(musb->mregs, OTG_SYSSTATUS),
247 musb_readl(musb->mregs, OTG_INTERFSEL),
248 musb_readl(musb->mregs, OTG_SIMENABLE));
247 249
248 omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1); 250 omap_vbus_power(musb, musb->board_mode == MUSB_HOST, 1);
249 251
@@ -256,18 +258,18 @@ int __init musb_platform_init(struct musb *musb)
256} 258}
257 259
258#ifdef CONFIG_PM 260#ifdef CONFIG_PM
259void musb_platform_save_context(struct musb_context_registers 261void musb_platform_save_context(struct musb *musb,
260 *musb_context) 262 struct musb_context_registers *musb_context)
261{ 263{
262 musb_context->otg_sysconfig = omap_readl(OTG_SYSCONFIG); 264 musb_context->otg_sysconfig = musb_readl(musb->mregs, OTG_SYSCONFIG);
263 musb_context->otg_forcestandby = omap_readl(OTG_FORCESTDBY); 265 musb_context->otg_forcestandby = musb_readl(musb->mregs, OTG_FORCESTDBY);
264} 266}
265 267
266void musb_platform_restore_context(struct musb_context_registers 268void musb_platform_restore_context(struct musb *musb,
267 *musb_context) 269 struct musb_context_registers *musb_context)
268{ 270{
269 omap_writel(musb_context->otg_sysconfig, OTG_SYSCONFIG); 271 musb_writel(musb->mregs, OTG_SYSCONFIG, musb_context->otg_sysconfig);
270 omap_writel(musb_context->otg_forcestandby, OTG_FORCESTDBY); 272 musb_writel(musb->mregs, OTG_FORCESTDBY, musb_context->otg_forcestandby);
271} 273}
272#endif 274#endif
273 275
@@ -279,13 +281,13 @@ int musb_platform_suspend(struct musb *musb)
279 return 0; 281 return 0;
280 282
281 /* in any role */ 283 /* in any role */
282 l = omap_readl(OTG_FORCESTDBY); 284 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
283 l |= ENABLEFORCE; /* enable MSTANDBY */ 285 l |= ENABLEFORCE; /* enable MSTANDBY */
284 omap_writel(l, OTG_FORCESTDBY); 286 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
285 287
286 l = omap_readl(OTG_SYSCONFIG); 288 l = musb_readl(musb->mregs, OTG_SYSCONFIG);
287 l |= ENABLEWAKEUP; /* enable wakeup */ 289 l |= ENABLEWAKEUP; /* enable wakeup */
288 omap_writel(l, OTG_SYSCONFIG); 290 musb_writel(musb->mregs, OTG_SYSCONFIG, l);
289 291
290 otg_set_suspend(musb->xceiv, 1); 292 otg_set_suspend(musb->xceiv, 1);
291 293
@@ -311,13 +313,13 @@ static int musb_platform_resume(struct musb *musb)
311 else 313 else
312 clk_enable(musb->clock); 314 clk_enable(musb->clock);
313 315
314 l = omap_readl(OTG_SYSCONFIG); 316 l = musb_readl(musb->mregs, OTG_SYSCONFIG);
315 l &= ~ENABLEWAKEUP; /* disable wakeup */ 317 l &= ~ENABLEWAKEUP; /* disable wakeup */
316 omap_writel(l, OTG_SYSCONFIG); 318 musb_writel(musb->mregs, OTG_SYSCONFIG, l);
317 319
318 l = omap_readl(OTG_FORCESTDBY); 320 l = musb_readl(musb->mregs, OTG_FORCESTDBY);
319 l &= ~ENABLEFORCE; /* disable MSTANDBY */ 321 l &= ~ENABLEFORCE; /* disable MSTANDBY */
320 omap_writel(l, OTG_FORCESTDBY); 322 musb_writel(musb->mregs, OTG_FORCESTDBY, l);
321 323
322 return 0; 324 return 0;
323} 325}
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index fbede7798aed..40b3c02ae9f0 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -10,47 +10,43 @@
10#ifndef __MUSB_OMAP243X_H__ 10#ifndef __MUSB_OMAP243X_H__
11#define __MUSB_OMAP243X_H__ 11#define __MUSB_OMAP243X_H__
12 12
13#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
14#include <mach/hardware.h>
15#include <plat/usb.h> 13#include <plat/usb.h>
16 14
17/* 15/*
18 * OMAP2430-specific definitions 16 * OMAP2430-specific definitions
19 */ 17 */
20 18
21#define MENTOR_BASE_OFFSET 0 19#define OTG_REVISION 0x400
22#if defined(CONFIG_ARCH_OMAP2430) 20
23#define OMAP_HSOTG_BASE (OMAP243X_HS_BASE) 21#define OTG_SYSCONFIG 0x404
24#elif defined(CONFIG_ARCH_OMAP3430)
25#define OMAP_HSOTG_BASE (OMAP34XX_HSUSB_OTG_BASE)
26#endif
27#define OMAP_HSOTG(offset) (OMAP_HSOTG_BASE + 0x400 + (offset))
28#define OTG_REVISION OMAP_HSOTG(0x0)
29#define OTG_SYSCONFIG OMAP_HSOTG(0x4)
30# define MIDLEMODE 12 /* bit position */ 22# define MIDLEMODE 12 /* bit position */
31# define FORCESTDBY (0 << MIDLEMODE) 23# define FORCESTDBY (0 << MIDLEMODE)
32# define NOSTDBY (1 << MIDLEMODE) 24# define NOSTDBY (1 << MIDLEMODE)
33# define SMARTSTDBY (2 << MIDLEMODE) 25# define SMARTSTDBY (2 << MIDLEMODE)
26
34# define SIDLEMODE 3 /* bit position */ 27# define SIDLEMODE 3 /* bit position */
35# define FORCEIDLE (0 << SIDLEMODE) 28# define FORCEIDLE (0 << SIDLEMODE)
36# define NOIDLE (1 << SIDLEMODE) 29# define NOIDLE (1 << SIDLEMODE)
37# define SMARTIDLE (2 << SIDLEMODE) 30# define SMARTIDLE (2 << SIDLEMODE)
31
38# define ENABLEWAKEUP (1 << 2) 32# define ENABLEWAKEUP (1 << 2)
39# define SOFTRST (1 << 1) 33# define SOFTRST (1 << 1)
40# define AUTOIDLE (1 << 0) 34# define AUTOIDLE (1 << 0)
41#define OTG_SYSSTATUS OMAP_HSOTG(0x8) 35
36#define OTG_SYSSTATUS 0x408
42# define RESETDONE (1 << 0) 37# define RESETDONE (1 << 0)
43#define OTG_INTERFSEL OMAP_HSOTG(0xc) 38
39#define OTG_INTERFSEL 0x40c
44# define EXTCP (1 << 2) 40# define EXTCP (1 << 2)
45# define PHYSEL 0 /* bit position */ 41# define PHYSEL 0 /* bit position */
46# define UTMI_8BIT (0 << PHYSEL) 42# define UTMI_8BIT (0 << PHYSEL)
47# define ULPI_12PIN (1 << PHYSEL) 43# define ULPI_12PIN (1 << PHYSEL)
48# define ULPI_8PIN (2 << PHYSEL) 44# define ULPI_8PIN (2 << PHYSEL)
49#define OTG_SIMENABLE OMAP_HSOTG(0x10) 45
46#define OTG_SIMENABLE 0x410
50# define TM1 (1 << 0) 47# define TM1 (1 << 0)
51#define OTG_FORCESTDBY OMAP_HSOTG(0x14)
52# define ENABLEFORCE (1 << 0)
53 48
54#endif /* CONFIG_ARCH_OMAP2430 */ 49#define OTG_FORCESTDBY 0x414
50# define ENABLEFORCE (1 << 0)
55 51
56#endif /* __MUSB_OMAP243X_H__ */ 52#endif /* __MUSB_OMAP243X_H__ */