diff options
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r-- | drivers/usb/musb/Kconfig | 2 | ||||
-rw-r--r-- | drivers/usb/musb/am35x.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/blackfin.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/da8xx.c | 7 | ||||
-rw-r--r-- | drivers/usb/musb/davinci.c | 7 | ||||
-rw-r--r-- | drivers/usb/musb/musb_core.c | 1 | ||||
-rw-r--r-- | drivers/usb/musb/musb_dsps.c | 3 | ||||
-rw-r--r-- | drivers/usb/musb/musb_gadget.c | 22 | ||||
-rw-r--r-- | drivers/usb/musb/musb_host.c | 44 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.c | 89 | ||||
-rw-r--r-- | drivers/usb/musb/omap2430.h | 9 | ||||
-rw-r--r-- | drivers/usb/musb/tusb6010.c | 2 | ||||
-rw-r--r-- | drivers/usb/musb/ux500.c | 12 |
13 files changed, 110 insertions, 92 deletions
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 23a0b7f0892d..45b19e2c60ba 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig | |||
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC | |||
11 | select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) | 11 | select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) |
12 | select TWL4030_USB if MACH_OMAP_3430SDP | 12 | select TWL4030_USB if MACH_OMAP_3430SDP |
13 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | 13 | select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA |
14 | select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA | ||
14 | select USB_OTG_UTILS | 15 | select USB_OTG_UTILS |
15 | help | 16 | help |
16 | Say Y here if your system has a dual role high speed USB | 17 | Say Y here if your system has a dual role high speed USB |
@@ -45,6 +46,7 @@ config USB_MUSB_DA8XX | |||
45 | 46 | ||
46 | config USB_MUSB_TUSB6010 | 47 | config USB_MUSB_TUSB6010 |
47 | tristate "TUSB6010" | 48 | tristate "TUSB6010" |
49 | depends on GENERIC_HARDIRQS | ||
48 | 50 | ||
49 | config USB_MUSB_OMAP2PLUS | 51 | config USB_MUSB_OMAP2PLUS |
50 | tristate "OMAP2430 and onwards" | 52 | tristate "OMAP2430 and onwards" |
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index c107d7cdfa69..59eea219034a 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -365,7 +365,7 @@ static int am35x_musb_init(struct musb *musb) | |||
365 | usb_nop_xceiv_register(); | 365 | usb_nop_xceiv_register(); |
366 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 366 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
367 | if (IS_ERR_OR_NULL(musb->xceiv)) | 367 | if (IS_ERR_OR_NULL(musb->xceiv)) |
368 | return -ENODEV; | 368 | return -EPROBE_DEFER; |
369 | 369 | ||
370 | setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); | 370 | setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); |
371 | 371 | ||
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 14dab9f9b3d0..dbb31b30c7fa 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -406,7 +406,7 @@ static int bfin_musb_init(struct musb *musb) | |||
406 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 406 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
407 | if (IS_ERR_OR_NULL(musb->xceiv)) { | 407 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
408 | gpio_free(musb->config->gpio_vrsel); | 408 | gpio_free(musb->config->gpio_vrsel); |
409 | return -ENODEV; | 409 | return -EPROBE_DEFER; |
410 | } | 410 | } |
411 | 411 | ||
412 | bfin_musb_reg_init(musb); | 412 | bfin_musb_reg_init(musb); |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 97996af2646e..7c71769d71ff 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -410,6 +410,7 @@ static int da8xx_musb_init(struct musb *musb) | |||
410 | { | 410 | { |
411 | void __iomem *reg_base = musb->ctrl_base; | 411 | void __iomem *reg_base = musb->ctrl_base; |
412 | u32 rev; | 412 | u32 rev; |
413 | int ret = -ENODEV; | ||
413 | 414 | ||
414 | musb->mregs += DA8XX_MENTOR_CORE_OFFSET; | 415 | musb->mregs += DA8XX_MENTOR_CORE_OFFSET; |
415 | 416 | ||
@@ -420,8 +421,10 @@ static int da8xx_musb_init(struct musb *musb) | |||
420 | 421 | ||
421 | usb_nop_xceiv_register(); | 422 | usb_nop_xceiv_register(); |
422 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 423 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
423 | if (IS_ERR_OR_NULL(musb->xceiv)) | 424 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
425 | ret = -EPROBE_DEFER; | ||
424 | goto fail; | 426 | goto fail; |
427 | } | ||
425 | 428 | ||
426 | setup_timer(&otg_workaround, otg_timer, (unsigned long)musb); | 429 | setup_timer(&otg_workaround, otg_timer, (unsigned long)musb); |
427 | 430 | ||
@@ -441,7 +444,7 @@ static int da8xx_musb_init(struct musb *musb) | |||
441 | musb->isr = da8xx_musb_interrupt; | 444 | musb->isr = da8xx_musb_interrupt; |
442 | return 0; | 445 | return 0; |
443 | fail: | 446 | fail: |
444 | return -ENODEV; | 447 | return ret; |
445 | } | 448 | } |
446 | 449 | ||
447 | static int da8xx_musb_exit(struct musb *musb) | 450 | static int da8xx_musb_exit(struct musb *musb) |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index b1c01cad28b2..e040d9103735 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -380,11 +380,14 @@ static int davinci_musb_init(struct musb *musb) | |||
380 | { | 380 | { |
381 | void __iomem *tibase = musb->ctrl_base; | 381 | void __iomem *tibase = musb->ctrl_base; |
382 | u32 revision; | 382 | u32 revision; |
383 | int ret = -ENODEV; | ||
383 | 384 | ||
384 | usb_nop_xceiv_register(); | 385 | usb_nop_xceiv_register(); |
385 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 386 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
386 | if (IS_ERR_OR_NULL(musb->xceiv)) | 387 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
388 | ret = -EPROBE_DEFER; | ||
387 | goto unregister; | 389 | goto unregister; |
390 | } | ||
388 | 391 | ||
389 | musb->mregs += DAVINCI_BASE_OFFSET; | 392 | musb->mregs += DAVINCI_BASE_OFFSET; |
390 | 393 | ||
@@ -438,7 +441,7 @@ fail: | |||
438 | usb_put_phy(musb->xceiv); | 441 | usb_put_phy(musb->xceiv); |
439 | unregister: | 442 | unregister: |
440 | usb_nop_xceiv_unregister(); | 443 | usb_nop_xceiv_unregister(); |
441 | return -ENODEV; | 444 | return ret; |
442 | } | 445 | } |
443 | 446 | ||
444 | static int davinci_musb_exit(struct musb *musb) | 447 | static int davinci_musb_exit(struct musb *musb) |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fd3486745e64..60b41cc28da4 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1993,6 +1993,7 @@ fail2: | |||
1993 | musb_platform_exit(musb); | 1993 | musb_platform_exit(musb); |
1994 | 1994 | ||
1995 | fail1: | 1995 | fail1: |
1996 | pm_runtime_disable(musb->controller); | ||
1996 | dev_err(musb->controller, | 1997 | dev_err(musb->controller, |
1997 | "musb_init_controller failed with status %d\n", status); | 1998 | "musb_init_controller failed with status %d\n", status); |
1998 | 1999 | ||
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 99f470d26a38..6bb89715b637 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/of.h> | ||
35 | #include <linux/err.h> | 34 | #include <linux/err.h> |
36 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
37 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
@@ -419,7 +418,7 @@ static int dsps_musb_init(struct musb *musb) | |||
419 | usb_nop_xceiv_register(); | 418 | usb_nop_xceiv_register(); |
420 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 419 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
421 | if (IS_ERR_OR_NULL(musb->xceiv)) | 420 | if (IS_ERR_OR_NULL(musb->xceiv)) |
422 | return -ENODEV; | 421 | return -EPROBE_DEFER; |
423 | 422 | ||
424 | /* Returns zero if e.g. not clocked */ | 423 | /* Returns zero if e.g. not clocked */ |
425 | rev = dsps_readl(reg_base, wrp->revision); | 424 | rev = dsps_readl(reg_base, wrp->revision); |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 876787438c2f..be18537c5f14 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -408,7 +408,19 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
408 | csr |= (MUSB_TXCSR_DMAENAB | 408 | csr |= (MUSB_TXCSR_DMAENAB |
409 | | MUSB_TXCSR_DMAMODE | 409 | | MUSB_TXCSR_DMAMODE |
410 | | MUSB_TXCSR_MODE); | 410 | | MUSB_TXCSR_MODE); |
411 | if (!musb_ep->hb_mult) | 411 | /* |
412 | * Enable Autoset according to table | ||
413 | * below | ||
414 | * bulk_split hb_mult Autoset_Enable | ||
415 | * 0 0 Yes(Normal) | ||
416 | * 0 >0 No(High BW ISO) | ||
417 | * 1 0 Yes(HS bulk) | ||
418 | * 1 >0 Yes(FS bulk) | ||
419 | */ | ||
420 | if (!musb_ep->hb_mult || | ||
421 | (musb_ep->hb_mult && | ||
422 | can_bulk_split(musb, | ||
423 | musb_ep->type))) | ||
412 | csr |= MUSB_TXCSR_AUTOSET; | 424 | csr |= MUSB_TXCSR_AUTOSET; |
413 | } | 425 | } |
414 | csr &= ~MUSB_TXCSR_P_UNDERRUN; | 426 | csr &= ~MUSB_TXCSR_P_UNDERRUN; |
@@ -1110,11 +1122,15 @@ static int musb_gadget_enable(struct usb_ep *ep, | |||
1110 | /* Set TXMAXP with the FIFO size of the endpoint | 1122 | /* Set TXMAXP with the FIFO size of the endpoint |
1111 | * to disable double buffering mode. | 1123 | * to disable double buffering mode. |
1112 | */ | 1124 | */ |
1113 | if (musb->double_buffer_not_ok) | 1125 | if (musb->double_buffer_not_ok) { |
1114 | musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); | 1126 | musb_writew(regs, MUSB_TXMAXP, hw_ep->max_packet_sz_tx); |
1115 | else | 1127 | } else { |
1128 | if (can_bulk_split(musb, musb_ep->type)) | ||
1129 | musb_ep->hb_mult = (hw_ep->max_packet_sz_tx / | ||
1130 | musb_ep->packet_sz) - 1; | ||
1116 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz | 1131 | musb_writew(regs, MUSB_TXMAXP, musb_ep->packet_sz |
1117 | | (musb_ep->hb_mult << 11)); | 1132 | | (musb_ep->hb_mult << 11)); |
1133 | } | ||
1118 | 1134 | ||
1119 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; | 1135 | csr = MUSB_TXCSR_MODE | MUSB_TXCSR_CLRDATATOG; |
1120 | if (musb_readw(regs, MUSB_TXCSR) | 1136 | if (musb_readw(regs, MUSB_TXCSR) |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index e9f0fd9ddd2d..1ce1fcf3f3e7 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -634,7 +634,17 @@ static bool musb_tx_dma_program(struct dma_controller *dma, | |||
634 | mode = 1; | 634 | mode = 1; |
635 | csr |= MUSB_TXCSR_DMAMODE | MUSB_TXCSR_DMAENAB; | 635 | csr |= MUSB_TXCSR_DMAMODE | MUSB_TXCSR_DMAENAB; |
636 | /* autoset shouldn't be set in high bandwidth */ | 636 | /* autoset shouldn't be set in high bandwidth */ |
637 | if (qh->hb_mult == 1) | 637 | /* |
638 | * Enable Autoset according to table | ||
639 | * below | ||
640 | * bulk_split hb_mult Autoset_Enable | ||
641 | * 0 1 Yes(Normal) | ||
642 | * 0 >1 No(High BW ISO) | ||
643 | * 1 1 Yes(HS bulk) | ||
644 | * 1 >1 Yes(FS bulk) | ||
645 | */ | ||
646 | if (qh->hb_mult == 1 || (qh->hb_mult > 1 && | ||
647 | can_bulk_split(hw_ep->musb, qh->type))) | ||
638 | csr |= MUSB_TXCSR_AUTOSET; | 648 | csr |= MUSB_TXCSR_AUTOSET; |
639 | } else { | 649 | } else { |
640 | mode = 0; | 650 | mode = 0; |
@@ -746,7 +756,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | |||
746 | /* general endpoint setup */ | 756 | /* general endpoint setup */ |
747 | if (epnum) { | 757 | if (epnum) { |
748 | /* flush all old state, set default */ | 758 | /* flush all old state, set default */ |
749 | musb_h_tx_flush_fifo(hw_ep); | 759 | /* |
760 | * We could be flushing valid | ||
761 | * packets in double buffering | ||
762 | * case | ||
763 | */ | ||
764 | if (!hw_ep->tx_double_buffered) | ||
765 | musb_h_tx_flush_fifo(hw_ep); | ||
750 | 766 | ||
751 | /* | 767 | /* |
752 | * We must not clear the DMAMODE bit before or in | 768 | * We must not clear the DMAMODE bit before or in |
@@ -763,11 +779,13 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | |||
763 | ); | 779 | ); |
764 | csr |= MUSB_TXCSR_MODE; | 780 | csr |= MUSB_TXCSR_MODE; |
765 | 781 | ||
766 | if (usb_gettoggle(urb->dev, qh->epnum, 1)) | 782 | if (!hw_ep->tx_double_buffered) { |
767 | csr |= MUSB_TXCSR_H_WR_DATATOGGLE | 783 | if (usb_gettoggle(urb->dev, qh->epnum, 1)) |
768 | | MUSB_TXCSR_H_DATATOGGLE; | 784 | csr |= MUSB_TXCSR_H_WR_DATATOGGLE |
769 | else | 785 | | MUSB_TXCSR_H_DATATOGGLE; |
770 | csr |= MUSB_TXCSR_CLRDATATOG; | 786 | else |
787 | csr |= MUSB_TXCSR_CLRDATATOG; | ||
788 | } | ||
771 | 789 | ||
772 | musb_writew(epio, MUSB_TXCSR, csr); | 790 | musb_writew(epio, MUSB_TXCSR, csr); |
773 | /* REVISIT may need to clear FLUSHFIFO ... */ | 791 | /* REVISIT may need to clear FLUSHFIFO ... */ |
@@ -791,17 +809,19 @@ static void musb_ep_program(struct musb *musb, u8 epnum, | |||
791 | /* protocol/endpoint/interval/NAKlimit */ | 809 | /* protocol/endpoint/interval/NAKlimit */ |
792 | if (epnum) { | 810 | if (epnum) { |
793 | musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); | 811 | musb_writeb(epio, MUSB_TXTYPE, qh->type_reg); |
794 | if (musb->double_buffer_not_ok) | 812 | if (musb->double_buffer_not_ok) { |
795 | musb_writew(epio, MUSB_TXMAXP, | 813 | musb_writew(epio, MUSB_TXMAXP, |
796 | hw_ep->max_packet_sz_tx); | 814 | hw_ep->max_packet_sz_tx); |
797 | else if (can_bulk_split(musb, qh->type)) | 815 | } else if (can_bulk_split(musb, qh->type)) { |
816 | qh->hb_mult = hw_ep->max_packet_sz_tx | ||
817 | / packet_sz; | ||
798 | musb_writew(epio, MUSB_TXMAXP, packet_sz | 818 | musb_writew(epio, MUSB_TXMAXP, packet_sz |
799 | | ((hw_ep->max_packet_sz_tx / | 819 | | ((qh->hb_mult) - 1) << 11); |
800 | packet_sz) - 1) << 11); | 820 | } else { |
801 | else | ||
802 | musb_writew(epio, MUSB_TXMAXP, | 821 | musb_writew(epio, MUSB_TXMAXP, |
803 | qh->maxpacket | | 822 | qh->maxpacket | |
804 | ((qh->hb_mult - 1) << 11)); | 823 | ((qh->hb_mult - 1) << 11)); |
824 | } | ||
805 | musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); | 825 | musb_writeb(epio, MUSB_TXINTERVAL, qh->intv_reg); |
806 | } else { | 826 | } else { |
807 | musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); | 827 | musb_writeb(epio, MUSB_NAKLIMIT0, qh->intv_reg); |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index acd5f9d71d03..1762354fe793 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/err.h> | 37 | #include <linux/err.h> |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/usb/musb-omap.h> | 39 | #include <linux/usb/musb-omap.h> |
40 | #include <linux/usb/omap_control_usb.h> | ||
40 | 41 | ||
41 | #include "musb_core.h" | 42 | #include "musb_core.h" |
42 | #include "omap2430.h" | 43 | #include "omap2430.h" |
@@ -46,7 +47,7 @@ struct omap2430_glue { | |||
46 | struct platform_device *musb; | 47 | struct platform_device *musb; |
47 | enum omap_musb_vbus_id_status status; | 48 | enum omap_musb_vbus_id_status status; |
48 | struct work_struct omap_musb_mailbox_work; | 49 | struct work_struct omap_musb_mailbox_work; |
49 | u32 __iomem *control_otghs; | 50 | struct device *control_otghs; |
50 | }; | 51 | }; |
51 | #define glue_to_musb(g) platform_get_drvdata(g->musb) | 52 | #define glue_to_musb(g) platform_get_drvdata(g->musb) |
52 | 53 | ||
@@ -54,26 +55,6 @@ struct omap2430_glue *_glue; | |||
54 | 55 | ||
55 | static struct timer_list musb_idle_timer; | 56 | static struct timer_list musb_idle_timer; |
56 | 57 | ||
57 | /** | ||
58 | * omap4_usb_phy_mailbox - write to usb otg mailbox | ||
59 | * @glue: struct omap2430_glue * | ||
60 | * @val: the value to be written to the mailbox | ||
61 | * | ||
62 | * On detection of a device (ID pin is grounded), this API should be called | ||
63 | * to set AVALID, VBUSVALID and ID pin is grounded. | ||
64 | * | ||
65 | * When OMAP is connected to a host (OMAP in device mode), this API | ||
66 | * is called to set AVALID, VBUSVALID and ID pin in high impedance. | ||
67 | * | ||
68 | * XXX: This function will be removed once we have a seperate driver for | ||
69 | * control module | ||
70 | */ | ||
71 | static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val) | ||
72 | { | ||
73 | if (glue->control_otghs) | ||
74 | writel(val, glue->control_otghs); | ||
75 | } | ||
76 | |||
77 | static void musb_do_idle(unsigned long _musb) | 58 | static void musb_do_idle(unsigned long _musb) |
78 | { | 59 | { |
79 | struct musb *musb = (void *)_musb; | 60 | struct musb *musb = (void *)_musb; |
@@ -255,11 +236,11 @@ static inline void omap2430_low_level_init(struct musb *musb) | |||
255 | void omap_musb_mailbox(enum omap_musb_vbus_id_status status) | 236 | void omap_musb_mailbox(enum omap_musb_vbus_id_status status) |
256 | { | 237 | { |
257 | struct omap2430_glue *glue = _glue; | 238 | struct omap2430_glue *glue = _glue; |
258 | struct musb *musb = glue_to_musb(glue); | ||
259 | 239 | ||
260 | glue->status = status; | 240 | if (glue && glue_to_musb(glue)) { |
261 | if (!musb) { | 241 | glue->status = status; |
262 | dev_err(glue->dev, "musb core is not yet ready\n"); | 242 | } else { |
243 | pr_err("%s: musb core is not yet ready\n", __func__); | ||
263 | return; | 244 | return; |
264 | } | 245 | } |
265 | 246 | ||
@@ -269,7 +250,6 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox); | |||
269 | 250 | ||
270 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) | 251 | static void omap_musb_set_mailbox(struct omap2430_glue *glue) |
271 | { | 252 | { |
272 | u32 val; | ||
273 | struct musb *musb = glue_to_musb(glue); | 253 | struct musb *musb = glue_to_musb(glue); |
274 | struct device *dev = musb->controller; | 254 | struct device *dev = musb->controller; |
275 | struct musb_hdrc_platform_data *pdata = dev->platform_data; | 255 | struct musb_hdrc_platform_data *pdata = dev->platform_data; |
@@ -285,8 +265,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
285 | musb->xceiv->last_event = USB_EVENT_ID; | 265 | musb->xceiv->last_event = USB_EVENT_ID; |
286 | if (musb->gadget_driver) { | 266 | if (musb->gadget_driver) { |
287 | pm_runtime_get_sync(dev); | 267 | pm_runtime_get_sync(dev); |
288 | val = AVALID | VBUSVALID; | 268 | omap_control_usb_set_mode(glue->control_otghs, |
289 | omap4_usb_phy_mailbox(glue, val); | 269 | USB_MODE_HOST); |
290 | omap2430_musb_set_vbus(musb, 1); | 270 | omap2430_musb_set_vbus(musb, 1); |
291 | } | 271 | } |
292 | break; | 272 | break; |
@@ -299,8 +279,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
299 | musb->xceiv->last_event = USB_EVENT_VBUS; | 279 | musb->xceiv->last_event = USB_EVENT_VBUS; |
300 | if (musb->gadget_driver) | 280 | if (musb->gadget_driver) |
301 | pm_runtime_get_sync(dev); | 281 | pm_runtime_get_sync(dev); |
302 | val = IDDIG | AVALID | VBUSVALID; | 282 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); |
303 | omap4_usb_phy_mailbox(glue, val); | ||
304 | break; | 283 | break; |
305 | 284 | ||
306 | case OMAP_MUSB_ID_FLOAT: | 285 | case OMAP_MUSB_ID_FLOAT: |
@@ -317,8 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) | |||
317 | if (musb->xceiv->otg->set_vbus) | 296 | if (musb->xceiv->otg->set_vbus) |
318 | otg_set_vbus(musb->xceiv->otg, 0); | 297 | otg_set_vbus(musb->xceiv->otg, 0); |
319 | } | 298 | } |
320 | val = SESSEND | IDDIG; | 299 | omap_control_usb_set_mode(glue->control_otghs, |
321 | omap4_usb_phy_mailbox(glue, val); | 300 | USB_MODE_DISCONNECT); |
322 | break; | 301 | break; |
323 | default: | 302 | default: |
324 | dev_dbg(dev, "ID float\n"); | 303 | dev_dbg(dev, "ID float\n"); |
@@ -366,10 +345,15 @@ static int omap2430_musb_init(struct musb *musb) | |||
366 | * up through ULPI. TWL4030-family PMICs include one, | 345 | * up through ULPI. TWL4030-family PMICs include one, |
367 | * which needs a driver, drivers aren't always needed. | 346 | * which needs a driver, drivers aren't always needed. |
368 | */ | 347 | */ |
369 | musb->xceiv = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); | 348 | if (dev->parent->of_node) |
349 | musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, | ||
350 | "usb-phy", 0); | ||
351 | else | ||
352 | musb->xceiv = devm_usb_get_phy_dev(dev, 0); | ||
353 | |||
370 | if (IS_ERR_OR_NULL(musb->xceiv)) { | 354 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
371 | pr_err("HS USB OTG: no transceiver configured\n"); | 355 | pr_err("HS USB OTG: no transceiver configured\n"); |
372 | return -ENODEV; | 356 | return -EPROBE_DEFER; |
373 | } | 357 | } |
374 | 358 | ||
375 | musb->isr = omap2430_musb_interrupt; | 359 | musb->isr = omap2430_musb_interrupt; |
@@ -415,7 +399,6 @@ err1: | |||
415 | static void omap2430_musb_enable(struct musb *musb) | 399 | static void omap2430_musb_enable(struct musb *musb) |
416 | { | 400 | { |
417 | u8 devctl; | 401 | u8 devctl; |
418 | u32 val; | ||
419 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 402 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
420 | struct device *dev = musb->controller; | 403 | struct device *dev = musb->controller; |
421 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | 404 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); |
@@ -425,8 +408,7 @@ static void omap2430_musb_enable(struct musb *musb) | |||
425 | switch (glue->status) { | 408 | switch (glue->status) { |
426 | 409 | ||
427 | case OMAP_MUSB_ID_GROUND: | 410 | case OMAP_MUSB_ID_GROUND: |
428 | val = AVALID | VBUSVALID; | 411 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST); |
429 | omap4_usb_phy_mailbox(glue, val); | ||
430 | if (data->interface_type != MUSB_INTERFACE_UTMI) | 412 | if (data->interface_type != MUSB_INTERFACE_UTMI) |
431 | break; | 413 | break; |
432 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 414 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
@@ -445,8 +427,7 @@ static void omap2430_musb_enable(struct musb *musb) | |||
445 | break; | 427 | break; |
446 | 428 | ||
447 | case OMAP_MUSB_VBUS_VALID: | 429 | case OMAP_MUSB_VBUS_VALID: |
448 | val = IDDIG | AVALID | VBUSVALID; | 430 | omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); |
449 | omap4_usb_phy_mailbox(glue, val); | ||
450 | break; | 431 | break; |
451 | 432 | ||
452 | default: | 433 | default: |
@@ -456,14 +437,12 @@ static void omap2430_musb_enable(struct musb *musb) | |||
456 | 437 | ||
457 | static void omap2430_musb_disable(struct musb *musb) | 438 | static void omap2430_musb_disable(struct musb *musb) |
458 | { | 439 | { |
459 | u32 val; | ||
460 | struct device *dev = musb->controller; | 440 | struct device *dev = musb->controller; |
461 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); | 441 | struct omap2430_glue *glue = dev_get_drvdata(dev->parent); |
462 | 442 | ||
463 | if (glue->status != OMAP_MUSB_UNKNOWN) { | 443 | if (glue->status != OMAP_MUSB_UNKNOWN) |
464 | val = SESSEND | IDDIG; | 444 | omap_control_usb_set_mode(glue->control_otghs, |
465 | omap4_usb_phy_mailbox(glue, val); | 445 | USB_MODE_DISCONNECT); |
466 | } | ||
467 | } | 446 | } |
468 | 447 | ||
469 | static int omap2430_musb_exit(struct musb *musb) | 448 | static int omap2430_musb_exit(struct musb *musb) |
@@ -498,7 +477,6 @@ static int omap2430_probe(struct platform_device *pdev) | |||
498 | struct omap2430_glue *glue; | 477 | struct omap2430_glue *glue; |
499 | struct device_node *np = pdev->dev.of_node; | 478 | struct device_node *np = pdev->dev.of_node; |
500 | struct musb_hdrc_config *config; | 479 | struct musb_hdrc_config *config; |
501 | struct resource *res; | ||
502 | int ret = -ENOMEM; | 480 | int ret = -ENOMEM; |
503 | 481 | ||
504 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); | 482 | glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); |
@@ -521,29 +499,23 @@ static int omap2430_probe(struct platform_device *pdev) | |||
521 | glue->musb = musb; | 499 | glue->musb = musb; |
522 | glue->status = OMAP_MUSB_UNKNOWN; | 500 | glue->status = OMAP_MUSB_UNKNOWN; |
523 | 501 | ||
524 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
525 | |||
526 | glue->control_otghs = devm_ioremap_resource(&pdev->dev, res); | ||
527 | |||
528 | if (np) { | 502 | if (np) { |
529 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 503 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
530 | if (!pdata) { | 504 | if (!pdata) { |
531 | dev_err(&pdev->dev, | 505 | dev_err(&pdev->dev, |
532 | "failed to allocate musb platfrom data\n"); | 506 | "failed to allocate musb platfrom data\n"); |
533 | ret = -ENOMEM; | ||
534 | goto err2; | 507 | goto err2; |
535 | } | 508 | } |
536 | 509 | ||
537 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | 510 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
538 | if (!data) { | 511 | if (!data) { |
539 | dev_err(&pdev->dev, | 512 | dev_err(&pdev->dev, |
540 | "failed to allocate musb board data\n"); | 513 | "failed to allocate musb board data\n"); |
541 | ret = -ENOMEM; | ||
542 | goto err2; | 514 | goto err2; |
543 | } | 515 | } |
544 | 516 | ||
545 | config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); | 517 | config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL); |
546 | if (!data) { | 518 | if (!config) { |
547 | dev_err(&pdev->dev, | 519 | dev_err(&pdev->dev, |
548 | "failed to allocate musb hdrc config\n"); | 520 | "failed to allocate musb hdrc config\n"); |
549 | goto err2; | 521 | goto err2; |
@@ -556,11 +528,22 @@ static int omap2430_probe(struct platform_device *pdev) | |||
556 | of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits); | 528 | of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits); |
557 | of_property_read_u32(np, "power", (u32 *)&pdata->power); | 529 | of_property_read_u32(np, "power", (u32 *)&pdata->power); |
558 | config->multipoint = of_property_read_bool(np, "multipoint"); | 530 | config->multipoint = of_property_read_bool(np, "multipoint"); |
531 | pdata->has_mailbox = of_property_read_bool(np, | ||
532 | "ti,has-mailbox"); | ||
559 | 533 | ||
560 | pdata->board_data = data; | 534 | pdata->board_data = data; |
561 | pdata->config = config; | 535 | pdata->config = config; |
562 | } | 536 | } |
563 | 537 | ||
538 | if (pdata->has_mailbox) { | ||
539 | glue->control_otghs = omap_get_control_dev(); | ||
540 | if (IS_ERR(glue->control_otghs)) { | ||
541 | dev_vdbg(&pdev->dev, "Failed to get control device\n"); | ||
542 | return -ENODEV; | ||
543 | } | ||
544 | } else { | ||
545 | glue->control_otghs = ERR_PTR(-ENODEV); | ||
546 | } | ||
564 | pdata->platform_ops = &omap2430_ops; | 547 | pdata->platform_ops = &omap2430_ops; |
565 | 548 | ||
566 | platform_set_drvdata(pdev, glue); | 549 | platform_set_drvdata(pdev, glue); |
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h index 8ef656659fcb..1b5e83a9840e 100644 --- a/drivers/usb/musb/omap2430.h +++ b/drivers/usb/musb/omap2430.h | |||
@@ -49,13 +49,4 @@ | |||
49 | #define OTG_FORCESTDBY 0x414 | 49 | #define OTG_FORCESTDBY 0x414 |
50 | # define ENABLEFORCE (1 << 0) | 50 | # define ENABLEFORCE (1 << 0) |
51 | 51 | ||
52 | /* | ||
53 | * Control Module bit definitions | ||
54 | * XXX: Will be removed once we have a driver for control module. | ||
55 | */ | ||
56 | #define AVALID BIT(0) | ||
57 | #define BVALID BIT(1) | ||
58 | #define VBUSVALID BIT(2) | ||
59 | #define SESSEND BIT(3) | ||
60 | #define IDDIG BIT(4) | ||
61 | #endif /* __MUSB_OMAP243X_H__ */ | 52 | #endif /* __MUSB_OMAP243X_H__ */ |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 3969813c217d..464bd23cccda 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -1069,7 +1069,7 @@ static int tusb_musb_init(struct musb *musb) | |||
1069 | usb_nop_xceiv_register(); | 1069 | usb_nop_xceiv_register(); |
1070 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 1070 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
1071 | if (IS_ERR_OR_NULL(musb->xceiv)) | 1071 | if (IS_ERR_OR_NULL(musb->xceiv)) |
1072 | return -ENODEV; | 1072 | return -EPROBE_DEFER; |
1073 | 1073 | ||
1074 | pdev = to_platform_device(musb->controller); | 1074 | pdev = to_platform_device(musb->controller); |
1075 | 1075 | ||
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index a27ca1a9c994..13a392913769 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -61,7 +61,7 @@ static int ux500_musb_init(struct musb *musb) | |||
61 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); | 61 | musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2); |
62 | if (IS_ERR_OR_NULL(musb->xceiv)) { | 62 | if (IS_ERR_OR_NULL(musb->xceiv)) { |
63 | pr_err("HS USB OTG: no transceiver configured\n"); | 63 | pr_err("HS USB OTG: no transceiver configured\n"); |
64 | return -ENODEV; | 64 | return -EPROBE_DEFER; |
65 | } | 65 | } |
66 | 66 | ||
67 | musb->isr = ux500_musb_interrupt; | 67 | musb->isr = ux500_musb_interrupt; |
@@ -108,7 +108,7 @@ static int ux500_probe(struct platform_device *pdev) | |||
108 | goto err3; | 108 | goto err3; |
109 | } | 109 | } |
110 | 110 | ||
111 | ret = clk_enable(clk); | 111 | ret = clk_prepare_enable(clk); |
112 | if (ret) { | 112 | if (ret) { |
113 | dev_err(&pdev->dev, "failed to enable clock\n"); | 113 | dev_err(&pdev->dev, "failed to enable clock\n"); |
114 | goto err4; | 114 | goto err4; |
@@ -148,7 +148,7 @@ static int ux500_probe(struct platform_device *pdev) | |||
148 | return 0; | 148 | return 0; |
149 | 149 | ||
150 | err5: | 150 | err5: |
151 | clk_disable(clk); | 151 | clk_disable_unprepare(clk); |
152 | 152 | ||
153 | err4: | 153 | err4: |
154 | clk_put(clk); | 154 | clk_put(clk); |
@@ -168,7 +168,7 @@ static int ux500_remove(struct platform_device *pdev) | |||
168 | struct ux500_glue *glue = platform_get_drvdata(pdev); | 168 | struct ux500_glue *glue = platform_get_drvdata(pdev); |
169 | 169 | ||
170 | platform_device_unregister(glue->musb); | 170 | platform_device_unregister(glue->musb); |
171 | clk_disable(glue->clk); | 171 | clk_disable_unprepare(glue->clk); |
172 | clk_put(glue->clk); | 172 | clk_put(glue->clk); |
173 | kfree(glue); | 173 | kfree(glue); |
174 | 174 | ||
@@ -182,7 +182,7 @@ static int ux500_suspend(struct device *dev) | |||
182 | struct musb *musb = glue_to_musb(glue); | 182 | struct musb *musb = glue_to_musb(glue); |
183 | 183 | ||
184 | usb_phy_set_suspend(musb->xceiv, 1); | 184 | usb_phy_set_suspend(musb->xceiv, 1); |
185 | clk_disable(glue->clk); | 185 | clk_disable_unprepare(glue->clk); |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
@@ -193,7 +193,7 @@ static int ux500_resume(struct device *dev) | |||
193 | struct musb *musb = glue_to_musb(glue); | 193 | struct musb *musb = glue_to_musb(glue); |
194 | int ret; | 194 | int ret; |
195 | 195 | ||
196 | ret = clk_enable(glue->clk); | 196 | ret = clk_prepare_enable(glue->clk); |
197 | if (ret) { | 197 | if (ret) { |
198 | dev_err(dev, "failed to enable clock\n"); | 198 | dev_err(dev, "failed to enable clock\n"); |
199 | return ret; | 199 | return ret; |