diff options
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/Kconfig | 78 | ||||
-rw-r--r-- | drivers/usb/musb/Makefile | 4 | ||||
-rw-r--r-- | drivers/usb/musb/am35x.c | 4 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.h | 2 | ||||
-rw-r--r-- | drivers/usb/musb/cppi_dma.c | 26 | ||||
-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 | 141 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.h | 82 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 111 | ||||
-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_regs.h | 6 | ||||
-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 | 27 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010_omap.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/ux500_dma.c | 38 |
19 files changed, 131 insertions, 438 deletions
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 13093481f91..fc34b8b1191 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -3,12 +3,9 @@ | |||
3 | # for silicon based on Mentor Graphics INVENTRA designs | 3 | # for silicon based on Mentor Graphics INVENTRA designs |
4 | # | 4 | # |
5 | 5 | ||
6 | comment "Enable Host or Gadget support to see Inventra options" | ||
7 | depends on !USB && USB_GADGET=n | ||
8 | |||
9 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller | 6 | # (M)HDRC = (Multipoint) Highspeed Dual-Role Controller |
10 | config USB_MUSB_HDRC | 7 | config USB_MUSB_HDRC |
11 | depends on (USB || USB_GADGET) | 8 | depends on USB && USB_GADGET |
12 | depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523)) | 9 | depends on (ARM || (BF54x && !BF544) || (BF52x && !BF522 && !BF523)) |
13 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) | 10 | select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) |
14 | select TWL4030_USB if MACH_OMAP_3430SDP | 11 | select TWL4030_USB if MACH_OMAP_3430SDP |
@@ -67,79 +64,6 @@ config USB_MUSB_UX500 | |||
67 | 64 | ||
68 | endchoice | 65 | endchoice |
69 | 66 | ||
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 | 67 | config MUSB_PIO_ONLY |
144 | bool 'Disable DMA (always use PIO)' | 68 | bool 'Disable DMA (always use PIO)' |
145 | depends on USB_MUSB_HDRC | 69 | depends on USB_MUSB_HDRC |
diff --git a/drivers/usb/musb/Makefile b/drivers/usb/musb/Makefile index c4d228b6ef8..d8fd9d092de 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 23ac28f98d9..08f1d0b662a 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.c b/drivers/usb/musb/blackfin.c index ae8c3961774..5e7cfba5b07 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/prefetch.h> | ||
20 | 21 | ||
21 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
22 | 23 | ||
diff --git a/drivers/usb/musb/blackfin.h b/drivers/usb/musb/blackfin.h index bd9352a2ef2..c84dae546dc 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/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index 149f3f310a0..318fb4e8a88 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
@@ -226,8 +226,10 @@ static int cppi_controller_stop(struct dma_controller *c) | |||
226 | struct cppi *controller; | 226 | struct cppi *controller; |
227 | void __iomem *tibase; | 227 | void __iomem *tibase; |
228 | int i; | 228 | int i; |
229 | struct musb *musb; | ||
229 | 230 | ||
230 | controller = container_of(c, struct cppi, controller); | 231 | controller = container_of(c, struct cppi, controller); |
232 | musb = controller->musb; | ||
231 | 233 | ||
232 | tibase = controller->tibase; | 234 | tibase = controller->tibase; |
233 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ | 235 | /* DISABLE INDIVIDUAL CHANNEL Interrupts */ |
@@ -289,9 +291,11 @@ cppi_channel_allocate(struct dma_controller *c, | |||
289 | u8 index; | 291 | u8 index; |
290 | struct cppi_channel *cppi_ch; | 292 | struct cppi_channel *cppi_ch; |
291 | void __iomem *tibase; | 293 | void __iomem *tibase; |
294 | struct musb *musb; | ||
292 | 295 | ||
293 | controller = container_of(c, struct cppi, controller); | 296 | controller = container_of(c, struct cppi, controller); |
294 | tibase = controller->tibase; | 297 | tibase = controller->tibase; |
298 | musb = controller->musb; | ||
295 | 299 | ||
296 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ | 300 | /* ep0 doesn't use DMA; remember cppi indices are 0..N-1 */ |
297 | index = ep->epnum - 1; | 301 | index = ep->epnum - 1; |
@@ -339,7 +343,8 @@ static void cppi_channel_release(struct dma_channel *channel) | |||
339 | c = container_of(channel, struct cppi_channel, channel); | 343 | c = container_of(channel, struct cppi_channel, channel); |
340 | tibase = c->controller->tibase; | 344 | tibase = c->controller->tibase; |
341 | if (!c->hw_ep) | 345 | if (!c->hw_ep) |
342 | dev_dbg(musb->controller, "releasing idle DMA channel %p\n", c); | 346 | dev_dbg(c->controller->musb->controller, |
347 | "releasing idle DMA channel %p\n", c); | ||
343 | else if (!c->transmit) | 348 | else if (!c->transmit) |
344 | core_rxirq_enable(tibase, c->index + 1); | 349 | core_rxirq_enable(tibase, c->index + 1); |
345 | 350 | ||
@@ -357,10 +362,11 @@ cppi_dump_rx(int level, struct cppi_channel *c, const char *tag) | |||
357 | 362 | ||
358 | musb_ep_select(base, c->index + 1); | 363 | musb_ep_select(base, c->index + 1); |
359 | 364 | ||
360 | DBG(level, "RX DMA%d%s: %d left, csr %04x, " | 365 | dev_dbg(c->controller->musb->controller, |
361 | "%08x H%08x S%08x C%08x, " | 366 | "RX DMA%d%s: %d left, csr %04x, " |
362 | "B%08x L%08x %08x .. %08x" | 367 | "%08x H%08x S%08x C%08x, " |
363 | "\n", | 368 | "B%08x L%08x %08x .. %08x" |
369 | "\n", | ||
364 | c->index, tag, | 370 | c->index, tag, |
365 | musb_readl(c->controller->tibase, | 371 | musb_readl(c->controller->tibase, |
366 | DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index), | 372 | DAVINCI_RXCPPI_BUFCNT0_REG + 4 * c->index), |
@@ -387,10 +393,11 @@ cppi_dump_tx(int level, struct cppi_channel *c, const char *tag) | |||
387 | 393 | ||
388 | musb_ep_select(base, c->index + 1); | 394 | musb_ep_select(base, c->index + 1); |
389 | 395 | ||
390 | DBG(level, "TX DMA%d%s: csr %04x, " | 396 | dev_dbg(c->controller->musb->controller, |
391 | "H%08x S%08x C%08x %08x, " | 397 | "TX DMA%d%s: csr %04x, " |
392 | "F%08x L%08x .. %08x" | 398 | "H%08x S%08x C%08x %08x, " |
393 | "\n", | 399 | "F%08x L%08x .. %08x" |
400 | "\n", | ||
394 | c->index, tag, | 401 | c->index, tag, |
395 | musb_readw(c->hw_ep->regs, MUSB_TXCSR), | 402 | musb_readw(c->hw_ep->regs, MUSB_TXCSR), |
396 | 403 | ||
@@ -1022,6 +1029,7 @@ static bool cppi_rx_scan(struct cppi *cppi, unsigned ch) | |||
1022 | int i; | 1029 | int i; |
1023 | dma_addr_t safe2ack; | 1030 | dma_addr_t safe2ack; |
1024 | void __iomem *regs = rx->hw_ep->regs; | 1031 | void __iomem *regs = rx->hw_ep->regs; |
1032 | struct musb *musb = cppi->musb; | ||
1025 | 1033 | ||
1026 | cppi_dump_rx(6, rx, "/K"); | 1034 | cppi_dump_rx(6, rx, "/K"); |
1027 | 1035 | ||
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 662ed34980b..4da7492ddbd 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 2a2adf6492c..8bdf25a8b02 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 c71b0372786..96c5dbd1e0e 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 | /* |
@@ -1955,7 +1892,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1955 | * - initializes musb->xceiv, usually by otg_get_transceiver() | 1892 | * - initializes musb->xceiv, usually by otg_get_transceiver() |
1956 | * - stops powering VBUS | 1893 | * - stops powering VBUS |
1957 | * | 1894 | * |
1958 | * There are various transciever configurations. Blackfin, | 1895 | * There are various transceiver configurations. Blackfin, |
1959 | * DaVinci, TUSB60x0, and others integrate them. OMAP3 uses | 1896 | * DaVinci, TUSB60x0, and others integrate them. OMAP3 uses |
1960 | * external/discrete ones in various flavors (twl4030 family, | 1897 | * external/discrete ones in various flavors (twl4030 family, |
1961 | * isp1504, non-OTG, etc) mostly hooking up through ULPI. | 1898 | * isp1504, non-OTG, etc) mostly hooking up through ULPI. |
@@ -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); |
@@ -2078,8 +2013,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
2078 | if (status < 0) | 2013 | if (status < 0) |
2079 | goto fail3; | 2014 | goto fail3; |
2080 | 2015 | ||
2081 | pm_runtime_put(musb->controller); | ||
2082 | |||
2083 | status = musb_init_debugfs(musb); | 2016 | status = musb_init_debugfs(musb); |
2084 | if (status < 0) | 2017 | if (status < 0) |
2085 | goto fail4; | 2018 | goto fail4; |
@@ -2214,7 +2147,16 @@ static void musb_save_context(struct musb *musb) | |||
2214 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); | 2147 | musb->context.devctl = musb_readb(musb_base, MUSB_DEVCTL); |
2215 | 2148 | ||
2216 | for (i = 0; i < musb->config->num_eps; ++i) { | 2149 | for (i = 0; i < musb->config->num_eps; ++i) { |
2217 | epio = musb->endpoints[i].regs; | 2150 | struct musb_hw_ep *hw_ep; |
2151 | |||
2152 | hw_ep = &musb->endpoints[i]; | ||
2153 | if (!hw_ep) | ||
2154 | continue; | ||
2155 | |||
2156 | epio = hw_ep->regs; | ||
2157 | if (!epio) | ||
2158 | continue; | ||
2159 | |||
2218 | musb->context.index_regs[i].txmaxp = | 2160 | musb->context.index_regs[i].txmaxp = |
2219 | musb_readw(epio, MUSB_TXMAXP); | 2161 | musb_readw(epio, MUSB_TXMAXP); |
2220 | musb->context.index_regs[i].txcsr = | 2162 | musb->context.index_regs[i].txcsr = |
@@ -2280,7 +2222,16 @@ static void musb_restore_context(struct musb *musb) | |||
2280 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); | 2222 | musb_writeb(musb_base, MUSB_DEVCTL, musb->context.devctl); |
2281 | 2223 | ||
2282 | for (i = 0; i < musb->config->num_eps; ++i) { | 2224 | for (i = 0; i < musb->config->num_eps; ++i) { |
2283 | epio = musb->endpoints[i].regs; | 2225 | struct musb_hw_ep *hw_ep; |
2226 | |||
2227 | hw_ep = &musb->endpoints[i]; | ||
2228 | if (!hw_ep) | ||
2229 | continue; | ||
2230 | |||
2231 | epio = hw_ep->regs; | ||
2232 | if (!epio) | ||
2233 | continue; | ||
2234 | |||
2284 | musb_writew(epio, MUSB_TXMAXP, | 2235 | musb_writew(epio, MUSB_TXMAXP, |
2285 | musb->context.index_regs[i].txmaxp); | 2236 | musb->context.index_regs[i].txmaxp); |
2286 | musb_writew(epio, MUSB_TXCSR, | 2237 | musb_writew(epio, MUSB_TXCSR, |
@@ -2329,13 +2280,13 @@ static void musb_restore_context(struct musb *musb) | |||
2329 | musb->context.index_regs[i].rxhubport); | 2280 | musb->context.index_regs[i].rxhubport); |
2330 | } | 2281 | } |
2331 | } | 2282 | } |
2283 | musb_writeb(musb_base, MUSB_INDEX, musb->context.index); | ||
2332 | } | 2284 | } |
2333 | 2285 | ||
2334 | static int musb_suspend(struct device *dev) | 2286 | static int musb_suspend(struct device *dev) |
2335 | { | 2287 | { |
2336 | struct platform_device *pdev = to_platform_device(dev); | 2288 | struct musb *musb = dev_to_musb(dev); |
2337 | unsigned long flags; | 2289 | unsigned long flags; |
2338 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
2339 | 2290 | ||
2340 | spin_lock_irqsave(&musb->lock, flags); | 2291 | spin_lock_irqsave(&musb->lock, flags); |
2341 | 2292 | ||
@@ -2349,19 +2300,12 @@ static int musb_suspend(struct device *dev) | |||
2349 | */ | 2300 | */ |
2350 | } | 2301 | } |
2351 | 2302 | ||
2352 | musb_save_context(musb); | ||
2353 | |||
2354 | spin_unlock_irqrestore(&musb->lock, flags); | 2303 | spin_unlock_irqrestore(&musb->lock, flags); |
2355 | return 0; | 2304 | return 0; |
2356 | } | 2305 | } |
2357 | 2306 | ||
2358 | static int musb_resume_noirq(struct device *dev) | 2307 | static int musb_resume_noirq(struct device *dev) |
2359 | { | 2308 | { |
2360 | struct platform_device *pdev = to_platform_device(dev); | ||
2361 | struct musb *musb = dev_to_musb(&pdev->dev); | ||
2362 | |||
2363 | musb_restore_context(musb); | ||
2364 | |||
2365 | /* for static cmos like DaVinci, register values were preserved | 2309 | /* for static cmos like DaVinci, register values were preserved |
2366 | * unless for some reason the whole soc powered down or the USB | 2310 | * unless for some reason the whole soc powered down or the USB |
2367 | * module got reset through the PSC (vs just being disabled). | 2311 | * module got reset through the PSC (vs just being disabled). |
@@ -2426,34 +2370,13 @@ static struct platform_driver musb_driver = { | |||
2426 | 2370 | ||
2427 | static int __init musb_init(void) | 2371 | static int __init musb_init(void) |
2428 | { | 2372 | { |
2429 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
2430 | if (usb_disabled()) | 2373 | if (usb_disabled()) |
2431 | return 0; | 2374 | return 0; |
2432 | #endif | ||
2433 | 2375 | ||
2434 | pr_info("%s: version " MUSB_VERSION ", " | 2376 | 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?" | 2377 | "?dma?" |
2447 | #endif | ||
2448 | ", " | 2378 | ", " |
2449 | #ifdef CONFIG_USB_MUSB_OTG | 2379 | "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); | 2380 | musb_driver_name); |
2458 | return platform_driver_probe(&musb_driver, musb_probe); | 2381 | return platform_driver_probe(&musb_driver, musb_probe); |
2459 | } | 2382 | } |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 0e053b58796..b3c065ab9db 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 |
@@ -222,7 +172,8 @@ enum musb_g_ep0_state { | |||
222 | #endif | 172 | #endif |
223 | 173 | ||
224 | /* TUSB mapping: "flat" plus ep0 special cases */ | 174 | /* TUSB mapping: "flat" plus ep0 special cases */ |
225 | #if defined(CONFIG_USB_MUSB_TUSB6010) | 175 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
176 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
226 | #define musb_ep_select(_mbase, _epnum) \ | 177 | #define musb_ep_select(_mbase, _epnum) \ |
227 | musb_writeb((_mbase), MUSB_INDEX, (_epnum)) | 178 | musb_writeb((_mbase), MUSB_INDEX, (_epnum)) |
228 | #define MUSB_EP_OFFSET MUSB_TUSB_OFFSET | 179 | #define MUSB_EP_OFFSET MUSB_TUSB_OFFSET |
@@ -261,7 +212,7 @@ enum musb_g_ep0_state { | |||
261 | * @try_ilde: tries to idle the IP | 212 | * @try_ilde: tries to idle the IP |
262 | * @vbus_status: returns vbus status if possible | 213 | * @vbus_status: returns vbus status if possible |
263 | * @set_vbus: forces vbus status | 214 | * @set_vbus: forces vbus status |
264 | * @channel_program: pre check for standard dma channel_program func | 215 | * @adjust_channel_params: pre check for standard dma channel_program func |
265 | */ | 216 | */ |
266 | struct musb_platform_ops { | 217 | struct musb_platform_ops { |
267 | int (*init)(struct musb *musb); | 218 | int (*init)(struct musb *musb); |
@@ -291,7 +242,8 @@ struct musb_hw_ep { | |||
291 | void __iomem *fifo; | 242 | void __iomem *fifo; |
292 | void __iomem *regs; | 243 | void __iomem *regs; |
293 | 244 | ||
294 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 245 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
246 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
295 | void __iomem *conf; | 247 | void __iomem *conf; |
296 | #endif | 248 | #endif |
297 | 249 | ||
@@ -308,14 +260,14 @@ struct musb_hw_ep { | |||
308 | struct dma_channel *tx_channel; | 260 | struct dma_channel *tx_channel; |
309 | struct dma_channel *rx_channel; | 261 | struct dma_channel *rx_channel; |
310 | 262 | ||
311 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 263 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
264 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
312 | /* TUSB has "asynchronous" and "synchronous" dma modes */ | 265 | /* TUSB has "asynchronous" and "synchronous" dma modes */ |
313 | dma_addr_t fifo_async; | 266 | dma_addr_t fifo_async; |
314 | dma_addr_t fifo_sync; | 267 | dma_addr_t fifo_sync; |
315 | void __iomem *fifo_sync_va; | 268 | void __iomem *fifo_sync_va; |
316 | #endif | 269 | #endif |
317 | 270 | ||
318 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
319 | void __iomem *target_regs; | 271 | void __iomem *target_regs; |
320 | 272 | ||
321 | /* currently scheduled peripheral endpoint */ | 273 | /* currently scheduled peripheral endpoint */ |
@@ -324,31 +276,20 @@ struct musb_hw_ep { | |||
324 | 276 | ||
325 | u8 rx_reinit; | 277 | u8 rx_reinit; |
326 | u8 tx_reinit; | 278 | u8 tx_reinit; |
327 | #endif | ||
328 | 279 | ||
329 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
330 | /* peripheral side */ | 280 | /* peripheral side */ |
331 | struct musb_ep ep_in; /* TX */ | 281 | struct musb_ep ep_in; /* TX */ |
332 | struct musb_ep ep_out; /* RX */ | 282 | struct musb_ep ep_out; /* RX */ |
333 | #endif | ||
334 | }; | 283 | }; |
335 | 284 | ||
336 | static inline struct musb_request *next_in_request(struct musb_hw_ep *hw_ep) | 285 | static inline struct musb_request *next_in_request(struct musb_hw_ep *hw_ep) |
337 | { | 286 | { |
338 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
339 | return next_request(&hw_ep->ep_in); | 287 | return next_request(&hw_ep->ep_in); |
340 | #else | ||
341 | return NULL; | ||
342 | #endif | ||
343 | } | 288 | } |
344 | 289 | ||
345 | static inline struct musb_request *next_out_request(struct musb_hw_ep *hw_ep) | 290 | static inline struct musb_request *next_out_request(struct musb_hw_ep *hw_ep) |
346 | { | 291 | { |
347 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
348 | return next_request(&hw_ep->ep_out); | 292 | return next_request(&hw_ep->ep_out); |
349 | #else | ||
350 | return NULL; | ||
351 | #endif | ||
352 | } | 293 | } |
353 | 294 | ||
354 | struct musb_csr_regs { | 295 | struct musb_csr_regs { |
@@ -393,7 +334,6 @@ struct musb { | |||
393 | 334 | ||
394 | u32 port1_status; | 335 | u32 port1_status; |
395 | 336 | ||
396 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
397 | unsigned long rh_timer; | 337 | unsigned long rh_timer; |
398 | 338 | ||
399 | enum musb_h_ep0_state ep0_stage; | 339 | enum musb_h_ep0_state ep0_stage; |
@@ -411,7 +351,6 @@ struct musb { | |||
411 | struct list_head out_bulk; /* of musb_qh */ | 351 | struct list_head out_bulk; /* of musb_qh */ |
412 | 352 | ||
413 | struct timer_list otg_timer; | 353 | struct timer_list otg_timer; |
414 | #endif | ||
415 | struct notifier_block nb; | 354 | struct notifier_block nb; |
416 | 355 | ||
417 | struct dma_controller *dma_controller; | 356 | struct dma_controller *dma_controller; |
@@ -420,7 +359,8 @@ struct musb { | |||
420 | void __iomem *ctrl_base; | 359 | void __iomem *ctrl_base; |
421 | void __iomem *mregs; | 360 | void __iomem *mregs; |
422 | 361 | ||
423 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 362 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
363 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
424 | dma_addr_t async; | 364 | dma_addr_t async; |
425 | dma_addr_t sync; | 365 | dma_addr_t sync; |
426 | void __iomem *sync_va; | 366 | void __iomem *sync_va; |
@@ -472,7 +412,6 @@ struct musb { | |||
472 | #define can_bulk_combine(musb,type) \ | 412 | #define can_bulk_combine(musb,type) \ |
473 | (((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine) | 413 | (((type) == USB_ENDPOINT_XFER_BULK) && (musb)->bulk_combine) |
474 | 414 | ||
475 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
476 | /* is_suspended means USB B_PERIPHERAL suspend */ | 415 | /* is_suspended means USB B_PERIPHERAL suspend */ |
477 | unsigned is_suspended:1; | 416 | unsigned is_suspended:1; |
478 | 417 | ||
@@ -496,7 +435,6 @@ struct musb { | |||
496 | enum musb_g_ep0_state ep0_state; | 435 | enum musb_g_ep0_state ep0_state; |
497 | struct usb_gadget g; /* the gadget */ | 436 | struct usb_gadget g; /* the gadget */ |
498 | struct usb_gadget_driver *gadget_driver; /* its driver */ | 437 | struct usb_gadget_driver *gadget_driver; /* its driver */ |
499 | #endif | ||
500 | 438 | ||
501 | /* | 439 | /* |
502 | * FIXME: Remove this flag. | 440 | * FIXME: Remove this flag. |
@@ -518,12 +456,10 @@ struct musb { | |||
518 | #endif | 456 | #endif |
519 | }; | 457 | }; |
520 | 458 | ||
521 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
522 | static inline struct musb *gadget_to_musb(struct usb_gadget *g) | 459 | static inline struct musb *gadget_to_musb(struct usb_gadget *g) |
523 | { | 460 | { |
524 | return container_of(g, struct musb, g); | 461 | return container_of(g, struct musb, g); |
525 | } | 462 | } |
526 | #endif | ||
527 | 463 | ||
528 | #ifdef CONFIG_BLACKFIN | 464 | #ifdef CONFIG_BLACKFIN |
529 | static inline int musb_read_fifosize(struct musb *musb, | 465 | 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 6aeb363e63e..e81820370d6 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 | ||
@@ -1698,6 +1698,8 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | |||
1698 | 1698 | ||
1699 | is_on = !!is_on; | 1699 | is_on = !!is_on; |
1700 | 1700 | ||
1701 | pm_runtime_get_sync(musb->controller); | ||
1702 | |||
1701 | /* NOTE: this assumes we are sensing vbus; we'd rather | 1703 | /* NOTE: this assumes we are sensing vbus; we'd rather |
1702 | * not pullup unless the B-session is active. | 1704 | * not pullup unless the B-session is active. |
1703 | */ | 1705 | */ |
@@ -1707,9 +1709,17 @@ static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | |||
1707 | musb_pullup(musb, is_on); | 1709 | musb_pullup(musb, is_on); |
1708 | } | 1710 | } |
1709 | spin_unlock_irqrestore(&musb->lock, flags); | 1711 | spin_unlock_irqrestore(&musb->lock, flags); |
1712 | |||
1713 | pm_runtime_put(musb->controller); | ||
1714 | |||
1710 | return 0; | 1715 | return 0; |
1711 | } | 1716 | } |
1712 | 1717 | ||
1718 | static int musb_gadget_start(struct usb_gadget *g, | ||
1719 | struct usb_gadget_driver *driver); | ||
1720 | static int musb_gadget_stop(struct usb_gadget *g, | ||
1721 | struct usb_gadget_driver *driver); | ||
1722 | |||
1713 | static const struct usb_gadget_ops musb_gadget_operations = { | 1723 | static const struct usb_gadget_ops musb_gadget_operations = { |
1714 | .get_frame = musb_gadget_get_frame, | 1724 | .get_frame = musb_gadget_get_frame, |
1715 | .wakeup = musb_gadget_wakeup, | 1725 | .wakeup = musb_gadget_wakeup, |
@@ -1717,6 +1727,8 @@ static const struct usb_gadget_ops musb_gadget_operations = { | |||
1717 | /* .vbus_session = musb_gadget_vbus_session, */ | 1727 | /* .vbus_session = musb_gadget_vbus_session, */ |
1718 | .vbus_draw = musb_gadget_vbus_draw, | 1728 | .vbus_draw = musb_gadget_vbus_draw, |
1719 | .pullup = musb_gadget_pullup, | 1729 | .pullup = musb_gadget_pullup, |
1730 | .udc_start = musb_gadget_start, | ||
1731 | .udc_stop = musb_gadget_stop, | ||
1720 | }; | 1732 | }; |
1721 | 1733 | ||
1722 | /* ----------------------------------------------------------------------- */ | 1734 | /* ----------------------------------------------------------------------- */ |
@@ -1727,7 +1739,6 @@ static const struct usb_gadget_ops musb_gadget_operations = { | |||
1727 | * about there being only one external upstream port. It assumes | 1739 | * about there being only one external upstream port. It assumes |
1728 | * all peripheral ports are external... | 1740 | * all peripheral ports are external... |
1729 | */ | 1741 | */ |
1730 | static struct musb *the_gadget; | ||
1731 | 1742 | ||
1732 | static void musb_gadget_release(struct device *dev) | 1743 | static void musb_gadget_release(struct device *dev) |
1733 | { | 1744 | { |
@@ -1814,9 +1825,6 @@ int __init musb_gadget_setup(struct musb *musb) | |||
1814 | * musb peripherals at the same time, only the bus lock | 1825 | * musb peripherals at the same time, only the bus lock |
1815 | * is probably held. | 1826 | * is probably held. |
1816 | */ | 1827 | */ |
1817 | if (the_gadget) | ||
1818 | return -EBUSY; | ||
1819 | the_gadget = musb; | ||
1820 | 1828 | ||
1821 | musb->g.ops = &musb_gadget_operations; | 1829 | musb->g.ops = &musb_gadget_operations; |
1822 | musb->g.is_dualspeed = 1; | 1830 | musb->g.is_dualspeed = 1; |
@@ -1840,18 +1848,24 @@ int __init musb_gadget_setup(struct musb *musb) | |||
1840 | status = device_register(&musb->g.dev); | 1848 | status = device_register(&musb->g.dev); |
1841 | if (status != 0) { | 1849 | if (status != 0) { |
1842 | put_device(&musb->g.dev); | 1850 | put_device(&musb->g.dev); |
1843 | the_gadget = NULL; | 1851 | return status; |
1844 | } | 1852 | } |
1853 | status = usb_add_gadget_udc(musb->controller, &musb->g); | ||
1854 | if (status) | ||
1855 | goto err; | ||
1856 | |||
1857 | return 0; | ||
1858 | err: | ||
1859 | musb->g.dev.parent = NULL; | ||
1860 | device_unregister(&musb->g.dev); | ||
1845 | return status; | 1861 | return status; |
1846 | } | 1862 | } |
1847 | 1863 | ||
1848 | void musb_gadget_cleanup(struct musb *musb) | 1864 | void musb_gadget_cleanup(struct musb *musb) |
1849 | { | 1865 | { |
1850 | if (musb != the_gadget) | 1866 | usb_del_gadget_udc(&musb->g); |
1851 | return; | 1867 | if (musb->g.dev.parent) |
1852 | 1868 | device_unregister(&musb->g.dev); | |
1853 | device_unregister(&musb->g.dev); | ||
1854 | the_gadget = NULL; | ||
1855 | } | 1869 | } |
1856 | 1870 | ||
1857 | /* | 1871 | /* |
@@ -1863,59 +1877,30 @@ void musb_gadget_cleanup(struct musb *musb) | |||
1863 | * -ENOMEM no memory to perform the operation | 1877 | * -ENOMEM no memory to perform the operation |
1864 | * | 1878 | * |
1865 | * @param driver the gadget driver | 1879 | * @param driver the gadget driver |
1866 | * @param bind the driver's bind function | ||
1867 | * @return <0 if error, 0 if everything is fine | 1880 | * @return <0 if error, 0 if everything is fine |
1868 | */ | 1881 | */ |
1869 | int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | 1882 | static int musb_gadget_start(struct usb_gadget *g, |
1870 | int (*bind)(struct usb_gadget *)) | 1883 | struct usb_gadget_driver *driver) |
1871 | { | 1884 | { |
1872 | struct musb *musb = the_gadget; | 1885 | struct musb *musb = gadget_to_musb(g); |
1873 | unsigned long flags; | 1886 | unsigned long flags; |
1874 | int retval = -EINVAL; | 1887 | int retval = -EINVAL; |
1875 | 1888 | ||
1876 | if (!driver | 1889 | if (driver->speed != USB_SPEED_HIGH) |
1877 | || driver->speed != USB_SPEED_HIGH | ||
1878 | || !bind || !driver->setup) | ||
1879 | goto err0; | 1890 | goto err0; |
1880 | 1891 | ||
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; | ||
1886 | } | ||
1887 | |||
1888 | pm_runtime_get_sync(musb->controller); | 1892 | pm_runtime_get_sync(musb->controller); |
1889 | 1893 | ||
1890 | dev_dbg(musb->controller, "registering driver %s\n", driver->function); | 1894 | dev_dbg(musb->controller, "registering driver %s\n", driver->function); |
1891 | 1895 | ||
1892 | if (musb->gadget_driver) { | 1896 | 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; | 1897 | 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 | 1898 | ||
1914 | spin_lock_irqsave(&musb->lock, flags); | 1899 | spin_lock_irqsave(&musb->lock, flags); |
1900 | musb->is_active = 1; | ||
1915 | 1901 | ||
1916 | otg_set_peripheral(musb->xceiv, &musb->g); | 1902 | otg_set_peripheral(musb->xceiv, &musb->g); |
1917 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1903 | musb->xceiv->state = OTG_STATE_B_IDLE; |
1918 | musb->is_active = 1; | ||
1919 | 1904 | ||
1920 | /* | 1905 | /* |
1921 | * FIXME this ignores the softconnect flag. Drivers are | 1906 | * FIXME this ignores the softconnect flag. Drivers are |
@@ -1927,8 +1912,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1927 | if (!is_otg_enabled(musb)) | 1912 | if (!is_otg_enabled(musb)) |
1928 | musb_start(musb); | 1913 | musb_start(musb); |
1929 | 1914 | ||
1930 | otg_set_peripheral(musb->xceiv, &musb->g); | ||
1931 | |||
1932 | spin_unlock_irqrestore(&musb->lock, flags); | 1915 | spin_unlock_irqrestore(&musb->lock, flags); |
1933 | 1916 | ||
1934 | if (is_otg_enabled(musb)) { | 1917 | if (is_otg_enabled(musb)) { |
@@ -1960,15 +1943,9 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, | |||
1960 | err2: | 1943 | err2: |
1961 | if (!is_otg_enabled(musb)) | 1944 | if (!is_otg_enabled(musb)) |
1962 | musb_stop(musb); | 1945 | musb_stop(musb); |
1963 | |||
1964 | err1: | ||
1965 | musb->gadget_driver = NULL; | ||
1966 | musb->g.dev.driver = NULL; | ||
1967 | |||
1968 | err0: | 1946 | err0: |
1969 | return retval; | 1947 | return retval; |
1970 | } | 1948 | } |
1971 | EXPORT_SYMBOL(usb_gadget_probe_driver); | ||
1972 | 1949 | ||
1973 | static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) | 1950 | static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) |
1974 | { | 1951 | { |
@@ -2018,17 +1995,12 @@ static void stop_activity(struct musb *musb, struct usb_gadget_driver *driver) | |||
2018 | * | 1995 | * |
2019 | * @param driver the gadget driver to unregister | 1996 | * @param driver the gadget driver to unregister |
2020 | */ | 1997 | */ |
2021 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 1998 | static int musb_gadget_stop(struct usb_gadget *g, |
1999 | struct usb_gadget_driver *driver) | ||
2022 | { | 2000 | { |
2023 | struct musb *musb = the_gadget; | 2001 | struct musb *musb = gadget_to_musb(g); |
2024 | unsigned long flags; | 2002 | unsigned long flags; |
2025 | 2003 | ||
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) | 2004 | if (musb->xceiv->last_event == USB_EVENT_NONE) |
2033 | pm_runtime_get_sync(musb->controller); | 2005 | pm_runtime_get_sync(musb->controller); |
2034 | 2006 | ||
@@ -2039,9 +2011,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2039 | 2011 | ||
2040 | spin_lock_irqsave(&musb->lock, flags); | 2012 | spin_lock_irqsave(&musb->lock, flags); |
2041 | 2013 | ||
2042 | #ifdef CONFIG_USB_MUSB_OTG | ||
2043 | musb_hnp_stop(musb); | 2014 | musb_hnp_stop(musb); |
2044 | #endif | ||
2045 | 2015 | ||
2046 | (void) musb_gadget_vbus_draw(&musb->g, 0); | 2016 | (void) musb_gadget_vbus_draw(&musb->g, 0); |
2047 | 2017 | ||
@@ -2051,13 +2021,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2051 | 2021 | ||
2052 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); | 2022 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); |
2053 | 2023 | ||
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; | 2024 | musb->is_active = 0; |
2062 | musb_platform_try_idle(musb, 0); | 2025 | musb_platform_try_idle(musb, 0); |
2063 | spin_unlock_irqrestore(&musb->lock, flags); | 2026 | spin_unlock_irqrestore(&musb->lock, flags); |
@@ -2077,8 +2040,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | |||
2077 | 2040 | ||
2078 | return 0; | 2041 | return 0; |
2079 | } | 2042 | } |
2080 | EXPORT_SYMBOL(usb_gadget_unregister_driver); | ||
2081 | |||
2082 | 2043 | ||
2083 | /* ----------------------------------------------------------------------- */ | 2044 | /* ----------------------------------------------------------------------- */ |
2084 | 2045 | ||
@@ -2164,7 +2125,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2164 | 2125 | ||
2165 | switch (musb->xceiv->state) { | 2126 | switch (musb->xceiv->state) { |
2166 | default: | 2127 | default: |
2167 | #ifdef CONFIG_USB_MUSB_OTG | ||
2168 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", | 2128 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", |
2169 | otg_state_string(musb->xceiv->state)); | 2129 | otg_state_string(musb->xceiv->state)); |
2170 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2130 | musb->xceiv->state = OTG_STATE_A_IDLE; |
@@ -2176,7 +2136,6 @@ void musb_g_disconnect(struct musb *musb) | |||
2176 | break; | 2136 | break; |
2177 | case OTG_STATE_B_WAIT_ACON: | 2137 | case OTG_STATE_B_WAIT_ACON: |
2178 | case OTG_STATE_B_HOST: | 2138 | case OTG_STATE_B_HOST: |
2179 | #endif | ||
2180 | case OTG_STATE_B_PERIPHERAL: | 2139 | case OTG_STATE_B_PERIPHERAL: |
2181 | case OTG_STATE_B_IDLE: | 2140 | case OTG_STATE_B_IDLE: |
2182 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2141 | 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 b2faff23550..9378b359c1f 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 14b00776638..622d09fb9ab 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_regs.h b/drivers/usb/musb/musb_regs.h index 82410703dcd..03f2655af29 100644 --- a/drivers/usb/musb/musb_regs.h +++ b/drivers/usb/musb/musb_regs.h | |||
@@ -234,7 +234,8 @@ | |||
234 | #define MUSB_TESTMODE 0x0F /* 8 bit */ | 234 | #define MUSB_TESTMODE 0x0F /* 8 bit */ |
235 | 235 | ||
236 | /* Get offset for a given FIFO from musb->mregs */ | 236 | /* Get offset for a given FIFO from musb->mregs */ |
237 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 237 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
238 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
238 | #define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20)) | 239 | #define MUSB_FIFO_OFFSET(epnum) (0x200 + ((epnum) * 0x20)) |
239 | #else | 240 | #else |
240 | #define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4)) | 241 | #define MUSB_FIFO_OFFSET(epnum) (0x20 + ((epnum) * 4)) |
@@ -295,7 +296,8 @@ | |||
295 | #define MUSB_FLAT_OFFSET(_epnum, _offset) \ | 296 | #define MUSB_FLAT_OFFSET(_epnum, _offset) \ |
296 | (0x100 + (0x10*(_epnum)) + (_offset)) | 297 | (0x100 + (0x10*(_epnum)) + (_offset)) |
297 | 298 | ||
298 | #ifdef CONFIG_USB_MUSB_TUSB6010 | 299 | #if defined(CONFIG_USB_MUSB_TUSB6010) || \ |
300 | defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | ||
299 | /* TUSB6010 EP0 configuration register is special */ | 301 | /* TUSB6010 EP0 configuration register is special */ |
300 | #define MUSB_TUSB_OFFSET(_epnum, _offset) \ | 302 | #define MUSB_TUSB_OFFSET(_epnum, _offset) \ |
301 | (0x10 + _offset) | 303 | (0x10 + _offset) |
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index 2d80a575883..e9f80adc45a 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 c5d4c44d0ff..ba85f273e48 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 b410357cf01..ec1480191f7 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/prefetch.h> | ||
21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
22 | #include <linux/irq.h> | 23 | #include <linux/irq.h> |
23 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
@@ -269,8 +270,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf) | |||
269 | 270 | ||
270 | static struct musb *the_musb; | 271 | static struct musb *the_musb; |
271 | 272 | ||
272 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
273 | |||
274 | /* This is used by gadget drivers, and OTG transceiver logic, allowing | 273 | /* 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 | 274 | * 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 | 275 | * (that is, while VBUS exceeds 4.4V). In Default-A (including pure host |
@@ -310,10 +309,6 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA) | |||
310 | return 0; | 309 | return 0; |
311 | } | 310 | } |
312 | 311 | ||
313 | #else | ||
314 | #define tusb_draw_power NULL | ||
315 | #endif | ||
316 | |||
317 | /* workaround for issue 13: change clock during chip idle | 312 | /* workaround for issue 13: change clock during chip idle |
318 | * (to be fixed in rev3 silicon) ... symptoms include disconnect | 313 | * (to be fixed in rev3 silicon) ... symptoms include disconnect |
319 | * or looping suspend/resume cycles | 314 | * or looping suspend/resume cycles |
@@ -440,19 +435,15 @@ static void musb_do_idle(unsigned long _musb) | |||
440 | if (is_host_active(musb) && (musb->port1_status >> 16)) | 435 | if (is_host_active(musb) && (musb->port1_status >> 16)) |
441 | goto done; | 436 | goto done; |
442 | 437 | ||
443 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | 438 | if (is_peripheral_enabled(musb) && !musb->gadget_driver) { |
444 | if (is_peripheral_enabled(musb) && !musb->gadget_driver) | ||
445 | wakeups = 0; | 439 | wakeups = 0; |
446 | else { | 440 | } else { |
447 | wakeups = TUSB_PRCM_WHOSTDISCON | 441 | wakeups = TUSB_PRCM_WHOSTDISCON |
448 | | TUSB_PRCM_WBUS | 442 | | TUSB_PRCM_WBUS |
449 | | TUSB_PRCM_WVBUS; | 443 | | TUSB_PRCM_WVBUS; |
450 | if (is_otg_enabled(musb)) | 444 | if (is_otg_enabled(musb)) |
451 | wakeups |= TUSB_PRCM_WID; | 445 | wakeups |= TUSB_PRCM_WID; |
452 | } | 446 | } |
453 | #else | ||
454 | wakeups = TUSB_PRCM_WHOSTDISCON | TUSB_PRCM_WBUS; | ||
455 | #endif | ||
456 | tusb_allow_idle(musb, wakeups); | 447 | tusb_allow_idle(musb, wakeups); |
457 | } | 448 | } |
458 | done: | 449 | done: |
@@ -610,30 +601,22 @@ static int tusb_musb_set_mode(struct musb *musb, u8 musb_mode) | |||
610 | 601 | ||
611 | switch (musb_mode) { | 602 | switch (musb_mode) { |
612 | 603 | ||
613 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
614 | case MUSB_HOST: /* Disable PHY ID detect, ground ID */ | 604 | case MUSB_HOST: /* Disable PHY ID detect, ground ID */ |
615 | phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 605 | phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
616 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 606 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
617 | dev_conf |= TUSB_DEV_CONF_ID_SEL; | 607 | dev_conf |= TUSB_DEV_CONF_ID_SEL; |
618 | dev_conf &= ~TUSB_DEV_CONF_SOFT_ID; | 608 | dev_conf &= ~TUSB_DEV_CONF_SOFT_ID; |
619 | break; | 609 | break; |
620 | #endif | ||
621 | |||
622 | #ifdef CONFIG_USB_GADGET_MUSB_HDRC | ||
623 | case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */ | 610 | case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */ |
624 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 611 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
625 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 612 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
626 | dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); | 613 | dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); |
627 | break; | 614 | break; |
628 | #endif | ||
629 | |||
630 | #ifdef CONFIG_USB_MUSB_OTG | ||
631 | case MUSB_OTG: /* Use PHY ID detection */ | 615 | case MUSB_OTG: /* Use PHY ID detection */ |
632 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 616 | phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
633 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; | 617 | phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; |
634 | dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); | 618 | dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); |
635 | break; | 619 | break; |
636 | #endif | ||
637 | 620 | ||
638 | default: | 621 | default: |
639 | dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode); | 622 | dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode); |
@@ -684,7 +667,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
684 | /* B-dev state machine: no vbus ~= disconnect */ | 667 | /* B-dev state machine: no vbus ~= disconnect */ |
685 | if ((is_otg_enabled(musb) && !musb->xceiv->default_a) | 668 | if ((is_otg_enabled(musb) && !musb->xceiv->default_a) |
686 | || !is_host_enabled(musb)) { | 669 | || !is_host_enabled(musb)) { |
687 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
688 | /* ? musb_root_disconnect(musb); */ | 670 | /* ? musb_root_disconnect(musb); */ |
689 | musb->port1_status &= | 671 | musb->port1_status &= |
690 | ~(USB_PORT_STAT_CONNECTION | 672 | ~(USB_PORT_STAT_CONNECTION |
@@ -693,7 +675,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
693 | | USB_PORT_STAT_HIGH_SPEED | 675 | | USB_PORT_STAT_HIGH_SPEED |
694 | | USB_PORT_STAT_TEST | 676 | | USB_PORT_STAT_TEST |
695 | ); | 677 | ); |
696 | #endif | ||
697 | 678 | ||
698 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { | 679 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { |
699 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); | 680 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); |
diff --git a/drivers/usb/musb/tusb6010_omap.c b/drivers/usb/musb/tusb6010_omap.c index c784e6c03aa..b67b4bc596c 100644 --- a/drivers/usb/musb/tusb6010_omap.c +++ b/drivers/usb/musb/tusb6010_omap.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <plat/mux.h> | 20 | #include <plat/mux.h> |
21 | 21 | ||
22 | #include "musb_core.h" | 22 | #include "musb_core.h" |
23 | #include "tusb6010.h" | ||
23 | 24 | ||
24 | #define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data) | 25 | #define to_chdat(c) ((struct tusb_omap_dma_ch *)(c)->private_data) |
25 | 26 | ||
@@ -89,7 +90,7 @@ static inline int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat) | |||
89 | u32 reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP); | 90 | u32 reg = musb_readl(chdat->tbase, TUSB_DMA_EP_MAP); |
90 | 91 | ||
91 | if (reg != 0) { | 92 | if (reg != 0) { |
92 | dev_dbg(musb->controller, "ep%i dmareq0 is busy for ep%i\n", | 93 | dev_dbg(chdat->musb->controller, "ep%i dmareq0 is busy for ep%i\n", |
93 | chdat->epnum, reg & 0xf); | 94 | chdat->epnum, reg & 0xf); |
94 | return -EAGAIN; | 95 | return -EAGAIN; |
95 | } | 96 | } |
diff --git a/drivers/usb/musb/ux500_dma.c b/drivers/usb/musb/ux500_dma.c index cecace41183..ef4333f4bbe 100644 --- a/drivers/usb/musb/ux500_dma.c +++ b/drivers/usb/musb/ux500_dma.c | |||
@@ -65,7 +65,8 @@ static void ux500_tx_work(struct work_struct *data) | |||
65 | struct musb *musb = hw_ep->musb; | 65 | struct musb *musb = hw_ep->musb; |
66 | unsigned long flags; | 66 | unsigned long flags; |
67 | 67 | ||
68 | DBG(4, "DMA tx transfer done on hw_ep=%d\n", hw_ep->epnum); | 68 | dev_dbg(musb->controller, "DMA tx transfer done on hw_ep=%d\n", |
69 | hw_ep->epnum); | ||
69 | 70 | ||
70 | spin_lock_irqsave(&musb->lock, flags); | 71 | spin_lock_irqsave(&musb->lock, flags); |
71 | ux500_channel->channel.actual_len = ux500_channel->cur_len; | 72 | ux500_channel->channel.actual_len = ux500_channel->cur_len; |
@@ -84,7 +85,8 @@ static void ux500_rx_work(struct work_struct *data) | |||
84 | struct musb *musb = hw_ep->musb; | 85 | struct musb *musb = hw_ep->musb; |
85 | unsigned long flags; | 86 | unsigned long flags; |
86 | 87 | ||
87 | DBG(4, "DMA rx transfer done on hw_ep=%d\n", hw_ep->epnum); | 88 | dev_dbg(musb->controller, "DMA rx transfer done on hw_ep=%d\n", |
89 | hw_ep->epnum); | ||
88 | 90 | ||
89 | spin_lock_irqsave(&musb->lock, flags); | 91 | spin_lock_irqsave(&musb->lock, flags); |
90 | ux500_channel->channel.actual_len = ux500_channel->cur_len; | 92 | ux500_channel->channel.actual_len = ux500_channel->cur_len; |
@@ -116,9 +118,11 @@ static bool ux500_configure_channel(struct dma_channel *channel, | |||
116 | enum dma_slave_buswidth addr_width; | 118 | enum dma_slave_buswidth addr_width; |
117 | dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) + | 119 | dma_addr_t usb_fifo_addr = (MUSB_FIFO_OFFSET(hw_ep->epnum) + |
118 | ux500_channel->controller->phy_base); | 120 | ux500_channel->controller->phy_base); |
121 | struct musb *musb = ux500_channel->controller->private_data; | ||
119 | 122 | ||
120 | DBG(4, "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", | 123 | dev_dbg(musb->controller, |
121 | packet_sz, mode, dma_addr, len, ux500_channel->is_tx); | 124 | "packet_sz=%d, mode=%d, dma_addr=0x%x, len=%d is_tx=%d\n", |
125 | packet_sz, mode, dma_addr, len, ux500_channel->is_tx); | ||
122 | 126 | ||
123 | ux500_channel->cur_len = len; | 127 | ux500_channel->cur_len = len; |
124 | 128 | ||
@@ -133,15 +137,13 @@ static bool ux500_configure_channel(struct dma_channel *channel, | |||
133 | DMA_SLAVE_BUSWIDTH_4_BYTES; | 137 | DMA_SLAVE_BUSWIDTH_4_BYTES; |
134 | 138 | ||
135 | slave_conf.direction = direction; | 139 | slave_conf.direction = direction; |
136 | if (direction == DMA_FROM_DEVICE) { | 140 | slave_conf.src_addr = usb_fifo_addr; |
137 | slave_conf.src_addr = usb_fifo_addr; | 141 | slave_conf.src_addr_width = addr_width; |
138 | slave_conf.src_addr_width = addr_width; | 142 | slave_conf.src_maxburst = 16; |
139 | slave_conf.src_maxburst = 16; | 143 | slave_conf.dst_addr = usb_fifo_addr; |
140 | } else { | 144 | slave_conf.dst_addr_width = addr_width; |
141 | slave_conf.dst_addr = usb_fifo_addr; | 145 | slave_conf.dst_maxburst = 16; |
142 | slave_conf.dst_addr_width = addr_width; | 146 | |
143 | slave_conf.dst_maxburst = 16; | ||
144 | } | ||
145 | dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, | 147 | dma_chan->device->device_control(dma_chan, DMA_SLAVE_CONFIG, |
146 | (unsigned long) &slave_conf); | 148 | (unsigned long) &slave_conf); |
147 | 149 | ||
@@ -166,6 +168,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
166 | struct ux500_dma_controller *controller = container_of(c, | 168 | struct ux500_dma_controller *controller = container_of(c, |
167 | struct ux500_dma_controller, controller); | 169 | struct ux500_dma_controller, controller); |
168 | struct ux500_dma_channel *ux500_channel = NULL; | 170 | struct ux500_dma_channel *ux500_channel = NULL; |
171 | struct musb *musb = controller->private_data; | ||
169 | u8 ch_num = hw_ep->epnum - 1; | 172 | u8 ch_num = hw_ep->epnum - 1; |
170 | u32 max_ch; | 173 | u32 max_ch; |
171 | 174 | ||
@@ -192,7 +195,7 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
192 | ux500_channel->hw_ep = hw_ep; | 195 | ux500_channel->hw_ep = hw_ep; |
193 | ux500_channel->is_allocated = 1; | 196 | ux500_channel->is_allocated = 1; |
194 | 197 | ||
195 | DBG(7, "hw_ep=%d, is_tx=0x%x, channel=%d\n", | 198 | dev_dbg(musb->controller, "hw_ep=%d, is_tx=0x%x, channel=%d\n", |
196 | hw_ep->epnum, is_tx, ch_num); | 199 | hw_ep->epnum, is_tx, ch_num); |
197 | 200 | ||
198 | return &(ux500_channel->channel); | 201 | return &(ux500_channel->channel); |
@@ -201,8 +204,9 @@ static struct dma_channel *ux500_dma_channel_allocate(struct dma_controller *c, | |||
201 | static void ux500_dma_channel_release(struct dma_channel *channel) | 204 | static void ux500_dma_channel_release(struct dma_channel *channel) |
202 | { | 205 | { |
203 | struct ux500_dma_channel *ux500_channel = channel->private_data; | 206 | struct ux500_dma_channel *ux500_channel = channel->private_data; |
207 | struct musb *musb = ux500_channel->controller->private_data; | ||
204 | 208 | ||
205 | DBG(7, "channel=%d\n", ux500_channel->ch_num); | 209 | dev_dbg(musb->controller, "channel=%d\n", ux500_channel->ch_num); |
206 | 210 | ||
207 | if (ux500_channel->is_allocated) { | 211 | if (ux500_channel->is_allocated) { |
208 | ux500_channel->is_allocated = 0; | 212 | ux500_channel->is_allocated = 0; |
@@ -252,8 +256,8 @@ static int ux500_dma_channel_abort(struct dma_channel *channel) | |||
252 | void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs; | 256 | void __iomem *epio = musb->endpoints[ux500_channel->hw_ep->epnum].regs; |
253 | u16 csr; | 257 | u16 csr; |
254 | 258 | ||
255 | DBG(4, "channel=%d, is_tx=%d\n", ux500_channel->ch_num, | 259 | dev_dbg(musb->controller, "channel=%d, is_tx=%d\n", |
256 | ux500_channel->is_tx); | 260 | ux500_channel->ch_num, ux500_channel->is_tx); |
257 | 261 | ||
258 | if (channel->status == MUSB_DMA_STATUS_BUSY) { | 262 | if (channel->status == MUSB_DMA_STATUS_BUSY) { |
259 | if (ux500_channel->is_tx) { | 263 | if (ux500_channel->is_tx) { |