aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/tusb6010.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-06-22 10:28:09 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-01 17:31:10 -0400
commit622859634a663c5e55d0e2a2cdbb55ac058d97b3 (patch)
tree5f41809476f487de7d461ccaac4d80179d0d2561 /drivers/usb/musb/tusb6010.c
parente4e5b136eb6f2d3aa10dca108a1b787dc92d67df (diff)
usb: musb: drop a gigantic amount of ifdeferry
the MUSB IP is always OTG, so there's no point in adding so many ifdefs on the code. Drop those and always compile the driver for OTG support. This also allows us to drop the useless "driver mode" choice. For doing that, we need to make musb depend on both Host and Peripheral side. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb/tusb6010.c')
-rw-r--r--drivers/usb/musb/tusb6010.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index b410357cf016..9eec41fbf3a4 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -269,8 +269,6 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
269 269
270static struct musb *the_musb; 270static struct musb *the_musb;
271 271
272#ifdef CONFIG_USB_GADGET_MUSB_HDRC
273
274/* This is used by gadget drivers, and OTG transceiver logic, allowing 272/* This is used by gadget drivers, and OTG transceiver logic, allowing
275 * at most mA current to be drawn from VBUS during a Default-B session 273 * at most mA current to be drawn from VBUS during a Default-B session
276 * (that is, while VBUS exceeds 4.4V). In Default-A (including pure host 274 * (that is, while VBUS exceeds 4.4V). In Default-A (including pure host
@@ -310,10 +308,6 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA)
310 return 0; 308 return 0;
311} 309}
312 310
313#else
314#define tusb_draw_power NULL
315#endif
316
317/* workaround for issue 13: change clock during chip idle 311/* workaround for issue 13: change clock during chip idle
318 * (to be fixed in rev3 silicon) ... symptoms include disconnect 312 * (to be fixed in rev3 silicon) ... symptoms include disconnect
319 * or looping suspend/resume cycles 313 * or looping suspend/resume cycles
@@ -440,19 +434,15 @@ static void musb_do_idle(unsigned long _musb)
440 if (is_host_active(musb) && (musb->port1_status >> 16)) 434 if (is_host_active(musb) && (musb->port1_status >> 16))
441 goto done; 435 goto done;
442 436
443#ifdef CONFIG_USB_GADGET_MUSB_HDRC 437 if (is_peripheral_enabled(musb) && !musb->gadget_driver) {
444 if (is_peripheral_enabled(musb) && !musb->gadget_driver)
445 wakeups = 0; 438 wakeups = 0;
446 else { 439 } else {
447 wakeups = TUSB_PRCM_WHOSTDISCON 440 wakeups = TUSB_PRCM_WHOSTDISCON
448 | TUSB_PRCM_WBUS 441 | TUSB_PRCM_WBUS
449 | TUSB_PRCM_WVBUS; 442 | TUSB_PRCM_WVBUS;
450 if (is_otg_enabled(musb)) 443 if (is_otg_enabled(musb))
451 wakeups |= TUSB_PRCM_WID; 444 wakeups |= TUSB_PRCM_WID;
452 } 445 }
453#else
454 wakeups = TUSB_PRCM_WHOSTDISCON | TUSB_PRCM_WBUS;
455#endif
456 tusb_allow_idle(musb, wakeups); 446 tusb_allow_idle(musb, wakeups);
457 } 447 }
458done: 448done:
@@ -610,30 +600,22 @@ static int tusb_musb_set_mode(struct musb *musb, u8 musb_mode)
610 600
611 switch (musb_mode) { 601 switch (musb_mode) {
612 602
613#ifdef CONFIG_USB_MUSB_HDRC_HCD
614 case MUSB_HOST: /* Disable PHY ID detect, ground ID */ 603 case MUSB_HOST: /* Disable PHY ID detect, ground ID */
615 phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 604 phy_otg_ctrl &= ~TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
616 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 605 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
617 dev_conf |= TUSB_DEV_CONF_ID_SEL; 606 dev_conf |= TUSB_DEV_CONF_ID_SEL;
618 dev_conf &= ~TUSB_DEV_CONF_SOFT_ID; 607 dev_conf &= ~TUSB_DEV_CONF_SOFT_ID;
619 break; 608 break;
620#endif
621
622#ifdef CONFIG_USB_GADGET_MUSB_HDRC
623 case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */ 609 case MUSB_PERIPHERAL: /* Disable PHY ID detect, keep ID pull-up on */
624 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 610 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
625 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 611 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
626 dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); 612 dev_conf |= (TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID);
627 break; 613 break;
628#endif
629
630#ifdef CONFIG_USB_MUSB_OTG
631 case MUSB_OTG: /* Use PHY ID detection */ 614 case MUSB_OTG: /* Use PHY ID detection */
632 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 615 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
633 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 616 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP;
634 dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); 617 dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID);
635 break; 618 break;
636#endif
637 619
638 default: 620 default:
639 dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode); 621 dev_dbg(musb->controller, "Trying to set mode %i\n", musb_mode);
@@ -684,7 +666,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
684 /* B-dev state machine: no vbus ~= disconnect */ 666 /* B-dev state machine: no vbus ~= disconnect */
685 if ((is_otg_enabled(musb) && !musb->xceiv->default_a) 667 if ((is_otg_enabled(musb) && !musb->xceiv->default_a)
686 || !is_host_enabled(musb)) { 668 || !is_host_enabled(musb)) {
687#ifdef CONFIG_USB_MUSB_HDRC_HCD
688 /* ? musb_root_disconnect(musb); */ 669 /* ? musb_root_disconnect(musb); */
689 musb->port1_status &= 670 musb->port1_status &=
690 ~(USB_PORT_STAT_CONNECTION 671 ~(USB_PORT_STAT_CONNECTION
@@ -693,7 +674,6 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase)
693 | USB_PORT_STAT_HIGH_SPEED 674 | USB_PORT_STAT_HIGH_SPEED
694 | USB_PORT_STAT_TEST 675 | USB_PORT_STAT_TEST
695 ); 676 );
696#endif
697 677
698 if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { 678 if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) {
699 dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); 679 dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n");