diff options
author | Felipe Balbi <balbi@ti.com> | 2011-06-22 10:28:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-01 17:31:10 -0400 |
commit | 622859634a663c5e55d0e2a2cdbb55ac058d97b3 (patch) | |
tree | 5f41809476f487de7d461ccaac4d80179d0d2561 | |
parent | e4e5b136eb6f2d3aa10dca108a1b787dc92d67df (diff) |
usb: musb: drop a gigantic amount of ifdeferry
the MUSB IP is always OTG, so there's no point
in adding so many ifdefs on the code. Drop those
and always compile the driver for OTG support.
This also allows us to drop the useless "driver
mode" choice. For doing that, we need to make
musb depend on both Host and Peripheral side.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/musb/Kconfig | 75 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 4 | ||||
-rw-r--r-- | drivers/usb/musb/am35x.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.h | 2 | ||||
-rw-r--r-- | drivers/usb/musb/da8xx.c | 12 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 5 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 86 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.h | 68 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget_ep0.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.h | 4 | ||||
-rw-r--r-- | drivers/usb/musb/musb_virthub.c | 6 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 15 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 26 |
14 files changed, 10 insertions, 305 deletions
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 13093481f918..6192b45959f4 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -8,7 +8,7 @@ comment "Enable Host or Gadget support to see Inventra options" | |||
8 | 8 | ||
9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller | 9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller |
10 | config USB_MUSB_HDRC | 10 | config USB_MUSB_HDRC |
11 | depends on (USB || USB_GADGET) | 11 | depends on USB && USB_GADGET |
12 | depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523)) | 12 | depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523)) |
13 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) | 13 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) |
14 | select TWL4030_USB if MACH_OMAP_3430SDP | 14 | select TWL4030_USB if MACH_OMAP_3430SDP |
@@ -67,79 +67,6 @@ config USB_MUSB_UX500 | |||
67 | 67 | ||
68 | endchoice | 68 | endchoice |
69 | 69 | ||
70 | choice | ||
71 | prompt "Driver Mode" | ||
72 | depends on USB_MUSB_HDRC | ||
73 | help | ||
74 | Dual-Role devices can support both host and peripheral roles, | ||
75 | as well as a the special "OTG Device" role which can switch | ||
76 | between both roles as needed. | ||
77 | |||
78 | # use USB_MUSB_HDRC_HCD not USB_MUSB_HOST to #ifdef host side support; | ||
79 | # OTG needs both roles, not just USB_MUSB_HOST. | ||
80 | config USB_MUSB_HOST | ||
81 | depends on USB | ||
82 | bool "USB Host" | ||
83 | help | ||
84 | Say Y here if your system supports the USB host role. | ||
85 | If it has a USB "A" (rectangular), "Mini-A" (uncommon), | ||
86 | or "Mini-AB" connector, it supports the host role. | ||
87 | (With a "Mini-AB" connector, you should enable USB OTG.) | ||
88 | |||
89 | # use USB_GADGET_MUSB_HDRC not USB_MUSB_PERIPHERAL to #ifdef peripheral | ||
90 | # side support ... OTG needs both roles | ||
91 | config USB_MUSB_PERIPHERAL | ||
92 | depends on USB_GADGET | ||
93 | bool "USB Peripheral (gadget stack)" | ||
94 | select USB_GADGET_MUSB_HDRC | ||
95 | help | ||
96 | Say Y here if your system supports the USB peripheral role. | ||
97 | If it has a USB "B" (squarish), "Mini-B", or "Mini-AB" | ||
98 | connector, it supports the peripheral role. | ||
99 | (With a "Mini-AB" connector, you should enable USB OTG.) | ||
100 | |||
101 | config USB_MUSB_OTG | ||
102 | depends on USB && USB_GADGET && PM && EXPERIMENTAL | ||
103 | bool "Both host and peripheral: USB OTG (On The Go) Device" | ||
104 | select USB_GADGET_MUSB_HDRC | ||
105 | select USB_OTG | ||
106 | help | ||
107 | The most notable feature of USB OTG is support for a | ||
108 | "Dual-Role" device, which can act as either a device | ||
109 | or a host. The initial role choice can be changed | ||
110 | later, when two dual-role devices talk to each other. | ||
111 | |||
112 | At this writing, the OTG support in this driver is incomplete, | ||
113 | omitting the mandatory HNP or SRP protocols. However, some | ||
114 | of the cable based role switching works. (That is, grounding | ||
115 | the ID pin switches the controller to host mode, while leaving | ||
116 | it floating leaves it in peripheral mode.) | ||
117 | |||
118 | Select this if your system has a Mini-AB connector, or | ||
119 | to simplify certain kinds of configuration. | ||
120 | |||
121 | To implement your OTG Targeted Peripherals List (TPL), enable | ||
122 | USB_OTG_WHITELIST and update "drivers/usb/core/otg_whitelist.h" | ||
123 | to match your requirements. | ||
124 | |||
125 | endchoice | ||
126 | |||
127 | # enable peripheral support (including with OTG) | ||
128 | config USB_GADGET_MUSB_HDRC | ||
129 | bool | ||
130 | depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG) | ||
131 | # default y | ||
132 | # select USB_GADGET_DUALSPEED | ||
133 | # select USB_GADGET_SELECTED | ||
134 | |||
135 | # enables host support (including with OTG) | ||
136 | config USB_MUSB_HDRC_HCD | ||
137 | bool | ||
138 | depends on USB_MUSB_HDRC && (USB_MUSB_HOST || USB_MUSB_OTG) | ||
139 | select USB_OTG if USB_GADGET_MUSB_HDRC | ||
140 | default y | ||
141 | |||
142 | |||
143 | config MUSB_PIO_ONLY | 70 | config MUSB_PIO_ONLY |
144 | bool 'Disable DMA (always use PIO)' | 71 | bool 'Disable DMA (always use PIO)' |
145 | depends on USB_MUSB_HDRC | 72 | depends on USB_MUSB_HDRC |
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index c4d228b6ef8a..d8fd9d092dec 100644 --- a/drivers/usb/musb/Makefile +++ b/drivers/usb/musb/Makefile | |||
@@ -6,8 +6,8 @@ obj-$(CONFIG_USB_MUSB_HDRC) += musb_hdrc.o | |||
6 | 6 | ||
7 | musb_hdrc-y := musb_core.o | 7 | musb_hdrc-y := musb_core.o |
8 | 8 | ||
9 | musb_hdrc-$(CONFIG_USB_GADGET_MUSB_HDRC) += musb_gadget_ep0.o musb_gadget.o | 9 | musb_hdrc-y += musb_gadget_ep0.o musb_gadget.o |
10 | musb_hdrc-$(CONFIG_USB_MUSB_HDRC_HCD) += musb_virthub.o musb_host.o | 10 | musb_hdrc-y += musb_virthub.o musb_host.o |
11 | musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o | 11 | musb_hdrc-$(CONFIG_DEBUG_FS) += musb_debugfs.o |
12 | 12 | ||
13 | # Hardware Glue Layer | 13 | # Hardware Glue Layer |
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 23ac28f98d91..08f1d0b662a3 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -124,11 +124,7 @@ static void am35x_musb_disable(struct musb *musb) | |||
124 | musb_writel(reg_base, USB_END_OF_INTR_REG, 0); | 124 | musb_writel(reg_base, USB_END_OF_INTR_REG, 0); |
125 | } | 125 | } |
126 | 126 | ||
127 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
128 | #define portstate(stmt) stmt | 127 | #define portstate(stmt) stmt |
129 | #else | ||
130 | #define portstate(stmt) | ||
131 | #endif | ||
132 | 128 | ||
133 | static void am35x_musb_set_vbus(struct musb *musb, int is_on) | 129 | static void am35x_musb_set_vbus(struct musb *musb, int is_on) |
134 | { | 130 | { |
diff --git a/drivers/usb/musb/blackfin.h b/drivers/usb/musb/blackfin.h index bd9352a2ef2a..c84dae546dc6 100644 --- a/drivers/usb/musb/blackfin.h +++ b/drivers/usb/musb/blackfin.h | |||
@@ -47,7 +47,7 @@ | |||
47 | * So, need to either use silicon v0.2+ or disable DMA mode in MUSB. | 47 | * So, need to either use silicon v0.2+ or disable DMA mode in MUSB. |
48 | */ | 48 | */ |
49 | #if ANOMALY_05000380 && defined(CONFIG_BF52x) && \ | 49 | #if ANOMALY_05000380 && defined(CONFIG_BF52x) && \ |
50 | defined(CONFIG_USB_MUSB_HDRC) && !defined(CONFIG_MUSB_PIO_ONLY) | 50 | !defined(CONFIG_MUSB_PIO_ONLY) |
51 | # error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1" | 51 | # error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1" |
52 | #endif | 52 | #endif |
53 | 53 | ||
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 662ed34980bd..4da7492ddbdb 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -172,11 +172,7 @@ static void da8xx_musb_disable(struct musb *musb) | |||
172 | musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); | 172 | musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); |
173 | } | 173 | } |
174 | 174 | ||
175 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | 175 | #define portstate(stmt) stmt |
176 | #define portstate(stmt) stmt | ||
177 | #else | ||
178 | #define portstate(stmt) | ||
179 | #endif | ||
180 | 176 | ||
181 | static void da8xx_musb_set_vbus(struct musb *musb, int is_on) | 177 | static void da8xx_musb_set_vbus(struct musb *musb, int is_on) |
182 | { | 178 | { |
@@ -397,21 +393,15 @@ static int da8xx_musb_set_mode(struct musb *musb, u8 musb_mode) | |||
397 | 393 | ||
398 | cfgchip2 &= ~CFGCHIP2_OTGMODE; | 394 | cfgchip2 &= ~CFGCHIP2_OTGMODE; |
399 | switch (musb_mode) { | 395 | switch (musb_mode) { |
400 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
401 | case MUSB_HOST: /* Force VBUS valid, ID = 0 */ | 396 | case MUSB_HOST: /* Force VBUS valid, ID = 0 */ |
402 | cfgchip2 |= CFGCHIP2_FORCE_HOST; | 397 | cfgchip2 |= CFGCHIP2_FORCE_HOST; |
403 | break; | 398 | break; |
404 | #endif | ||
405 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
406 | case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */ | 399 | case MUSB_PERIPHERAL: /* Force VBUS valid, ID = 1 */ |
407 | cfgchip2 |= CFGCHIP2_FORCE_DEVICE; | 400 | cfgchip2 |= CFGCHIP2_FORCE_DEVICE; |
408 | break; | 401 | break; |
409 | #endif | ||
410 | #ifdef CONFIG_USB_MUSB_OTG | ||
411 | case MUSB_OTG: /* Don't override the VBUS/ID comparators */ | 402 | case MUSB_OTG: /* Don't override the VBUS/ID comparators */ |
412 | cfgchip2 |= CFGCHIP2_NO_OVERRIDE; | 403 | cfgchip2 |= CFGCHIP2_NO_OVERRIDE; |
413 | break; | 404 | break; |
414 | #endif | ||
415 | default: | 405 | default: |
416 | dev_dbg(musb->controller, "Trying to set unsupported mode %u\n", musb_mode); | 406 | dev_dbg(musb->controller, "Trying to set unsupported mode %u\n", musb_mode); |
417 | } | 407 | } |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 2a2adf6492cd..8bdf25a8b023 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -143,12 +143,7 @@ static void davinci_musb_disable(struct musb *musb) | |||
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
147 | #define portstate(stmt) stmt | 146 | #define portstate(stmt) stmt |
148 | #else | ||
149 | #define portstate(stmt) | ||
150 | #endif | ||
151 | |||
152 | 147 | ||
153 | /* | 148 | /* |
154 | * VBUS SWITCHING IS BOARD-SPECIFIC ... at least for the DM6446 EVM, | 149 | * VBUS SWITCHING IS BOARD-SPECIFIC ... at least for the DM6446 EVM, |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index b1faed7806f5..7ab949795589 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -328,8 +328,6 @@ void musb_load_testpacket(struct musb *musb) | |||
328 | 328 | ||
329 | /*-------------------------------------------------------------------------*/ | 329 | /*-------------------------------------------------------------------------*/ |
330 | 330 | ||
331 | #ifdef CONFIG_USB_MUSB_OTG | ||
332 | |||
333 | /* | 331 | /* |
334 | * Handles OTG hnp timeouts, such as b_ase0_brst | 332 | * Handles OTG hnp timeouts, such as b_ase0_brst |
335 | */ | 333 | */ |
@@ -401,8 +399,6 @@ void musb_hnp_stop(struct musb *musb) | |||
401 | musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16); | 399 | musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16); |
402 | } | 400 | } |
403 | 401 | ||
404 | #endif | ||
405 | |||
406 | /* | 402 | /* |
407 | * Interrupt Service Routine to record USB "global" interrupts. | 403 | * Interrupt Service Routine to record USB "global" interrupts. |
408 | * Since these do not happen often and signify things of | 404 | * Since these do not happen often and signify things of |
@@ -432,7 +428,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
432 | dev_dbg(musb->controller, "RESUME (%s)\n", otg_state_string(musb->xceiv->state)); | 428 | dev_dbg(musb->controller, "RESUME (%s)\n", otg_state_string(musb->xceiv->state)); |
433 | 429 | ||
434 | if (devctl & MUSB_DEVCTL_HM) { | 430 | if (devctl & MUSB_DEVCTL_HM) { |
435 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
436 | void __iomem *mbase = musb->mregs; | 431 | void __iomem *mbase = musb->mregs; |
437 | 432 | ||
438 | switch (musb->xceiv->state) { | 433 | switch (musb->xceiv->state) { |
@@ -472,17 +467,13 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
472 | "host", | 467 | "host", |
473 | otg_state_string(musb->xceiv->state)); | 468 | otg_state_string(musb->xceiv->state)); |
474 | } | 469 | } |
475 | #endif | ||
476 | } else { | 470 | } else { |
477 | switch (musb->xceiv->state) { | 471 | switch (musb->xceiv->state) { |
478 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
479 | case OTG_STATE_A_SUSPEND: | 472 | case OTG_STATE_A_SUSPEND: |
480 | /* possibly DISCONNECT is upcoming */ | 473 | /* possibly DISCONNECT is upcoming */ |
481 | musb->xceiv->state = OTG_STATE_A_HOST; | 474 | musb->xceiv->state = OTG_STATE_A_HOST; |
482 | usb_hcd_resume_root_hub(musb_to_hcd(musb)); | 475 | usb_hcd_resume_root_hub(musb_to_hcd(musb)); |
483 | break; | 476 | break; |
484 | #endif | ||
485 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
486 | case OTG_STATE_B_WAIT_ACON: | 477 | case OTG_STATE_B_WAIT_ACON: |
487 | case OTG_STATE_B_PERIPHERAL: | 478 | case OTG_STATE_B_PERIPHERAL: |
488 | /* disconnect while suspended? we may | 479 | /* disconnect while suspended? we may |
@@ -500,7 +491,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
500 | case OTG_STATE_B_IDLE: | 491 | case OTG_STATE_B_IDLE: |
501 | musb->int_usb &= ~MUSB_INTR_SUSPEND; | 492 | musb->int_usb &= ~MUSB_INTR_SUSPEND; |
502 | break; | 493 | break; |
503 | #endif | ||
504 | default: | 494 | default: |
505 | WARNING("bogus %s RESUME (%s)\n", | 495 | WARNING("bogus %s RESUME (%s)\n", |
506 | "peripheral", | 496 | "peripheral", |
@@ -509,7 +499,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
509 | } | 499 | } |
510 | } | 500 | } |
511 | 501 | ||
512 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
513 | /* see manual for the order of the tests */ | 502 | /* see manual for the order of the tests */ |
514 | if (int_usb & MUSB_INTR_SESSREQ) { | 503 | if (int_usb & MUSB_INTR_SESSREQ) { |
515 | void __iomem *mbase = musb->mregs; | 504 | void __iomem *mbase = musb->mregs; |
@@ -609,14 +598,12 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
609 | handled = IRQ_HANDLED; | 598 | handled = IRQ_HANDLED; |
610 | } | 599 | } |
611 | 600 | ||
612 | #endif | ||
613 | if (int_usb & MUSB_INTR_SUSPEND) { | 601 | if (int_usb & MUSB_INTR_SUSPEND) { |
614 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x power %02x\n", | 602 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x power %02x\n", |
615 | otg_state_string(musb->xceiv->state), devctl, power); | 603 | otg_state_string(musb->xceiv->state), devctl, power); |
616 | handled = IRQ_HANDLED; | 604 | handled = IRQ_HANDLED; |
617 | 605 | ||
618 | switch (musb->xceiv->state) { | 606 | switch (musb->xceiv->state) { |
619 | #ifdef CONFIG_USB_MUSB_OTG | ||
620 | case OTG_STATE_A_PERIPHERAL: | 607 | case OTG_STATE_A_PERIPHERAL: |
621 | /* We also come here if the cable is removed, since | 608 | /* We also come here if the cable is removed, since |
622 | * this silicon doesn't report ID-no-longer-grounded. | 609 | * this silicon doesn't report ID-no-longer-grounded. |
@@ -633,7 +620,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
633 | ? : OTG_TIME_A_WAIT_BCON)); | 620 | ? : OTG_TIME_A_WAIT_BCON)); |
634 | 621 | ||
635 | break; | 622 | break; |
636 | #endif | ||
637 | case OTG_STATE_B_IDLE: | 623 | case OTG_STATE_B_IDLE: |
638 | if (!musb->is_active) | 624 | if (!musb->is_active) |
639 | break; | 625 | break; |
@@ -642,13 +628,11 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
642 | musb->is_active = is_otg_enabled(musb) | 628 | musb->is_active = is_otg_enabled(musb) |
643 | && musb->xceiv->gadget->b_hnp_enable; | 629 | && musb->xceiv->gadget->b_hnp_enable; |
644 | if (musb->is_active) { | 630 | if (musb->is_active) { |
645 | #ifdef CONFIG_USB_MUSB_OTG | ||
646 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 631 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; |
647 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); | 632 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); |
648 | mod_timer(&musb->otg_timer, jiffies | 633 | mod_timer(&musb->otg_timer, jiffies |
649 | + msecs_to_jiffies( | 634 | + msecs_to_jiffies( |
650 | OTG_TIME_B_ASE0_BRST)); | 635 | OTG_TIME_B_ASE0_BRST)); |
651 | #endif | ||
652 | } | 636 | } |
653 | break; | 637 | break; |
654 | case OTG_STATE_A_WAIT_BCON: | 638 | case OTG_STATE_A_WAIT_BCON: |
@@ -672,7 +656,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
672 | } | 656 | } |
673 | } | 657 | } |
674 | 658 | ||
675 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
676 | if (int_usb & MUSB_INTR_CONNECT) { | 659 | if (int_usb & MUSB_INTR_CONNECT) { |
677 | struct usb_hcd *hcd = musb_to_hcd(musb); | 660 | struct usb_hcd *hcd = musb_to_hcd(musb); |
678 | 661 | ||
@@ -682,7 +665,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
682 | 665 | ||
683 | musb->ep0_stage = MUSB_EP0_START; | 666 | musb->ep0_stage = MUSB_EP0_START; |
684 | 667 | ||
685 | #ifdef CONFIG_USB_MUSB_OTG | ||
686 | /* flush endpoints when transitioning from Device Mode */ | 668 | /* flush endpoints when transitioning from Device Mode */ |
687 | if (is_peripheral_active(musb)) { | 669 | if (is_peripheral_active(musb)) { |
688 | /* REVISIT HNP; just force disconnect */ | 670 | /* REVISIT HNP; just force disconnect */ |
@@ -690,7 +672,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
690 | musb_writew(musb->mregs, MUSB_INTRTXE, musb->epmask); | 672 | musb_writew(musb->mregs, MUSB_INTRTXE, musb->epmask); |
691 | musb_writew(musb->mregs, MUSB_INTRRXE, musb->epmask & 0xfffe); | 673 | musb_writew(musb->mregs, MUSB_INTRRXE, musb->epmask & 0xfffe); |
692 | musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7); | 674 | musb_writeb(musb->mregs, MUSB_INTRUSBE, 0xf7); |
693 | #endif | ||
694 | musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED | 675 | musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED |
695 | |USB_PORT_STAT_HIGH_SPEED | 676 | |USB_PORT_STAT_HIGH_SPEED |
696 | |USB_PORT_STAT_ENABLE | 677 | |USB_PORT_STAT_ENABLE |
@@ -739,7 +720,6 @@ b_host: | |||
739 | dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n", | 720 | dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n", |
740 | otg_state_string(musb->xceiv->state), devctl); | 721 | otg_state_string(musb->xceiv->state), devctl); |
741 | } | 722 | } |
742 | #endif /* CONFIG_USB_MUSB_HDRC_HCD */ | ||
743 | 723 | ||
744 | if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) { | 724 | if ((int_usb & MUSB_INTR_DISCONNECT) && !musb->ignore_disconnect) { |
745 | dev_dbg(musb->controller, "DISCONNECT (%s) as %s, devctl %02x\n", | 725 | dev_dbg(musb->controller, "DISCONNECT (%s) as %s, devctl %02x\n", |
@@ -748,7 +728,6 @@ b_host: | |||
748 | handled = IRQ_HANDLED; | 728 | handled = IRQ_HANDLED; |
749 | 729 | ||
750 | switch (musb->xceiv->state) { | 730 | switch (musb->xceiv->state) { |
751 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
752 | case OTG_STATE_A_HOST: | 731 | case OTG_STATE_A_HOST: |
753 | case OTG_STATE_A_SUSPEND: | 732 | case OTG_STATE_A_SUSPEND: |
754 | usb_hcd_resume_root_hub(musb_to_hcd(musb)); | 733 | usb_hcd_resume_root_hub(musb_to_hcd(musb)); |
@@ -757,8 +736,6 @@ b_host: | |||
757 | musb_platform_try_idle(musb, jiffies | 736 | musb_platform_try_idle(musb, jiffies |
758 | + msecs_to_jiffies(musb->a_wait_bcon)); | 737 | + msecs_to_jiffies(musb->a_wait_bcon)); |
759 | break; | 738 | break; |
760 | #endif /* HOST */ | ||
761 | #ifdef CONFIG_USB_MUSB_OTG | ||
762 | case OTG_STATE_B_HOST: | 739 | case OTG_STATE_B_HOST: |
763 | /* REVISIT this behaves for "real disconnect" | 740 | /* REVISIT this behaves for "real disconnect" |
764 | * cases; make sure the other transitions from | 741 | * cases; make sure the other transitions from |
@@ -777,13 +754,10 @@ b_host: | |||
777 | /* FALLTHROUGH */ | 754 | /* FALLTHROUGH */ |
778 | case OTG_STATE_B_WAIT_ACON: | 755 | case OTG_STATE_B_WAIT_ACON: |
779 | /* FALLTHROUGH */ | 756 | /* FALLTHROUGH */ |
780 | #endif /* OTG */ | ||
781 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
782 | case OTG_STATE_B_PERIPHERAL: | 757 | case OTG_STATE_B_PERIPHERAL: |
783 | case OTG_STATE_B_IDLE: | 758 | case OTG_STATE_B_IDLE: |
784 | musb_g_disconnect(musb); | 759 | musb_g_disconnect(musb); |
785 | break; | 760 | break; |
786 | #endif /* GADGET */ | ||
787 | default: | 761 | default: |
788 | WARNING("unhandled DISCONNECT transition (%s)\n", | 762 | WARNING("unhandled DISCONNECT transition (%s)\n", |
789 | otg_state_string(musb->xceiv->state)); | 763 | otg_state_string(musb->xceiv->state)); |
@@ -814,7 +788,6 @@ b_host: | |||
814 | dev_dbg(musb->controller, "BUS RESET as %s\n", | 788 | dev_dbg(musb->controller, "BUS RESET as %s\n", |
815 | otg_state_string(musb->xceiv->state)); | 789 | otg_state_string(musb->xceiv->state)); |
816 | switch (musb->xceiv->state) { | 790 | switch (musb->xceiv->state) { |
817 | #ifdef CONFIG_USB_OTG | ||
818 | case OTG_STATE_A_SUSPEND: | 791 | case OTG_STATE_A_SUSPEND: |
819 | /* We need to ignore disconnect on suspend | 792 | /* We need to ignore disconnect on suspend |
820 | * otherwise tusb 2.0 won't reconnect after a | 793 | * otherwise tusb 2.0 won't reconnect after a |
@@ -842,7 +815,6 @@ b_host: | |||
842 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 815 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; |
843 | musb_g_reset(musb); | 816 | musb_g_reset(musb); |
844 | break; | 817 | break; |
845 | #endif | ||
846 | case OTG_STATE_B_IDLE: | 818 | case OTG_STATE_B_IDLE: |
847 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 819 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; |
848 | /* FALLTHROUGH */ | 820 | /* FALLTHROUGH */ |
@@ -1191,14 +1163,12 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, | |||
1191 | /* configure the FIFO */ | 1163 | /* configure the FIFO */ |
1192 | musb_writeb(mbase, MUSB_INDEX, hw_ep->epnum); | 1164 | musb_writeb(mbase, MUSB_INDEX, hw_ep->epnum); |
1193 | 1165 | ||
1194 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1195 | /* EP0 reserved endpoint for control, bidirectional; | 1166 | /* EP0 reserved endpoint for control, bidirectional; |
1196 | * EP1 reserved for bulk, two unidirection halves. | 1167 | * EP1 reserved for bulk, two unidirection halves. |
1197 | */ | 1168 | */ |
1198 | if (hw_ep->epnum == 1) | 1169 | if (hw_ep->epnum == 1) |
1199 | musb->bulk_ep = hw_ep; | 1170 | musb->bulk_ep = hw_ep; |
1200 | /* REVISIT error check: be sure ep0 can both rx and tx ... */ | 1171 | /* REVISIT error check: be sure ep0 can both rx and tx ... */ |
1201 | #endif | ||
1202 | switch (cfg->style) { | 1172 | switch (cfg->style) { |
1203 | case FIFO_TX: | 1173 | case FIFO_TX: |
1204 | musb_write_txfifosz(mbase, c_size); | 1174 | musb_write_txfifosz(mbase, c_size); |
@@ -1317,12 +1287,10 @@ done: | |||
1317 | n + 1, musb->config->num_eps * 2 - 1, | 1287 | n + 1, musb->config->num_eps * 2 - 1, |
1318 | offset, (1 << (musb->config->ram_bits + 2))); | 1288 | offset, (1 << (musb->config->ram_bits + 2))); |
1319 | 1289 | ||
1320 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1321 | if (!musb->bulk_ep) { | 1290 | if (!musb->bulk_ep) { |
1322 | pr_debug("%s: missing bulk\n", musb_driver_name); | 1291 | pr_debug("%s: missing bulk\n", musb_driver_name); |
1323 | return -EINVAL; | 1292 | return -EINVAL; |
1324 | } | 1293 | } |
1325 | #endif | ||
1326 | 1294 | ||
1327 | return 0; | 1295 | return 0; |
1328 | } | 1296 | } |
@@ -1353,7 +1321,6 @@ static int __init ep_config_from_hw(struct musb *musb) | |||
1353 | 1321 | ||
1354 | /* FIXME set up hw_ep->{rx,tx}_double_buffered */ | 1322 | /* FIXME set up hw_ep->{rx,tx}_double_buffered */ |
1355 | 1323 | ||
1356 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1357 | /* pick an RX/TX endpoint for bulk */ | 1324 | /* pick an RX/TX endpoint for bulk */ |
1358 | if (hw_ep->max_packet_sz_tx < 512 | 1325 | if (hw_ep->max_packet_sz_tx < 512 |
1359 | || hw_ep->max_packet_sz_rx < 512) | 1326 | || hw_ep->max_packet_sz_rx < 512) |
@@ -1365,15 +1332,12 @@ static int __init ep_config_from_hw(struct musb *musb) | |||
1365 | if (musb->bulk_ep) | 1332 | if (musb->bulk_ep) |
1366 | continue; | 1333 | continue; |
1367 | musb->bulk_ep = hw_ep; | 1334 | musb->bulk_ep = hw_ep; |
1368 | #endif | ||
1369 | } | 1335 | } |
1370 | 1336 | ||
1371 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1372 | if (!musb->bulk_ep) { | 1337 | if (!musb->bulk_ep) { |
1373 | pr_debug("%s: missing bulk\n", musb_driver_name); | 1338 | pr_debug("%s: missing bulk\n", musb_driver_name); |
1374 | return -EINVAL; | 1339 | return -EINVAL; |
1375 | } | 1340 | } |
1376 | #endif | ||
1377 | 1341 | ||
1378 | return 0; | 1342 | return 0; |
1379 | } | 1343 | } |
@@ -1429,13 +1393,11 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1429 | } else { | 1393 | } else { |
1430 | musb->is_multipoint = 0; | 1394 | musb->is_multipoint = 0; |
1431 | type = ""; | 1395 | type = ""; |
1432 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1433 | #ifndef CONFIG_USB_OTG_BLACKLIST_HUB | 1396 | #ifndef CONFIG_USB_OTG_BLACKLIST_HUB |
1434 | printk(KERN_ERR | 1397 | printk(KERN_ERR |
1435 | "%s: kernel must blacklist external hubs\n", | 1398 | "%s: kernel must blacklist external hubs\n", |
1436 | musb_driver_name); | 1399 | musb_driver_name); |
1437 | #endif | 1400 | #endif |
1438 | #endif | ||
1439 | } | 1401 | } |
1440 | 1402 | ||
1441 | /* log release info */ | 1403 | /* log release info */ |
@@ -1479,11 +1441,9 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1479 | #endif | 1441 | #endif |
1480 | 1442 | ||
1481 | hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase; | 1443 | hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase; |
1482 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1483 | hw_ep->target_regs = musb_read_target_reg_base(i, mbase); | 1444 | hw_ep->target_regs = musb_read_target_reg_base(i, mbase); |
1484 | hw_ep->rx_reinit = 1; | 1445 | hw_ep->rx_reinit = 1; |
1485 | hw_ep->tx_reinit = 1; | 1446 | hw_ep->tx_reinit = 1; |
1486 | #endif | ||
1487 | 1447 | ||
1488 | if (hw_ep->max_packet_sz_tx) { | 1448 | if (hw_ep->max_packet_sz_tx) { |
1489 | dev_dbg(musb->controller, | 1449 | dev_dbg(musb->controller, |
@@ -1561,13 +1521,11 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1561 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", | 1521 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", |
1562 | musb->int_usb, musb->int_tx, musb->int_rx); | 1522 | musb->int_usb, musb->int_tx, musb->int_rx); |
1563 | 1523 | ||
1564 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1565 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) | 1524 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) |
1566 | if (!musb->gadget_driver) { | 1525 | if (!musb->gadget_driver) { |
1567 | dev_dbg(musb->controller, "No gadget driver loaded\n"); | 1526 | dev_dbg(musb->controller, "No gadget driver loaded\n"); |
1568 | return IRQ_HANDLED; | 1527 | return IRQ_HANDLED; |
1569 | } | 1528 | } |
1570 | #endif | ||
1571 | 1529 | ||
1572 | /* the core can interrupt us for multiple reasons; docs have | 1530 | /* the core can interrupt us for multiple reasons; docs have |
1573 | * a generic interrupt flowchart to follow | 1531 | * a generic interrupt flowchart to follow |
@@ -1767,8 +1725,6 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1767 | } | 1725 | } |
1768 | static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); | 1726 | static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); |
1769 | 1727 | ||
1770 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1771 | |||
1772 | /* Gadget drivers can't know that a host is connected so they might want | 1728 | /* Gadget drivers can't know that a host is connected so they might want |
1773 | * to start SRP, but users can. This allows userspace to trigger SRP. | 1729 | * to start SRP, but users can. This allows userspace to trigger SRP. |
1774 | */ | 1730 | */ |
@@ -1792,14 +1748,10 @@ musb_srp_store(struct device *dev, struct device_attribute *attr, | |||
1792 | } | 1748 | } |
1793 | static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); | 1749 | static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); |
1794 | 1750 | ||
1795 | #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ | ||
1796 | |||
1797 | static struct attribute *musb_attributes[] = { | 1751 | static struct attribute *musb_attributes[] = { |
1798 | &dev_attr_mode.attr, | 1752 | &dev_attr_mode.attr, |
1799 | &dev_attr_vbus.attr, | 1753 | &dev_attr_vbus.attr, |
1800 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1801 | &dev_attr_srp.attr, | 1754 | &dev_attr_srp.attr, |
1802 | #endif | ||
1803 | NULL | 1755 | NULL |
1804 | }; | 1756 | }; |
1805 | 1757 | ||
@@ -1832,7 +1784,6 @@ allocate_instance(struct device *dev, | |||
1832 | struct musb *musb; | 1784 | struct musb *musb; |
1833 | struct musb_hw_ep *ep; | 1785 | struct musb_hw_ep *ep; |
1834 | int epnum; | 1786 | int epnum; |
1835 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1836 | struct usb_hcd *hcd; | 1787 | struct usb_hcd *hcd; |
1837 | 1788 | ||
1838 | hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev)); | 1789 | hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev)); |
@@ -1850,12 +1801,6 @@ allocate_instance(struct device *dev, | |||
1850 | 1801 | ||
1851 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1802 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1852 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1803 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; |
1853 | #else | ||
1854 | musb = kzalloc(sizeof *musb, GFP_KERNEL); | ||
1855 | if (!musb) | ||
1856 | return NULL; | ||
1857 | |||
1858 | #endif | ||
1859 | dev_set_drvdata(dev, musb); | 1804 | dev_set_drvdata(dev, musb); |
1860 | musb->mregs = mbase; | 1805 | musb->mregs = mbase; |
1861 | musb->ctrl_base = mbase; | 1806 | musb->ctrl_base = mbase; |
@@ -1885,9 +1830,7 @@ static void musb_free(struct musb *musb) | |||
1885 | sysfs_remove_group(&musb->controller->kobj, &musb_attr_group); | 1830 | sysfs_remove_group(&musb->controller->kobj, &musb_attr_group); |
1886 | #endif | 1831 | #endif |
1887 | 1832 | ||
1888 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1889 | musb_gadget_cleanup(musb); | 1833 | musb_gadget_cleanup(musb); |
1890 | #endif | ||
1891 | 1834 | ||
1892 | if (musb->nIrq >= 0) { | 1835 | if (musb->nIrq >= 0) { |
1893 | if (musb->irq_wake) | 1836 | if (musb->irq_wake) |
@@ -1901,11 +1844,7 @@ static void musb_free(struct musb *musb) | |||
1901 | dma_controller_destroy(c); | 1844 | dma_controller_destroy(c); |
1902 | } | 1845 | } |
1903 | 1846 | ||
1904 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1905 | usb_put_hcd(musb_to_hcd(musb)); | ||
1906 | #else | ||
1907 | kfree(musb); | 1847 | kfree(musb); |
1908 | #endif | ||
1909 | } | 1848 | } |
1910 | 1849 | ||
1911 | /* | 1850 | /* |
@@ -2000,9 +1939,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2000 | if (status < 0) | 1939 | if (status < 0) |
2001 | goto fail3; | 1940 | goto fail3; |
2002 | 1941 | ||
2003 | #ifdef CONFIG_USB_MUSB_OTG | ||
2004 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); | 1942 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); |
2005 | #endif | ||
2006 | 1943 | ||
2007 | /* Init IRQ workqueue before request_irq */ | 1944 | /* Init IRQ workqueue before request_irq */ |
2008 | INIT_WORK(&musb->irq_work, musb_irq_work); | 1945 | INIT_WORK(&musb->irq_work, musb_irq_work); |
@@ -2444,34 +2381,13 @@ static struct platform_driver musb_driver = { | |||
2444 | 2381 | ||
2445 | static int __init musb_init(void) | 2382 | static int __init musb_init(void) |
2446 | { | 2383 | { |
2447 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
2448 | if (usb_disabled()) | 2384 | if (usb_disabled()) |
2449 | return 0; | 2385 | return 0; |
2450 | #endif | ||
2451 | 2386 | ||
2452 | pr_info("%s: version " MUSB_VERSION ", " | 2387 | pr_info("%s: version " MUSB_VERSION ", " |
2453 | #ifdef CONFIG_MUSB_PIO_ONLY | ||
2454 | "pio" | ||
2455 | #elif defined(CONFIG_USB_TI_CPPI_DMA) | ||
2456 | "cppi-dma" | ||
2457 | #elif defined(CONFIG_USB_INVENTRA_DMA) | ||
2458 | "musb-dma" | ||
2459 | #elif defined(CONFIG_USB_TUSB_OMAP_DMA) | ||
2460 | "tusb-omap-dma" | ||
2461 | #elif defined(CONFIG_USB_UX500_DMA) | ||
2462 | "ux500-dma" | ||
2463 | #else | ||
2464 | "?dma?" | 2388 | "?dma?" |
2465 | #endif | ||
2466 | ", " | 2389 | ", " |
2467 | #ifdef CONFIG_USB_MUSB_OTG | 2390 | "otg (peripheral+host)", |
2468 | "otg (peripheral+host)" | ||
2469 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) | ||
2470 | "peripheral" | ||
2471 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) | ||
2472 | "host" | ||
2473 | #endif | ||
2474 | , | ||
2475 | musb_driver_name); | 2391 | musb_driver_name); |
2476 | return platform_driver_probe(&musb_driver, musb_probe); | 2392 | return platform_driver_probe(&musb_driver, musb_probe); |
2477 | } | 2393 | } |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 12542a48a64e..668eeef601ae 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -72,10 +72,6 @@ struct musb_ep; | |||
72 | #include <linux/usb/hcd.h> | 72 | #include <linux/usb/hcd.h> |
73 | #include "musb_host.h" | 73 | #include "musb_host.h" |
74 | 74 | ||
75 | |||
76 | |||
77 | #ifdef CONFIG_USB_MUSB_OTG | ||
78 | |||
79 | #define is_peripheral_enabled(musb) ((musb)->board_mode != MUSB_HOST) | 75 | #define is_peripheral_enabled(musb) ((musb)->board_mode != MUSB_HOST) |
80 | #define is_host_enabled(musb) ((musb)->board_mode != MUSB_PERIPHERAL) | 76 | #define is_host_enabled(musb) ((musb)->board_mode != MUSB_PERIPHERAL) |
81 | #define is_otg_enabled(musb) ((musb)->board_mode == MUSB_OTG) | 77 | #define is_otg_enabled(musb) ((musb)->board_mode == MUSB_OTG) |
@@ -86,24 +82,6 @@ struct musb_ep; | |||
86 | #define is_peripheral_active(m) (!(m)->is_host) | 82 | #define is_peripheral_active(m) (!(m)->is_host) |
87 | #define is_host_active(m) ((m)->is_host) | 83 | #define is_host_active(m) ((m)->is_host) |
88 | 84 | ||
89 | #else | ||
90 | #define is_peripheral_enabled(musb) is_peripheral_capable() | ||
91 | #define is_host_enabled(musb) is_host_capable() | ||
92 | #define is_otg_enabled(musb) 0 | ||
93 | |||
94 | #define is_peripheral_active(musb) is_peripheral_capable() | ||
95 | #define is_host_active(musb) is_host_capable() | ||
96 | #endif | ||
97 | |||
98 | #if defined(CONFIG_USB_MUSB_OTG) || defined(CONFIG_USB_MUSB_PERIPHERAL) | ||
99 | /* for some reason, the "select USB_GADGET_MUSB_HDRC" doesn't always | ||
100 | * override that choice selection (often USB_GADGET_DUMMY_HCD). | ||
101 | */ | ||
102 | #ifndef CONFIG_USB_GADGET_MUSB_HDRC | ||
103 | #error bogus Kconfig output ... select CONFIG_USB_GADGET_MUSB_HDRC | ||
104 | #endif | ||
105 | #endif /* need MUSB gadget selection */ | ||
106 | |||
107 | #ifndef CONFIG_HAVE_CLK | 85 | #ifndef CONFIG_HAVE_CLK |
108 | /* Dummy stub for clk framework */ | 86 | /* Dummy stub for clk framework */ |
109 | #define clk_get(dev, id) NULL | 87 | #define clk_get(dev, id) NULL |
@@ -119,8 +97,6 @@ struct musb_ep; | |||
119 | 97 | ||
120 | /****************************** PERIPHERAL ROLE *****************************/ | 98 | /****************************** PERIPHERAL ROLE *****************************/ |
121 | 99 | ||
122 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
123 | |||
124 | #define is_peripheral_capable() (1) | 100 | #define is_peripheral_capable() (1) |
125 | 101 | ||
126 | extern irqreturn_t musb_g_ep0_irq(struct musb *); | 102 | extern irqreturn_t musb_g_ep0_irq(struct musb *); |
@@ -132,40 +108,14 @@ extern void musb_g_resume(struct musb *); | |||
132 | extern void musb_g_wakeup(struct musb *); | 108 | extern void musb_g_wakeup(struct musb *); |
133 | extern void musb_g_disconnect(struct musb *); | 109 | extern void musb_g_disconnect(struct musb *); |
134 | 110 | ||
135 | #else | ||
136 | |||
137 | #define is_peripheral_capable() (0) | ||
138 | |||
139 | static inline irqreturn_t musb_g_ep0_irq(struct musb *m) { return IRQ_NONE; } | ||
140 | static inline void musb_g_reset(struct musb *m) {} | ||
141 | static inline void musb_g_suspend(struct musb *m) {} | ||
142 | static inline void musb_g_resume(struct musb *m) {} | ||
143 | static inline void musb_g_wakeup(struct musb *m) {} | ||
144 | static inline void musb_g_disconnect(struct musb *m) {} | ||
145 | |||
146 | #endif | ||
147 | |||
148 | /****************************** HOST ROLE ***********************************/ | 111 | /****************************** HOST ROLE ***********************************/ |
149 | 112 | ||
150 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
151 | |||
152 | #define is_host_capable() (1) | 113 | #define is_host_capable() (1) |
153 | 114 | ||
154 | extern irqreturn_t musb_h_ep0_irq(struct musb *); | 115 | extern irqreturn_t musb_h_ep0_irq(struct musb *); |
155 | extern void musb_host_tx(struct musb *, u8); | 116 | extern void musb_host_tx(struct musb *, u8); |
156 | extern void musb_host_rx(struct musb *, u8); | 117 | extern void musb_host_rx(struct musb *, u8); |
157 | 118 | ||
158 | #else | ||
159 | |||
160 | #define is_host_capable() (0) | ||
161 | |||
162 | static inline irqreturn_t musb_h_ep0_irq(struct musb *m) { return IRQ_NONE; } | ||
163 | static inline void musb_host_tx(struct musb *m, u8 e) {} | ||
164 | static inline void musb_host_rx(struct musb *m, u8 e) {} | ||
165 | |||
166 | #endif | ||
167 | |||
168 | |||
169 | /****************************** CONSTANTS ********************************/ | 119 | /****************************** CONSTANTS ********************************/ |
170 | 120 | ||
171 | #ifndef MUSB_C_NUM_EPS | 121 | #ifndef MUSB_C_NUM_EPS |
@@ -315,7 +265,6 @@ struct musb_hw_ep { | |||
315 | void __iomem *fifo_sync_va; | 265 | void __iomem *fifo_sync_va; |
316 | #endif | 266 | #endif |
317 | 267 | ||
318 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
319 | void __iomem *target_regs; | 268 | void __iomem *target_regs; |
320 | 269 | ||
321 | /* currently scheduled peripheral endpoint */ | 270 | /* currently scheduled peripheral endpoint */ |
@@ -324,31 +273,20 @@ struct musb_hw_ep { | |||
324 | 273 | ||
325 | u8 rx_reinit; | 274 | u8 rx_reinit; |
326 | u8 tx_reinit; | 275 | u8 tx_reinit; |
327 | #endif | ||
328 | 276 | ||
329 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
330 | /* peripheral side */ | 277 | /* peripheral side */ |
331 | struct musb_ep ep_in; /* TX */ | 278 | struct musb_ep ep_in; /* TX */ |
332 | struct musb_ep ep_out; /* RX */ | 279 | struct musb_ep ep_out; /* RX */ |
333 | #endif | ||
334 | }; | 280 | }; |
335 | 281 | ||
336 | static inline struct musb_request *next_in_request(struct musb_hw_ep *hw_ep) | 282 | static inline struct musb_request *next_in_request(struct musb_hw_ep *hw_ep) |
337 | { | 283 | { |
338 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
339 | return next_request(&hw_ep->ep_in); | 284 | return next_request(&hw_ep->ep_in); |
340 | #else | ||
341 | return NULL; | ||
342 | #endif | ||
343 | } | 285 | } |
344 | 286 | ||
345 | static inline struct musb_request *next_out_request(struct musb_hw_ep *hw_ep) | 287 | static inline struct musb_request *next_out_request(struct musb_hw_ep *hw_ep) |
346 | { | 288 | { |
347 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
348 | return next_request(&hw_ep->ep_out); | 289 | return next_request(&hw_ep->ep_out); |
349 | #else | ||
350 | return NULL; | ||
351 | #endif | ||
352 | } | 290 | } |
353 | 291 | ||
354 | struct musb_csr_regs { | 292 | struct musb_csr_regs { |
@@ -393,7 +331,6 @@ struct musb { | |||
393 | 331 | ||
394 | u32 port1_status; | 332 | u32 port1_status; |
395 | 333 | ||
396 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
397 | unsigned long rh_timer; | 334 | unsigned long rh_timer; |
398 | 335 | ||
399 | enum musb_h_ep0_state ep0_stage; | 336 | enum musb_h_ep0_state ep0_stage; |
@@ -411,7 +348,6 @@ struct musb { | |||
411 | struct list_head out_bulk; /* of musb_qh */ | 348 | struct list_head out_bulk; /* of musb_qh */ |
412 | 349 | ||
413 | struct timer_list otg_timer; | 350 | struct timer_list otg_timer; |
414 | #endif | ||
415 | struct notifier_block nb; | 351 | struct notifier_block nb; |
416 | 352 | ||
417 | struct dma_controller *dma_controller; | 353 | struct dma_controller *dma_controller; |
@@ -472,7 +408,6 @@ struct musb { | |||
472 | #define can_bulk_combine(musb,type) \ | 408 | #define can_bulk_combine(musb,type) \ |
473 | (((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine) | 409 | (((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine) |
474 | 410 | ||
475 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
476 | /* is_suspended means USB B_PERIPHERAL suspend */ | 411 | /* is_suspended means USB B_PERIPHERAL suspend */ |
477 | unsigned is_suspended:1; | 412 | unsigned is_suspended:1; |
478 | 413 | ||
@@ -496,7 +431,6 @@ struct musb { | |||
496 | enum musb_g_ep0_state ep0_state; | 431 | enum musb_g_ep0_state ep0_state; |
497 | struct usb_gadget g; /* the gadget */ | 432 | struct usb_gadget g; /* the gadget */ |
498 | struct usb_gadget_driver *gadget_driver; /* its driver */ | 433 | struct usb_gadget_driver *gadget_driver; /* its driver */ |
499 | #endif | ||
500 | 434 | ||
501 | /* | 435 | /* |
502 | * FIXME: Remove this flag. | 436 | * FIXME: Remove this flag. |
@@ -518,12 +452,10 @@ struct musb { | |||
518 | #endif | 452 | #endif |
519 | }; | 453 | }; |
520 | 454 | ||
521 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
522 | static inline struct musb *gadget_to_musb(struct usb_gadget *g) | 455 | static inline struct musb *gadget_to_musb(struct usb_gadget *g) |
523 | { | 456 | { |
524 | return container_of(g, struct musb, g); | 457 | return container_of(g, struct musb, g); |
525 | } | 458 | } |
526 | #endif | ||
527 | 459 | ||
528 | #ifdef CONFIG_BLACKFIN | 460 | #ifdef CONFIG_BLACKFIN |
529 | static inline int musb_read_fifosize(struct musb *musb, | 461 | static inline int musb_read_fifosize(struct musb *musb, |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 728572cf709c..37e70d390de8 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -2048,9 +2048,7 @@ static int musb_gadget_stop(struct usb_gadget_driver *driver) | |||
2048 | 2048 | ||
2049 | spin_lock_irqsave(&musb->lock, flags); | 2049 | spin_lock_irqsave(&musb->lock, flags); |
2050 | 2050 | ||
2051 | #ifdef CONFIG_USB_MUSB_OTG | ||
2052 | musb_hnp_stop(musb); | 2051 | musb_hnp_stop(musb); |
2053 | #endif | ||
2054 | 2052 | ||
2055 | (void) musb_gadget_vbus_draw(&musb->g, 0); | 2053 | (void) musb_gadget_vbus_draw(&musb->g, 0); |
2056 | 2054 | ||
@@ -2171,7 +2169,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2171 | 2169 | ||
2172 | switch (musb->xceiv->state) { | 2170 | switch (musb->xceiv->state) { |
2173 | default: | 2171 | default: |
2174 | #ifdef CONFIG_USB_MUSB_OTG | ||
2175 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", | 2172 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", |
2176 | otg_state_string(musb->xceiv->state)); | 2173 | otg_state_string(musb->xceiv->state)); |
2177 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2174 | musb->xceiv->state = OTG_STATE_A_IDLE; |
@@ -2183,7 +2180,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2183 | break; | 2180 | break; |
2184 | case OTG_STATE_B_WAIT_ACON: | 2181 | case OTG_STATE_B_WAIT_ACON: |
2185 | case OTG_STATE_B_HOST: | 2182 | case OTG_STATE_B_HOST: |
2186 | #endif | ||
2187 | case OTG_STATE_B_PERIPHERAL: | 2183 | case OTG_STATE_B_PERIPHERAL: |
2188 | case OTG_STATE_B_IDLE: | 2184 | case OTG_STATE_B_IDLE: |
2189 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2185 | musb->xceiv->state = OTG_STATE_B_IDLE; |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index b2faff235507..9378b359c1f0 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
@@ -88,7 +88,6 @@ static int service_tx_status_request( | |||
88 | case USB_RECIP_DEVICE: | 88 | case USB_RECIP_DEVICE: |
89 | result[0] = musb->is_self_powered << USB_DEVICE_SELF_POWERED; | 89 | result[0] = musb->is_self_powered << USB_DEVICE_SELF_POWERED; |
90 | result[0] |= musb->may_wakeup << USB_DEVICE_REMOTE_WAKEUP; | 90 | result[0] |= musb->may_wakeup << USB_DEVICE_REMOTE_WAKEUP; |
91 | #ifdef CONFIG_USB_MUSB_OTG | ||
92 | if (musb->g.is_otg) { | 91 | if (musb->g.is_otg) { |
93 | result[0] |= musb->g.b_hnp_enable | 92 | result[0] |= musb->g.b_hnp_enable |
94 | << USB_DEVICE_B_HNP_ENABLE; | 93 | << USB_DEVICE_B_HNP_ENABLE; |
@@ -97,7 +96,6 @@ static int service_tx_status_request( | |||
97 | result[0] |= musb->g.a_hnp_support | 96 | result[0] |= musb->g.a_hnp_support |
98 | << USB_DEVICE_A_HNP_SUPPORT; | 97 | << USB_DEVICE_A_HNP_SUPPORT; |
99 | } | 98 | } |
100 | #endif | ||
101 | break; | 99 | break; |
102 | 100 | ||
103 | case USB_RECIP_INTERFACE: | 101 | case USB_RECIP_INTERFACE: |
@@ -392,7 +390,6 @@ __acquires(musb->lock) | |||
392 | if (handled > 0) | 390 | if (handled > 0) |
393 | musb->test_mode = true; | 391 | musb->test_mode = true; |
394 | break; | 392 | break; |
395 | #ifdef CONFIG_USB_MUSB_OTG | ||
396 | case USB_DEVICE_B_HNP_ENABLE: | 393 | case USB_DEVICE_B_HNP_ENABLE: |
397 | if (!musb->g.is_otg) | 394 | if (!musb->g.is_otg) |
398 | goto stall; | 395 | goto stall; |
@@ -409,7 +406,6 @@ __acquires(musb->lock) | |||
409 | goto stall; | 406 | goto stall; |
410 | musb->g.a_alt_hnp_support = 1; | 407 | musb->g.a_alt_hnp_support = 1; |
411 | break; | 408 | break; |
412 | #endif | ||
413 | case USB_DEVICE_DEBUG_MODE: | 409 | case USB_DEVICE_DEBUG_MODE: |
414 | handled = 0; | 410 | handled = 0; |
415 | break; | 411 | break; |
diff --git a/drivers/usb/musb/musb_host.h b/drivers/usb/musb/musb_host.h index 14b00776638d..622d09fb9aba 100644 --- a/drivers/usb/musb/musb_host.h +++ b/drivers/usb/musb/musb_host.h | |||
@@ -95,7 +95,6 @@ extern const struct hc_driver musb_hc_driver; | |||
95 | 95 | ||
96 | static inline struct urb *next_urb(struct musb_qh *qh) | 96 | static inline struct urb *next_urb(struct musb_qh *qh) |
97 | { | 97 | { |
98 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
99 | struct list_head *queue; | 98 | struct list_head *queue; |
100 | 99 | ||
101 | if (!qh) | 100 | if (!qh) |
@@ -104,9 +103,6 @@ static inline struct urb *next_urb(struct musb_qh *qh) | |||
104 | if (list_empty(queue)) | 103 | if (list_empty(queue)) |
105 | return NULL; | 104 | return NULL; |
106 | return list_entry(queue->next, struct urb, urb_list); | 105 | return list_entry(queue->next, struct urb, urb_list); |
107 | #else | ||
108 | return NULL; | ||
109 | #endif | ||
110 | } | 106 | } |
111 | 107 | ||
112 | #endif /* _MUSB_HOST_H */ | 108 | #endif /* _MUSB_HOST_H */ |
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index 2d80a5758838..e9f80adc45a4 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -88,14 +88,12 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
88 | OTG_TIME_A_AIDL_BDIS)); | 88 | OTG_TIME_A_AIDL_BDIS)); |
89 | musb_platform_try_idle(musb, 0); | 89 | musb_platform_try_idle(musb, 0); |
90 | break; | 90 | break; |
91 | #ifdef CONFIG_USB_MUSB_OTG | ||
92 | case OTG_STATE_B_HOST: | 91 | case OTG_STATE_B_HOST: |
93 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 92 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; |
94 | musb->is_active = is_otg_enabled(musb) | 93 | musb->is_active = is_otg_enabled(musb) |
95 | && musb->xceiv->host->b_hnp_enable; | 94 | && musb->xceiv->host->b_hnp_enable; |
96 | musb_platform_try_idle(musb, 0); | 95 | musb_platform_try_idle(musb, 0); |
97 | break; | 96 | break; |
98 | #endif | ||
99 | default: | 97 | default: |
100 | dev_dbg(musb->controller, "bogus rh suspend? %s\n", | 98 | dev_dbg(musb->controller, "bogus rh suspend? %s\n", |
101 | otg_state_string(musb->xceiv->state)); | 99 | otg_state_string(musb->xceiv->state)); |
@@ -118,13 +116,11 @@ static void musb_port_reset(struct musb *musb, bool do_reset) | |||
118 | u8 power; | 116 | u8 power; |
119 | void __iomem *mbase = musb->mregs; | 117 | void __iomem *mbase = musb->mregs; |
120 | 118 | ||
121 | #ifdef CONFIG_USB_MUSB_OTG | ||
122 | if (musb->xceiv->state == OTG_STATE_B_IDLE) { | 119 | if (musb->xceiv->state == OTG_STATE_B_IDLE) { |
123 | dev_dbg(musb->controller, "HNP: Returning from HNP; no hub reset from b_idle\n"); | 120 | dev_dbg(musb->controller, "HNP: Returning from HNP; no hub reset from b_idle\n"); |
124 | musb->port1_status &= ~USB_PORT_STAT_RESET; | 121 | musb->port1_status &= ~USB_PORT_STAT_RESET; |
125 | return; | 122 | return; |
126 | } | 123 | } |
127 | #endif | ||
128 | 124 | ||
129 | if (!is_host_active(musb)) | 125 | if (!is_host_active(musb)) |
130 | return; | 126 | return; |
@@ -191,14 +187,12 @@ void musb_root_disconnect(struct musb *musb) | |||
191 | 187 | ||
192 | switch (musb->xceiv->state) { | 188 | switch (musb->xceiv->state) { |
193 | case OTG_STATE_A_SUSPEND: | 189 | case OTG_STATE_A_SUSPEND: |
194 | #ifdef CONFIG_USB_MUSB_OTG | ||
195 | if (is_otg_enabled(musb) | 190 | if (is_otg_enabled(musb) |
196 | && musb->xceiv->host->b_hnp_enable) { | 191 | && musb->xceiv->host->b_hnp_enable) { |
197 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; | 192 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; |
198 | musb->g.is_a_peripheral = 1; | 193 | musb->g.is_a_peripheral = 1; |
199 | break; | 194 | break; |
200 | } | 195 | } |
201 | #endif | ||
202 | /* FALLTHROUGH */ | 196 | /* FALLTHROUGH */ |
203 | case OTG_STATE_A_HOST: | 197 | case OTG_STATE_A_HOST: |
204 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 198 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index c5d4c44d0ffa..ba85f273e487 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -51,9 +51,7 @@ static void musb_do_idle(unsigned long _musb) | |||
51 | { | 51 | { |
52 | struct musb *musb = (void *)_musb; | 52 | struct musb *musb = (void *)_musb; |
53 | unsigned long flags; | 53 | unsigned long flags; |
54 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
55 | u8 power; | 54 | u8 power; |
56 | #endif | ||
57 | u8 devctl; | 55 | u8 devctl; |
58 | 56 | ||
59 | spin_lock_irqsave(&musb->lock, flags); | 57 | spin_lock_irqsave(&musb->lock, flags); |
@@ -70,7 +68,6 @@ static void musb_do_idle(unsigned long _musb) | |||
70 | MUSB_HST_MODE(musb); | 68 | MUSB_HST_MODE(musb); |
71 | } | 69 | } |
72 | break; | 70 | break; |
73 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
74 | case OTG_STATE_A_SUSPEND: | 71 | case OTG_STATE_A_SUSPEND: |
75 | /* finish RESUME signaling? */ | 72 | /* finish RESUME signaling? */ |
76 | if (musb->port1_status & MUSB_PORT_STAT_RESUME) { | 73 | if (musb->port1_status & MUSB_PORT_STAT_RESUME) { |
@@ -87,15 +84,12 @@ static void musb_do_idle(unsigned long _musb) | |||
87 | musb->xceiv->state = OTG_STATE_A_HOST; | 84 | musb->xceiv->state = OTG_STATE_A_HOST; |
88 | } | 85 | } |
89 | break; | 86 | break; |
90 | #endif | ||
91 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
92 | case OTG_STATE_A_HOST: | 87 | case OTG_STATE_A_HOST: |
93 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 88 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
94 | if (devctl & MUSB_DEVCTL_BDEVICE) | 89 | if (devctl & MUSB_DEVCTL_BDEVICE) |
95 | musb->xceiv->state = OTG_STATE_B_IDLE; | 90 | musb->xceiv->state = OTG_STATE_B_IDLE; |
96 | else | 91 | else |
97 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 92 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; |
98 | #endif | ||
99 | default: | 93 | default: |
100 | break; | 94 | break; |
101 | } | 95 | } |
@@ -243,13 +237,11 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
243 | dev_dbg(musb->controller, "ID GND\n"); | 237 | dev_dbg(musb->controller, "ID GND\n"); |
244 | 238 | ||
245 | if (is_otg_enabled(musb)) { | 239 | if (is_otg_enabled(musb)) { |
246 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
247 | if (musb->gadget_driver) { | 240 | if (musb->gadget_driver) { |
248 | pm_runtime_get_sync(musb->controller); | 241 | pm_runtime_get_sync(musb->controller); |
249 | otg_init(musb->xceiv); | 242 | otg_init(musb->xceiv); |
250 | omap2430_musb_set_vbus(musb, 1); | 243 | omap2430_musb_set_vbus(musb, 1); |
251 | } | 244 | } |
252 | #endif | ||
253 | } else { | 245 | } else { |
254 | pm_runtime_get_sync(musb->controller); | 246 | pm_runtime_get_sync(musb->controller); |
255 | otg_init(musb->xceiv); | 247 | otg_init(musb->xceiv); |
@@ -260,21 +252,16 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
260 | case USB_EVENT_VBUS: | 252 | case USB_EVENT_VBUS: |
261 | dev_dbg(musb->controller, "VBUS Connect\n"); | 253 | dev_dbg(musb->controller, "VBUS Connect\n"); |
262 | 254 | ||
263 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
264 | if (musb->gadget_driver) | 255 | if (musb->gadget_driver) |
265 | pm_runtime_get_sync(musb->controller); | 256 | pm_runtime_get_sync(musb->controller); |
266 | #endif | ||
267 | otg_init(musb->xceiv); | 257 | otg_init(musb->xceiv); |
268 | break; | 258 | break; |
269 | 259 | ||
270 | case USB_EVENT_NONE: | 260 | case USB_EVENT_NONE: |
271 | dev_dbg(musb->controller, "VBUS Disconnect\n"); | 261 | dev_dbg(musb->controller, "VBUS Disconnect\n"); |
272 | 262 | ||
273 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
274 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) | 263 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) |
275 | if (musb->gadget_driver) | 264 | if (musb->gadget_driver) { |
276 | #endif | ||
277 | { | ||
278 | pm_runtime_mark_last_busy(musb->controller); | 265 | pm_runtime_mark_last_busy(musb->controller); |
279 | pm_runtime_put_autosuspend(musb->controller); | 266 | pm_runtime_put_autosuspend(musb->controller); |
280 | } | 267 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index b410357cf016..9eec41fbf3a4 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -269,8 +269,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf) | |||
269 | 269 | ||
270 | static struct musb *the_musb; | 270 | static struct musb *the_musb; |
271 | 271 | ||
272 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
273 | |||
274 | /* This is used by gadget drivers, and OTG transceiver logic, allowing | 272 | /* This is used by gadget drivers, and OTG transceiver logic, allowing |
275 | * at most mA current to be drawn from VBUS during a Default-B session | 273 | * at most mA current to be drawn from VBUS during a Default-B session |
276 | * (that is, while VBUS exceeds 4.4V). In Default-A (including pure host | 274 | * (that is, while VBUS exceeds 4.4V). In Default-A (including pure host |
@@ -310,10 +308,6 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA) | |||
310 | return 0; | 308 | return 0; |
311 | } | 309 | } |
312 | 310 | ||
313 | #else | ||
314 | #define tusb_draw_power NULL | ||
315 | #endif | ||
316 | |||
317 | /* workaround for issue 13: change clock during chip idle | 311 | /* workaround for issue 13: change clock during chip idle |
318 | * (to be fixed in rev3 silicon) ... symptoms include disconnect | 312 | * (to be fixed in rev3 silicon) ... symptoms include disconnect |
319 | * or looping suspend/resume cycles | 313 | * or looping suspend/resume cycles |
@@ -440,19 +434,15 @@ static void musb_do_idle(unsigned long _musb) | |||
440 | if (is_host_active(musb) && (musb->port1_status >> 16)) | 434 | if (is_host_active(musb) && (musb->port1_status >> 16)) |
441 | goto done; | 435 | goto done; |
442 | 436 | ||
443 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | 437 | if (is_peripheral_enabled(musb) && !musb->gadget_driver) { |
444 | if (is_peripheral_enabled(musb) && !musb->gadget_driver) | ||
445 | wakeups = 0; | 438 | wakeups = 0; |
446 | else { | 439 | } else { |
447 | wakeups = TUSB_PRCM_WHOSTDISCON | 440 | wakeups = TUSB_PRCM_WHOSTDISCON |
448 | | TUSB_PRCM_WBUS | 441 | | TUSB_PRCM_WBUS |
449 | | TUSB_PRCM_WVBUS; | 442 | | TUSB_PRCM_WVBUS; |
450 | if (is_otg_enabled(musb)) | 443 | if (is_otg_enabled(musb)) |
451 | wakeups |= TUSB_PRCM_WID; | 444 | wakeups |= TUSB_PRCM_WID; |
452 | } | 445 | } |
453 | #else | ||
454 | wakeups = TUSB_PRCM_WHOSTDISCON | TUSB_PRCM_WBUS; | ||
455 | #endif | ||
456 | tusb_allow_idle(musb, wakeups); | 446 | tusb_allow_idle(musb, wakeups); |
457 | } | 447 | } |
458 | done: | 448 | done: |
@@ -610,30 +600,22 @@ static int tusb_musb_set_mode(struct musb *musb, u8 musb_mode) | |||
610 | 600 | ||
611 | switch (musb_mode) { | 601 | switch (musb_mode) { |
612 | 602 | ||
613 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
614 | case MUSB_HOST: /* Disable PHY ID detect, ground ID */ | 603 | case MUSB_HOST: /* Disable PHY ID detect, ground ID */ |
615 | phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 604 | phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
616 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 605 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
617 | dev_conf |= TUSB_DEV_CONF_ID_SEL; | 606 | dev_conf |= TUSB_DEV_CONF_ID_SEL; |
618 | dev_conf &= ~TUSB_DEV_CONF_SOFT_ID; | 607 | dev_conf &= ~TUSB_DEV_CONF_SOFT_ID; |
619 | break; | 608 | break; |
620 | #endif | ||
621 | |||
622 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
623 | case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */ | 609 | case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */ |
624 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 610 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
625 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 611 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
626 | dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); | 612 | dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); |
627 | break; | 613 | break; |
628 | #endif | ||
629 | |||
630 | #ifdef CONFIG_USB_MUSB_OTG | ||
631 | case MUSB_OTG: /* Use PHY ID detection */ | 614 | case MUSB_OTG: /* Use PHY ID detection */ |
632 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 615 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
633 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 616 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
634 | dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); | 617 | dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); |
635 | break; | 618 | break; |
636 | #endif | ||
637 | 619 | ||
638 | default: | 620 | default: |
639 | dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode); | 621 | dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode); |
@@ -684,7 +666,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
684 | /* B-dev state machine: no vbus ~= disconnect */ | 666 | /* B-dev state machine: no vbus ~= disconnect */ |
685 | if ((is_otg_enabled(musb) && !musb->xceiv->default_a) | 667 | if ((is_otg_enabled(musb) && !musb->xceiv->default_a) |
686 | || !is_host_enabled(musb)) { | 668 | || !is_host_enabled(musb)) { |
687 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
688 | /* ? musb_root_disconnect(musb); */ | 669 | /* ? musb_root_disconnect(musb); */ |
689 | musb->port1_status &= | 670 | musb->port1_status &= |
690 | ~(USB_PORT_STAT_CONNECTION | 671 | ~(USB_PORT_STAT_CONNECTION |
@@ -693,7 +674,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
693 | | USB_PORT_STAT_HIGH_SPEED | 674 | | USB_PORT_STAT_HIGH_SPEED |
694 | | USB_PORT_STAT_TEST | 675 | | USB_PORT_STAT_TEST |
695 | ); | 676 | ); |
696 | #endif | ||
697 | 677 | ||
698 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { | 678 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { |
699 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); | 679 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); |