diff options
author | Felipe Balbi <balbi@ti.com> | 2010-12-01 06:22:05 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2010-12-07 02:19:39 -0500 |
commit | 743411b3f3e96e8ac4cae73551a0a95392fed1ea (patch) | |
tree | 485f2f1f92768df7b1cc2d44cf3b8d4cc3cdaf3b /drivers/usb/musb/davinci.c | |
parent | 3ca8abb84522f4b773678726db6ebd6fc277bc96 (diff) |
usb: musb: make all glue layer export struct musb_platform_ops
preparing to a big refactor on musb code. We need
to be able to compile in all glue layers (or at
least all ARM-based ones) together and have a
working binary.
While preparing for that, we move every glue
layer to export only one symbol, which is
a struct musb_platform_ops, and make all
other functions static.
Later patches will come to allow for compiling
all glue layers together and have a working
binary.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/davinci.c')
-rw-r--r-- | drivers/usb/musb/davinci.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 051e2bf1897a..e283b5af8de0 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -83,7 +83,7 @@ static inline void phy_off(void) | |||
83 | 83 | ||
84 | static int dma_off = 1; | 84 | static int dma_off = 1; |
85 | 85 | ||
86 | void musb_platform_enable(struct musb *musb) | 86 | static void davinci_musb_enable(struct musb *musb) |
87 | { | 87 | { |
88 | u32 tmp, old, val; | 88 | u32 tmp, old, val; |
89 | 89 | ||
@@ -116,7 +116,7 @@ void musb_platform_enable(struct musb *musb) | |||
116 | /* | 116 | /* |
117 | * Disable the HDRC and flush interrupts | 117 | * Disable the HDRC and flush interrupts |
118 | */ | 118 | */ |
119 | void musb_platform_disable(struct musb *musb) | 119 | static void davinci_musb_disable(struct musb *musb) |
120 | { | 120 | { |
121 | /* because we don't set CTRLR.UINT, "important" to: | 121 | /* because we don't set CTRLR.UINT, "important" to: |
122 | * - not read/write INTRUSB/INTRUSBE | 122 | * - not read/write INTRUSB/INTRUSBE |
@@ -167,7 +167,7 @@ static void evm_deferred_drvvbus(struct work_struct *ignored) | |||
167 | 167 | ||
168 | #endif /* EVM */ | 168 | #endif /* EVM */ |
169 | 169 | ||
170 | static void davinci_source_power(struct musb *musb, int is_on, int immediate) | 170 | static void davinci_musb_source_power(struct musb *musb, int is_on, int immediate) |
171 | { | 171 | { |
172 | #ifdef CONFIG_MACH_DAVINCI_EVM | 172 | #ifdef CONFIG_MACH_DAVINCI_EVM |
173 | if (is_on) | 173 | if (is_on) |
@@ -190,10 +190,10 @@ static void davinci_source_power(struct musb *musb, int is_on, int immediate) | |||
190 | #endif | 190 | #endif |
191 | } | 191 | } |
192 | 192 | ||
193 | static void davinci_set_vbus(struct musb *musb, int is_on) | 193 | static void davinci_musb_set_vbus(struct musb *musb, int is_on) |
194 | { | 194 | { |
195 | WARN_ON(is_on && is_peripheral_active(musb)); | 195 | WARN_ON(is_on && is_peripheral_active(musb)); |
196 | davinci_source_power(musb, is_on, 0); | 196 | davinci_musb_source_power(musb, is_on, 0); |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
@@ -259,7 +259,7 @@ static void otg_timer(unsigned long _musb) | |||
259 | spin_unlock_irqrestore(&musb->lock, flags); | 259 | spin_unlock_irqrestore(&musb->lock, flags); |
260 | } | 260 | } |
261 | 261 | ||
262 | static irqreturn_t davinci_interrupt(int irq, void *__hci) | 262 | static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) |
263 | { | 263 | { |
264 | unsigned long flags; | 264 | unsigned long flags; |
265 | irqreturn_t retval = IRQ_NONE; | 265 | irqreturn_t retval = IRQ_NONE; |
@@ -345,7 +345,7 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
345 | /* NOTE: this must complete poweron within 100 msec | 345 | /* NOTE: this must complete poweron within 100 msec |
346 | * (OTG_TIME_A_WAIT_VRISE) but we don't check for that. | 346 | * (OTG_TIME_A_WAIT_VRISE) but we don't check for that. |
347 | */ | 347 | */ |
348 | davinci_source_power(musb, drvvbus, 0); | 348 | davinci_musb_source_power(musb, drvvbus, 0); |
349 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", | 349 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", |
350 | drvvbus ? "on" : "off", | 350 | drvvbus ? "on" : "off", |
351 | otg_state_string(musb), | 351 | otg_state_string(musb), |
@@ -370,13 +370,13 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
370 | return retval; | 370 | return retval; |
371 | } | 371 | } |
372 | 372 | ||
373 | int musb_platform_set_mode(struct musb *musb, u8 mode) | 373 | static int davinci_musb_set_mode(struct musb *musb, u8 mode) |
374 | { | 374 | { |
375 | /* EVM can't do this (right?) */ | 375 | /* EVM can't do this (right?) */ |
376 | return -EIO; | 376 | return -EIO; |
377 | } | 377 | } |
378 | 378 | ||
379 | int __init musb_platform_init(struct musb *musb) | 379 | static int davinci_musb_init(struct musb *musb) |
380 | { | 380 | { |
381 | void __iomem *tibase = musb->ctrl_base; | 381 | void __iomem *tibase = musb->ctrl_base; |
382 | u32 revision; | 382 | u32 revision; |
@@ -398,8 +398,8 @@ int __init musb_platform_init(struct musb *musb) | |||
398 | if (is_host_enabled(musb)) | 398 | if (is_host_enabled(musb)) |
399 | setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); | 399 | setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); |
400 | 400 | ||
401 | musb->board_set_vbus = davinci_set_vbus; | 401 | musb->board_set_vbus = davinci_musb_set_vbus; |
402 | davinci_source_power(musb, 0, 1); | 402 | davinci_musb_source_power(musb, 0, 1); |
403 | 403 | ||
404 | /* dm355 EVM swaps D+/D- for signal integrity, and | 404 | /* dm355 EVM swaps D+/D- for signal integrity, and |
405 | * is clocked from the main 24 MHz crystal. | 405 | * is clocked from the main 24 MHz crystal. |
@@ -440,7 +440,7 @@ int __init musb_platform_init(struct musb *musb) | |||
440 | revision, __raw_readl(USB_PHY_CTRL), | 440 | revision, __raw_readl(USB_PHY_CTRL), |
441 | musb_readb(tibase, DAVINCI_USB_CTRL_REG)); | 441 | musb_readb(tibase, DAVINCI_USB_CTRL_REG)); |
442 | 442 | ||
443 | musb->isr = davinci_interrupt; | 443 | musb->isr = davinci_musb_interrupt; |
444 | return 0; | 444 | return 0; |
445 | 445 | ||
446 | fail: | 446 | fail: |
@@ -451,7 +451,7 @@ fail: | |||
451 | return -ENODEV; | 451 | return -ENODEV; |
452 | } | 452 | } |
453 | 453 | ||
454 | int musb_platform_exit(struct musb *musb) | 454 | static int davinci_musb_exit(struct musb *musb) |
455 | { | 455 | { |
456 | if (is_host_enabled(musb)) | 456 | if (is_host_enabled(musb)) |
457 | del_timer_sync(&otg_workaround); | 457 | del_timer_sync(&otg_workaround); |
@@ -465,7 +465,7 @@ int musb_platform_exit(struct musb *musb) | |||
465 | __raw_writel(deepsleep, DM355_DEEPSLEEP); | 465 | __raw_writel(deepsleep, DM355_DEEPSLEEP); |
466 | } | 466 | } |
467 | 467 | ||
468 | davinci_source_power(musb, 0 /*off*/, 1); | 468 | davinci_musb_source_power(musb, 0 /*off*/, 1); |
469 | 469 | ||
470 | /* delay, to avoid problems with module reload */ | 470 | /* delay, to avoid problems with module reload */ |
471 | if (is_host_enabled(musb) && musb->xceiv->default_a) { | 471 | if (is_host_enabled(musb) && musb->xceiv->default_a) { |
@@ -502,3 +502,15 @@ int musb_platform_exit(struct musb *musb) | |||
502 | 502 | ||
503 | return 0; | 503 | return 0; |
504 | } | 504 | } |
505 | |||
506 | const struct musb_platform_ops musb_ops = { | ||
507 | .init = davinci_musb_init, | ||
508 | .exit = davinci_musb_exit, | ||
509 | |||
510 | .enable = davinci_musb_enable, | ||
511 | .disable = davinci_musb_disable, | ||
512 | |||
513 | .set_mode = davinci_musb_set_mode, | ||
514 | |||
515 | .set_vbus = davinci_musb_set_vbus, | ||
516 | }; | ||