diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 02:08:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 02:08:32 -0400 |
commit | f549953c15deab4c54708b39af86d4edecc6cddc (patch) | |
tree | f0412f989b77cdceab34c18aa85a8a25d5942a1f /drivers/usb/musb | |
parent | f0deb97ab13ad1f89cd0993f7339655d59788405 (diff) | |
parent | e04f5f7e423018bcec84c11af2058cdce87816f3 (diff) |
Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (115 commits)
EHCI: fix direction handling for interrupt data toggles
USB: serial: add IDs for WinChipHead USB->RS232 adapter
USB: OHCI: fix another regression for NVIDIA controllers
usb: gadget: m66592-udc: add pullup function
usb: gadget: m66592-udc: add function for external controller
usb: gadget: r8a66597-udc: add pullup function
usb: renesas_usbhs: support multi driver
usb: renesas_usbhs: inaccessible pipe is not an error
usb: renesas_usbhs: care buff alignment when dma handler
USB: PL2303: correctly handle baudrates above 115200
usb: r8a66597-hcd: fixup USB_PORT_STAT_C_SUSPEND shift
usb: renesas_usbhs: compile/config are rescued
usb: renesas_usbhs: fixup comment-out
usb: update email address in ohci-sh and r8a66597-hcd
usb: r8a66597-hcd: add function for external controller
EHCI: only power off port if over-current is active
USB: mon: Allow to use usbmon without debugfs
USB: EHCI: go back to using the system clock for QH unlinks
ehci: add pci quirk for Ordissimo and RM Slate 100 too
ehci: refactor pci quirk to use standard dmi_check_system method
...
Fix up trivial conflicts in Documentation/feature-removal-schedule.txt
Diffstat (limited to 'drivers/usb/musb')
-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 | 133 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.h | 70 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 102 | ||||
-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, 69 insertions, 393 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 bcbd1aba961a..20a28731c338 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 */ |
@@ -927,7 +899,6 @@ void musb_start(struct musb *musb) | |||
927 | 899 | ||
928 | /* put into basic highspeed mode and start session */ | 900 | /* put into basic highspeed mode and start session */ |
929 | musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE | 901 | musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE |
930 | | MUSB_POWER_SOFTCONN | ||
931 | | MUSB_POWER_HSENAB | 902 | | MUSB_POWER_HSENAB |
932 | /* ENSUSPEND wedges tusb */ | 903 | /* ENSUSPEND wedges tusb */ |
933 | /* | MUSB_POWER_ENSUSPEND */ | 904 | /* | MUSB_POWER_ENSUSPEND */ |
@@ -1038,10 +1009,15 @@ static void musb_shutdown(struct platform_device *pdev) | |||
1038 | * We don't currently use dynamic fifo setup capability to do anything | 1009 | * We don't currently use dynamic fifo setup capability to do anything |
1039 | * more than selecting one of a bunch of predefined configurations. | 1010 | * more than selecting one of a bunch of predefined configurations. |
1040 | */ | 1011 | */ |
1041 | #if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_OMAP2PLUS) \ | 1012 | #if defined(CONFIG_USB_MUSB_TUSB6010) \ |
1042 | || defined(CONFIG_USB_MUSB_AM35X) | 1013 | || defined(CONFIG_USB_MUSB_TUSB6010_MODULE) \ |
1014 | || defined(CONFIG_USB_MUSB_OMAP2PLUS) \ | ||
1015 | || defined(CONFIG_USB_MUSB_OMAP2PLUS_MODULE) \ | ||
1016 | || defined(CONFIG_USB_MUSB_AM35X) \ | ||
1017 | || defined(CONFIG_USB_MUSB_AM35X_MODULE) | ||
1043 | static ushort __initdata fifo_mode = 4; | 1018 | static ushort __initdata fifo_mode = 4; |
1044 | #elif defined(CONFIG_USB_MUSB_UX500) | 1019 | #elif defined(CONFIG_USB_MUSB_UX500) \ |
1020 | || defined(CONFIG_USB_MUSB_UX500_MODULE) | ||
1045 | static ushort __initdata fifo_mode = 5; | 1021 | static ushort __initdata fifo_mode = 5; |
1046 | #else | 1022 | #else |
1047 | static ushort __initdata fifo_mode = 2; | 1023 | static ushort __initdata fifo_mode = 2; |
@@ -1191,14 +1167,12 @@ fifo_setup(struct musb *musb, struct musb_hw_ep *hw_ep, | |||
1191 | /* configure the FIFO */ | 1167 | /* configure the FIFO */ |
1192 | musb_writeb(mbase, MUSB_INDEX, hw_ep->epnum); | 1168 | musb_writeb(mbase, MUSB_INDEX, hw_ep->epnum); |
1193 | 1169 | ||
1194 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1195 | /* EP0 reserved endpoint for control, bidirectional; | 1170 | /* EP0 reserved endpoint for control, bidirectional; |
1196 | * EP1 reserved for bulk, two unidirection halves. | 1171 | * EP1 reserved for bulk, two unidirection halves. |
1197 | */ | 1172 | */ |
1198 | if (hw_ep->epnum == 1) | 1173 | if (hw_ep->epnum == 1) |
1199 | musb->bulk_ep = hw_ep; | 1174 | musb->bulk_ep = hw_ep; |
1200 | /* REVISIT error check: be sure ep0 can both rx and tx ... */ | 1175 | /* REVISIT error check: be sure ep0 can both rx and tx ... */ |
1201 | #endif | ||
1202 | switch (cfg->style) { | 1176 | switch (cfg->style) { |
1203 | case FIFO_TX: | 1177 | case FIFO_TX: |
1204 | musb_write_txfifosz(mbase, c_size); | 1178 | musb_write_txfifosz(mbase, c_size); |
@@ -1317,12 +1291,10 @@ done: | |||
1317 | n + 1, musb->config->num_eps * 2 - 1, | 1291 | n + 1, musb->config->num_eps * 2 - 1, |
1318 | offset, (1 << (musb->config->ram_bits + 2))); | 1292 | offset, (1 << (musb->config->ram_bits + 2))); |
1319 | 1293 | ||
1320 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1321 | if (!musb->bulk_ep) { | 1294 | if (!musb->bulk_ep) { |
1322 | pr_debug("%s: missing bulk\n", musb_driver_name); | 1295 | pr_debug("%s: missing bulk\n", musb_driver_name); |
1323 | return -EINVAL; | 1296 | return -EINVAL; |
1324 | } | 1297 | } |
1325 | #endif | ||
1326 | 1298 | ||
1327 | return 0; | 1299 | return 0; |
1328 | } | 1300 | } |
@@ -1353,7 +1325,6 @@ static int __init ep_config_from_hw(struct musb *musb) | |||
1353 | 1325 | ||
1354 | /* FIXME set up hw_ep->{rx,tx}_double_buffered */ | 1326 | /* FIXME set up hw_ep->{rx,tx}_double_buffered */ |
1355 | 1327 | ||
1356 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1357 | /* pick an RX/TX endpoint for bulk */ | 1328 | /* pick an RX/TX endpoint for bulk */ |
1358 | if (hw_ep->max_packet_sz_tx < 512 | 1329 | if (hw_ep->max_packet_sz_tx < 512 |
1359 | || hw_ep->max_packet_sz_rx < 512) | 1330 | || hw_ep->max_packet_sz_rx < 512) |
@@ -1365,15 +1336,12 @@ static int __init ep_config_from_hw(struct musb *musb) | |||
1365 | if (musb->bulk_ep) | 1336 | if (musb->bulk_ep) |
1366 | continue; | 1337 | continue; |
1367 | musb->bulk_ep = hw_ep; | 1338 | musb->bulk_ep = hw_ep; |
1368 | #endif | ||
1369 | } | 1339 | } |
1370 | 1340 | ||
1371 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1372 | if (!musb->bulk_ep) { | 1341 | if (!musb->bulk_ep) { |
1373 | pr_debug("%s: missing bulk\n", musb_driver_name); | 1342 | pr_debug("%s: missing bulk\n", musb_driver_name); |
1374 | return -EINVAL; | 1343 | return -EINVAL; |
1375 | } | 1344 | } |
1376 | #endif | ||
1377 | 1345 | ||
1378 | return 0; | 1346 | return 0; |
1379 | } | 1347 | } |
@@ -1429,13 +1397,11 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1429 | } else { | 1397 | } else { |
1430 | musb->is_multipoint = 0; | 1398 | musb->is_multipoint = 0; |
1431 | type = ""; | 1399 | type = ""; |
1432 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1433 | #ifndef CONFIG_USB_OTG_BLACKLIST_HUB | 1400 | #ifndef CONFIG_USB_OTG_BLACKLIST_HUB |
1434 | printk(KERN_ERR | 1401 | printk(KERN_ERR |
1435 | "%s: kernel must blacklist external hubs\n", | 1402 | "%s: kernel must blacklist external hubs\n", |
1436 | musb_driver_name); | 1403 | musb_driver_name); |
1437 | #endif | 1404 | #endif |
1438 | #endif | ||
1439 | } | 1405 | } |
1440 | 1406 | ||
1441 | /* log release info */ | 1407 | /* log release info */ |
@@ -1479,11 +1445,9 @@ static int __init musb_core_init(u16 musb_type, struct musb *musb) | |||
1479 | #endif | 1445 | #endif |
1480 | 1446 | ||
1481 | hw_ep->regs = MUSB_EP_OFFSET(i, 0) + mbase; | 1447 | 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); | 1448 | hw_ep->target_regs = musb_read_target_reg_base(i, mbase); |
1484 | hw_ep->rx_reinit = 1; | 1449 | hw_ep->rx_reinit = 1; |
1485 | hw_ep->tx_reinit = 1; | 1450 | hw_ep->tx_reinit = 1; |
1486 | #endif | ||
1487 | 1451 | ||
1488 | if (hw_ep->max_packet_sz_tx) { | 1452 | if (hw_ep->max_packet_sz_tx) { |
1489 | dev_dbg(musb->controller, | 1453 | dev_dbg(musb->controller, |
@@ -1561,14 +1525,6 @@ irqreturn_t musb_interrupt(struct musb *musb) | |||
1561 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", | 1525 | (devctl & MUSB_DEVCTL_HM) ? "host" : "peripheral", |
1562 | musb->int_usb, musb->int_tx, musb->int_rx); | 1526 | musb->int_usb, musb->int_tx, musb->int_rx); |
1563 | 1527 | ||
1564 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1565 | if (is_otg_enabled(musb) || is_peripheral_enabled(musb)) | ||
1566 | if (!musb->gadget_driver) { | ||
1567 | dev_dbg(musb->controller, "No gadget driver loaded\n"); | ||
1568 | return IRQ_HANDLED; | ||
1569 | } | ||
1570 | #endif | ||
1571 | |||
1572 | /* the core can interrupt us for multiple reasons; docs have | 1528 | /* the core can interrupt us for multiple reasons; docs have |
1573 | * a generic interrupt flowchart to follow | 1529 | * a generic interrupt flowchart to follow |
1574 | */ | 1530 | */ |
@@ -1767,8 +1723,6 @@ musb_vbus_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1767 | } | 1723 | } |
1768 | static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); | 1724 | static DEVICE_ATTR(vbus, 0644, musb_vbus_show, musb_vbus_store); |
1769 | 1725 | ||
1770 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1771 | |||
1772 | /* Gadget drivers can't know that a host is connected so they might want | 1726 | /* 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. | 1727 | * to start SRP, but users can. This allows userspace to trigger SRP. |
1774 | */ | 1728 | */ |
@@ -1792,14 +1746,10 @@ musb_srp_store(struct device *dev, struct device_attribute *attr, | |||
1792 | } | 1746 | } |
1793 | static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); | 1747 | static DEVICE_ATTR(srp, 0644, NULL, musb_srp_store); |
1794 | 1748 | ||
1795 | #endif /* CONFIG_USB_GADGET_MUSB_HDRC */ | ||
1796 | |||
1797 | static struct attribute *musb_attributes[] = { | 1749 | static struct attribute *musb_attributes[] = { |
1798 | &dev_attr_mode.attr, | 1750 | &dev_attr_mode.attr, |
1799 | &dev_attr_vbus.attr, | 1751 | &dev_attr_vbus.attr, |
1800 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1801 | &dev_attr_srp.attr, | 1752 | &dev_attr_srp.attr, |
1802 | #endif | ||
1803 | NULL | 1753 | NULL |
1804 | }; | 1754 | }; |
1805 | 1755 | ||
@@ -1832,7 +1782,6 @@ allocate_instance(struct device *dev, | |||
1832 | struct musb *musb; | 1782 | struct musb *musb; |
1833 | struct musb_hw_ep *ep; | 1783 | struct musb_hw_ep *ep; |
1834 | int epnum; | 1784 | int epnum; |
1835 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1836 | struct usb_hcd *hcd; | 1785 | struct usb_hcd *hcd; |
1837 | 1786 | ||
1838 | hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev)); | 1787 | hcd = usb_create_hcd(&musb_hc_driver, dev, dev_name(dev)); |
@@ -1850,12 +1799,6 @@ allocate_instance(struct device *dev, | |||
1850 | 1799 | ||
1851 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1800 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1852 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1801 | 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); | 1802 | dev_set_drvdata(dev, musb); |
1860 | musb->mregs = mbase; | 1803 | musb->mregs = mbase; |
1861 | musb->ctrl_base = mbase; | 1804 | musb->ctrl_base = mbase; |
@@ -1885,9 +1828,7 @@ static void musb_free(struct musb *musb) | |||
1885 | sysfs_remove_group(&musb->controller->kobj, &musb_attr_group); | 1828 | sysfs_remove_group(&musb->controller->kobj, &musb_attr_group); |
1886 | #endif | 1829 | #endif |
1887 | 1830 | ||
1888 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
1889 | musb_gadget_cleanup(musb); | 1831 | musb_gadget_cleanup(musb); |
1890 | #endif | ||
1891 | 1832 | ||
1892 | if (musb->nIrq >= 0) { | 1833 | if (musb->nIrq >= 0) { |
1893 | if (musb->irq_wake) | 1834 | if (musb->irq_wake) |
@@ -1901,11 +1842,7 @@ static void musb_free(struct musb *musb) | |||
1901 | dma_controller_destroy(c); | 1842 | dma_controller_destroy(c); |
1902 | } | 1843 | } |
1903 | 1844 | ||
1904 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
1905 | usb_put_hcd(musb_to_hcd(musb)); | ||
1906 | #else | ||
1907 | kfree(musb); | 1845 | kfree(musb); |
1908 | #endif | ||
1909 | } | 1846 | } |
1910 | 1847 | ||
1911 | /* | 1848 | /* |
@@ -2000,9 +1937,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2000 | if (status < 0) | 1937 | if (status < 0) |
2001 | goto fail3; | 1938 | goto fail3; |
2002 | 1939 | ||
2003 | #ifdef CONFIG_USB_MUSB_OTG | ||
2004 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); | 1940 | setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb); |
2005 | #endif | ||
2006 | 1941 | ||
2007 | /* Init IRQ workqueue before request_irq */ | 1942 | /* Init IRQ workqueue before request_irq */ |
2008 | INIT_WORK(&musb->irq_work, musb_irq_work); | 1943 | INIT_WORK(&musb->irq_work, musb_irq_work); |
@@ -2214,7 +2149,16 @@ static void musb_save_context(struct musb *musb) | |||
2214 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); | 2149 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); |
2215 | 2150 | ||
2216 | for (i = 0; i < musb->config->num_eps; ++i) { | 2151 | for (i = 0; i < musb->config->num_eps; ++i) { |
2217 | epio = musb->endpoints[i].regs; | 2152 | struct musb_hw_ep *hw_ep; |
2153 | |||
2154 | hw_ep = &musb->endpoints[i]; | ||
2155 | if (!hw_ep) | ||
2156 | continue; | ||
2157 | |||
2158 | epio = hw_ep->regs; | ||
2159 | if (!epio) | ||
2160 | continue; | ||
2161 | |||
2218 | musb->context.index_regs[i].txmaxp = | 2162 | musb->context.index_regs[i].txmaxp = |
2219 | musb_readw(epio, MUSB_TXMAXP); | 2163 | musb_readw(epio, MUSB_TXMAXP); |
2220 | musb->context.index_regs[i].txcsr = | 2164 | musb->context.index_regs[i].txcsr = |
@@ -2280,7 +2224,16 @@ static void musb_restore_context(struct musb *musb) | |||
2280 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2224 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
2281 | 2225 | ||
2282 | for (i = 0; i < musb->config->num_eps; ++i) { | 2226 | for (i = 0; i < musb->config->num_eps; ++i) { |
2283 | epio = musb->endpoints[i].regs; | 2227 | struct musb_hw_ep *hw_ep; |
2228 | |||
2229 | hw_ep = &musb->endpoints[i]; | ||
2230 | if (!hw_ep) | ||
2231 | continue; | ||
2232 | |||
2233 | epio = hw_ep->regs; | ||
2234 | if (!epio) | ||
2235 | continue; | ||
2236 | |||
2284 | musb_writew(epio, MUSB_TXMAXP, | 2237 | musb_writew(epio, MUSB_TXMAXP, |
2285 | musb->context.index_regs[i].txmaxp); | 2238 | musb->context.index_regs[i].txmaxp); |
2286 | musb_writew(epio, MUSB_TXCSR, | 2239 | musb_writew(epio, MUSB_TXCSR, |
@@ -2329,13 +2282,13 @@ static void musb_restore_context(struct musb *musb) | |||
2329 | musb->context.index_regs[i].rxhubport); | 2282 | musb->context.index_regs[i].rxhubport); |
2330 | } | 2283 | } |
2331 | } | 2284 | } |
2285 | musb_writeb(musb_base, MUSB_INDEX, musb->context.index); | ||
2332 | } | 2286 | } |
2333 | 2287 | ||
2334 | static int musb_suspend(struct device *dev) | 2288 | static int musb_suspend(struct device *dev) |
2335 | { | 2289 | { |
2336 | struct platform_device *pdev = to_platform_device(dev); | 2290 | struct musb *musb = dev_to_musb(dev); |
2337 | unsigned long flags; | 2291 | unsigned long flags; |
2338 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
2339 | 2292 | ||
2340 | spin_lock_irqsave(&musb->lock, flags); | 2293 | spin_lock_irqsave(&musb->lock, flags); |
2341 | 2294 | ||
@@ -2357,8 +2310,7 @@ static int musb_suspend(struct device *dev) | |||
2357 | 2310 | ||
2358 | static int musb_resume_noirq(struct device *dev) | 2311 | static int musb_resume_noirq(struct device *dev) |
2359 | { | 2312 | { |
2360 | struct platform_device *pdev = to_platform_device(dev); | 2313 | struct musb *musb = dev_to_musb(dev); |
2361 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
2362 | 2314 | ||
2363 | musb_restore_context(musb); | 2315 | musb_restore_context(musb); |
2364 | 2316 | ||
@@ -2426,34 +2378,13 @@ static struct platform_driver musb_driver = { | |||
2426 | 2378 | ||
2427 | static int __init musb_init(void) | 2379 | static int __init musb_init(void) |
2428 | { | 2380 | { |
2429 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
2430 | if (usb_disabled()) | 2381 | if (usb_disabled()) |
2431 | return 0; | 2382 | return 0; |
2432 | #endif | ||
2433 | 2383 | ||
2434 | pr_info("%s: version " MUSB_VERSION ", " | 2384 | pr_info("%s: version " MUSB_VERSION ", " |
2435 | #ifdef CONFIG_MUSB_PIO_ONLY | ||
2436 | "pio" | ||
2437 | #elif defined(CONFIG_USB_TI_CPPI_DMA) | ||
2438 | "cppi-dma" | ||
2439 | #elif defined(CONFIG_USB_INVENTRA_DMA) | ||
2440 | "musb-dma" | ||
2441 | #elif defined(CONFIG_USB_TUSB_OMAP_DMA) | ||
2442 | "tusb-omap-dma" | ||
2443 | #elif defined(CONFIG_USB_UX500_DMA) | ||
2444 | "ux500-dma" | ||
2445 | #else | ||
2446 | "?dma?" | 2385 | "?dma?" |
2447 | #endif | ||
2448 | ", " | 2386 | ", " |
2449 | #ifdef CONFIG_USB_MUSB_OTG | 2387 | "otg (peripheral+host)", |
2450 | "otg (peripheral+host)" | ||
2451 | #elif defined(CONFIG_USB_GADGET_MUSB_HDRC) | ||
2452 | "peripheral" | ||
2453 | #elif defined(CONFIG_USB_MUSB_HDRC_HCD) | ||
2454 | "host" | ||
2455 | #endif | ||
2456 | , | ||
2457 | musb_driver_name); | 2388 | musb_driver_name); |
2458 | return platform_driver_probe(&musb_driver, musb_probe); | 2389 | return platform_driver_probe(&musb_driver, musb_probe); |
2459 | } | 2390 | } |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 0e053b587960..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 |
@@ -261,7 +211,7 @@ enum musb_g_ep0_state { | |||
261 | * @try_ilde: tries to idle the IP | 211 | * @try_ilde: tries to idle the IP |
262 | * @vbus_status: returns vbus status if possible | 212 | * @vbus_status: returns vbus status if possible |
263 | * @set_vbus: forces vbus status | 213 | * @set_vbus: forces vbus status |
264 | * @channel_program: pre check for standard dma channel_program func | 214 | * @adjust_channel_params: pre check for standard dma channel_program func |
265 | */ | 215 | */ |
266 | struct musb_platform_ops { | 216 | struct musb_platform_ops { |
267 | int (*init)(struct musb *musb); | 217 | int (*init)(struct musb *musb); |
@@ -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 6aeb363e63e7..b67a062f556b 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1663,8 +1663,8 @@ static void musb_pullup(struct musb *musb, int is_on) | |||
1663 | 1663 | ||
1664 | /* FIXME if on, HdrcStart; if off, HdrcStop */ | 1664 | /* FIXME if on, HdrcStart; if off, HdrcStop */ |
1665 | 1665 | ||
1666 | dev_dbg(musb->controller, "gadget %s D+ pullup %s\n", | 1666 | dev_dbg(musb->controller, "gadget D+ pullup %s\n", |
1667 | musb->gadget_driver->function, is_on ? "on" : "off"); | 1667 | is_on ? "on" : "off"); |
1668 | musb_writeb(musb->mregs, MUSB_POWER, power); | 1668 | musb_writeb(musb->mregs, MUSB_POWER, power); |
1669 | } | 1669 | } |
1670 | 1670 | ||
@@ -1710,6 +1710,11 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | |||
1710 | return 0; | 1710 | return 0; |
1711 | } | 1711 | } |
1712 | 1712 | ||
1713 | static int musb_gadget_start(struct usb_gadget *g, | ||
1714 | struct usb_gadget_driver *driver); | ||
1715 | static int musb_gadget_stop(struct usb_gadget *g, | ||
1716 | struct usb_gadget_driver *driver); | ||
1717 | |||
1713 | static const struct usb_gadget_ops musb_gadget_operations = { | 1718 | static const struct usb_gadget_ops musb_gadget_operations = { |
1714 | .get_frame = musb_gadget_get_frame, | 1719 | .get_frame = musb_gadget_get_frame, |
1715 | .wakeup = musb_gadget_wakeup, | 1720 | .wakeup = musb_gadget_wakeup, |
@@ -1717,6 +1722,8 @@ static const struct usb_gadget_ops musb_gadget_operations = { | |||
1717 | /* .vbus_session = musb_gadget_vbus_session, */ | 1722 | /* .vbus_session = musb_gadget_vbus_session, */ |
1718 | .vbus_draw = musb_gadget_vbus_draw, | 1723 | .vbus_draw = musb_gadget_vbus_draw, |
1719 | .pullup = musb_gadget_pullup, | 1724 | .pullup = musb_gadget_pullup, |
1725 | .udc_start = musb_gadget_start, | ||
1726 | .udc_stop = musb_gadget_stop, | ||
1720 | }; | 1727 | }; |
1721 | 1728 | ||
1722 | /* ----------------------------------------------------------------------- */ | 1729 | /* ----------------------------------------------------------------------- */ |
@@ -1727,7 +1734,6 @@ static const struct usb_gadget_ops musb_gadget_operations = { | |||
1727 | * about there being only one external upstream port. It assumes | 1734 | * about there being only one external upstream port. It assumes |
1728 | * all peripheral ports are external... | 1735 | * all peripheral ports are external... |
1729 | */ | 1736 | */ |
1730 | static struct musb *the_gadget; | ||
1731 | 1737 | ||
1732 | static void musb_gadget_release(struct device *dev) | 1738 | static void musb_gadget_release(struct device *dev) |
1733 | { | 1739 | { |
@@ -1814,9 +1820,6 @@ int __init musb_gadget_setup(struct musb *musb) | |||
1814 | * musb peripherals at the same time, only the bus lock | 1820 | * musb peripherals at the same time, only the bus lock |
1815 | * is probably held. | 1821 | * is probably held. |
1816 | */ | 1822 | */ |
1817 | if (the_gadget) | ||
1818 | return -EBUSY; | ||
1819 | the_gadget = musb; | ||
1820 | 1823 | ||
1821 | musb->g.ops = &musb_gadget_operations; | 1824 | musb->g.ops = &musb_gadget_operations; |
1822 | musb->g.is_dualspeed = 1; | 1825 | musb->g.is_dualspeed = 1; |
@@ -1840,18 +1843,22 @@ int __init musb_gadget_setup(struct musb *musb) | |||
1840 | status = device_register(&musb->g.dev); | 1843 | status = device_register(&musb->g.dev); |
1841 | if (status != 0) { | 1844 | if (status != 0) { |
1842 | put_device(&musb->g.dev); | 1845 | put_device(&musb->g.dev); |
1843 | the_gadget = NULL; | 1846 | return status; |
1844 | } | 1847 | } |
1848 | status = usb_add_gadget_udc(musb->controller, &musb->g); | ||
1849 | if (status) | ||
1850 | goto err; | ||
1851 | |||
1852 | return 0; | ||
1853 | err: | ||
1854 | device_unregister(&musb->g.dev); | ||
1845 | return status; | 1855 | return status; |
1846 | } | 1856 | } |
1847 | 1857 | ||
1848 | void musb_gadget_cleanup(struct musb *musb) | 1858 | void musb_gadget_cleanup(struct musb *musb) |
1849 | { | 1859 | { |
1850 | if (musb != the_gadget) | 1860 | usb_del_gadget_udc(&musb->g); |
1851 | return; | ||
1852 | |||
1853 | device_unregister(&musb->g.dev); | 1861 | device_unregister(&musb->g.dev); |
1854 | the_gadget = NULL; | ||
1855 | } | 1862 | } |
1856 | 1863 | ||
1857 | /* | 1864 | /* |
@@ -1863,59 +1870,30 @@ void musb_gadget_cleanup(struct musb *musb) | |||
1863 | * -ENOMEM no memory to perform the operation | 1870 | * -ENOMEM no memory to perform the operation |
1864 | * | 1871 | * |
1865 | * @param driver the gadget driver | 1872 | * @param driver the gadget driver |
1866 | * @param bind the driver's bind function | ||
1867 | * @return <0 if error, 0 if everything is fine | 1873 | * @return <0 if error, 0 if everything is fine |
1868 | */ | 1874 | */ |
1869 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | 1875 | static int musb_gadget_start(struct usb_gadget *g, |
1870 | int (*bind)(struct usb_gadget *)) | 1876 | struct usb_gadget_driver *driver) |
1871 | { | 1877 | { |
1872 | struct musb *musb = the_gadget; | 1878 | struct musb *musb = gadget_to_musb(g); |
1873 | unsigned long flags; | 1879 | unsigned long flags; |
1874 | int retval = -EINVAL; | 1880 | int retval = -EINVAL; |
1875 | 1881 | ||
1876 | if (!driver | 1882 | if (driver->speed != USB_SPEED_HIGH) |
1877 | || driver->speed != USB_SPEED_HIGH | ||
1878 | || !bind || !driver->setup) | ||
1879 | goto err0; | ||
1880 | |||
1881 | /* driver must be initialized to support peripheral mode */ | ||
1882 | if (!musb) { | ||
1883 | dev_dbg(musb->controller, "no dev??\n"); | ||
1884 | retval = -ENODEV; | ||
1885 | goto err0; | 1883 | goto err0; |
1886 | } | ||
1887 | 1884 | ||
1888 | pm_runtime_get_sync(musb->controller); | 1885 | pm_runtime_get_sync(musb->controller); |
1889 | 1886 | ||
1890 | dev_dbg(musb->controller, "registering driver %s\n", driver->function); | 1887 | dev_dbg(musb->controller, "registering driver %s\n", driver->function); |
1891 | 1888 | ||
1892 | if (musb->gadget_driver) { | 1889 | musb->softconnect = 0; |
1893 | dev_dbg(musb->controller, "%s is already bound to %s\n", | ||
1894 | musb_driver_name, | ||
1895 | musb->gadget_driver->driver.name); | ||
1896 | retval = -EBUSY; | ||
1897 | goto err0; | ||
1898 | } | ||
1899 | |||
1900 | spin_lock_irqsave(&musb->lock, flags); | ||
1901 | musb->gadget_driver = driver; | 1890 | musb->gadget_driver = driver; |
1902 | musb->g.dev.driver = &driver->driver; | ||
1903 | driver->driver.bus = NULL; | ||
1904 | musb->softconnect = 1; | ||
1905 | spin_unlock_irqrestore(&musb->lock, flags); | ||
1906 | |||
1907 | retval = bind(&musb->g); | ||
1908 | if (retval) { | ||
1909 | dev_dbg(musb->controller, "bind to driver %s failed --> %d\n", | ||
1910 | driver->driver.name, retval); | ||
1911 | goto err1; | ||
1912 | } | ||
1913 | 1891 | ||
1914 | spin_lock_irqsave(&musb->lock, flags); | 1892 | spin_lock_irqsave(&musb->lock, flags); |
1893 | musb->is_active = 1; | ||
1915 | 1894 | ||
1916 | otg_set_peripheral(musb->xceiv, &musb->g); | 1895 | otg_set_peripheral(musb->xceiv, &musb->g); |
1917 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1896 | musb->xceiv->state = OTG_STATE_B_IDLE; |
1918 | musb->is_active = 1; | ||
1919 | 1897 | ||
1920 | /* | 1898 | /* |
1921 | * FIXME this ignores the softconnect flag. Drivers are | 1899 | * FIXME this ignores the softconnect flag. Drivers are |
@@ -1927,8 +1905,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1927 | if (!is_otg_enabled(musb)) | 1905 | if (!is_otg_enabled(musb)) |
1928 | musb_start(musb); | 1906 | musb_start(musb); |
1929 | 1907 | ||
1930 | otg_set_peripheral(musb->xceiv, &musb->g); | ||
1931 | |||
1932 | spin_unlock_irqrestore(&musb->lock, flags); | 1908 | spin_unlock_irqrestore(&musb->lock, flags); |
1933 | 1909 | ||
1934 | if (is_otg_enabled(musb)) { | 1910 | if (is_otg_enabled(musb)) { |
@@ -1960,15 +1936,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1960 | err2: | 1936 | err2: |
1961 | if (!is_otg_enabled(musb)) | 1937 | if (!is_otg_enabled(musb)) |
1962 | musb_stop(musb); | 1938 | musb_stop(musb); |
1963 | |||
1964 | err1: | ||
1965 | musb->gadget_driver = NULL; | ||
1966 | musb->g.dev.driver = NULL; | ||
1967 | |||
1968 | err0: | 1939 | err0: |
1969 | return retval; | 1940 | return retval; |
1970 | } | 1941 | } |
1971 | EXPORT_SYMBOL(usb_gadget_probe_driver); | ||
1972 | 1942 | ||
1973 | static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) | 1943 | static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) |
1974 | { | 1944 | { |
@@ -2018,17 +1988,12 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) | |||
2018 | * | 1988 | * |
2019 | * @param driver the gadget driver to unregister | 1989 | * @param driver the gadget driver to unregister |
2020 | */ | 1990 | */ |
2021 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 1991 | static int musb_gadget_stop(struct usb_gadget *g, |
1992 | struct usb_gadget_driver *driver) | ||
2022 | { | 1993 | { |
2023 | struct musb *musb = the_gadget; | 1994 | struct musb *musb = gadget_to_musb(g); |
2024 | unsigned long flags; | 1995 | unsigned long flags; |
2025 | 1996 | ||
2026 | if (!driver || !driver->unbind || !musb) | ||
2027 | return -EINVAL; | ||
2028 | |||
2029 | if (!musb->gadget_driver) | ||
2030 | return -EINVAL; | ||
2031 | |||
2032 | if (musb->xceiv->last_event == USB_EVENT_NONE) | 1997 | if (musb->xceiv->last_event == USB_EVENT_NONE) |
2033 | pm_runtime_get_sync(musb->controller); | 1998 | pm_runtime_get_sync(musb->controller); |
2034 | 1999 | ||
@@ -2039,9 +2004,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2039 | 2004 | ||
2040 | spin_lock_irqsave(&musb->lock, flags); | 2005 | spin_lock_irqsave(&musb->lock, flags); |
2041 | 2006 | ||
2042 | #ifdef CONFIG_USB_MUSB_OTG | ||
2043 | musb_hnp_stop(musb); | 2007 | musb_hnp_stop(musb); |
2044 | #endif | ||
2045 | 2008 | ||
2046 | (void) musb_gadget_vbus_draw(&musb->g, 0); | 2009 | (void) musb_gadget_vbus_draw(&musb->g, 0); |
2047 | 2010 | ||
@@ -2051,13 +2014,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2051 | 2014 | ||
2052 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); | 2015 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); |
2053 | 2016 | ||
2054 | spin_unlock_irqrestore(&musb->lock, flags); | ||
2055 | driver->unbind(&musb->g); | ||
2056 | spin_lock_irqsave(&musb->lock, flags); | ||
2057 | |||
2058 | musb->gadget_driver = NULL; | ||
2059 | musb->g.dev.driver = NULL; | ||
2060 | |||
2061 | musb->is_active = 0; | 2017 | musb->is_active = 0; |
2062 | musb_platform_try_idle(musb, 0); | 2018 | musb_platform_try_idle(musb, 0); |
2063 | spin_unlock_irqrestore(&musb->lock, flags); | 2019 | spin_unlock_irqrestore(&musb->lock, flags); |
@@ -2077,8 +2033,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2077 | 2033 | ||
2078 | return 0; | 2034 | return 0; |
2079 | } | 2035 | } |
2080 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | ||
2081 | |||
2082 | 2036 | ||
2083 | /* ----------------------------------------------------------------------- */ | 2037 | /* ----------------------------------------------------------------------- */ |
2084 | 2038 | ||
@@ -2164,7 +2118,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2164 | 2118 | ||
2165 | switch (musb->xceiv->state) { | 2119 | switch (musb->xceiv->state) { |
2166 | default: | 2120 | default: |
2167 | #ifdef CONFIG_USB_MUSB_OTG | ||
2168 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", | 2121 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", |
2169 | otg_state_string(musb->xceiv->state)); | 2122 | otg_state_string(musb->xceiv->state)); |
2170 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2123 | musb->xceiv->state = OTG_STATE_A_IDLE; |
@@ -2176,7 +2129,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2176 | break; | 2129 | break; |
2177 | case OTG_STATE_B_WAIT_ACON: | 2130 | case OTG_STATE_B_WAIT_ACON: |
2178 | case OTG_STATE_B_HOST: | 2131 | case OTG_STATE_B_HOST: |
2179 | #endif | ||
2180 | case OTG_STATE_B_PERIPHERAL: | 2132 | case OTG_STATE_B_PERIPHERAL: |
2181 | case OTG_STATE_B_IDLE: | 2133 | case OTG_STATE_B_IDLE: |
2182 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2134 | 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"); |