Merge branch 'omap/musb' into next/boards

* omap/musb:
  ARM: OMAP: musb: Add support for ti816evm
  ARM: OMAP: musb: Add ti81xx phy power function
  ARM: OMAP: musb: Adding support for ti81xx
This commit is contained in:
Olof Johansson 2011-12-16 14:51:19 -08:00
commit 58c017750d
4 changed files with 79 additions and 0 deletions

View File

@ -23,6 +23,14 @@
#include <plat/irqs.h> #include <plat/irqs.h>
#include <plat/board.h> #include <plat/board.h>
#include "common.h" #include "common.h"
#include <plat/usb.h>
static struct omap_musb_board_data musb_board_data = {
.set_phy_power = ti81xx_musb_phy_power,
.interface_type = MUSB_INTERFACE_ULPI,
.mode = MUSB_OTG,
.power = 500,
};
static struct omap_board_config_kernel ti81xx_evm_config[] __initdata = { static struct omap_board_config_kernel ti81xx_evm_config[] __initdata = {
}; };
@ -33,6 +41,7 @@ static void __init ti81xx_evm_init(void)
omap_sdrc_init(NULL, NULL); omap_sdrc_init(NULL, NULL);
omap_board_config = ti81xx_evm_config; omap_board_config = ti81xx_evm_config;
omap_board_config_size = ARRAY_SIZE(ti81xx_evm_config); omap_board_config_size = ARRAY_SIZE(ti81xx_evm_config);
usb_musb_init(&musb_board_data);
} }
MACHINE_START(TI8168EVM, "ti8168evm") MACHINE_START(TI8168EVM, "ti8168evm")

View File

@ -260,3 +260,38 @@ void am35x_set_mode(u8 musb_mode)
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
} }
void ti81xx_musb_phy_power(u8 on)
{
void __iomem *scm_base = NULL;
u32 usbphycfg;
scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
if (!scm_base) {
pr_err("system control module ioremap failed\n");
return;
}
usbphycfg = __raw_readl(scm_base + USBCTRL0);
if (on) {
if (cpu_is_ti816x()) {
usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC;
} else if (cpu_is_ti814x()) {
usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
| USBPHY_DPINPUT | USBPHY_DMINPUT);
usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
| USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
}
} else {
if (cpu_is_ti816x())
usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE;
else if (cpu_is_ti814x())
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}
__raw_writel(usbphycfg, scm_base + USBCTRL0);
iounmap(scm_base);
}

View File

@ -93,6 +93,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
if (cpu_is_omap3517() || cpu_is_omap3505()) { if (cpu_is_omap3517() || cpu_is_omap3505()) {
oh_name = "am35x_otg_hs"; oh_name = "am35x_otg_hs";
name = "musb-am35x"; name = "musb-am35x";
} else if (cpu_is_ti81xx()) {
oh_name = "usb_otg_hs";
name = "musb-ti81xx";
} else { } else {
oh_name = "usb_otg_hs"; oh_name = "usb_otg_hs";
name = "musb-omap2430"; name = "musb-omap2430";

View File

@ -114,6 +114,7 @@ extern void am35x_musb_reset(void);
extern void am35x_musb_phy_power(u8 on); extern void am35x_musb_phy_power(u8 on);
extern void am35x_musb_clear_irq(void); extern void am35x_musb_clear_irq(void);
extern void am35x_set_mode(u8 musb_mode); extern void am35x_set_mode(u8 musb_mode);
extern void ti81xx_musb_phy_power(u8 on);
/* /*
* FIXME correct answer depends on hmc_mode, * FIXME correct answer depends on hmc_mode,
@ -273,6 +274,37 @@ static inline void omap2_usbfs_init(struct omap_usb_config *pdata)
#define CONF2_OTGPWRDN (1 << 2) #define CONF2_OTGPWRDN (1 << 2)
#define CONF2_DATPOL (1 << 1) #define CONF2_DATPOL (1 << 1)
/* TI81XX specific definitions */
#define USBCTRL0 0x620
#define USBSTAT0 0x624
/* TI816X PHY controls bits */
#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
/* TI814X PHY controls bits */
#define USBPHY_CM_PWRDN (1 << 0)
#define USBPHY_OTG_PWRDN (1 << 1)
#define USBPHY_CHGDET_DIS (1 << 2)
#define USBPHY_CHGDET_RSTRT (1 << 3)
#define USBPHY_SRCONDM (1 << 4)
#define USBPHY_SINKONDP (1 << 5)
#define USBPHY_CHGISINK_EN (1 << 6)
#define USBPHY_CHGVSRC_EN (1 << 7)
#define USBPHY_DMPULLUP (1 << 8)
#define USBPHY_DPPULLUP (1 << 9)
#define USBPHY_CDET_EXTCTL (1 << 10)
#define USBPHY_GPIO_MODE (1 << 12)
#define USBPHY_DPOPBUFCTL (1 << 13)
#define USBPHY_DMOPBUFCTL (1 << 14)
#define USBPHY_DPINPUT (1 << 15)
#define USBPHY_DMINPUT (1 << 16)
#define USBPHY_DPGPIO_PD (1 << 17)
#define USBPHY_DMGPIO_PD (1 << 18)
#define USBPHY_OTGVDET_EN (1 << 19)
#define USBPHY_OTGSESSEND_EN (1 << 20)
#define USBPHY_DATA_POLARITY (1 << 23)
#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB) #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB)
u32 omap1_usb0_init(unsigned nwires, unsigned is_device); u32 omap1_usb0_init(unsigned nwires, unsigned is_device);
u32 omap1_usb1_init(unsigned nwires); u32 omap1_usb1_init(unsigned nwires);