tusb6010.c (a9de18eb761f7c1c860964b2e5addc1a35c7e861) | tusb6010.c (96a274d1da950a96cb31ac1bed044e049d770980) |
---|---|
1/* 2 * TUSB6010 USB 2.0 OTG Dual Role controller 3 * 4 * Copyright (C) 2006 Nokia Corporation 5 * Jarkko Nikula <jarkko.nikula@nokia.com> 6 * Tony Lindgren <tony@atomide.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 584 unchanged lines hidden (view full) --- 593 * 594 * Note that if a mini-A cable is plugged in the ID line will stay down as 595 * the weak ID pull-up is not able to pull the ID up. 596 * 597 * REVISIT: It would be possible to add support for changing between host 598 * and peripheral modes in non-OTG configurations by reconfiguring hardware 599 * and then setting musb->board_mode. For now, only support OTG mode. 600 */ | 1/* 2 * TUSB6010 USB 2.0 OTG Dual Role controller 3 * 4 * Copyright (C) 2006 Nokia Corporation 5 * Jarkko Nikula <jarkko.nikula@nokia.com> 6 * Tony Lindgren <tony@atomide.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 584 unchanged lines hidden (view full) --- 593 * 594 * Note that if a mini-A cable is plugged in the ID line will stay down as 595 * the weak ID pull-up is not able to pull the ID up. 596 * 597 * REVISIT: It would be possible to add support for changing between host 598 * and peripheral modes in non-OTG configurations by reconfiguring hardware 599 * and then setting musb->board_mode. For now, only support OTG mode. 600 */ |
601void musb_platform_set_mode(struct musb *musb, u8 musb_mode) | 601int musb_platform_set_mode(struct musb *musb, u8 musb_mode) |
602{ 603 void __iomem *tbase = musb->ctrl_base; 604 u32 otg_stat, phy_otg_ctrl, phy_otg_ena, dev_conf; 605 606 if (musb->board_mode != MUSB_OTG) { 607 ERR("Changing mode currently only supported in OTG mode\n"); 608 return -EINVAL; 609 } --- 26 unchanged lines hidden (view full) --- 636 case MUSB_OTG: /* Use PHY ID detection */ 637 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 638 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 639 dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); 640 break; 641#endif 642 643 default: | 602{ 603 void __iomem *tbase = musb->ctrl_base; 604 u32 otg_stat, phy_otg_ctrl, phy_otg_ena, dev_conf; 605 606 if (musb->board_mode != MUSB_OTG) { 607 ERR("Changing mode currently only supported in OTG mode\n"); 608 return -EINVAL; 609 } --- 26 unchanged lines hidden (view full) --- 636 case MUSB_OTG: /* Use PHY ID detection */ 637 phy_otg_ctrl |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 638 phy_otg_ena |= TUSB_PHY_OTG_CTRL_OTG_ID_PULLUP; 639 dev_conf &= ~(TUSB_DEV_CONF_ID_SEL | TUSB_DEV_CONF_SOFT_ID); 640 break; 641#endif 642 643 default: |
644 DBG(2, "Trying to set unknown mode %i\n", musb_mode); | 644 DBG(2, "Trying to set mode %i\n", musb_mode); 645 return -EINVAL; |
645 } 646 647 musb_writel(tbase, TUSB_PHY_OTG_CTRL, 648 TUSB_PHY_OTG_CTRL_WRPROTECT | phy_otg_ctrl); 649 musb_writel(tbase, TUSB_PHY_OTG_CTRL_ENABLE, 650 TUSB_PHY_OTG_CTRL_WRPROTECT | phy_otg_ena); 651 musb_writel(tbase, TUSB_DEV_CONF, dev_conf); 652 653 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); 654 if ((musb_mode == MUSB_PERIPHERAL) && 655 !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) 656 INFO("Cannot be peripheral with mini-A cable " 657 "otg_stat: %08x\n", otg_stat); | 646 } 647 648 musb_writel(tbase, TUSB_PHY_OTG_CTRL, 649 TUSB_PHY_OTG_CTRL_WRPROTECT | phy_otg_ctrl); 650 musb_writel(tbase, TUSB_PHY_OTG_CTRL_ENABLE, 651 TUSB_PHY_OTG_CTRL_WRPROTECT | phy_otg_ena); 652 musb_writel(tbase, TUSB_DEV_CONF, dev_conf); 653 654 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); 655 if ((musb_mode == MUSB_PERIPHERAL) && 656 !(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) 657 INFO("Cannot be peripheral with mini-A cable " 658 "otg_stat: %08x\n", otg_stat); |
659 660 return 0; |
|
658} 659 660static inline unsigned long 661tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) 662{ 663 u32 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); 664 unsigned long idle_timeout = 0; 665 --- 486 unchanged lines hidden --- | 661} 662 663static inline unsigned long 664tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) 665{ 666 u32 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); 667 unsigned long idle_timeout = 0; 668 --- 486 unchanged lines hidden --- |