diff options
author | Olof Johansson <olof@lixom.net> | 2011-12-16 17:51:19 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2011-12-16 17:51:19 -0500 |
commit | 58c017750dc00793cf9ee292a5ce4df1748e852f (patch) | |
tree | c3c43c75b0a853b281699cdeafd36dddf976b17d | |
parent | f4eb64da25fb71e2c600688226ef9bc7738fd197 (diff) | |
parent | 705eb64e2ed78c63b9e2b6002b029ce8710ff7cf (diff) |
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
-rw-r--r-- | arch/arm/mach-omap2/board-ti8168evm.c | 9 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_phy_internal.c | 35 | ||||
-rw-r--r-- | arch/arm/mach-omap2/usb-musb.c | 3 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/usb.h | 32 |
4 files changed, 79 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c index b3ca997a44fa..5b6ad6e3ccb4 100644 --- a/arch/arm/mach-omap2/board-ti8168evm.c +++ b/arch/arm/mach-omap2/board-ti8168evm.c | |||
@@ -23,6 +23,14 @@ | |||
23 | #include <plat/irqs.h> | 23 | #include <plat/irqs.h> |
24 | #include <plat/board.h> | 24 | #include <plat/board.h> |
25 | #include "common.h" | 25 | #include "common.h" |
26 | #include <plat/usb.h> | ||
27 | |||
28 | static struct omap_musb_board_data musb_board_data = { | ||
29 | .set_phy_power = ti81xx_musb_phy_power, | ||
30 | .interface_type = MUSB_INTERFACE_ULPI, | ||
31 | .mode = MUSB_OTG, | ||
32 | .power = 500, | ||
33 | }; | ||
26 | 34 | ||
27 | static struct omap_board_config_kernel ti81xx_evm_config[] __initdata = { | 35 | static struct omap_board_config_kernel ti81xx_evm_config[] __initdata = { |
28 | }; | 36 | }; |
@@ -33,6 +41,7 @@ static void __init ti81xx_evm_init(void) | |||
33 | omap_sdrc_init(NULL, NULL); | 41 | omap_sdrc_init(NULL, NULL); |
34 | omap_board_config = ti81xx_evm_config; | 42 | omap_board_config = ti81xx_evm_config; |
35 | omap_board_config_size = ARRAY_SIZE(ti81xx_evm_config); | 43 | omap_board_config_size = ARRAY_SIZE(ti81xx_evm_config); |
44 | usb_musb_init(&musb_board_data); | ||
36 | } | 45 | } |
37 | 46 | ||
38 | MACHINE_START(TI8168EVM, "ti8168evm") | 47 | MACHINE_START(TI8168EVM, "ti8168evm") |
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c b/arch/arm/mach-omap2/omap_phy_internal.c index 58775e3c8476..4c90477e6f82 100644 --- a/arch/arm/mach-omap2/omap_phy_internal.c +++ b/arch/arm/mach-omap2/omap_phy_internal.c | |||
@@ -260,3 +260,38 @@ void am35x_set_mode(u8 musb_mode) | |||
260 | 260 | ||
261 | omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); | 261 | omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2); |
262 | } | 262 | } |
263 | |||
264 | void ti81xx_musb_phy_power(u8 on) | ||
265 | { | ||
266 | void __iomem *scm_base = NULL; | ||
267 | u32 usbphycfg; | ||
268 | |||
269 | scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K); | ||
270 | if (!scm_base) { | ||
271 | pr_err("system control module ioremap failed\n"); | ||
272 | return; | ||
273 | } | ||
274 | |||
275 | usbphycfg = __raw_readl(scm_base + USBCTRL0); | ||
276 | |||
277 | if (on) { | ||
278 | if (cpu_is_ti816x()) { | ||
279 | usbphycfg |= TI816X_USBPHY0_NORMAL_MODE; | ||
280 | usbphycfg &= ~TI816X_USBPHY_REFCLK_OSC; | ||
281 | } else if (cpu_is_ti814x()) { | ||
282 | usbphycfg &= ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN | ||
283 | | USBPHY_DPINPUT | USBPHY_DMINPUT); | ||
284 | usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN | ||
285 | | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL); | ||
286 | } | ||
287 | } else { | ||
288 | if (cpu_is_ti816x()) | ||
289 | usbphycfg &= ~TI816X_USBPHY0_NORMAL_MODE; | ||
290 | else if (cpu_is_ti814x()) | ||
291 | usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN; | ||
292 | |||
293 | } | ||
294 | __raw_writel(usbphycfg, scm_base + USBCTRL0); | ||
295 | |||
296 | iounmap(scm_base); | ||
297 | } | ||
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c index 267975086a7b..8d5ed775dd56 100644 --- a/arch/arm/mach-omap2/usb-musb.c +++ b/arch/arm/mach-omap2/usb-musb.c | |||
@@ -93,6 +93,9 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data) | |||
93 | if (cpu_is_omap3517() || cpu_is_omap3505()) { | 93 | if (cpu_is_omap3517() || cpu_is_omap3505()) { |
94 | oh_name = "am35x_otg_hs"; | 94 | oh_name = "am35x_otg_hs"; |
95 | name = "musb-am35x"; | 95 | name = "musb-am35x"; |
96 | } else if (cpu_is_ti81xx()) { | ||
97 | oh_name = "usb_otg_hs"; | ||
98 | name = "musb-ti81xx"; | ||
96 | } else { | 99 | } else { |
97 | oh_name = "usb_otg_hs"; | 100 | oh_name = "usb_otg_hs"; |
98 | name = "musb-omap2430"; | 101 | name = "musb-omap2430"; |
diff --git a/arch/arm/plat-omap/include/plat/usb.h b/arch/arm/plat-omap/include/plat/usb.h index 17d3c939775c..c616385f27bd 100644 --- a/arch/arm/plat-omap/include/plat/usb.h +++ b/arch/arm/plat-omap/include/plat/usb.h | |||
@@ -114,6 +114,7 @@ extern void am35x_musb_reset(void); | |||
114 | extern void am35x_musb_phy_power(u8 on); | 114 | extern void am35x_musb_phy_power(u8 on); |
115 | extern void am35x_musb_clear_irq(void); | 115 | extern void am35x_musb_clear_irq(void); |
116 | extern void am35x_set_mode(u8 musb_mode); | 116 | extern void am35x_set_mode(u8 musb_mode); |
117 | extern void ti81xx_musb_phy_power(u8 on); | ||
117 | 118 | ||
118 | /* | 119 | /* |
119 | * FIXME correct answer depends on hmc_mode, | 120 | * FIXME correct answer depends on hmc_mode, |
@@ -273,6 +274,37 @@ static inline void omap2_usbfs_init(struct omap_usb_config *pdata) | |||
273 | #define CONF2_OTGPWRDN (1 << 2) | 274 | #define CONF2_OTGPWRDN (1 << 2) |
274 | #define CONF2_DATPOL (1 << 1) | 275 | #define CONF2_DATPOL (1 << 1) |
275 | 276 | ||
277 | /* TI81XX specific definitions */ | ||
278 | #define USBCTRL0 0x620 | ||
279 | #define USBSTAT0 0x624 | ||
280 | |||
281 | /* TI816X PHY controls bits */ | ||
282 | #define TI816X_USBPHY0_NORMAL_MODE (1 << 0) | ||
283 | #define TI816X_USBPHY_REFCLK_OSC (1 << 8) | ||
284 | |||
285 | /* TI814X PHY controls bits */ | ||
286 | #define USBPHY_CM_PWRDN (1 << 0) | ||
287 | #define USBPHY_OTG_PWRDN (1 << 1) | ||
288 | #define USBPHY_CHGDET_DIS (1 << 2) | ||
289 | #define USBPHY_CHGDET_RSTRT (1 << 3) | ||
290 | #define USBPHY_SRCONDM (1 << 4) | ||
291 | #define USBPHY_SINKONDP (1 << 5) | ||
292 | #define USBPHY_CHGISINK_EN (1 << 6) | ||
293 | #define USBPHY_CHGVSRC_EN (1 << 7) | ||
294 | #define USBPHY_DMPULLUP (1 << 8) | ||
295 | #define USBPHY_DPPULLUP (1 << 9) | ||
296 | #define USBPHY_CDET_EXTCTL (1 << 10) | ||
297 | #define USBPHY_GPIO_MODE (1 << 12) | ||
298 | #define USBPHY_DPOPBUFCTL (1 << 13) | ||
299 | #define USBPHY_DMOPBUFCTL (1 << 14) | ||
300 | #define USBPHY_DPINPUT (1 << 15) | ||
301 | #define USBPHY_DMINPUT (1 << 16) | ||
302 | #define USBPHY_DPGPIO_PD (1 << 17) | ||
303 | #define USBPHY_DMGPIO_PD (1 << 18) | ||
304 | #define USBPHY_OTGVDET_EN (1 << 19) | ||
305 | #define USBPHY_OTGSESSEND_EN (1 << 20) | ||
306 | #define USBPHY_DATA_POLARITY (1 << 23) | ||
307 | |||
276 | #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB) | 308 | #if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_USB) |
277 | u32 omap1_usb0_init(unsigned nwires, unsigned is_device); | 309 | u32 omap1_usb0_init(unsigned nwires, unsigned is_device); |
278 | u32 omap1_usb1_init(unsigned nwires); | 310 | u32 omap1_usb1_init(unsigned nwires); |