[PATCH] usb: omap: ohci: Missing driver unregister in module exit

2010-09-14 Thread Keshava Munegowda
The un-registration of OHCI driver was not done in 
the ohci_hcd_mod_exit function. This was affecting rmmod command not
to work for OMAP3 platforms.
The platform driver un-registration for OMAP3 platforms is perfomed
while removing the OHCI module from kernel.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ohci-hcd.c |3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/usb/host/ohci-hcd.c
===
--- linux-2.6.orig/drivers/usb/host/ohci-hcd.c
+++ linux-2.6/drivers/usb/host/ohci-hcd.c
@@ -1270,6 +1270,9 @@ static void __exit ohci_hcd_mod_exit(voi
 #ifdef PLATFORM_DRIVER
platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
+#ifdef OMAP3_PLATFORM_DRIVER
+   platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
+#endif
 #ifdef PS3_SYSTEM_BUS_DRIVER
ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: omap: fix the warning return type defaults to 'int'

2010-10-05 Thread Keshava Munegowda

This patch fix the follwing warning when compiling usb code 
for OMAP defconfigs.
arch/arm/plat-omap/include/plat/usb.h:109: warning: return type defaults
to 'int'

Signed-off-by: Keshava Munegowda 
---
 arch/arm/plat-omap/include/plat/usb.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/arch/arm/plat-omap/include/plat/usb.h
===
--- linux-2.6.orig/arch/arm/plat-omap/include/plat/usb.h
+++ linux-2.6/arch/arm/plat-omap/include/plat/usb.h
@@ -105,7 +105,7 @@ static inline void omap1_usb_init(struct
 #if defined(CONFIG_ARCH_OMAP_OTG) || defined(CONFIG_ARCH_OMAP_OTG_MODULE)
 void omap2_usbfs_init(struct omap_usb_config *pdata);
 #else
-static inline omap2_usbfs_init(struct omap_usb_config *pdata)
+static inline void omap2_usbfs_init(struct omap_usb_config *pdata)
 {
 }
 #endif
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: omap: fix the warning unused variable 'status'

2010-10-05 Thread Keshava Munegowda
This patch fix the follwing warning when compiling usb code 
for OMAP defconfigs.
arch/arm/mach-omap2/board-omap4panda.c:277: warning: unused variable 'status'

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-omap4panda.c |2 --
 1 file changed, 2 deletions(-)

Index: linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/board-omap4panda.c
+++ linux-2.6/arch/arm/mach-omap2/board-omap4panda.c
@@ -274,8 +274,6 @@ static int __init omap4_panda_i2c_init(v
 }
 static void __init omap4_panda_init(void)
 {
-   int status;
-
omap4_panda_i2c_init();
omap_serial_init();
omap4_twl6030_hsmmc_init(mmc);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/5] usb: omap: prepare for OMAP4 EHCI and OHCI support

2010-08-18 Thread Keshava Munegowda
This series does minor code cleanup in preparation of an upcoming
series to add support for EHCI and OHCI on the OMAP4 SoC.

The changes are:
- Rename clock names to be consistent across OMAP3 and OMAP4
- Remove hardcoding of the number of TLL channels
- Move PHY reset earlier in the init sequence

These patches do not make any changes to existing functionalities.

Diffstat is below:

drivers/usb/host/ehci-omap.c   |  104 -
drivers/usb/host/ohci-omap3.c  |   55 ++---
2 files changed
---
Keshava
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5] usb: ehci: omap: Update clock names to be same across OMAP3 and OMAP4

2010-08-18 Thread Keshava Munegowda
Rename usbhost2_120m_fck to usbhost_hs_fck and
usbhost1_48m_fck to usbhost_fs_fck, so that we can reuse the
names across OMAP3 and OMAP4.

OMAP3 and OMAP4 have similar clocks, with different frequencies.
The driver should not need to care about these.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ehci-omap.c |   56 +--
 1 file changed, 28 insertions(+), 28 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -156,8 +156,8 @@ struct ehci_hcd_omap {
struct device   *dev;
 
struct clk  *usbhost_ick;
-   struct clk  *usbhost2_120m_fck;
-   struct clk  *usbhost1_48m_fck;
+   struct clk  *usbhost_hs_fck;
+   struct clk  *usbhost_fs_fck;
struct clk  *usbtll_fck;
struct clk  *usbtll_ick;
 
@@ -286,19 +286,19 @@ static int omap_start_ehc(struct ehci_hc
}
clk_enable(omap->usbhost_ick);
 
-   omap->usbhost2_120m_fck = clk_get(omap->dev, "usbhost_120m_fck");
-   if (IS_ERR(omap->usbhost2_120m_fck)) {
-   ret = PTR_ERR(omap->usbhost2_120m_fck);
-   goto err_host_120m_fck;
-   }
-   clk_enable(omap->usbhost2_120m_fck);
-
-   omap->usbhost1_48m_fck = clk_get(omap->dev, "usbhost_48m_fck");
-   if (IS_ERR(omap->usbhost1_48m_fck)) {
-   ret = PTR_ERR(omap->usbhost1_48m_fck);
-   goto err_host_48m_fck;
+   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
+   if (IS_ERR(omap->usbhost_hs_fck)) {
+   ret = PTR_ERR(omap->usbhost_hs_fck);
+   goto err_host_hs_fck;
+   }
+   clk_enable(omap->usbhost_hs_fck);
+
+   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
+   if (IS_ERR(omap->usbhost_fs_fck)) {
+   ret = PTR_ERR(omap->usbhost_fs_fck);
+   goto err_host_fs_fck;
}
-   clk_enable(omap->usbhost1_48m_fck);
+   clk_enable(omap->usbhost_fs_fck);
 
if (omap->phy_reset) {
/* Refer: ISSUE1 */
@@ -472,8 +472,8 @@ err_tll_ick:
clk_put(omap->usbtll_fck);
 
 err_tll_fck:
-   clk_disable(omap->usbhost1_48m_fck);
-   clk_put(omap->usbhost1_48m_fck);
+   clk_disable(omap->usbhost_fs_fck);
+   clk_put(omap->usbhost_fs_fck);
 
if (omap->phy_reset) {
if (gpio_is_valid(omap->reset_gpio_port[0]))
@@ -483,11 +483,11 @@ err_tll_fck:
gpio_free(omap->reset_gpio_port[1]);
}
 
-err_host_48m_fck:
-   clk_disable(omap->usbhost2_120m_fck);
-   clk_put(omap->usbhost2_120m_fck);
+err_host_fs_fck:
+   clk_disable(omap->usbhost_hs_fck);
+   clk_put(omap->usbhost_hs_fck);
 
-err_host_120m_fck:
+err_host_hs_fck:
clk_disable(omap->usbhost_ick);
clk_put(omap->usbhost_ick);
 
@@ -550,16 +550,16 @@ static void omap_stop_ehc(struct ehci_hc
omap->usbhost_ick = NULL;
}
 
-   if (omap->usbhost1_48m_fck != NULL) {
-   clk_disable(omap->usbhost1_48m_fck);
-   clk_put(omap->usbhost1_48m_fck);
-   omap->usbhost1_48m_fck = NULL;
+   if (omap->usbhost_fs_fck != NULL) {
+   clk_disable(omap->usbhost_fs_fck);
+   clk_put(omap->usbhost_fs_fck);
+   omap->usbhost_fs_fck = NULL;
}
 
-   if (omap->usbhost2_120m_fck != NULL) {
-   clk_disable(omap->usbhost2_120m_fck);
-   clk_put(omap->usbhost2_120m_fck);
-   omap->usbhost2_120m_fck = NULL;
+   if (omap->usbhost_hs_fck != NULL) {
+   clk_disable(omap->usbhost_hs_fck);
+   clk_put(omap->usbhost_hs_fck);
+   omap->usbhost_hs_fck = NULL;
}
 
if (omap->usbtll_ick != NULL) {
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/5] usb: ehci: don't hard-code TLL channel count.

2010-08-18 Thread Keshava Munegowda
Make TLL channel count a parameter instead of a hardcoded value.
This allows us to be flexible with future OMAP revisions which
could have a different number of channels.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ehci-omap.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -191,13 +191,14 @@ struct ehci_hcd_omap {
 
 /*-*/
 
-static void omap_usb_utmi_init(struct ehci_hcd_omap *omap, u8 tll_channel_mask)
+static void omap_usb_utmi_init(struct ehci_hcd_omap *omap,
+   u8 tll_channel_mask, u8 tll_channel_count)
 {
unsigned reg;
int i;
 
/* Program the 3 TLL channels upfront */
-   for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
+   for (i = 0; i < tll_channel_count; i++) {
reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i));
 
/* Disable AutoIdle, BitStuffing and use SDR Mode */
@@ -217,7 +218,7 @@ static void omap_usb_utmi_init(struct eh
ehci_omap_writel(omap->tll_base, OMAP_TLL_SHARED_CONF, reg);
 
/* Enable channels now */
-   for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
+   for (i = 0; i < tll_channel_count; i++) {
reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i));
 
/* Enable only the reg that is needed */
@@ -438,7 +439,7 @@ static int omap_start_ehc(struct ehci_hc
tll_ch_mask |= OMAP_TLL_CHANNEL_3_EN_MASK;
 
/* Enable UTMI mode for required TLL channels */
-   omap_usb_utmi_init(omap, tll_ch_mask);
+   omap_usb_utmi_init(omap, tll_ch_mask, OMAP_TLL_CHANNEL_COUNT);
}
 
if (omap->phy_reset) {
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] usb: ehci: relocate PHY reset code

2010-08-18 Thread Keshava Munegowda
The PHY reset code is moved at the begining and end of the function
omap_start_ehc. This simplfies the writing clocks enabling code for 
OMAP4 later. 

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ehci-omap.c |   52 +--
 1 file changed, 26 insertions(+), 26 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -279,6 +279,24 @@ static int omap_start_ehc(struct ehci_hc
 
dev_dbg(omap->dev, "starting TI EHCI USB Controller\n");
 
+   if (omap->phy_reset) {
+   /* Refer: ISSUE1 */
+   if (gpio_is_valid(omap->reset_gpio_port[0])) {
+   gpio_request(omap->reset_gpio_port[0],
+   "USB1 PHY reset");
+   gpio_direction_output(omap->reset_gpio_port[0], 0);
+   }
+
+   if (gpio_is_valid(omap->reset_gpio_port[1])) {
+   gpio_request(omap->reset_gpio_port[1],
+   "USB2 PHY reset");
+   gpio_direction_output(omap->reset_gpio_port[1], 0);
+   }
+
+   /* Hold the PHY in RESET for enough time till DIR is high */
+   udelay(10);
+   }
+
/* Enable Clocks for USBHOST */
omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
if (IS_ERR(omap->usbhost_ick)) {
@@ -301,24 +319,6 @@ static int omap_start_ehc(struct ehci_hc
}
clk_enable(omap->usbhost_fs_fck);
 
-   if (omap->phy_reset) {
-   /* Refer: ISSUE1 */
-   if (gpio_is_valid(omap->reset_gpio_port[0])) {
-   gpio_request(omap->reset_gpio_port[0],
-   "USB1 PHY reset");
-   gpio_direction_output(omap->reset_gpio_port[0], 0);
-   }
-
-   if (gpio_is_valid(omap->reset_gpio_port[1])) {
-   gpio_request(omap->reset_gpio_port[1],
-   "USB2 PHY reset");
-   gpio_direction_output(omap->reset_gpio_port[1], 0);
-   }
-
-   /* Hold the PHY in RESET for enough time till DIR is high */
-   udelay(10);
-   }
-
/* Configure TLL for 60Mhz clk for ULPI */
omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
if (IS_ERR(omap->usbtll_fck)) {
@@ -476,14 +476,6 @@ err_tll_fck:
clk_disable(omap->usbhost_fs_fck);
clk_put(omap->usbhost_fs_fck);
 
-   if (omap->phy_reset) {
-   if (gpio_is_valid(omap->reset_gpio_port[0]))
-   gpio_free(omap->reset_gpio_port[0]);
-
-   if (gpio_is_valid(omap->reset_gpio_port[1]))
-   gpio_free(omap->reset_gpio_port[1]);
-   }
-
 err_host_fs_fck:
clk_disable(omap->usbhost_hs_fck);
clk_put(omap->usbhost_hs_fck);
@@ -493,6 +485,14 @@ err_host_hs_fck:
clk_put(omap->usbhost_ick);
 
 err_host_ick:
+   if (omap->phy_reset) {
+   if (gpio_is_valid(omap->reset_gpio_port[0]))
+   gpio_free(omap->reset_gpio_port[0]);
+
+   if (gpio_is_valid(omap->reset_gpio_port[1]))
+   gpio_free(omap->reset_gpio_port[1]);
+   }
+
return ret;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/5] usb: ohci: omap: Update clock names to be same across OMAP3 and OMAP4

2010-08-18 Thread Keshava Munegowda
Rename usbhost2_120m_fck to usbhost_hs_fck and
usbhost1_48m_fck to usbhost_fs_fck, so that we can reuse the
names across OMAP3 and OMAP4.

OMAP3 and OMAP4 have similar clocks, with different frequencies.
The driver should not need to care about these.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ohci-omap3.c |   48 +-
 1 file changed, 24 insertions(+), 24 deletions(-)

Index: kernel-omap4-base/drivers/usb/host/ohci-omap3.c
===
--- kernel-omap4-base.orig/drivers/usb/host/ohci-omap3.c
+++ kernel-omap4-base/drivers/usb/host/ohci-omap3.c
@@ -135,8 +135,8 @@ struct ohci_hcd_omap3 {
struct device   *dev;
 
struct clk  *usbhost_ick;
-   struct clk  *usbhost2_120m_fck;
-   struct clk  *usbhost1_48m_fck;
+   struct clk  *usbhost_hs_fck;
+   struct clk  *usbhost_fs_fck;
struct clk  *usbtll_fck;
struct clk  *usbtll_ick;
 
@@ -157,11 +157,11 @@ static void ohci_omap3_clock_power(struc
clk_enable(omap->usbtll_ick);
clk_enable(omap->usbtll_fck);
clk_enable(omap->usbhost_ick);
-   clk_enable(omap->usbhost1_48m_fck);
-   clk_enable(omap->usbhost2_120m_fck);
+   clk_enable(omap->usbhost_fs_fck);
+   clk_enable(omap->usbhost_hs_fck);
} else {
-   clk_disable(omap->usbhost2_120m_fck);
-   clk_disable(omap->usbhost1_48m_fck);
+   clk_disable(omap->usbhost_hs_fck);
+   clk_disable(omap->usbhost_fs_fck);
clk_disable(omap->usbhost_ick);
clk_disable(omap->usbtll_fck);
clk_disable(omap->usbtll_ick);
@@ -297,18 +297,18 @@ static int omap3_start_ohci(struct ohci_
goto err_host_ick;
}
 
-   omap->usbhost2_120m_fck = clk_get(omap->dev, "usbhost_120m_fck");
-   if (IS_ERR(omap->usbhost2_120m_fck)) {
+   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
+   if (IS_ERR(omap->usbhost_hs_fck)) {
dev_err(omap->dev, "could not get usbhost_120m_fck\n");
-   ret = PTR_ERR(omap->usbhost2_120m_fck);
-   goto err_host_120m_fck;
+   ret = PTR_ERR(omap->usbhost_hs_fck);
+   goto err_host_hs_fck;
}
 
-   omap->usbhost1_48m_fck = clk_get(omap->dev, "usbhost_48m_fck");
-   if (IS_ERR(omap->usbhost1_48m_fck)) {
+   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
+   if (IS_ERR(omap->usbhost_fs_fck)) {
dev_err(omap->dev, "could not get usbhost_48m_fck\n");
-   ret = PTR_ERR(omap->usbhost1_48m_fck);
-   goto err_host_48m_fck;
+   ret = PTR_ERR(omap->usbhost_fs_fck);
+   goto err_host_fs_fck;
}
 
omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
@@ -434,12 +434,12 @@ err_tll_ick:
clk_put(omap->usbtll_fck);
 
 err_tll_fck:
-   clk_put(omap->usbhost1_48m_fck);
+   clk_put(omap->usbhost_fs_fck);
 
-err_host_48m_fck:
-   clk_put(omap->usbhost2_120m_fck);
+err_host_fs_fck:
+   clk_put(omap->usbhost_hs_fck);
 
-err_host_120m_fck:
+err_host_hs_fck:
clk_put(omap->usbhost_ick);
 
 err_host_ick:
@@ -501,14 +501,14 @@ static void omap3_stop_ohci(struct ohci_
omap->usbhost_ick = NULL;
}
 
-   if (omap->usbhost1_48m_fck != NULL) {
-   clk_put(omap->usbhost1_48m_fck);
-   omap->usbhost1_48m_fck = NULL;
+   if (omap->usbhost_fs_fck != NULL) {
+   clk_put(omap->usbhost_fs_fck);
+   omap->usbhost_fs_fck = NULL;
}
 
-   if (omap->usbhost2_120m_fck != NULL) {
-   clk_put(omap->usbhost2_120m_fck);
-   omap->usbhost2_120m_fck = NULL;
+   if (omap->usbhost_hs_fck != NULL) {
+   clk_put(omap->usbhost_hs_fck);
+   omap->usbhost_hs_fck = NULL;
}
 
if (omap->usbtll_ick != NULL) {
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] usb: ohci: don't hard-code TLL channel count

2010-08-18 Thread Keshava Munegowda
Make TLL channel count a parameter instead of a hardcoded value.
This allows us to be flexible with future OMAP revisions which
could have a different number of channels.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ohci-omap3.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: kernel-omap4-base/drivers/usb/host/ohci-omap3.c
===
--- kernel-omap4-base.orig/drivers/usb/host/ohci-omap3.c
+++ kernel-omap4-base/drivers/usb/host/ohci-omap3.c
@@ -245,7 +245,8 @@ static unsigned ohci_omap3_fslsmode(enum
}
 }
 
-static void ohci_omap3_tll_config(struct ohci_hcd_omap3 *omap)
+static void ohci_omap3_tll_config(struct ohci_hcd_omap3 *omap,
+   u8 tll_channel_count)
 {
u32 reg;
int i;
@@ -263,7 +264,7 @@ static void ohci_omap3_tll_config(struct
 * REVISIT: Only the 3-pin and 4-pin PHY modes have
 * actually been tested.
 */
-   for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
+   for (i = 0; i < tll_channel_count; i++) {
 
/* Enable only those channels that are actually used */
if (omap->port_mode[i] == OMAP_OHCI_PORT_MODE_UNUSED)
@@ -422,7 +423,7 @@ static int omap3_start_ohci(struct ohci_
ohci_omap_writel(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
dev_dbg(omap->dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
 
-   ohci_omap3_tll_config(omap);
+   ohci_omap3_tll_config(omap, OMAP_TLL_CHANNEL_COUNT);
 
return 0;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5] usb: ohci: don't hard-code TLL channel count

2010-08-18 Thread Keshava Munegowda
Make TLL channel count a parameter instead of a hardcoded value.
This allows us to be flexible with future OMAP revisions which
could have a different number of channels.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ohci-omap3.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: kernel-omap4-base/drivers/usb/host/ohci-omap3.c
===
--- kernel-omap4-base.orig/drivers/usb/host/ohci-omap3.c
+++ kernel-omap4-base/drivers/usb/host/ohci-omap3.c
@@ -245,7 +245,8 @@ static unsigned ohci_omap3_fslsmode(enum
}
 }
 
-static void ohci_omap3_tll_config(struct ohci_hcd_omap3 *omap)
+static void ohci_omap3_tll_config(struct ohci_hcd_omap3 *omap,
+   u8 tll_channel_count)
 {
u32 reg;
int i;
@@ -263,7 +264,7 @@ static void ohci_omap3_tll_config(struct
 * REVISIT: Only the 3-pin and 4-pin PHY modes have
 * actually been tested.
 */
-   for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
+   for (i = 0; i < tll_channel_count; i++) {
 
/* Enable only those channels that are actually used */
if (omap->port_mode[i] == OMAP_OHCI_PORT_MODE_UNUSED)
@@ -422,7 +423,7 @@ static int omap3_start_ohci(struct ohci_
ohci_omap_writel(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
dev_dbg(omap->dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
 
-   ohci_omap3_tll_config(omap);
+   ohci_omap3_tll_config(omap, OMAP_TLL_CHANNEL_COUNT);
 
return 0;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/7] usb: ehci: omap: Adding OMAP4 support

2010-08-19 Thread Keshava Munegowda
The OMAP4 EHCI supports only two ports and hence two TLL channels.
Each port is driven by seperate clocks. Following interface mode 
exists in EHCI controller of OMAP4.
- External PHY mode , with 12 pin ULPI
- USBTLL mode
- HSIC mode 
The External PHY mode is validated with these patches and other modes are TODOs
for later. 
The TLL clocks are enabled and channels are configuared only when
USBTLL mode is choosen.
 
The summary is of patches - 

1/7 Add the base address of EHCI controller
2/7 based on omap3 and omap4 ; the processor specific clocks
enabled. formats the code of ehci-omap.c so that OMAP4 specific 
changes can be easily inserted.  
3/7 Adding OMAP4 support.
4/7 Introduces the Kconfig macro to include the ehci driver
as platform driver 
5/7 This is hack to do the mux setting for EHCI pad configuration;
This patch will be replaced when the mux framework for omap4
is introduced.
6/7 Adds the EHCI IRQ number and base address resources in 
ehci initialization.
7/7 The EHCI init fuction invocation from 4430 sdp init.

diffstat is below:
 drivers/usb/host/Kconfig   |8 
 drivers/usb/host/ehci-hcd.c|2 
 drivers/usb/host/ehci-omap.c   |  539 +
 3 files changed 

-- keshava
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 1/7] usb: ehci-omap: Add the HSUSB base address

2010-08-19 Thread Keshava Munegowda
Update omap44xx.h with base addresses for USBHOST and USBTLL.
This patch will be replaced with the HWMOD(hardware mode) implementation later.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/plat-omap/include/plat/omap44xx.h |5 +
 1 file changed, 5 insertions(+)

Index: kernel-omap4-base/arch/arm/plat-omap/include/plat/omap44xx.h
===
--- kernel-omap4-base.orig/arch/arm/plat-omap/include/plat/omap44xx.h
+++ kernel-omap4-base/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -52,5 +52,10 @@
 #define OMAP4_MMU1_BASE0x55082000
 #define OMAP4_MMU2_BASE0x4A066000
 
+#define OMAP44XX_USBTLL_BASE   (L4_44XX_BASE + 0x62000)
+#define OMAP44XX_UHH_CONFIG_BASE   (L4_44XX_BASE + 0x64000)
+#define OMAP44XX_HSUSB_OHCI_BASE   (L4_44XX_BASE + 0x64800)
+#define OMAP44XX_HSUSB_EHCI_BASE   (L4_44XX_BASE + 0x64C00)
+
 #endif /* __ASM_ARCH_OMAP44XX_H */
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 2/7] usb: ehci-omap: don't execute OMAP3-specific code on non-OMAP3

2010-08-19 Thread Keshava Munegowda
Formats the code so that omap4 ehci host driver can be inserted
in TODO location later. The function cpu_is_omap44xx is used to determine
the OMAP3 or OAMP4 processor. This function will be later replaced by
hwmode changes.

There are No functional changes in this patch.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ehci-omap.c |  295 +--
 1 file changed, 150 insertions(+), 145 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -297,194 +297,184 @@ static int omap_start_ehc(struct ehci_hc
udelay(10);
}
 
-   /* Enable Clocks for USBHOST */
-   omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
-   if (IS_ERR(omap->usbhost_ick)) {
-   ret =  PTR_ERR(omap->usbhost_ick);
-   goto err_host_ick;
-   }
-   clk_enable(omap->usbhost_ick);
+   if (cpu_is_omap44xx()) {
+   /* TODO */
+   } else {
+   /* Enable Clocks for USBHOST */
+   omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
+   if (IS_ERR(omap->usbhost_ick)) {
+   ret =  PTR_ERR(omap->usbhost_ick);
+   goto err_host;
+   }
+   clk_enable(omap->usbhost_ick);
 
-   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
-   if (IS_ERR(omap->usbhost_hs_fck)) {
-   ret = PTR_ERR(omap->usbhost_hs_fck);
-   goto err_host_hs_fck;
-   }
-   clk_enable(omap->usbhost_hs_fck);
+   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
+   if (IS_ERR(omap->usbhost_hs_fck)) {
+   ret = PTR_ERR(omap->usbhost_hs_fck);
+   goto err_host_hs_fck;
+   }
+   clk_enable(omap->usbhost_hs_fck);
 
-   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
-   if (IS_ERR(omap->usbhost_fs_fck)) {
-   ret = PTR_ERR(omap->usbhost_fs_fck);
-   goto err_host_fs_fck;
-   }
-   clk_enable(omap->usbhost_fs_fck);
+   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
+   if (IS_ERR(omap->usbhost_fs_fck)) {
+   ret = PTR_ERR(omap->usbhost_fs_fck);
+   goto err_host_fs_fck;
+   }
+   clk_enable(omap->usbhost_fs_fck);
 
-   /* Configure TLL for 60Mhz clk for ULPI */
-   omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
-   if (IS_ERR(omap->usbtll_fck)) {
-   ret = PTR_ERR(omap->usbtll_fck);
-   goto err_tll_fck;
-   }
-   clk_enable(omap->usbtll_fck);
+   /* Configure TLL for 60Mhz clk for ULPI */
+   omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
+   if (IS_ERR(omap->usbtll_fck)) {
+   ret = PTR_ERR(omap->usbtll_fck);
+   goto err_tll_fck;
+   }
+   clk_enable(omap->usbtll_fck);
 
-   omap->usbtll_ick = clk_get(omap->dev, "usbtll_ick");
-   if (IS_ERR(omap->usbtll_ick)) {
-   ret = PTR_ERR(omap->usbtll_ick);
-   goto err_tll_ick;
-   }
-   clk_enable(omap->usbtll_ick);
+   omap->usbtll_ick = clk_get(omap->dev, "usbtll_ick");
+   if (IS_ERR(omap->usbtll_ick)) {
+   ret = PTR_ERR(omap->usbtll_ick);
+   goto err_tll_ick;
+   }
+   clk_enable(omap->usbtll_ick);
 
-   /* perform TLL soft reset, and wait until reset is complete */
-   ehci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
+   /* perform TLL soft reset, and wait until reset is complete */
+   ehci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
OMAP_USBTLL_SYSCONFIG_SOFTRESET);
 
-   /* Wait for TLL reset to complete */
-   while (!(ehci_omap_readl(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
+   /* Wait for TLL reset to complete */
+   while (!(ehci_omap_readl(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
& OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
-   cpu_relax();
+   cpu_relax();
 
-   if (time_after(jiffies, timeout)) {
-   dev_dbg(omap->dev, "operation timed out\n");
-   ret = -EINVAL;
-   goto err_sys_status;
+   if (time_after(jiffie

[RFC] [PATCH 3/7] usb: ehci-omap: omap: Add OMAP4 support

2010-08-19 Thread Keshava Munegowda
Update the ehci-omap driver to add support for OMAP4.

The OMAP4 has two ports compared to 3 on the OMAP3.
Each port has its own functional clock, compared to a single clock
for all ports on OMAP3. The clock can be internally sourced 
(TLL mode, HSIC mode), or externally provided (ULPI PHY).

Register bit positions for mode selections
(TLL, HSIC or ULPI PHY) have changed.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ehci-omap.c |  208 ++-
 1 file changed, 205 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/usb/host/ehci-omap.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-omap.c
+++ linux-2.6/drivers/usb/host/ehci-omap.c
@@ -127,6 +127,31 @@
 #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0
 
+/* OMAP4 specific */
+#define OMAP_UHH_SYSCONFIG_IDLEMODE_RESET  (~(0xC))
+#define OMAP_UHH_SYSCONFIG_FIDLEMODE_SET   (0 << 2)
+#define OMAP_UHH_SYSCONFIG_NIDLEMODE_SET   (1 << 2)
+#define OMAP_UHH_SYSCONFIG_SIDLEMODE_SET   (2 << 2)
+#define OMAP_UHH_SYSCONFIG_SWIDLMODE_SET   (3 << 2)
+
+#define OMAP_UHH_SYSCONFIG_STDYMODE_RESET  (~(3 << 4))
+#define OMAP_UHH_SYSCONFIG_FSTDYMODE_SET   (0 << 4)
+#define OMAP_UHH_SYSCONFIG_NSTDYMODE_SET   (1 << 4)
+#define OMAP_UHH_SYSCONFIG_SSTDYMODE_SET   (2 << 4)
+#define OMAP_UHH_SYSCONFIG_SWSTDMODE_SET   (3 << 4)
+
+#define OMAP_UHH_HOST_PORTS_RESET  (~(0xF << 16))
+#define OMAP_UHH_HOST_P1_SET_ULPIPHY   (0 << 16)
+#define OMAP_UHH_HOST_P1_SET_ULPITLL   (1 << 16)
+#define OMAP_UHH_HOST_P1_SET_HSIC  (3 << 16)
+
+#define OMAP_UHH_HOST_P2_SET_ULPIPHY   (0 << 18)
+#define OMAP_UHH_HOST_P2_SET_ULPITLL   (1 << 18)
+#define OMAP_UHH_HOST_P2_SET_HSIC  (3 << 18)
+#define OMAP4_UHH_SYSCONFIG_SOFTRESET  (1 << 0)
+
+#define OMAP4_TLL_CHANNEL_COUNT2
+
 /*-*/
 
 static inline void ehci_omap_writel(void __iomem *base, u32 reg, u32 val)
@@ -160,6 +185,10 @@ struct ehci_hcd_omap {
struct clk  *usbhost_fs_fck;
struct clk  *usbtll_fck;
struct clk  *usbtll_ick;
+   struct clk  *xclk60mhsp1_ck;
+   struct clk  *xclk60mhsp2_ck;
+   struct clk  *utmi_p1_fck;
+   struct clk  *utmi_p2_fck;
 
/* FIXME the following two workarounds are
 * board specific not silicon-specific so these
@@ -298,7 +327,163 @@ static int omap_start_ehc(struct ehci_hc
}
 
if (cpu_is_omap44xx()) {
-   /* TODO */
+   /* Enable clocks for OMAP4 USBHOST */
+   omap->usbhost_hs_fck = clk_get(omap->dev, "usb_host_fck");
+   if (IS_ERR(omap->usbhost_hs_fck)) {
+   ret = PTR_ERR(omap->usbhost_hs_fck);
+   goto err_host;
+   }
+   clk_enable(omap->usbhost_hs_fck);
+
+   omap->usbhost_fs_fck = clk_get(omap->dev, "usb_host_fs_fck");
+   if (IS_ERR(omap->usbhost_fs_fck)) {
+   ret = PTR_ERR(omap->usbhost_fs_fck);
+   goto err_44host_fs_fck;
+   }
+   clk_enable(omap->usbhost_fs_fck);
+
+   omap->xclk60mhsp1_ck = clk_get(omap->dev, "xclk60mhsp1_ck");
+   if (IS_ERR(omap->xclk60mhsp1_ck)) {
+   ret = PTR_ERR(omap->xclk60mhsp1_ck);
+   goto err_xclk60mhsp1_ck;
+   }
+
+   omap->utmi_p1_fck = clk_get(omap->dev, "utmi_p1_gfclk_ck");
+   if (IS_ERR(omap->utmi_p1_fck)) {
+   ret = PTR_ERR(omap->utmi_p1_fck);
+   goto err_xclk60mhsp1_ck;
+   }
+
+   /* Set the clock parent as External clock  */
+   ret = clk_set_parent(omap->utmi_p1_fck, omap->xclk60mhsp1_ck);
+   if (ret != 0)
+   goto err_xclk60mhsp1_ck;
+
+   clk_enable(omap->utmi_p1_fck);
+
+   omap->xclk60mhsp2_ck = clk_get(omap->dev, "xclk60mhsp2_ck");
+   if (IS_ERR(omap->xclk60mhsp2_ck)) {
+   ret = PTR_ERR(omap->xclk60mhsp2_ck);
+   goto err_xclk60mhsp2_ck;
+   }
+
+   omap->utmi_p2_fck = clk_get(omap->dev, "utmi_p2_g

[RFC] [PATCH 4/7] omap: usb: ehci: IO mux mode settings for omap4

2010-08-19 Thread Keshava Munegowda
This patch adds mux-mode settings for EHCI pads on OMAP4.
This is a hack for now, 
This code be replaced when the mux framework is introduced for OMAP4.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/usb-ehci.c |  109 +
 1 file changed, 109 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/usb-ehci.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/usb-ehci.c
+++ linux-2.6/arch/arm/mach-omap2/usb-ehci.c
@@ -214,6 +214,115 @@ static void setup_ehci_io_mux(const enum
return;
 }
 
+static void setup_4430ehci_io_mux(const enum ehci_hcd_omap_mode *port_mode)
+{
+   /*
+* FIXME: This funtion should use mux framework functions;
+* For now, we are hardcoding this.
+*/
+   switch (port_mode[0]) {
+   case EHCI_HCD_OMAP_MODE_PHY:
+
+   /* HUSB1_PHY CLK , INPUT ENABLED, PULLDOWN  */
+   omap_writew(0x010C, 0x4A1000C2);
+
+   /* HUSB1 STP */
+   omap_writew(0x0004, 0x4A1000C4);
+
+   /* HUSB1_DIR */
+   omap_writew(0x010C, 0x4A1000C6);
+
+   /* HUSB1_NXT */
+   omap_writew(0x010C, 0x4A1000C8);
+
+   /* HUSB1_DATA0 */
+   omap_writew(0x010C, 0x4A1000CA);
+
+   /* HUSB1_DATA1 */
+   omap_writew(0x010C, 0x4A1000CC);
+
+   /* HUSB1_DATA2 */
+   omap_writew(0x010C, 0x4A1000CE);
+
+   /* HUSB1_DATA3 */
+   omap_writew(0x010C, 0x4A1000D0);
+
+   /* HUSB1_DATA4 */
+   omap_writew(0x010C, 0x4A1000D2);
+
+   /* HUSB1_DATA5 */
+   omap_writew(0x010C, 0x4A1000D4);
+
+   /* HUSB1_DATA6 */
+   omap_writew(0x010C, 0x4A1000D6);
+
+   /* HUSB1_DATA7 */
+   omap_writew(0x010C, 0x4A1000D8);
+
+   break;
+
+   case EHCI_HCD_OMAP_MODE_TLL:
+   /* TODO */
+
+   break;
+   case EHCI_HCD_OMAP_MODE_UNKNOWN:
+   /* FALLTHROUGH */
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case EHCI_HCD_OMAP_MODE_PHY:
+   /* HUSB2_PHY CLK , INPUT PULLDOWN ENABLED  */
+   omap_writew(0x010C, 0x4A100160);
+
+   /* HUSB2 STP */
+   omap_writew(0x0002, 0x4A100162);
+
+   /* HUSB2_DIR */
+   omap_writew(0x010A, 0x4A100164);
+
+   /* HUSB2_NXT */
+   omap_writew(0x010A, 0x4A100166);
+
+   /* HUSB2_DATA0 */
+   omap_writew(0x010A, 0x4A100168);
+
+   /* HUSB2_DATA1 */
+   omap_writew(0x010A, 0x4A10016A);
+
+   /* HUSB2_DATA2 */
+   omap_writew(0x010A, 0x4A10016C);
+
+   /* HUSB2_DATA3 */
+   omap_writew(0x010A, 0x4A10016E);
+
+   /* HUSB2_DATA4 */
+   omap_writew(0x010A, 0x4A100170);
+
+   /* HUSB2_DATA5 */
+   omap_writew(0x010A, 0x4A100172);
+
+   /* HUSB2_DATA6 */
+   omap_writew(0x010A, 0x4A100174);
+
+   /* HUSB2_DATA7 */
+   omap_writew(0x010A, 0x4A100176);
+
+   break;
+
+   case EHCI_HCD_OMAP_MODE_TLL:
+   /* TODO */
+
+   break;
+   case EHCI_HCD_OMAP_MODE_UNKNOWN:
+   /* FALLTHROUGH */
+   default:
+   break;
+   }
+   return;
+}
+
 void __init usb_ehci_init(const struct ehci_hcd_omap_platform_data *pdata)
 {
platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 5/7] omap: usb: ehci: Initialize resources for omap4

2010-08-19 Thread Keshava Munegowda
Update resources (IRQ number, base addresses) for EHCI on OMAP4.
This patch will be replaced when the driver is converted to
take advantage of hwmod (hardware mode).

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/usb-ehci.c |   26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/arm/mach-omap2/usb-ehci.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/usb-ehci.c
+++ linux-2.6/arch/arm/mach-omap2/usb-ehci.c
@@ -34,22 +34,15 @@
 
 static struct resource ehci_resources[] = {
{
-   .start  = OMAP34XX_EHCI_BASE,
-   .end= OMAP34XX_EHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{ /* general IRQ */
-   .start   = INT_34XX_EHCI_IRQ,
.flags   = IORESOURCE_IRQ,
}
 };
@@ -328,8 +321,25 @@ void __init usb_ehci_init(const struct e
platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
 
/* Setup Pin IO MUX for EHCI */
-   if (cpu_is_omap34xx())
+   if (cpu_is_omap34xx()) {
+   ehci_resources[0].start = OMAP34XX_EHCI_BASE;
+   ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
+   ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
+   ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
+   ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
+   ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
+   ehci_resources[3].start = INT_34XX_EHCI_IRQ;
setup_ehci_io_mux(pdata->port_mode);
+   } else if (cpu_is_omap44xx()) {
+   ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
+   ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
+   ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
+   ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
+   ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
+   ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
+   ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
+   setup_4430ehci_io_mux(pdata->port_mode);
+   }
 
if (platform_device_register(&ehci_device) < 0) {
printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 6/7] usb: ehci: Introduce CONFIG_USB_EHCI_HCD_OMAP3

2010-08-19 Thread Keshava Munegowda
Introduce the CONFIG_USB_EHCI_HCD_OMAP3 option to select
EHCI support on OMAP3 and later chips. This scales better
than having a long line of dependencies for each new OMAP
with EHCI support.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/Kconfig|8 
 drivers/usb/host/ehci-hcd.c |2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/usb/host/ehci-hcd.c
===
--- linux-2.6.orig/drivers/usb/host/ehci-hcd.c
+++ linux-2.6/drivers/usb/host/ehci-hcd.c
@@ -1157,7 +1157,7 @@ MODULE_LICENSE ("GPL");
 #definePLATFORM_DRIVER ehci_hcd_au1xxx_driver
 #endif
 
-#ifdef CONFIG_ARCH_OMAP3
+#ifdef CONFIG_USB_EHCI_HCD_OMAP3
 #include "ehci-omap.c"
 #definePLATFORM_DRIVER ehci_hcd_omap_driver
 #endif
Index: linux-2.6/drivers/usb/host/Kconfig
===
--- linux-2.6.orig/drivers/usb/host/Kconfig
+++ linux-2.6/drivers/usb/host/Kconfig
@@ -126,6 +126,14 @@ config USB_EHCI_MXC
---help---
  Variation of ARC USB block used in some Freescale chips.
 
+config USB_EHCI_HCD_OMAP3
+   bool "EHCI support for OMAP3 and later chips"
+   depends on USB_EHCI_HCD && (ARCH_OMAP3 || ARCH_OMAP4)
+   default y
+   --- help ---
+ Enables support for the on-chip EHCI controller on
+ OMAP3 and later chips.
+
 config USB_EHCI_HCD_PPC_OF
bool "EHCI support for PPC USB controller on OF platform bus"
depends on USB_EHCI_HCD && PPC_OF
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 7/7] omap: ehci: enable the ehci port on OMAP4SDP

2010-08-19 Thread Keshava Munegowda
The OMAP4 SDP has EHCI port1 hooked up to an external SMSC3320
transciever. GPIO 157 is used to power on the transceiver.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/board-4430sdp.c |   20 
 1 file changed, 20 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
+++ linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
@@ -40,6 +40,7 @@
 #define ETH_KS8851_IRQ 34
 #define ETH_KS8851_POWER_ON48
 #define ETH_KS8851_QUART   138
+#define OMAP4SDP_MDM_PWR_EN_GPIO   157
 
 static struct gpio_led sdp4430_gpio_leds[] = {
{
@@ -412,6 +413,17 @@ static struct i2c_board_info __initdata 
I2C_BOARD_INFO("tmp105", 0x48),
},
 };
+
+static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
+   .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .phy_reset  = false,
+   .reset_gpio_port[0]  = -EINVAL,
+   .reset_gpio_port[1]  = -EINVAL,
+   .reset_gpio_port[2]  = -EINVAL
+};
+
 static int __init omap4_i2c_init(void)
 {
/*
@@ -434,6 +446,14 @@ static void __init omap_4430sdp_init(voi
platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices));
omap_serial_init();
omap4_twl6030_hsmmc_init(mmc);
+
+   /* Power on the ULPI PHY */
+   if (gpio_is_valid(OMAP4SDP_MDM_PWR_EN_GPIO)) {
+   /* FIXME: Assumes pad is muxed for GPIO mode */
+   gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO, "USBB1 PHY VMDM_3V3");
+   gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
+   }
+   usb_ehci_init(&ehci_pdata);
/* OMAP4 SDP uses internal transceiver so register nop transceiver */
usb_nop_xceiv_register();
/* FIXME: allow multi-omap to boot until musb is updated for omap4 */
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 0/5] usb: ohci: omap: Add OMAP4 Support

2010-08-20 Thread Keshava Munegowda
The OMAP4 OHCI supports only two ports and hence two TLL channels.
Each port is driven by seperate clocks. The OHCI controller is operated
with the following two serial interface modes.
- External PHY mode 
- USBTLL mode

The PHY mode with Unidirectional 6-pin encoding (TX: DAT/SE0 mode) 
is validated  with these patches.

patch summary:

1/5 formats the code of ehci-omap.c so that omap4 specific 
changes can be easily inserted.  
2/5 implements OMAP4 support
3/5 This is hack to do the mux setting for OHCI pad configuration;
This patch will be replaced when the mux framework for omap4
is introduced.
4/5 Adds the OHCI IRQ number and base address resources in 
ehci initialization.
5/5 registering OHCI controller in 4430 sdp board file.

-keshava
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 1/5] usb: ohci-omap3: seperate the OMAP3-specific code

2010-08-20 Thread Keshava Munegowda
Formats the code so that omap4 ohci host specific code changes can be
inserted in TODO location later.The function cpu_is_omap44xx is used
to determine the OMAP3 or OMAP4 processor. This function will be
later replaced by HWMOD changes.

No functional changes.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ohci-omap3.c |  236 +-
 1 file changed, 120 insertions(+), 116 deletions(-)

Index: linux-2.6/drivers/usb/host/ohci-omap3.c
===
--- linux-2.6.orig/drivers/usb/host/ohci-omap3.c
+++ linux-2.6/drivers/usb/host/ohci-omap3.c
@@ -290,161 +290,165 @@ static int omap3_start_ohci(struct ohci_
 
dev_dbg(omap->dev, "starting TI OHCI USB Controller\n");
 
-   /* Get all the clock handles we need */
-   omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
-   if (IS_ERR(omap->usbhost_ick)) {
-   dev_err(omap->dev, "could not get usbhost_ick\n");
-   ret =  PTR_ERR(omap->usbhost_ick);
-   goto err_host_ick;
-   }
-
-   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
-   if (IS_ERR(omap->usbhost_hs_fck)) {
-   dev_err(omap->dev, "could not get usbhost_120m_fck\n");
-   ret = PTR_ERR(omap->usbhost_hs_fck);
-   goto err_host_hs_fck;
-   }
-
-   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
-   if (IS_ERR(omap->usbhost_fs_fck)) {
-   dev_err(omap->dev, "could not get usbhost_48m_fck\n");
-   ret = PTR_ERR(omap->usbhost_fs_fck);
-   goto err_host_fs_fck;
-   }
+   if (cpu_is_omap44xx()) {
+   /* TODO */
+   } else {
+   /* Get all the clock handles we need */
+   omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
+   if (IS_ERR(omap->usbhost_ick)) {
+   dev_err(omap->dev, "could not get usbhost_ick\n");
+   ret =  PTR_ERR(omap->usbhost_ick);
+   goto err_host_ick;
+   }
 
-   omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
-   if (IS_ERR(omap->usbtll_fck)) {
-   dev_err(omap->dev, "could not get usbtll_fck\n");
-   ret = PTR_ERR(omap->usbtll_fck);
-   goto err_tll_fck;
-   }
+   omap->usbhost_hs_fck = clk_get(omap->dev, "usbhost_120m_fck");
+   if (IS_ERR(omap->usbhost_hs_fck)) {
+   dev_err(omap->dev, "could not get usbhost_120m_fck\n");
+   ret = PTR_ERR(omap->usbhost_hs_fck);
+   goto err_host_hs_fck;
+   }
 
-   omap->usbtll_ick = clk_get(omap->dev, "usbtll_ick");
-   if (IS_ERR(omap->usbtll_ick)) {
-   dev_err(omap->dev, "could not get usbtll_ick\n");
-   ret = PTR_ERR(omap->usbtll_ick);
-   goto err_tll_ick;
-   }
+   omap->usbhost_fs_fck = clk_get(omap->dev, "usbhost_48m_fck");
+   if (IS_ERR(omap->usbhost_fs_fck)) {
+   dev_err(omap->dev, "could not get usbhost_48m_fck\n");
+   ret = PTR_ERR(omap->usbhost_fs_fck);
+   goto err_host_fs_fck;
+   }
 
-   /* Now enable all the clocks in the correct order */
-   ohci_omap3_clock_power(omap, 1);
+   omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
+   if (IS_ERR(omap->usbtll_fck)) {
+   dev_err(omap->dev, "could not get usbtll_fck\n");
+   ret = PTR_ERR(omap->usbtll_fck);
+   goto err_tll_fck;
+   }
 
-   /* perform TLL soft reset, and wait until reset is complete */
-   ohci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
-   OMAP_USBTLL_SYSCONFIG_SOFTRESET);
+   omap->usbtll_ick = clk_get(omap->dev, "usbtll_ick");
+   if (IS_ERR(omap->usbtll_ick)) {
+   dev_err(omap->dev, "could not get usbtll_ick\n");
+   ret = PTR_ERR(omap->usbtll_ick);
+   goto err_tll_ick;
+   }
 
-   /* Wait for TLL reset to complete */
-   while (!(ohci_omap_readl(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
-   & OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
-   cpu_relax();
+   /* Now enable all the clocks in the correct order */
+   ohci_omap3_clock

[RFC] [PATCH 2/5] usb: ohci: omap: Add OMAP4 support

2010-08-20 Thread Keshava Munegowda
Update the ohci-omap3 driver to add support for OMAP4.

The OMAP4 has two ports compared to 3 on the OMAP3.
Each port has its own functional clock, compared to a single clock
for all ports on OMAP3. 

Register bit positions for mode selections (TLL or PHY) 
have changed.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 drivers/usb/host/ohci-omap3.c |  213 ++
 1 file changed, 194 insertions(+), 19 deletions(-)

Index: linux-2.6/drivers/usb/host/ohci-omap3.c
===
--- linux-2.6.orig/drivers/usb/host/ohci-omap3.c
+++ linux-2.6/drivers/usb/host/ohci-omap3.c
@@ -106,6 +106,31 @@
 
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
+/* OMAP4 specific */
+#define OMAP_UHH_SYSCONFIG_IDLEMODE_RESET  (~(0xC))
+#define OMAP_UHH_SYSCONFIG_FIDLEMODE_SET   (0 << 2)
+#define OMAP_UHH_SYSCONFIG_NIDLEMODE_SET   (1 << 2)
+#define OMAP_UHH_SYSCONFIG_SIDLEMODE_SET   (2 << 2)
+#define OMAP_UHH_SYSCONFIG_SWIDLMODE_SET   (3 << 2)
+
+#define OMAP_UHH_SYSCONFIG_STDYMODE_RESET  (~(3 << 4))
+#define OMAP_UHH_SYSCONFIG_FSTDYMODE_SET   (0 << 4)
+#define OMAP_UHH_SYSCONFIG_NSTDYMODE_SET   (1 << 4)
+#define OMAP_UHH_SYSCONFIG_SSTDYMODE_SET   (2 << 4)
+#define OMAP_UHH_SYSCONFIG_SWSTDMODE_SET   (3 << 4)
+
+#define OMAP_UHH_HOST_PORTS_RESET  (~(0xF << 16))
+#define OMAP_UHH_HOST_P1_SET_ULPIPHY   (0 << 16)
+#define OMAP_UHH_HOST_P1_SET_ULPITLL   (1 << 16)
+#define OMAP_UHH_HOST_P1_SET_HSIC  (3 << 16)
+
+#define OMAP_UHH_HOST_P2_SET_ULPIPHY   (0 << 18)
+#define OMAP_UHH_HOST_P2_SET_ULPITLL   (1 << 18)
+#define OMAP_UHH_HOST_P2_SET_HSIC  (3 << 18)
+#define OMAP4_UHH_SYSCONFIG_SOFTRESET  (1 << 0)
+
+#define OMAP4_TLL_CHANNEL_COUNT2
+
 /*-*/
 
 static inline void ohci_omap_writel(void __iomem *base, u32 reg, u32 val)
@@ -128,8 +153,6 @@ static inline u8 ohci_omap_readb(void __
return __raw_readb(base + reg);
 }
 
-/*-*/
-
 struct ohci_hcd_omap3 {
struct ohci_hcd *ohci;
struct device   *dev;
@@ -139,6 +162,10 @@ struct ohci_hcd_omap3 {
struct clk  *usbhost_fs_fck;
struct clk  *usbtll_fck;
struct clk  *usbtll_ick;
+   struct clk  *xclk60mhsp1_ck;
+   struct clk  *xclk60mhsp2_ck;
+   struct clk  *utmi_p1_fck;
+   struct clk  *utmi_p2_fck;
 
/* port_mode: TLL/PHY, 2/3/4/6-PIN, DP-DM/DAT-SE0 */
enum ohci_omap3_port_mode   port_mode[OMAP3_HS_USB_PORTS];
@@ -154,17 +181,36 @@ struct ohci_hcd_omap3 {
 static void ohci_omap3_clock_power(struct ohci_hcd_omap3 *omap, int on)
 {
if (on) {
-   clk_enable(omap->usbtll_ick);
-   clk_enable(omap->usbtll_fck);
-   clk_enable(omap->usbhost_ick);
-   clk_enable(omap->usbhost_fs_fck);
-   clk_enable(omap->usbhost_hs_fck);
+   if (omap->usbtll_ick != NULL)
+   clk_enable(omap->usbtll_ick);
+   if (omap->usbtll_fck != NULL)
+   clk_enable(omap->usbtll_fck);
+   if (omap->usbhost_ick != NULL)
+   clk_enable(omap->usbhost_ick);
+   if (omap->usbhost_fs_fck != NULL)
+   clk_enable(omap->usbhost_fs_fck);
+   if (omap->usbhost_hs_fck != NULL)
+   clk_enable(omap->usbhost_hs_fck);
+   if (omap->utmi_p1_fck != NULL)
+   clk_enable(omap->utmi_p1_fck);
+   if (omap->utmi_p2_fck != NULL)
+   clk_enable(omap->utmi_p2_fck);
+
} else {
-   clk_disable(omap->usbhost_hs_fck);
-   clk_disable(omap->usbhost_fs_fck);
-   clk_disable(omap->usbhost_ick);
-   clk_disable(omap->usbtll_fck);
-   clk_disable(omap->usbtll_ick);
+   if (omap->usbtll_ick != NULL)
+   clk_disable(omap->usbtll_ick);
+   if (omap->usbtll_fck != NULL)
+   clk_disable(omap->usbtll_fck);
+   if (omap->usbhost_ick != NULL)
+   clk_disable(omap->usbhost_ick);
+   if (omap->usbhost_fs_fck != NULL)
+   clk_disable(omap->usbhost_fs_fck)

[RFC] [PATCH 3/5] usb: ohci: omap: IO mux mode settings for omap4

2010-08-20 Thread Keshava Munegowda
Add mux-mode settings for OHCI pads on OMAP4.
This will be replaced when the mux framework is introduced for OMAP4.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/usb-ehci.c |   85 +
 1 file changed, 85 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/usb-ehci.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/usb-ehci.c
+++ linux-2.6/arch/arm/mach-omap2/usb-ehci.c
@@ -490,6 +490,91 @@ static void setup_ohci_io_mux(const enum
}
 }
 
+static void setup_4430ohci_io_mux(const enum ohci_omap3_port_mode *port_mode)
+{
+   /* FIXME: This funtion should use Mux frame work functions;
+* for now, we are hardcodeing it
+* This function will be later replaced by MUX framework API.
+*/
+   switch (port_mode[0]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+
+   /* usbb1_mm_rxdp */
+   omap_writew(0x001D, 0x4A1000C4);
+
+   /* usbb1_mm_rxdm */
+   omap_writew(0x001D, 0x4A1000C8);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+
+   /* usbb1_mm_rxrcv */
+   omap_writew(0x001D, 0x4A1000CA);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+
+   /* usbb1_mm_txen */
+   omap_writew(0x001D, 0x4A1000D0);
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+
+   /* usbb1_mm_txdat */
+   omap_writew(0x001D, 0x4A1000CE);
+
+   /* usbb1_mm_txse0 */
+   omap_writew(0x001D, 0x4A1000CC);
+   break;
+
+   case OMAP_OHCI_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+
+   /* usbb2_mm_rxdp */
+   omap_writew(0x010C, 0x4A1000F8);
+
+   /* usbb2_mm_rxdm */
+   omap_writew(0x010C, 0x4A1000F6);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+
+   /* usbb2_mm_rxrcv */
+   omap_writew(0x010C, 0x4A1000FA);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+
+   /* usbb2_mm_txen */
+   omap_writew(0x080C, 0x4A1000FC);
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+
+   /* usbb2_mm_txdat */
+   omap_writew(0x000C, 0x4A100112);
+
+   /* usbb2_mm_txse0 */
+   omap_writew(0x000C, 0x4A100110);
+   break;
+
+   case OMAP_OHCI_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+}
+
 void __init usb_ohci_init(const struct ohci_hcd_omap_platform_data *pdata)
 {
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 4/5] usb: ohci: omap: Initialize resources for OMAP4

2010-08-20 Thread Keshava Munegowda
Update resources (IRQ number, base addresses) for OHCI on OMAP4.
This patch should be replaced when the driver is converted to
take advantage of hwmod (hardware mode).

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/usb-ehci.c |   26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/arm/mach-omap2/usb-ehci.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/usb-ehci.c
+++ linux-2.6/arch/arm/mach-omap2/usb-ehci.c
@@ -360,22 +360,15 @@ void __init usb_ehci_init(const struct e
 
 static struct resource ohci_resources[] = {
{
-   .start  = OMAP34XX_OHCI_BASE,
-   .end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{   /* general IRQ */
-   .start  = INT_34XX_OHCI_IRQ,
.flags  = IORESOURCE_IRQ,
}
 };
@@ -580,8 +573,25 @@ void __init usb_ohci_init(const struct o
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
 
/* Setup Pin IO MUX for OHCI */
-   if (cpu_is_omap34xx())
+   if (cpu_is_omap34xx()) {
+   ohci_resources[0].start = OMAP34XX_OHCI_BASE;
+   ohci_resources[0].end   = OMAP34XX_OHCI_BASE + SZ_1K - 1;
+   ohci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
+   ohci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
+   ohci_resources[2].start = OMAP34XX_USBTLL_BASE;
+   ohci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
+   ohci_resources[3].start = INT_34XX_OHCI_IRQ;
setup_ohci_io_mux(pdata->port_mode);
+   } else if (cpu_is_omap44xx()) {
+   ohci_resources[0].start = OMAP44XX_HSUSB_OHCI_BASE;
+   ohci_resources[0].end   = OMAP44XX_HSUSB_OHCI_BASE + SZ_1K - 1;
+   ohci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
+   ohci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_1K - 1;
+   ohci_resources[2].start = OMAP44XX_USBTLL_BASE;
+   ohci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
+   ohci_resources[3].start = OMAP44XX_IRQ_OHCI;
+   setup_4430ohci_io_mux(pdata->port_mode);
+   }
 
if (platform_device_register(&ohci_device) < 0) {
pr_err("Unable to register FS-USB (OHCI) device\n");
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC] [PATCH 5/5] usb: ohci: omap: enable the ohci port on OMAP4SDP

2010-08-20 Thread Keshava Munegowda
The port 2 of OHCI controller is connected to external PHY. 
The Unidirection 6 pin serial mode is configured.

Signed-off-by: Keshava Munegowda 
Signed-off-by: Anand Gadiyar 
---
 arch/arm/mach-omap2/board-4430sdp.c |6 ++
 1 file changed, 6 insertions(+)

Index: linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
===
--- linux-2.6.orig/arch/arm/mach-omap2/board-4430sdp.c
+++ linux-2.6/arch/arm/mach-omap2/board-4430sdp.c
@@ -424,6 +424,11 @@ static const struct ehci_hcd_omap_platfo
.reset_gpio_port[2]  = -EINVAL
 };
 
+static const struct ohci_hcd_omap_platform_data ohci_pdata __initconst = {
+   .port_mode[0] = OMAP_OHCI_PORT_MODE_UNUSED,
+   .port_mode[1] = OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0,
+   .port_mode[2] = OMAP_OHCI_PORT_MODE_UNUSED,
+};
 static int __init omap4_i2c_init(void)
 {
/*
@@ -454,6 +459,7 @@ static void __init omap_4430sdp_init(voi
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
}
usb_ehci_init(&ehci_pdata);
+   usb_ohci_init(&ohci_pdata);
/* OMAP4 SDP uses internal transceiver so register nop transceiver */
usb_nop_xceiv_register();
/* FIXME: allow multi-omap to boot until musb is updated for omap4 */
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10] arm: omap: usb: host: add names to resources

2011-02-25 Thread Keshava Munegowda
From: Felipe Balbi 

add names to EHCI and OHCI resources. That will help us
identify the resource correctly when moving to a setup
where OHCI and EHCI play well together.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/usb-ehci.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
index 25eeada..2c74fa1 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -350,6 +350,11 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
setup_4430ehci_io_mux(pdata->port_mode);
}
 
+   ehci_resources[0].name  = "ehci";
+   ehci_resources[1].name  = "uhh";
+   ehci_resources[2].name  = "tll";
+   ehci_resources[3].name  = "irq";
+
if (platform_device_register(&ehci_device) < 0) {
printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
return;
@@ -369,21 +374,25 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
 
 static struct resource ohci_resources[] = {
{
+   .name   = "ohci",
.start  = OMAP34XX_OHCI_BASE,
.end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "uhh",
.start  = OMAP34XX_UHH_CONFIG_BASE,
.end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "tll",
.start  = OMAP34XX_USBTLL_BASE,
.end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{   /* general IRQ */
+   .name   = "irq",
.start  = INT_34XX_OHCI_IRQ,
.flags  = IORESOURCE_IRQ,
}
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/10] EHCI and OHCI patches of OMAP3 and OMAP4

2011-02-25 Thread Keshava Munegowda
this is how it EHCI/OHCI code re oraganize look like:
. we have EHCI and OHCI be children of a usbhs "core driver"
which will take care of all accesses to
UHH and TLL bases. 

. we pass enable/disable functions down from EHCI and OHCI drivers.
to USBHS driver.

. UHH and TLL power management will eventually move to
omap-usb-host.c


Felipe Balbi (3):
  arm: omap: usb: host: add names to resources
  usb: host: omap: switch to platform_get_resource_byname
  arm: omap2: usb: rename usb-ehci.c to usb-host.c

Keshava Munegowda (7):
  arm: omap: usb: create enums and structures for ehci and ohci
  usb: host: omap: common usb host core driver
  arm: omap: usb: usbhs core device initialization
  arm: omap: usb: Invoke usbhs core device initialization
  arm: omap: usb: cleanup ehci and ohci resources and devices
  usb: host: omap: ehci and ohci simplification
  arm: omap: usb: clock entries for omap3 and omap4

 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/board-3430sdp.c|   10 +-
 arch/arm/mach-omap2/board-3630sdp.c|   10 +-
 arch/arm/mach-omap2/board-4430sdp.c|   10 +-
 arch/arm/mach-omap2/board-am3517crane.c|   10 +-
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +-
 arch/arm/mach-omap2/board-cm-t35.c |   10 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |   10 +-
 arch/arm/mach-omap2/board-devkit8000.c |   10 +-
 arch/arm/mach-omap2/board-igep0020.c   |   10 +-
 arch/arm/mach-omap2/board-igep0030.c   |   10 +-
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +-
 arch/arm/mach-omap2/board-omap3evm.c   |   14 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +-
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/board-overo.c  |   10 +-
 arch/arm/mach-omap2/board-zoom.c   |   10 +-
 arch/arm/mach-omap2/clock3xxx_data.c   |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c   |   10 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |  305 +---
 arch/arm/plat-omap/include/plat/usb.h  |   55 +-
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/omap-usb-host.c|  981 
 drivers/usb/host/ehci-omap.c   |  881 ++---
 drivers/usb/host/ohci-omap3.c  |  584 ++-
 28 files changed, 1444 insertions(+), 1584 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (68%)
 create mode 100644 drivers/mfd/omap-usb-host.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/10] usb: host: omap: switch to platform_get_resource_byname

2011-02-25 Thread Keshava Munegowda
From: Felipe Balbi 

now that we have names on all memory bases, we can
switch to use platform_get_resource_byname() which
will make it simpler when we move to a setup where
OHCI and EHCI on OMAP play well together.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/host/ehci-omap.c  |6 +++---
 drivers/usb/host/ohci-omap3.c |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index f784ceb..37cf12b 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -813,7 +813,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci  = hcd_to_ehci(hcd);
omap->ehci->sbrn= 0x20;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -829,7 +829,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci->caps = hcd->regs;
omap->ehci_base = hcd->regs;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -837,7 +837,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index a37d599..32f56bb 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -618,7 +618,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
omap->es2_compatibility = pdata->es2_compatibility;
omap->ohci  = hcd_to_ohci(hcd);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -630,7 +630,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -638,7 +638,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/10] arm: omap: usb: clock entries for omap3 and omap4

2011-02-25 Thread Keshava Munegowda
The devices of clocks are set to usbhs, so that
only usbhs common driver can invoke these clocks.
The dummy per port clocks are added to omap3
clock data base. This helps to invoke common
clock get APIs for omap3 and omap4.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/clock3xxx_data.c |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c |   10 +-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 403a4a1..bba590f 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3286,7 +3286,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3322,7 +3322,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("mmci-omap-hs.2",   "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3368,11 +3368,15 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cam_ick",  &cam_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "csi2_96m_fck", &csi2_96m_fck,  CK_34XX | CK_36XX),
CLK(NULL,   "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "utmi_p1_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "utmi_p2_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp1_ck",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index de9ec8d..46fd3f6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3197,7 +3197,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_fck",&uart3_fck, 
CK_443X),
CLK(NULL,   "uart4_fck",&uart4_fck, 
CK_443X),
CLK(NULL,   "usb_

[PATCH 09/10] usb: host: omap: ehci and ohci simplification

2011-02-25 Thread Keshava Munegowda
The ehci and ohci drivers are simplified; Since
UHH and TLL initialization, clock handling are
done by common usbhs core driver, these fucntionalities
are removed from ehci and ohci drivers.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ehci-omap.c  |  881 -
 drivers/usb/host/ohci-omap3.c |  584 +++-
 2 files changed, 132 insertions(+), 1333 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 77e9906..a61ce6c 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -4,9 +4,10 @@
  * Bus Glue for the EHCI controllers in OMAP3/4
  * Tested on several OMAP3 boards, and OMAP4 Pandaboard
  *
- * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Copyright (C) 2007-2011 Texas Instruments, Inc.
  * Author: Vikram Pandita 
  * Author: Anand Gadiyar 
+ * Author: Keshava Munegowda 
  *
  * Copyright (C) 2009 Nokia Corporation
  * Contact: Felipe Balbi 
@@ -27,116 +28,19 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * TODO (last updated Nov 21, 2010):
+ * TODO (last updated Feb 27, 2010):
  * - add kernel-doc
  * - enable AUTOIDLE
  * - add suspend/resume
- * - move workarounds to board-files
- * - factor out code common to OHCI
  * - add HSIC and TLL support
  * - convert to use hwmod and runtime PM
  */
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
 
-/*
- * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
- * Use ehci_omap_readl()/ehci_omap_writel() functions
- */
-
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
-/* UHH Register Set */
-#defineOMAP_UHH_REVISION   (0x00)
-#defineOMAP_UHH_SYSCONFIG  (0x10)
-#defineOMAP_UHH_SYSCONFIG_MIDLEMODE(1 << 12)
-#defineOMAP_UHH_SYSCONFIG_CACTIVITY(1 << 8)
-#defineOMAP_UHH_SYSCONFIG_SIDLEMODE(1 << 3)
-#define

[PATCH 08/10] arm: omap: usb: cleanup ehci and ohci devices

2011-02-25 Thread Keshava Munegowda
The prototype and defination of functions usb_ehci_init and
usb_ohci_init are removed. The ehci and ohci devices are
removed since usbhs device contains both ehci and ohci details.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  166 -
 arch/arm/plat-omap/include/plat/usb.h |4 -
 2 files changed, 20 insertions(+), 150 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index da4c0d3..403fd89 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -33,33 +33,38 @@
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
-static struct resource ehci_resources[] = {
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
{
+   .name   = "uhh",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "tll",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "ehci",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = "ehci-irq",
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .name   = "ohci",
.flags  = IORESOURCE_MEM,
},
-   { /* general IRQ */
-   .flags   = IORESOURCE_IRQ,
+   {
+   .name   = "ohci-irq",
+   .flags  = IORESOURCE_IRQ,
}
 };
 
-static u64 ehci_dmamask = ~(u32)0;
-static struct platform_device ehci_device = {
-   .name   = "ehci-omap",
-   .id = 0,
-   .dev = {
-   .dma_mask   = &ehci_dmamask,
-   .coherent_dma_mask  = 0x,
-   .platform_data  = NULL,
-   },
-   .num_resources  = ARRAY_SIZE(ehci_resources),
-   .resource   = ehci_resources,
-};
+static struct usbhs_omap_platform_data usbhs_data;
+static struct ehci_hcd_omap_platform_data  ehci_data;
+static struct ohci_hcd_omap_platform_data  ohci_data;
 
 /* MUX settings for EHCI pins */
 /*
@@ -326,81 +331,6 @@ static void setup_4430ehci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-{
-   platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
-
-   /* Setup Pin IO MUX for EHCI */
-   if (cpu_is_omap34xx()) {
-   ehci_resources[0].start = OMAP34XX_EHCI_BASE;
-   ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-   ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = INT_34XX_EHCI_IRQ;
-   setup_ehci_io_mux(pdata->port_mode);
-   } else if (cpu_is_omap44xx()) {
-   ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
-   ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
-   ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
-   setup_4430ehci_io_mux(pdata->port_mode);
-   }
-
-   ehci_resources[0].name  = "ehci";
-   ehci_resources[1].name  = "uhh";
-   ehci_resources[2].name  = "tll";
-   ehci_resources[3].name  = "irq";
-
-   if (platform_device_register(&ehci_device) < 0) {
-   printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
-   return;
-   }
-}
-
-static struct resource ohci_resources[] = {
-   {
-   .name   = "ohci",
-   .start  = OMAP34XX_OHCI_BASE,
-   .end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "uhh",
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "tll",
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {   /* general IRQ */
-   .name   = "irq",
-   .start  = INT_34XX_OHCI_IRQ,
-   .flags  = IORESOURCE_IRQ,
-   }
-};
-
-static u64 ohci_dmamask = DMA_BIT_MASK(32);

[PATCH 07/10] arm: omap: usb: Invoke usbhs core device initialization

2011-02-25 Thread Keshava Munegowda
The usbhs intialization is invoked by all omap3 and omap4
variant board files.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|2 +-
 arch/arm/mach-omap2/board-3630sdp.c|2 +-
 arch/arm/mach-omap2/board-4430sdp.c|2 +-
 arch/arm/mach-omap2/board-am3517crane.c|2 +-
 arch/arm/mach-omap2/board-am3517evm.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c |2 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |2 +-
 arch/arm/mach-omap2/board-devkit8000.c |2 +-
 arch/arm/mach-omap2/board-igep0020.c   |2 +-
 arch/arm/mach-omap2/board-igep0030.c   |2 +-
 arch/arm/mach-omap2/board-omap3beagle.c|2 +-
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
 arch/arm/mach-omap2/board-omap4panda.c |2 +-
 arch/arm/mach-omap2/board-overo.c  |2 +-
 arch/arm/mach-omap2/board-zoom.c   |2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index a991aeb..7542ba5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 03fd8ac..deed2db 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1f59e8d..13cb1cf 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
usb_musb_init(&musb_board_data);
 
status = omap_ethernet_init();
diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 1b825a0..e3a194f 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -103,7 +103,7 @@ static void __init am3517_crane_init(void)
return;
}
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index f5bc1c6..913538a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -502,7 +502,7 @@ static void __init am3517_evm_init(void)
 
/* Configure GPIO for EHCI port */
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
/* DSS */
am3517_evm_display_init();
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index c79aa9b..9be7289 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -810,7 +810,7 @@ static void __init cm_t35_init(void)
cm_t35_init_display();
 
usb_musb_init(&musb_board_data);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CM_T35, "Compulab CM-T35")
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index 8288a0b..8e18dc7 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -192,7 +192,7 @@ static int cm_t3517_init_usbh(void)
msleep(1);
}
 
-   usb_ehci_init(&cm_t3517_ehci_pdata);
+   usbhs_init(&cm_t3517_ehci_pdata);
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index e0131dd..bc0141b 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -803,7 +803,7 @@ static void __init devkit8000_init(void)
devkit8000_ads7846_init();
 
usb_musb_init(&musb_b

[PATCH 05/10] usb: host: omap: common usb host core driver

2011-02-25 Thread Keshava Munegowda
enabling and disabling the common clocks for ehci
and ohci is implemented. usbhs is a common parent
platform driver for EHCI and OHCI driver. This driver
receives the clock enable and disable requests
from ehci and ohci drivers.The UHH and TLL
initialization is also performed.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/plat-omap/include/plat/usb.h |3 +
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/omap-usb-host.c   |  981 +
 4 files changed, 994 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-host.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index dc6ef62..7aeaa76 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -102,6 +102,9 @@ extern void usb_ehci_init(const struct 
usbhs_omap_board_data *pdata);
 
 extern void usb_ohci_init(const struct usbhs_omap_board_data *pdata);
 
+extern int omap_usbhs_enable(struct device *dev);
+extern void omap_usbhs_disable(struct device *dev);
+
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index fd01836..a6dfa37 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -624,6 +624,15 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_OMAP_USB_HOST
+   bool "Support OMAP USBHS core driver"
+   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
+   default y
+   help
+ This is the core driver for the OAMP EHCI and OHCI drivers.
+ This MFD driver does the required setup functionalities for
+ OMAP USB Host drivers.
+
 endif # MFD_SUPPORT
 
 menu "Multimedia Capabilities Port drivers"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a54e2c7..91fe384 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -83,3 +83,4 @@ obj-$(CONFIG_MFD_TPS6586X)+= tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
new file mode 100644
index 000..5fb60b5
--- /dev/null
+++ b/drivers/mfd/omap-usb-host.c
@@ -0,0 +1,981 @@
+/**
+ * omap-usb-host.c - The USBHS core driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBHS_DRIVER_NAME  "usbhs-omap"
+#define OMAP_EHCI_DEVICE   "ehci-omap"
+#define OMAP_OHCI_DEVICE   "ohci-omap3"
+
+/* OMAP USBHOST Register addresses  */
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
+#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
+#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
+#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 <<

[PATCH 04/10] arm: omap: usb: create enums and structures for ehci and ohci

2011-02-25 Thread Keshava Munegowda
Create the ehci and ohci specific platform data structures.
The port enum values are made common for both ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-3630sdp.c|   10 +++---
 arch/arm/mach-omap2/board-4430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-am3517crane.c|   10 +++---
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +++---
 arch/arm/mach-omap2/board-cm-t35.c |   10 +++---
 arch/arm/mach-omap2/board-cm-t3517.c   |8 ++--
 arch/arm/mach-omap2/board-devkit8000.c |   10 +++---
 arch/arm/mach-omap2/board-igep0020.c   |   10 +++---
 arch/arm/mach-omap2/board-igep0030.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +++---
 arch/arm/mach-omap2/board-omap3evm.c   |   14 
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +++---
 arch/arm/mach-omap2/board-omap4panda.c |   10 +++---
 arch/arm/mach-omap2/board-overo.c  |   10 +++---
 arch/arm/mach-omap2/board-zoom.c   |   10 +++---
 arch/arm/mach-omap2/usb-host.c |   50 +-
 arch/arm/plat-omap/include/plat/usb.h  |   54 ++--
 drivers/usb/host/ehci-omap.c   |   42 +++---
 drivers/usb/host/ohci-omap3.c  |   22 ++--
 22 files changed, 184 insertions(+), 168 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d4e41ef..a991aeb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -653,11 +653,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 57,
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 6264564..03fd8ac 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -54,11 +54,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 126,
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 07d1b20..1f59e8d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -251,10 +251,10 @@ static void __init omap_4430sdp_init_irq(void)
gic_init_irq();
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
-   .port_mode[0]   = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
-   .port_mode[2]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
+   .port_mode[0]   = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1]   = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[2]   = OMAP_USBHS_PORT_MODE_UNUSED,
.phy_reset  = false,
.reset_gpio_port[0]  = -EINVAL,
.reset_gpio_port[1]  = -EINVAL,
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&ehci_pd

[PATCH 06/10] arm: omap: usb: usbhs core device initialization

2011-02-25 Thread Keshava Munegowda
A new usbhs platform device is defined;
this device will be the parent device of ehci and
ohci platform devices. the usbhs_init function
is defined which does the usbhs device initialization
and I/O mux of ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  194 ++---
 arch/arm/plat-omap/include/plat/usb.h |2 +
 2 files changed, 182 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index b04ce6f..da4c0d3 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
+ * Author: Keshava Munegowda 
  *
  * Generalization by:
  * Felipe Balbi 
@@ -19,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -30,7 +31,7 @@
 
 #include "mux.h"
 
-#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
+#ifdef CONFIG_MFD_OMAP_USB_HOST
 
 static struct resource ehci_resources[] = {
{
@@ -361,17 +362,6 @@ void __init usb_ehci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
-#else
-
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-
-{
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
 static struct resource ohci_resources[] = {
{
.name   = "ohci",
@@ -508,6 +498,77 @@ static void setup_ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
+static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
+{
+   switch (port_mode[0]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb1_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb2_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+}
+
 void __init usb_ohci_init(const struct usbhs_omap_board_data *pdata)
 {
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
@@ -522,10 +583,115 @@ void __init usb_ohci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
+
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = "uhh",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = "tll",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+

[PATCH 03/10] arm: omap2: usb: rename usb-ehci.c to usb-host.c

2011-02-25 Thread Keshava Munegowda
From: Felipe Balbi 

We already have both EHCI and OHCI there, so let's
rename to be sure everybody will understand the entire
USB HOST functionality is setup on this file.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |8 
 2 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (98%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 1c0c2b0..64dc417 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,7 @@ usbfs-$(CONFIG_ARCH_OMAP_OTG)   := usb-fs.o
 obj-y  += $(usbfs-m) $(usbfs-y)
 obj-y  += usb-musb.o
 obj-$(CONFIG_MACH_OMAP2_TUSB6010)  += usb-tusb6010.o
-obj-y  += usb-ehci.o
+obj-y  += usb-host.o
 
 onenand-$(CONFIG_MTD_ONENAND_OMAP2):= gpmc-onenand.o
 obj-y  += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-host.c
similarity index 98%
rename from arch/arm/mach-omap2/usb-ehci.c
rename to arch/arm/mach-omap2/usb-host.c
index 2c74fa1..45f9b80 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -1,14 +1,14 @@
 /*
- * linux/arch/arm/mach-omap2/usb-ehci.c
+ * usb-host.c - OMAP USB Host
  *
  * This file will contain the board specific details for the
- * Synopsys EHCI host controller on OMAP3430
+ * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards
  *
- * Copyright (C) 2007 Texas Instruments
+ * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
  *
  * Generalization by:
- * Felipe Balbi 
+ * Felipe Balbi 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/10 v1] EHCI and OHCI patches of OMAP3 and OMAP4

2011-02-28 Thread Keshava Munegowda
this is how it EHCI/OHCI code re oraganize look like:
. we have EHCI and OHCI be children of a usbhs "core driver"
which will take care of all accesses to
UHH and TLL bases. 

. we pass enable/disable functions down from EHCI and OHCI drivers.
to USBHS driver.

. UHH and TLL power management will eventually move to
omap-usb-host.c

Felipe Balbi (3):
  arm: omap: usb: host: add names to resources
  usb: host: omap: switch to platform_get_resource_byname
  arm: omap2: usb: rename usb-ehci.c to usb-host.c

Keshava Munegowda (7):
  arm: omap: usb: create common enums and structures for ehci and ohci
  usb: host: omap: common usb host core driver
  arm: omap: usb: usbhs core device initialization
  arm: omap: usb: Invoke usbhs core device initialization
  arm: omap: usb: cleanup ehci and ohci resources and devices
  usb: host: omap: ehci and ohci simplification
  arm: omap: usb: clock entries for omap3 and omap4

 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/board-3430sdp.c|   10 +-
 arch/arm/mach-omap2/board-3630sdp.c|   10 +-
 arch/arm/mach-omap2/board-4430sdp.c|   10 +-
 arch/arm/mach-omap2/board-am3517crane.c|   10 +-
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +-
 arch/arm/mach-omap2/board-cm-t35.c |   10 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |   10 +-
 arch/arm/mach-omap2/board-devkit8000.c |   10 +-
 arch/arm/mach-omap2/board-igep0020.c   |   10 +-
 arch/arm/mach-omap2/board-igep0030.c   |   10 +-
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +-
 arch/arm/mach-omap2/board-omap3evm.c   |   14 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +-
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/board-overo.c  |   10 +-
 arch/arm/mach-omap2/board-zoom.c   |   10 +-
 arch/arm/mach-omap2/clock3xxx_data.c   |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c   |   10 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |  307 +---
 arch/arm/plat-omap/include/plat/usb.h  |   55 +-
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/omap-usb-host.c|  981 
 drivers/usb/host/ehci-omap.c   |  877 ++---
 drivers/usb/host/ohci-omap3.c  |  584 ++-
 28 files changed, 1445 insertions(+), 1581 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (68%)
 create mode 100644 drivers/mfd/omap-usb-host.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10 v1] arm: omap: usb: host: add names to resources

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi 

add names to EHCI and OHCI resources. That will help us
identify the resource correctly when moving to a setup
where OHCI and EHCI play well together.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/usb-ehci.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
index 25eeada..2c74fa1 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -350,6 +350,11 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
setup_4430ehci_io_mux(pdata->port_mode);
}
 
+   ehci_resources[0].name  = "ehci";
+   ehci_resources[1].name  = "uhh";
+   ehci_resources[2].name  = "tll";
+   ehci_resources[3].name  = "irq";
+
if (platform_device_register(&ehci_device) < 0) {
printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
return;
@@ -369,21 +374,25 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
 
 static struct resource ohci_resources[] = {
{
+   .name   = "ohci",
.start  = OMAP34XX_OHCI_BASE,
.end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "uhh",
.start  = OMAP34XX_UHH_CONFIG_BASE,
.end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "tll",
.start  = OMAP34XX_USBTLL_BASE,
.end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{   /* general IRQ */
+   .name   = "irq",
.start  = INT_34XX_OHCI_IRQ,
.flags  = IORESOURCE_IRQ,
}
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/10 v1] arm: omap: usb: cleanup ehci and ohci resources and devices

2011-02-28 Thread Keshava Munegowda
The prototype and defination of functions usb_ehci_init and
usb_ohci_init are removed. The ehci and ohci devices are
removed since usbhs device contains both ehci and ohci details.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  176 +
 arch/arm/plat-omap/include/plat/usb.h |4 -
 2 files changed, 26 insertions(+), 154 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index 19cf0d6..ffb4b37 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -33,34 +33,46 @@
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
-static struct resource ehci_resources[] = {
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = "uhh",
+   .flags  = IORESOURCE_MEM,
+   },
{
+   .name   = "tll",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "ehci",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "ehci-irq",
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .name   = "ohci",
.flags  = IORESOURCE_MEM,
},
-   { /* general IRQ */
-   .flags   = IORESOURCE_IRQ,
+   {
+   .name   = "ohci-irq",
+   .flags  = IORESOURCE_IRQ,
}
 };
 
-static u64 ehci_dmamask = ~(u32)0;
-static struct platform_device ehci_device = {
-   .name   = "ehci-omap",
-   .id = 0,
-   .dev = {
-   .dma_mask   = &ehci_dmamask,
-   .coherent_dma_mask  = 0x,
-   .platform_data  = NULL,
-   },
-   .num_resources  = ARRAY_SIZE(ehci_resources),
-   .resource   = ehci_resources,
+static struct platform_device usbhs_device = {
+   .name   = OMAP_USBHS_DEVICE,
+   .id = 0,
+   .num_resources  = ARRAY_SIZE(usbhs_resources),
+   .resource   = usbhs_resources,
 };
 
+static struct usbhs_omap_platform_data usbhs_data;
+static struct ehci_hcd_omap_platform_data  ehci_data;
+static struct ohci_hcd_omap_platform_data  ohci_data;
+
 /* MUX settings for EHCI pins */
 /*
  * setup_ehci_io_mux - initialize IO pad mux for USBHOST
@@ -326,81 +338,6 @@ static void setup_4430ehci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-{
-   platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
-
-   /* Setup Pin IO MUX for EHCI */
-   if (cpu_is_omap34xx()) {
-   ehci_resources[0].start = OMAP34XX_EHCI_BASE;
-   ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-   ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = INT_34XX_EHCI_IRQ;
-   setup_ehci_io_mux(pdata->port_mode);
-   } else if (cpu_is_omap44xx()) {
-   ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
-   ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
-   ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
-   setup_4430ehci_io_mux(pdata->port_mode);
-   }
-
-   ehci_resources[0].name  = "ehci";
-   ehci_resources[1].name  = "uhh";
-   ehci_resources[2].name  = "tll";
-   ehci_resources[3].name  = "irq";
-
-   if (platform_device_register(&ehci_device) < 0) {
-   printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
-   return;
-   }
-}
-
-static struct resource ohci_resources[] = {
-   {
-   .name   = "ohci",
-   .start  = OMAP34XX_OHCI_BASE,
-   .end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "uhh",
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "tll",
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_

[PATCH 07/10 v1] arm: omap: usb: Invoke usbhs core device initialization

2011-02-28 Thread Keshava Munegowda
The usbhs intialization is invoked by all omap3 and omap4
variant board files.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|2 +-
 arch/arm/mach-omap2/board-3630sdp.c|2 +-
 arch/arm/mach-omap2/board-4430sdp.c|2 +-
 arch/arm/mach-omap2/board-am3517crane.c|2 +-
 arch/arm/mach-omap2/board-am3517evm.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c |2 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |2 +-
 arch/arm/mach-omap2/board-devkit8000.c |2 +-
 arch/arm/mach-omap2/board-igep0020.c   |2 +-
 arch/arm/mach-omap2/board-igep0030.c   |2 +-
 arch/arm/mach-omap2/board-omap3beagle.c|2 +-
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
 arch/arm/mach-omap2/board-omap4panda.c |2 +-
 arch/arm/mach-omap2/board-overo.c  |2 +-
 arch/arm/mach-omap2/board-zoom.c   |2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index a991aeb..7542ba5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 03fd8ac..deed2db 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1f59e8d..13cb1cf 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
usb_musb_init(&musb_board_data);
 
status = omap_ethernet_init();
diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 1b825a0..e3a194f 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -103,7 +103,7 @@ static void __init am3517_crane_init(void)
return;
}
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index f5bc1c6..913538a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -502,7 +502,7 @@ static void __init am3517_evm_init(void)
 
/* Configure GPIO for EHCI port */
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
/* DSS */
am3517_evm_display_init();
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index c79aa9b..9be7289 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -810,7 +810,7 @@ static void __init cm_t35_init(void)
cm_t35_init_display();
 
usb_musb_init(&musb_board_data);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CM_T35, "Compulab CM-T35")
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index 8288a0b..8e18dc7 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -192,7 +192,7 @@ static int cm_t3517_init_usbh(void)
msleep(1);
}
 
-   usb_ehci_init(&cm_t3517_ehci_pdata);
+   usbhs_init(&cm_t3517_ehci_pdata);
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index e0131dd..bc0141b 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -803,7 +803,7 @@ static void __init devkit8000_init(void)
devkit8000_ads7846_init();
 
usb_musb_init(&musb_b

[PATCH 09/10 v1] usb: host: omap: ehci and ohci simplification

2011-02-28 Thread Keshava Munegowda
The ehci and ohci drivers are simplified; Since
UHH and TLL initialization, clock handling are
done by common usbhs core driver, these fucntionalities
are removed from ehci and ohci drivers.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ehci-omap.c  |  877 -
 drivers/usb/host/ohci-omap3.c |  584 +++-
 2 files changed, 130 insertions(+), 1331 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 77e9906..583dafe 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -4,9 +4,10 @@
  * Bus Glue for the EHCI controllers in OMAP3/4
  * Tested on several OMAP3 boards, and OMAP4 Pandaboard
  *
- * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Copyright (C) 2007-2011 Texas Instruments, Inc.
  * Author: Vikram Pandita 
  * Author: Anand Gadiyar 
+ * Author: Keshava Munegowda 
  *
  * Copyright (C) 2009 Nokia Corporation
  * Contact: Felipe Balbi 
@@ -27,116 +28,19 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * TODO (last updated Nov 21, 2010):
+ * TODO (last updated Feb 27, 2010):
  * - add kernel-doc
  * - enable AUTOIDLE
  * - add suspend/resume
- * - move workarounds to board-files
- * - factor out code common to OHCI
  * - add HSIC and TLL support
  * - convert to use hwmod and runtime PM
  */
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
 
-/*
- * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
- * Use ehci_omap_readl()/ehci_omap_writel() functions
- */
-
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
-/* UHH Register Set */
-#defineOMAP_UHH_REVISION   (0x00)
-#defineOMAP_UHH_SYSCONFIG  (0x10)
-#defineOMAP_UHH_SYSCONFIG_MIDLEMODE(1 << 12)
-#defineOMAP_UHH_SYSCONFIG_CACTIVITY(1 << 8)
-#defineOMAP_UHH_SYSCONFIG_SIDLEMODE(1 << 3)
-#define

[PATCH 05/10 v1] usb: host: omap: common usb host core driver

2011-02-28 Thread Keshava Munegowda
enabling and disabling the common clocks for ehci
and ohci is implemented. usbhs is a common parent
platform driver for EHCI and OHCI driver. This driver
receives the clock enable and disable requests
from ehci and ohci drivers.The UHH and TLL
initialization is also performed.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/plat-omap/include/plat/usb.h |3 +
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/omap-usb-host.c   |  981 +
 4 files changed, 994 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-host.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index dc6ef62..7aeaa76 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -102,6 +102,9 @@ extern void usb_ehci_init(const struct 
usbhs_omap_board_data *pdata);
 
 extern void usb_ohci_init(const struct usbhs_omap_board_data *pdata);
 
+extern int omap_usbhs_enable(struct device *dev);
+extern void omap_usbhs_disable(struct device *dev);
+
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index fd01836..a6dfa37 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -624,6 +624,15 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_OMAP_USB_HOST
+   bool "Support OMAP USBHS core driver"
+   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
+   default y
+   help
+ This is the core driver for the OAMP EHCI and OHCI drivers.
+ This MFD driver does the required setup functionalities for
+ OMAP USB Host drivers.
+
 endif # MFD_SUPPORT
 
 menu "Multimedia Capabilities Port drivers"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a54e2c7..91fe384 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -83,3 +83,4 @@ obj-$(CONFIG_MFD_TPS6586X)+= tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
new file mode 100644
index 000..5fb60b5
--- /dev/null
+++ b/drivers/mfd/omap-usb-host.c
@@ -0,0 +1,981 @@
+/**
+ * omap-usb-host.c - The USBHS core driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBHS_DRIVER_NAME  "usbhs-omap"
+#define OMAP_EHCI_DEVICE   "ehci-omap"
+#define OMAP_OHCI_DEVICE   "ohci-omap3"
+
+/* OMAP USBHOST Register addresses  */
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
+#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
+#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
+#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 <<

[PATCH 10/10 v1] arm: omap: usb: clock entries for omap3 and omap4

2011-02-28 Thread Keshava Munegowda
The devices of clocks are set to usbhs, so that
only usbhs common driver can invoke these clocks.
The dummy per port clocks are added to omap3
clock data base. This helps to invoke common
clock get APIs for omap3 and omap4.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/clock3xxx_data.c |   14 +-
 arch/arm/mach-omap2/clock44xx_data.c |   10 +-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 403a4a1..bba590f 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3286,7 +3286,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3322,7 +3322,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("mmci-omap-hs.2",   "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3368,11 +3368,15 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cam_ick",  &cam_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "csi2_96m_fck", &csi2_96m_fck,  CK_34XX | CK_36XX),
CLK(NULL,   "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "utmi_p1_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "utmi_p2_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp1_ck",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index de9ec8d..46fd3f6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3197,7 +3197,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_fck",&uart3_fck, 
CK_443X),
CLK(NULL,   "uart4_fck",&uart4_fck, 
CK_443X),
CLK(NULL,   "usb_

[PATCH 03/10 v1] arm: omap2: usb: rename usb-ehci.c to usb-host.c

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi 

We already have both EHCI and OHCI there, so let's
rename to be sure everybody will understand the entire
USB HOST functionality is setup on this file.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |8 
 2 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (98%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 1c0c2b0..64dc417 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,7 @@ usbfs-$(CONFIG_ARCH_OMAP_OTG)   := usb-fs.o
 obj-y  += $(usbfs-m) $(usbfs-y)
 obj-y  += usb-musb.o
 obj-$(CONFIG_MACH_OMAP2_TUSB6010)  += usb-tusb6010.o
-obj-y  += usb-ehci.o
+obj-y  += usb-host.o
 
 onenand-$(CONFIG_MTD_ONENAND_OMAP2):= gpmc-onenand.o
 obj-y  += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-host.c
similarity index 98%
rename from arch/arm/mach-omap2/usb-ehci.c
rename to arch/arm/mach-omap2/usb-host.c
index 2c74fa1..45f9b80 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -1,14 +1,14 @@
 /*
- * linux/arch/arm/mach-omap2/usb-ehci.c
+ * usb-host.c - OMAP USB Host
  *
  * This file will contain the board specific details for the
- * Synopsys EHCI host controller on OMAP3430
+ * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards
  *
- * Copyright (C) 2007 Texas Instruments
+ * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
  *
  * Generalization by:
- * Felipe Balbi 
+ * Felipe Balbi 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/10 v1] arm: omap: usb: create common enums and structures for ehci and ohci

2011-02-28 Thread Keshava Munegowda
Create the ehci and ohci specific platform data structures.
The port enum values are made common for both ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-3630sdp.c|   10 +++---
 arch/arm/mach-omap2/board-4430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-am3517crane.c|   10 +++---
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +++---
 arch/arm/mach-omap2/board-cm-t35.c |   10 +++---
 arch/arm/mach-omap2/board-cm-t3517.c   |8 ++--
 arch/arm/mach-omap2/board-devkit8000.c |   10 +++---
 arch/arm/mach-omap2/board-igep0020.c   |   10 +++---
 arch/arm/mach-omap2/board-igep0030.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +++---
 arch/arm/mach-omap2/board-omap3evm.c   |   14 
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +++---
 arch/arm/mach-omap2/board-omap4panda.c |   10 +++---
 arch/arm/mach-omap2/board-overo.c  |   10 +++---
 arch/arm/mach-omap2/board-zoom.c   |   10 +++---
 arch/arm/mach-omap2/usb-host.c |   50 +-
 arch/arm/plat-omap/include/plat/usb.h  |   54 ++--
 drivers/usb/host/ehci-omap.c   |   42 +++---
 drivers/usb/host/ohci-omap3.c  |   22 ++--
 22 files changed, 184 insertions(+), 168 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d4e41ef..a991aeb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -653,11 +653,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 57,
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 6264564..03fd8ac 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -54,11 +54,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 126,
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 07d1b20..1f59e8d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -251,10 +251,10 @@ static void __init omap_4430sdp_init_irq(void)
gic_init_irq();
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
-   .port_mode[0]   = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
-   .port_mode[2]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
+   .port_mode[0]   = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1]   = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[2]   = OMAP_USBHS_PORT_MODE_UNUSED,
.phy_reset  = false,
.reset_gpio_port[0]  = -EINVAL,
.reset_gpio_port[1]  = -EINVAL,
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&ehci_pd

[PATCH 06/10 v1] arm: omap: usb: usbhs core device initialization

2011-02-28 Thread Keshava Munegowda
A new usbhs platform device is defined;
this device will be the parent device of ehci and
ohci platform devices. the usbhs_init function
is defined which does the usbhs device initialization
and I/O mux of ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  196 ++---
 arch/arm/plat-omap/include/plat/usb.h |2 +
 2 files changed, 184 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index b04ce6f..19cf0d6 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
+ * Author: Keshava Munegowda 
  *
  * Generalization by:
  * Felipe Balbi 
@@ -19,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -30,7 +31,7 @@
 
 #include "mux.h"
 
-#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
+#ifdef CONFIG_MFD_OMAP_USB_HOST
 
 static struct resource ehci_resources[] = {
{
@@ -361,17 +362,6 @@ void __init usb_ehci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
-#else
-
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-
-{
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
 static struct resource ohci_resources[] = {
{
.name   = "ohci",
@@ -508,6 +498,77 @@ static void setup_ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
+static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
+{
+   switch (port_mode[0]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb1_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb2_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+}
+
 void __init usb_ohci_init(const struct usbhs_omap_board_data *pdata)
 {
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
@@ -522,10 +583,117 @@ void __init usb_ohci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = "uhh",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = "tll",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+

[PATCH 02/10 v1] usb: host: omap: switch to platform_get_resource_byname

2011-02-28 Thread Keshava Munegowda
From: Felipe Balbi 

now that we have names on all memory bases, we can
switch to use platform_get_resource_byname() which
will make it simpler when we move to a setup where
OHCI and EHCI on OMAP play well together.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/host/ehci-omap.c  |6 +++---
 drivers/usb/host/ohci-omap3.c |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index f784ceb..37cf12b 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -813,7 +813,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci  = hcd_to_ehci(hcd);
omap->ehci->sbrn= 0x20;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -829,7 +829,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci->caps = hcd->regs;
omap->ehci_base = hcd->regs;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -837,7 +837,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index a37d599..32f56bb 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -618,7 +618,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
omap->es2_compatibility = pdata->es2_compatibility;
omap->ohci  = hcd_to_ohci(hcd);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -630,7 +630,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -638,7 +638,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 04/10 v1] arm: omap: usb: create common enums and structures for ehci and ohci

2011-03-01 Thread Keshava Munegowda
> -Original Message-
> From: Felipe Balbi [mailto:ba...@ti.com]
> Sent: Tuesday, March 01, 2011 4:20 PM
> To: Keshava Munegowda
> Cc: linux-...@vger.kernel.org; linux-omap@vger.kernel.org; ba...@ti.com;
gadi...@ti.com; p-
> bas...@ti.com
> Subject: Re: [PATCH 04/10 v1] arm: omap: usb: create common enums and
structures for ehci and ohci
>
> On Mon, Feb 28, 2011 at 10:01:46PM +0530, Keshava Munegowda wrote:
> > Create the ehci and ohci specific platform data structures.
> > The port enum values are made common for both ehci and ohci.
> >
> > Signed-off-by: Keshava Munegowda 
>
> Applying: arm: omap: usb: create common enums and structures for ehci
and ohci
> error: patch failed: drivers/usb/host/ehci-omap.c:409
> error: drivers/usb/host/ehci-omap.c: patch does not apply
> Patch failed at 0005 arm: omap: usb: create common enums and structures
for ehci and ohci
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
>
> Which tree did you use as base for these patches ? I'm trying to apply
> on top of v.2.6.38-rc6

I will check this and send the rebased patches to you in next 2 hrs.


>
> --
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 04/10 v1] arm: omap: usb: create common enums and structures for ehci and ohci

2011-03-01 Thread Keshava Munegowda
> -Original Message-
> From: Felipe Balbi [mailto:ba...@ti.com]
> Sent: Tuesday, March 01, 2011 4:20 PM
> To: Keshava Munegowda
> Cc: linux-...@vger.kernel.org; linux-omap@vger.kernel.org; ba...@ti.com;
gadi...@ti.com; p-
> bas...@ti.com
> Subject: Re: [PATCH 04/10 v1] arm: omap: usb: create common enums and
structures for ehci and ohci
>
> On Mon, Feb 28, 2011 at 10:01:46PM +0530, Keshava Munegowda wrote:
> > Create the ehci and ohci specific platform data structures.
> > The port enum values are made common for both ehci and ohci.
> >
> > Signed-off-by: Keshava Munegowda 
>
> Applying: arm: omap: usb: create common enums and structures for ehci
and ohci
> error: patch failed: drivers/usb/host/ehci-omap.c:409
> error: drivers/usb/host/ehci-omap.c: patch does not apply
> Patch failed at 0005 arm: omap: usb: create common enums and structures
for ehci and ohci
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
>
> Which tree did you use as base for these patches ? I'm trying to apply
> on top of v.2.6.38-rc6

Balbi

I tried at my side on l2.6.38-rc6 , it dint see any failures its working.

These patches are apply correctly on l2.6.38-rc6
Commit id: f5412be599602124d2bdd49947b231dd77c0bf99

Please check; its working my side.

---
Keshava Munegowda




>
> --
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 04/10 v1] arm: omap: usb: create common enums and structures for ehci and ohci

2011-03-01 Thread Keshava Munegowda
> -Original Message-
> From: Felipe Balbi [mailto:ba...@ti.com]
> Sent: Tuesday, March 01, 2011 6:08 PM
> To: Felipe Balbi
> Cc: Keshava Munegowda; linux-...@vger.kernel.org;
linux-omap@vger.kernel.org; Anand Gadiyar; Partha
> Basak
> Subject: Re: [PATCH 04/10 v1] arm: omap: usb: create common enums and
structures for ehci and ohci
>
> On Tue, Mar 01, 2011 at 02:35:43PM +0200, Felipe Balbi wrote:
> > On Tue, Mar 01, 2011 at 05:07:34PM +0530, Keshava Munegowda wrote:
> > > > -Original Message-
> > > > From: Felipe Balbi [mailto:ba...@ti.com]
> > > > Sent: Tuesday, March 01, 2011 4:20 PM
> > > > To: Keshava Munegowda
> > > > Cc: linux-...@vger.kernel.org; linux-omap@vger.kernel.org;
ba...@ti.com;
> > > gadi...@ti.com; p-
> > > > bas...@ti.com
> > > > Subject: Re: [PATCH 04/10 v1] arm: omap: usb: create common enums
and
> > > structures for ehci and ohci
> > > >
> > > > On Mon, Feb 28, 2011 at 10:01:46PM +0530, Keshava Munegowda wrote:
> > > > > Create the ehci and ohci specific platform data structures.
> > > > > The port enum values are made common for both ehci and ohci.
> > > > >
> > > > > Signed-off-by: Keshava Munegowda 
> > > >
> > > > Applying: arm: omap: usb: create common enums and structures for
ehci
> > > and ohci
> > > > error: patch failed: drivers/usb/host/ehci-omap.c:409
> > > > error: drivers/usb/host/ehci-omap.c: patch does not apply
> > > > Patch failed at 0005 arm: omap: usb: create common enums and
structures
> > > for ehci and ohci
> > > > When you have resolved this problem run "git am --resolved".
> > > > If you would prefer to skip this patch, instead run "git am
--skip".
> > > > To restore the original branch and stop patching run "git am
--abort".
> > > >
> > > > Which tree did you use as base for these patches ? I'm trying to
apply
> > > > on top of v.2.6.38-rc6
> > >
> > > Balbi
> > >
> > > I tried at my side on l2.6.38-rc6 , it dint see any failures its
working.
> > >
> > > These patches are apply correctly on l2.6.38-rc6
> > > Commit id: f5412be599602124d2bdd49947b231dd77c0bf99
> > >
> > > Please check; its working my side.
> >
> > You have to rebase on top of this patch which is going to mainline:
>
> BTW, bear in mind you should not cause a regression of that patch. A
> simple rebase is easy to do, but you cannot remove that feature
> introduced by Anand.

Yes, I will do the rebase, and I will send patches soon.





> --
> balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/10 v2] EHCI and OHCI patches of OMAP3 and OMAP4

2011-03-01 Thread Keshava Munegowda
this is how it EHCI/OHCI code re oraganize look like:
. we have EHCI and OHCI be children of a usbhs "core driver"
which will take care of all accesses to
UHH and TLL bases. 

. we pass enable/disable functions down from EHCI and OHCI drivers.
to USBHS driver.

. UHH and TLL power management will eventually move to
omap-usb-host.c

Felipe Balbi (3):
  arm: omap: usb: host: add names to resources
  usb: host: omap: switch to platform_get_resource_byname
  arm: omap2: usb: rename usb-ehci.c to usb-host.c

Keshava Munegowda (7):
  arm: omap: usb: create common enums and structures for ehci and ohci
  usb: host: omap: common usb host core driver
  arm: omap: usb: usbhs core device initialization
  arm: omap: usb: Invoke usbhs core device initialization
  arm: omap: usb: cleanup ehci and ohci resources and devices
  usb: host: omap: ehci and ohci simplification
  arm: omap: usb: clock entries for omap3 and omap4

 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/board-3430sdp.c|   10 +-
 arch/arm/mach-omap2/board-3630sdp.c|   10 +-
 arch/arm/mach-omap2/board-4430sdp.c|   10 +-
 arch/arm/mach-omap2/board-am3517crane.c|   10 +-
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +-
 arch/arm/mach-omap2/board-cm-t35.c |   10 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |   10 +-
 arch/arm/mach-omap2/board-devkit8000.c |   10 +-
 arch/arm/mach-omap2/board-igep0020.c   |   10 +-
 arch/arm/mach-omap2/board-igep0030.c   |   10 +-
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +-
 arch/arm/mach-omap2/board-omap3evm.c   |   14 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +-
 arch/arm/mach-omap2/board-omap4panda.c |   10 +-
 arch/arm/mach-omap2/board-overo.c  |   10 +-
 arch/arm/mach-omap2/board-zoom.c   |   10 +-
 arch/arm/mach-omap2/clock3xxx_data.c   |   19 +-
 arch/arm/mach-omap2/clock44xx_data.c   |   10 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |  306 ---
 arch/arm/plat-omap/include/plat/usb.h  |   55 +-
 drivers/mfd/Kconfig|9 +
 drivers/mfd/Makefile   |1 +
 drivers/mfd/omap-usb-host.c| 1061 
 drivers/usb/host/ehci-omap.c   | 1016 ++-
 drivers/usb/host/ohci-omap3.c  |  584 ++
 28 files changed, 1531 insertions(+), 1718 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (68%)
 create mode 100644 drivers/mfd/omap-usb-host.c

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/10 v2] arm: omap: usb: host: add names to resources

2011-03-01 Thread Keshava Munegowda
From: Felipe Balbi 

add names to EHCI and OHCI resources. That will help us
identify the resource correctly when moving to a setup
where OHCI and EHCI play well together.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/usb-ehci.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
index 25eeada..2c74fa1 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -350,6 +350,11 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
setup_4430ehci_io_mux(pdata->port_mode);
}
 
+   ehci_resources[0].name  = "ehci";
+   ehci_resources[1].name  = "uhh";
+   ehci_resources[2].name  = "tll";
+   ehci_resources[3].name  = "irq";
+
if (platform_device_register(&ehci_device) < 0) {
printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
return;
@@ -369,21 +374,25 @@ void __init usb_ehci_init(const struct 
ehci_hcd_omap_platform_data *pdata)
 
 static struct resource ohci_resources[] = {
{
+   .name   = "ohci",
.start  = OMAP34XX_OHCI_BASE,
.end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "uhh",
.start  = OMAP34XX_UHH_CONFIG_BASE,
.end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "tll",
.start  = OMAP34XX_USBTLL_BASE,
.end= OMAP34XX_USBTLL_BASE + SZ_4K - 1,
.flags  = IORESOURCE_MEM,
},
{   /* general IRQ */
+   .name   = "irq",
.start  = INT_34XX_OHCI_IRQ,
.flags  = IORESOURCE_IRQ,
}
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/10 v2] usb: host: omap: common usb host core driver

2011-03-01 Thread Keshava Munegowda
enabling and disabling the common clocks for ehci
and ohci is implemented. usbhs is a common parent
platform driver for EHCI and OHCI driver. This driver
receives the clock enable and disable requests
from ehci and ohci drivers.The UHH and TLL
initialization is also performed.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/plat-omap/include/plat/usb.h |3 +
 drivers/mfd/Kconfig   |9 +
 drivers/mfd/Makefile  |1 +
 drivers/mfd/omap-usb-host.c   | 1061 +
 4 files changed, 1074 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-host.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index dc6ef62..7aeaa76 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -102,6 +102,9 @@ extern void usb_ehci_init(const struct 
usbhs_omap_board_data *pdata);
 
 extern void usb_ohci_init(const struct usbhs_omap_board_data *pdata);
 
+extern int omap_usbhs_enable(struct device *dev);
+extern void omap_usbhs_disable(struct device *dev);
+
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
 extern int omap4430_phy_init(struct device *dev);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index fd01836..a6dfa37 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -624,6 +624,15 @@ config MFD_WL1273_CORE
  driver connects the radio-wl1273 V4L2 module and the wl1273
  audio codec.
 
+config MFD_OMAP_USB_HOST
+   bool "Support OMAP USBHS core driver"
+   depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
+   default y
+   help
+ This is the core driver for the OAMP EHCI and OHCI drivers.
+ This MFD driver does the required setup functionalities for
+ OMAP USB Host drivers.
+
 endif # MFD_SUPPORT
 
 menu "Multimedia Capabilities Port drivers"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index a54e2c7..91fe384 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -83,3 +83,4 @@ obj-$(CONFIG_MFD_TPS6586X)+= tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
new file mode 100644
index 000..cb01209
--- /dev/null
+++ b/drivers/mfd/omap-usb-host.c
@@ -0,0 +1,1061 @@
+/**
+ * omap-usb-host.c - The USBHS core driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBHS_DRIVER_NAME  "usbhs-omap"
+#define OMAP_EHCI_DEVICE   "ehci-omap"
+#define OMAP_OHCI_DEVICE   "ohci-omap3"
+
+/* OMAP USBHOST Register addresses  */
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
+#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
+#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
+#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 <<

[PATCH 07/10 v2] arm: omap: usb: Invoke usbhs core device initialization

2011-03-01 Thread Keshava Munegowda
The usbhs intialization is invoked by all omap3 and omap4
variant board files.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|2 +-
 arch/arm/mach-omap2/board-3630sdp.c|2 +-
 arch/arm/mach-omap2/board-4430sdp.c|2 +-
 arch/arm/mach-omap2/board-am3517crane.c|2 +-
 arch/arm/mach-omap2/board-am3517evm.c  |2 +-
 arch/arm/mach-omap2/board-cm-t35.c |2 +-
 arch/arm/mach-omap2/board-cm-t3517.c   |2 +-
 arch/arm/mach-omap2/board-devkit8000.c |2 +-
 arch/arm/mach-omap2/board-igep0020.c   |2 +-
 arch/arm/mach-omap2/board-igep0030.c   |2 +-
 arch/arm/mach-omap2/board-omap3beagle.c|2 +-
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 arch/arm/mach-omap2/board-omap3pandora.c   |2 +-
 arch/arm/mach-omap2/board-omap3stalker.c   |2 +-
 arch/arm/mach-omap2/board-omap3touchbook.c |2 +-
 arch/arm/mach-omap2/board-omap4panda.c |2 +-
 arch/arm/mach-omap2/board-overo.c  |2 +-
 arch/arm/mach-omap2/board-zoom.c   |2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index a991aeb..7542ba5 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 03fd8ac..deed2db 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 1f59e8d..13cb1cf 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
usb_musb_init(&musb_board_data);
 
status = omap_ethernet_init();
diff --git a/arch/arm/mach-omap2/board-am3517crane.c 
b/arch/arm/mach-omap2/board-am3517crane.c
index 1b825a0..e3a194f 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -103,7 +103,7 @@ static void __init am3517_crane_init(void)
return;
}
 
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
diff --git a/arch/arm/mach-omap2/board-am3517evm.c 
b/arch/arm/mach-omap2/board-am3517evm.c
index f5bc1c6..913538a 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -502,7 +502,7 @@ static void __init am3517_evm_init(void)
 
/* Configure GPIO for EHCI port */
omap_mux_init_gpio(57, OMAP_PIN_OUTPUT);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
am3517_evm_hecc_init(&am3517_evm_hecc_pdata);
/* DSS */
am3517_evm_display_init();
diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index c79aa9b..9be7289 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -810,7 +810,7 @@ static void __init cm_t35_init(void)
cm_t35_init_display();
 
usb_musb_init(&musb_board_data);
-   usb_ehci_init(&usbhs_bdata);
+   usbhs_init(&usbhs_bdata);
 }
 
 MACHINE_START(CM_T35, "Compulab CM-T35")
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c 
b/arch/arm/mach-omap2/board-cm-t3517.c
index 8288a0b..8e18dc7 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -192,7 +192,7 @@ static int cm_t3517_init_usbh(void)
msleep(1);
}
 
-   usb_ehci_init(&cm_t3517_ehci_pdata);
+   usbhs_init(&cm_t3517_ehci_pdata);
 
return 0;
 }
diff --git a/arch/arm/mach-omap2/board-devkit8000.c 
b/arch/arm/mach-omap2/board-devkit8000.c
index e0131dd..bc0141b 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -803,7 +803,7 @@ static void __init devkit8000_init(void)
devkit8000_ads7846_init();
 
usb_musb_init(&musb_b

[PATCH 10/10 v2] arm: omap: usb: clock entries for omap3 and omap4

2011-03-01 Thread Keshava Munegowda
The devices of clocks are set to usbhs, so that
only usbhs common driver can invoke these clocks.
The dummy per port clocks are added to omap3
clock data base. This helps to invoke common
clock get APIs for omap3 and omap4.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/clock3xxx_data.c |   19 ++-
 arch/arm/mach-omap2/clock44xx_data.c |   10 +-
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 403a4a1..fbb1e30 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3286,7 +3286,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3322,7 +3322,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("mmci-omap-hs.2",   "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3368,11 +3368,20 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cam_ick",  &cam_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "csi2_96m_fck", &csi2_96m_fck,  CK_34XX | CK_36XX),
CLK(NULL,   "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "hs_fck", &usbhost_120m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "fs_fck", &usbhost_48m_fck, CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("ehci-omap.0",  "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "usbhost_ick",  &usbhost_ick,   CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs-omap.0", "utmi_p1_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "utmi_p2_gfclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp1_ck",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs-omap.0", "init_60m_fclk",&dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3X

[PATCH 08/10 v2] arm: omap: usb: cleanup ehci and ohci resources and devices

2011-03-01 Thread Keshava Munegowda
The prototype and defination of functions usb_ehci_init and
usb_ohci_init are removed. The ehci and ohci devices are
removed since usbhs device contains both ehci and ohci details.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  176 +
 arch/arm/plat-omap/include/plat/usb.h |4 -
 2 files changed, 26 insertions(+), 154 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index ab06382..89ae298 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -33,34 +33,46 @@
 
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
-static struct resource ehci_resources[] = {
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = "uhh",
+   .flags  = IORESOURCE_MEM,
+   },
{
+   .name   = "tll",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "ehci",
.flags  = IORESOURCE_MEM,
},
{
+   .name   = "ehci-irq",
+   .flags  = IORESOURCE_IRQ,
+   },
+   {
+   .name   = "ohci",
.flags  = IORESOURCE_MEM,
},
-   { /* general IRQ */
-   .flags   = IORESOURCE_IRQ,
+   {
+   .name   = "ohci-irq",
+   .flags  = IORESOURCE_IRQ,
}
 };
 
-static u64 ehci_dmamask = ~(u32)0;
-static struct platform_device ehci_device = {
-   .name   = "ehci-omap",
-   .id = 0,
-   .dev = {
-   .dma_mask   = &ehci_dmamask,
-   .coherent_dma_mask  = 0x,
-   .platform_data  = NULL,
-   },
-   .num_resources  = ARRAY_SIZE(ehci_resources),
-   .resource   = ehci_resources,
+static struct platform_device usbhs_device = {
+   .name   = OMAP_USBHS_DEVICE,
+   .id = 0,
+   .num_resources  = ARRAY_SIZE(usbhs_resources),
+   .resource   = usbhs_resources,
 };
 
+static struct usbhs_omap_platform_data usbhs_data;
+static struct ehci_hcd_omap_platform_data  ehci_data;
+static struct ohci_hcd_omap_platform_data  ohci_data;
+
 /* MUX settings for EHCI pins */
 /*
  * setup_ehci_io_mux - initialize IO pad mux for USBHOST
@@ -326,81 +338,6 @@ static void setup_4430ehci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-{
-   platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
-
-   /* Setup Pin IO MUX for EHCI */
-   if (cpu_is_omap34xx()) {
-   ehci_resources[0].start = OMAP34XX_EHCI_BASE;
-   ehci_resources[0].end   = OMAP34XX_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP34XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1;
-   ehci_resources[2].start = OMAP34XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP34XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = INT_34XX_EHCI_IRQ;
-   setup_ehci_io_mux(pdata->port_mode);
-   } else if (cpu_is_omap44xx()) {
-   ehci_resources[0].start = OMAP44XX_HSUSB_EHCI_BASE;
-   ehci_resources[0].end   = OMAP44XX_HSUSB_EHCI_BASE + SZ_1K - 1;
-   ehci_resources[1].start = OMAP44XX_UHH_CONFIG_BASE;
-   ehci_resources[1].end   = OMAP44XX_UHH_CONFIG_BASE + SZ_2K - 1;
-   ehci_resources[2].start = OMAP44XX_USBTLL_BASE;
-   ehci_resources[2].end   = OMAP44XX_USBTLL_BASE + SZ_4K - 1;
-   ehci_resources[3].start = OMAP44XX_IRQ_EHCI;
-   setup_4430ehci_io_mux(pdata->port_mode);
-   }
-
-   ehci_resources[0].name  = "ehci";
-   ehci_resources[1].name  = "uhh";
-   ehci_resources[2].name  = "tll";
-   ehci_resources[3].name  = "irq";
-
-   if (platform_device_register(&ehci_device) < 0) {
-   printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
-   return;
-   }
-}
-
-static struct resource ohci_resources[] = {
-   {
-   .name   = "ohci",
-   .start  = OMAP34XX_OHCI_BASE,
-   .end= OMAP34XX_OHCI_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "uhh",
-   .start  = OMAP34XX_UHH_CONFIG_BASE,
-   .end= OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
-   .flags  = IORESOURCE_MEM,
-   },
-   {
-   .name   = "tll",
-   .start  = OMAP34XX_USBTLL_BASE,
-   .end= OMAP34XX_USBTLL_

[PATCH 06/10 v2] arm: omap: usb: usbhs core device initialization

2011-03-01 Thread Keshava Munegowda
A new usbhs platform device is defined;
this device will be the parent device of ehci and
ohci platform devices. the usbhs_init function
is defined which does the usbhs device initialization
and I/O mux of ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/usb-host.c|  195 ++---
 arch/arm/plat-omap/include/plat/usb.h |2 +
 2 files changed, 183 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index b04ce6f..ab06382 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -6,6 +6,7 @@
  *
  * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
+ * Author: Keshava Munegowda 
  *
  * Generalization by:
  * Felipe Balbi 
@@ -19,7 +20,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -30,7 +31,7 @@
 
 #include "mux.h"
 
-#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
+#ifdef CONFIG_MFD_OMAP_USB_HOST
 
 static struct resource ehci_resources[] = {
{
@@ -361,17 +362,6 @@ void __init usb_ehci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
-#else
-
-void __init usb_ehci_init(const struct usbhs_omap_board_data *pdata)
-
-{
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
 static struct resource ohci_resources[] = {
{
.name   = "ohci",
@@ -508,6 +498,77 @@ static void setup_ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
}
 }
 
+static void setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode)
+{
+   switch (port_mode[0]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb1_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb1_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb1_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+
+   switch (port_mode[1]) {
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxdp",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_rxdm",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM:
+   case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_rxrcv",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+   case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0:
+   omap_mux_init_signal("usbb2_mm_txen",
+   OMAP_PIN_INPUT_PULLDOWN);
+
+
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0:
+   case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM:
+   omap_mux_init_signal("usbb2_mm_txdat",
+   OMAP_PIN_INPUT_PULLDOWN);
+   omap_mux_init_signal("usbb2_mm_txse0",
+   OMAP_PIN_INPUT_PULLDOWN);
+   break;
+
+   case OMAP_USBHS_PORT_MODE_UNUSED:
+   default:
+   break;
+   }
+}
+
 void __init usb_ohci_init(const struct usbhs_omap_board_data *pdata)
 {
platform_device_add_data(&ohci_device, pdata, sizeof(*pdata));
@@ -522,10 +583,116 @@ void __init usb_ohci_init(const struct 
usbhs_omap_board_data *pdata)
}
 }
 
+#define OMAP_USBHS_DEVICE  "usbhs-omap"
+
+static struct resource usbhs_resources[] = {
+   {
+   .name   = "uhh",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .name   = "tll",
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+

[PATCH 09/10 v2] usb: host: omap: ehci and ohci simplification

2011-03-01 Thread Keshava Munegowda
The ehci and ohci drivers are simplified; Since
UHH and TLL initialization, clock handling are
done by common usbhs core driver, these functionalities
are removed from ehci and ohci drivers.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ehci-omap.c  | 1016 -
 drivers/usb/host/ohci-omap3.c |  584 ++--
 2 files changed, 132 insertions(+), 1468 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 18df6c6..7e41a95 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -4,9 +4,10 @@
  * Bus Glue for the EHCI controllers in OMAP3/4
  * Tested on several OMAP3 boards, and OMAP4 Pandaboard
  *
- * Copyright (C) 2007-2010 Texas Instruments, Inc.
+ * Copyright (C) 2007-2011 Texas Instruments, Inc.
  * Author: Vikram Pandita 
  * Author: Anand Gadiyar 
+ * Author: Keshava Munegowda 
  *
  * Copyright (C) 2009 Nokia Corporation
  * Contact: Felipe Balbi 
@@ -27,116 +28,19 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  *
- * TODO (last updated Nov 21, 2010):
+ * TODO (last updated Feb 27, 2010):
  * - add kernel-doc
  * - enable AUTOIDLE
  * - add suspend/resume
- * - move workarounds to board-files
- * - factor out code common to OHCI
  * - add HSIC and TLL support
  * - convert to use hwmod and runtime PM
  */
 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
 
-/*
- * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
- * Use ehci_omap_readl()/ehci_omap_writel() functions
- */
-
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
-/* UHH Register Set */
-#defineOMAP_UHH_REVISION   (0x00)
-#defineOMAP_UHH_SYSCONFIG  (0x10)
-#defineOMAP_UHH_SYSCONFIG_MIDLEMODE(1 << 12)
-#defineOMAP_UHH_SYSCONFIG_CACTIVITY(1 << 8)
-#defineOMAP_UHH_SYSCONFIG_SIDLEMODE(1 << 3)
-#define

[PATCH 04/10 v2] arm: omap: usb: create common enums and structures for ehci and ohci

2011-03-01 Thread Keshava Munegowda
Create the ehci and ohci specific platform data structures.
The port enum values are made common for both ehci and ohci.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/mach-omap2/board-3430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-3630sdp.c|   10 +++---
 arch/arm/mach-omap2/board-4430sdp.c|   10 +++---
 arch/arm/mach-omap2/board-am3517crane.c|   10 +++---
 arch/arm/mach-omap2/board-am3517evm.c  |   12 +++---
 arch/arm/mach-omap2/board-cm-t35.c |   10 +++---
 arch/arm/mach-omap2/board-cm-t3517.c   |8 ++--
 arch/arm/mach-omap2/board-devkit8000.c |   10 +++---
 arch/arm/mach-omap2/board-igep0020.c   |   10 +++---
 arch/arm/mach-omap2/board-igep0030.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3beagle.c|   10 +++---
 arch/arm/mach-omap2/board-omap3evm.c   |   14 
 arch/arm/mach-omap2/board-omap3pandora.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3stalker.c   |   10 +++---
 arch/arm/mach-omap2/board-omap3touchbook.c |   10 +++---
 arch/arm/mach-omap2/board-omap4panda.c |   10 +++---
 arch/arm/mach-omap2/board-overo.c  |   10 +++---
 arch/arm/mach-omap2/board-zoom.c   |   10 +++---
 arch/arm/mach-omap2/usb-host.c |   50 +-
 arch/arm/plat-omap/include/plat/usb.h  |   54 ++--
 drivers/usb/host/ehci-omap.c   |   42 +++---
 drivers/usb/host/ohci-omap3.c  |   22 ++--
 22 files changed, 184 insertions(+), 168 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c 
b/arch/arm/mach-omap2/board-3430sdp.c
index d4e41ef..a991aeb 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -653,11 +653,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 57,
@@ -816,7 +816,7 @@ static void __init omap_3430sdp_init(void)
board_flash_init(sdp_flash_partitions, chip_sel_3430);
sdp3430_display_init();
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
diff --git a/arch/arm/mach-omap2/board-3630sdp.c 
b/arch/arm/mach-omap2/board-3630sdp.c
index 6264564..03fd8ac 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -54,11 +54,11 @@ static void enable_board_wakeup_source(void)
OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
 
-   .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
+   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
 
.phy_reset  = true,
.reset_gpio_port[0]  = 126,
@@ -211,7 +211,7 @@ static void __init omap_sdp_init(void)
board_smc91x_init();
board_flash_init(sdp_flash_partitions, chip_sel_sdp);
enable_board_wakeup_source();
-   usb_ehci_init(&ehci_pdata);
+   usb_ehci_init(&usbhs_bdata);
 }
 
 MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 07d1b20..1f59e8d 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -251,10 +251,10 @@ static void __init omap_4430sdp_init_irq(void)
gic_init_irq();
 }
 
-static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
-   .port_mode[0]   = EHCI_HCD_OMAP_MODE_PHY,
-   .port_mode[1]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
-   .port_mode[2]   = EHCI_HCD_OMAP_MODE_UNKNOWN,
+static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
+   .port_mode[0]   = OMAP_EHCI_PORT_MODE_PHY,
+   .port_mode[1]   = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[2]   = OMAP_USBHS_PORT_MODE_UNUSED,
.phy_reset  = false,
.reset_gpio_port[0]  = -EINVAL,
.reset_gpio_port[1]  = -EINVAL,
@@ -583,7 +583,7 @@ static void __init omap_4430sdp_init(void)
else
gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1);
 
-   usb_ehci_init(&ehci_pd

[PATCH 03/10 v2] arm: omap2: usb: rename usb-ehci.c to usb-host.c

2011-03-01 Thread Keshava Munegowda
From: Felipe Balbi 

We already have both EHCI and OHCI there, so let's
rename to be sure everybody will understand the entire
USB HOST functionality is setup on this file.

Signed-off-by: Felipe Balbi 
---
 arch/arm/mach-omap2/Makefile   |2 +-
 arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} |8 
 2 files changed, 5 insertions(+), 5 deletions(-)
 rename arch/arm/mach-omap2/{usb-ehci.c => usb-host.c} (98%)

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 1c0c2b0..64dc417 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -229,7 +229,7 @@ usbfs-$(CONFIG_ARCH_OMAP_OTG)   := usb-fs.o
 obj-y  += $(usbfs-m) $(usbfs-y)
 obj-y  += usb-musb.o
 obj-$(CONFIG_MACH_OMAP2_TUSB6010)  += usb-tusb6010.o
-obj-y  += usb-ehci.o
+obj-y  += usb-host.o
 
 onenand-$(CONFIG_MTD_ONENAND_OMAP2):= gpmc-onenand.o
 obj-y  += $(onenand-m) $(onenand-y)
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-host.c
similarity index 98%
rename from arch/arm/mach-omap2/usb-ehci.c
rename to arch/arm/mach-omap2/usb-host.c
index 2c74fa1..45f9b80 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -1,14 +1,14 @@
 /*
- * linux/arch/arm/mach-omap2/usb-ehci.c
+ * usb-host.c - OMAP USB Host
  *
  * This file will contain the board specific details for the
- * Synopsys EHCI host controller on OMAP3430
+ * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards
  *
- * Copyright (C) 2007 Texas Instruments
+ * Copyright (C) 2007-2011 Texas Instruments
  * Author: Vikram Pandita 
  *
  * Generalization by:
- * Felipe Balbi 
+ * Felipe Balbi 
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/10 v2] usb: host: omap: switch to platform_get_resource_byname

2011-03-01 Thread Keshava Munegowda
From: Felipe Balbi 

now that we have names on all memory bases, we can
switch to use platform_get_resource_byname() which
will make it simpler when we move to a setup where
OHCI and EHCI on OMAP play well together.

Signed-off-by: Felipe Balbi 
---
 drivers/usb/host/ehci-omap.c  |6 +++---
 drivers/usb/host/ohci-omap3.c |6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index d7e223b..1527721 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -947,7 +947,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci  = hcd_to_ehci(hcd);
omap->ehci->sbrn= 0x20;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ehci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -963,7 +963,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
omap->ehci->caps = hcd->regs;
omap->ehci_base = hcd->regs;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -971,7 +971,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
diff --git a/drivers/usb/host/ohci-omap3.c b/drivers/usb/host/ohci-omap3.c
index a37d599..32f56bb 100644
--- a/drivers/usb/host/ohci-omap3.c
+++ b/drivers/usb/host/ohci-omap3.c
@@ -618,7 +618,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
omap->es2_compatibility = pdata->es2_compatibility;
omap->ohci  = hcd_to_ohci(hcd);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ohci");
 
hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);
@@ -630,7 +630,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "uhh");
omap->uhh_base = ioremap(res->start, resource_size(res));
if (!omap->uhh_base) {
dev_err(&pdev->dev, "UHH ioremap failed\n");
@@ -638,7 +638,7 @@ static int __devinit ohci_hcd_omap3_probe(struct 
platform_device *pdev)
goto err_uhh_ioremap;
}
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tll");
omap->tll_base = ioremap(res->start, resource_size(res));
if (!omap->tll_base) {
dev_err(&pdev->dev, "TLL ioremap failed\n");
-- 
1.6.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v2 2/2] RX-51: Enable isp1704 power on/off

2011-03-28 Thread Keshava Munegowda
> +
>  static struct platform_device rx51_charger_device = {
> - .name = "isp1704_charger",
> + .name   = "isp1704_charger",

Both are same; you don’t need this change!



> + .dev= {
> + .platform_data = &rx51_charger_data,
> + },
>  };
>
> +static void __init rx51_charger_init(void)
> +{
> + BUG_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
> + GPIOF_OUT_INIT_LOW, "isp1704_reset"));
> +
> + platform_device_register(&rx51_charger_device);
> +}
> +
>  #if defined(CONFIG_KEYBOARD_GPIO) ||
defined(CONFIG_KEYBOARD_GPIO_MODULE)
>
>  #define RX51_GPIO_CAMERA_LENS_COVER  110
> @@ -928,6 +951,6 @@ void __init rx51_peripherals_init(void)
>   if (partition)
>   omap2_hsmmc_init(mmc);
>
> - platform_device_register(&rx51_charger_device);
> + rx51_charger_init();
>  }
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH] mfd: Fix usbhs_enable error handling

2011-03-29 Thread Keshava Munegowda
> -Original Message-
> From: Axel Lin [mailto:axel@gmail.com]
> Sent: Tuesday, March 29, 2011 3:38 PM
> To: linux-ker...@vger.kernel.org
> Cc: Keshava Munegowda; Samuel Ortiz
> Subject: [PATCH] mfd: Fix usbhs_enable error handling
>
> In the case of missing platform_data we do not hold a spin_lock,
> thus we should not call spin_unlock_irqrestore in the error path.
>
> Also simplify the error handling by separating the successful path
> from error path. I think this change improves readability.
>
> Signed-off-by: Axel Lin 
> ---
>  drivers/mfd/omap-usb-host.c |8 +++-
>  1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
> index cb01209..4157d76 100644
> --- a/drivers/mfd/omap-usb-host.c
> +++ b/drivers/mfd/omap-usb-host.c
> @@ -700,8 +700,7 @@ static int usbhs_enable(struct device *dev)
>   dev_dbg(dev, "starting TI HSUSB Controller\n");
>   if (!pdata) {
>   dev_dbg(dev, "missing platform_data\n");
> - ret =  -ENODEV;
> - goto end_enable;
> + return  -ENODEV;
>   }
>
>   spin_lock_irqsave(&omap->lock, flags);
> @@ -915,7 +914,8 @@ static int usbhs_enable(struct device *dev)
>
>  end_count:
>   omap->count++;
> - goto end_enable;
> + spin_unlock_irqrestore(&omap->lock, flags);
> + return 0;
>
>  err_tll:
>   if (pdata->ehci_data->phy_reset) {
> @@ -931,8 +931,6 @@ err_tll:
>   clk_disable(omap->usbhost_fs_fck);
>   clk_disable(omap->usbhost_hs_fck);
>   clk_disable(omap->usbhost_ick);
> -
> -end_enable:
>   spin_unlock_irqrestore(&omap->lock, flags);
>   return ret;
>  }
> --
> 1.7.1

Thanks Axel!
Acked-by: Keshava Munegowda < keshava_mgo...@ti.com>

>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3 2/2] RX-51: Enable isp1704 power on/off

2011-03-29 Thread Keshava Munegowda
> +
>  static struct platform_device rx51_charger_device = {
> - .name = "isp1704_charger",
> + .name   = "isp1704_charger",

I don’t understand what difference between above two lines?
Is your mail client causing this? Or get send-mail doing this?


> + .dev= {
> + .platform_data = &rx51_charger_data,
> + },
>  };
>
> +static void __init rx51_charger_init(void)
> +{
> + WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
> + GPIOF_OUT_INIT_LOW, "isp1704_reset"));
> +
> + platform_device_register(&rx51_charger_device);
> +}
> +
>  #if defined(CONFIG_KEYBOARD_GPIO) ||
defined(CONFIG_KEYBOARD_GPIO_MODULE)
>
>  #define RX51_GPIO_CAMERA_LENS_COVER  110
> @@ -981,6 +1004,6 @@ void __init rx51_peripherals_init(void)
>   if (partition)
>   omap2_hsmmc_init(mmc);
>
> - platform_device_register(&rx51_charger_device);
> + rx51_charger_init();
>  }
>
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH v3 2/2] RX-51: Enable isp1704 power on/off

2011-03-29 Thread Keshava Munegowda
> -Original Message-
> From: kalle.jokini...@nokia.com [mailto:kalle.jokini...@nokia.com]
> Sent: Wednesday, March 30, 2011 12:12 PM
> To: keshava_mgo...@ti.com; linux-...@vger.kernel.org;
cbouatmai...@gmail.com
> Cc: ba...@ti.com; heikki.kroge...@nokia.com; sshtyl...@mvista.com;
t...@atomide.com; khil...@ti.com;
> linux-omap@vger.kernel.org; jhnik...@gmail.com
> Subject: RE: [PATCH v3 2/2] RX-51: Enable isp1704 power on/off
>
> Hi,
>
>  > -Original Message-----
>  > From: ext Keshava Munegowda [mailto:keshava_mgo...@ti.com]
>  > Sent: 30. maaliskuuta 2011 9:39
>  > To: Jokiniemi Kalle (Nokia-MS/Tampere); linux-...@vger.kernel.org;
>  > cbouatmai...@gmail.com
>  > Cc: Felipe Balbi; Krogerus Heikki (Nokia-MS/Helsinki);
sshtyl...@mvista.com;
>  > t...@atomide.com; Kevin Hilman; linux-omap@vger.kernel.org;
>  > jhnik...@gmail.com
>  > Subject: RE: [PATCH v3 2/2] RX-51: Enable isp1704 power on/off
>  >
>  > > +
>  > >  static struct platform_device rx51_charger_device = {
>  > > -.name = "isp1704_charger",
> ^space here
>
>
>
>  > > +.name   = "isp1704_charger",
>   ^tab here
>  >
>  > I don't understand what difference between above two lines?
>  > Is your mail client causing this? Or get send-mail doing this?
>
> No, changed space for tab so that all the members are indented same way.
> I had that (apparently obscure) explanation about this in the commit log
;)

Then, I am sorry; I couldn't able to notice this!



>
>  >
>  >
>  > > +.dev= {
>   ^tab here also
>
>  > > +.platform_data = &rx51_charger_data,
>  > > +},
>  > >  };
>  > >
>  > > +static void __init rx51_charger_init(void)
>  > > +{
>  > > +WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
>  > > +GPIOF_OUT_INIT_LOW, "isp1704_reset"));
>  > > +
>  > > +platform_device_register(&rx51_charger_device);
>  > > +}
>  > > +
>  > >  #if defined(CONFIG_KEYBOARD_GPIO) ||
>  > defined(CONFIG_KEYBOARD_GPIO_MODULE)
>  > >
>  > >  #define RX51_GPIO_CAMERA_LENS_COVER 110
>  > > @@ -981,6 +1004,6 @@ void __init rx51_peripherals_init(void)
>  > >  if (partition)
>  > >  omap2_hsmmc_init(mmc);
>  > >
>  > > -platform_device_register(&rx51_charger_device);
>  > > +rx51_charger_init();
>  > >  }
>  > >
>  > > --
>  > > 1.7.1
>  > >
>  > > --
>  > > To unsubscribe from this list: send the line "unsubscribe
linux-usb" in
>  > > the body of a message to majord...@vger.kernel.org
>  > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Regression?] Removed regulator support in ehci-omap

2011-04-11 Thread Keshava Munegowda
> -Original Message-
> From: Steve Sakoman [mailto:sako...@gmail.com]
> Sent: Tuesday, April 12, 2011 1:43 AM
> To: Steve Calfee
> Cc: Dmitry Artamonow; Keshava Munegowda; Felipe Balbi;
linux-...@vger.kernel.org; linux-
> o...@vger.kernel.org; linux-ker...@vger.kernel.org
> Subject: Re: [Regression?] Removed regulator support in ehci-omap
>
> On Mon, Apr 11, 2011 at 10:06 AM, Steve Calfee 
wrote:
> > On 04/11/11 02:32, Dmitry Artamonow wrote:
> >> Hi, guys!
> >>
> >> Can anyone explain why regulator support has been removed from
ehci-omap
> >> driver in commit 19403165 ("usb: host: omap: ehci and ohci
simplification")[1]?
> >> In 2.6.37/2.6.38 it was enough to apply simple patch[2] adding
regulators
> >> description to board file to make USB work on omap3evm board (because
USB PHY
> >> is powered via regulator). But now it won't work anymore in
2.6.39-rc2.
> >> BTW, I suspect that this commit also broke USB on omap3pandora board,
as it
> >> defines "hsusb0" regulator supply in its board file:
> >>
> > Yes, And Beagleboard xm (and I suspect other beagleboard versions) has
> > been broken in 2.6.39rc1+.
>
> FWIW, EHCI is also broken on Overo in both rc1 and rc2.
>
> Steve

Sorry guys! I will work on it coming week; currently I am in travel.

Well, regulator is not removed, its moved to usbhs core driver in
/driver/mfd/omap xx usb xxx host.c

Regards
Keshava Munegowda
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [Regression?] Removed regulator support in ehci-omap

2011-04-12 Thread Keshava Munegowda
> -Original Message-
> From: Dmitry Artamonow [mailto:mad_s...@inbox.ru]
> Sent: Tuesday, April 12, 2011 9:41 AM
> To: Keshava Munegowda
> Cc: Steve Sakoman; Steve Calfee; Felipe Balbi;
linux-...@vger.kernel.org; linux-omap@vger.kernel.org;
> linux-ker...@vger.kernel.org
> Subject: Re: [Regression?] Removed regulator support in ehci-omap
>
> On 02:18 Tue 12 Apr , Keshava Munegowda wrote:
> >
> > Sorry guys! I will work on it coming week; currently I am in travel.
> >
> > Well, regulator is not removed, its moved to usbhs core driver in
> > /driver/mfd/omap xx usb xxx host.c
>
> Ah, so EHCI/OHCI common code was moved into drivers/mfd... Good.
> But seems regulators support was lost somewhere during transition - the
> only mentioning about regulators in omap-usb-host.c is "#include" :
>
> mad@macmini:~/kernel-hack/linux-2.6(master)$ grep -i regulator
drivers/mfd/omap-usb-host.c
> #include 
> mad@macmini:~/kernel-hack/linux-2.6(master)$
>
> --
> Best regards,
> Dmitry "MAD" Artamonow

Thanks ! I will add some time next week!

Keshava Munegowda
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ARM: OMAP: TLL driver implementation for USB host driver

2012-06-20 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In V2:
 - covered review comments from linux omap and usb community
 - rebased on top Russ dil's patch 
'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
fixes an issue where the ULPI PHYs were not held in reset 
while initializing the EHCI controller

Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ARM: OMAP: USB: Remove TLL specific code

2012-06-20 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1 << 1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1 << 18)
 #define OMAP4_P2_MODE_HSIC (3 << 18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk   

[PATCH V2] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-06-20 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  "usbhs_omap"
+#define OMAP_USBTLL_DEVICE "usbhs_tll"
 #defineUSBHS_UHH_HWMODNAME "usb_host_hs"
 #define USBHS_TLL_HWMODNAME"usb_tll_hs"
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata->port_mode[i];
+   usbtll_data.port_mode[i] = pdata->port_mode[i];
ohci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata->port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)&usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   &usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err("Could not build hwmod devices %s,%s\n",
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err("Could not build hwmod device %s\n",
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   &usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err("Could not build hwmod devices %s\n",
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2] ARM: OMAP: USB: HOST TLL platform driver

2012-06-20 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool "Support OMAP USBHS core driver"
+   bool "Support OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..516059b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBTLL_DRIVER_NAME "usbhs_tll"
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#def

[PATCH V2] ARM: OMAP: change the USB TLL clocks device name

2012-06-20 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0..300ca51 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap_hsmmc.2", "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("usbhs_omap",   "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "init_60m_fclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..d60e8d6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3328,7 +3328,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "usb_tll_hs_usb_ch2_clk",   
&usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch0_clk",   
&usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch1_clk",   
&usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK("usbhs_omap",   "usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
+   CLK("usbhs_tll","usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
CLK(NULL,   "usim_ck",  &usim_ck,   
CK_443X),
CLK(NULL,   "usim_fclk",&usim_fclk, 
CK_443X),
CLK(NULL,   "usim_fck", &usim_fck,  
CK_443X),
@@ -3378,7 +3378,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_ick",&dummy_ck,  
CK_443X),
CLK(NULL,   "uart4_ick", 

[PATCH V2] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-06-20 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(&omap->lock, flags);
 
if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap->ehci_logic_fck);
 
spin_unlock_irqrestore(&omap->lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 0/5] ARM: OMAP: TLL driver implementation for USB host driver

2012-06-20 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dil's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller

Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 4/5] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-06-20 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(&omap->lock, flags);
 
if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap->ehci_logic_fck);
 
spin_unlock_irqrestore(&omap->lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 2/5] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-06-20 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  "usbhs_omap"
+#define OMAP_USBTLL_DEVICE "usbhs_tll"
 #defineUSBHS_UHH_HWMODNAME "usb_host_hs"
 #define USBHS_TLL_HWMODNAME"usb_tll_hs"
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata->port_mode[i];
+   usbtll_data.port_mode[i] = pdata->port_mode[i];
ohci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata->port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)&usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   &usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err("Could not build hwmod devices %s,%s\n",
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err("Could not build hwmod device %s\n",
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   &usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err("Could not build hwmod devices %s\n",
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V2 3/5] ARM: OMAP: USB: Remove TLL specific code

2012-06-20 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1 << 1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1 << 18)
 #define OMAP4_P2_MODE_HSIC (3 << 18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk   

[PATCH V2 1/5] ARM: OMAP: USB: HOST TLL platform driver

2012-06-20 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool "Support OMAP USBHS core driver"
+   bool "Support OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..516059b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBTLL_DRIVER_NAME "usbhs_tll"
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#def

[PATCH V2 5/5] ARM: OMAP: change the USB TLL clocks device name

2012-06-20 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0..300ca51 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap_hsmmc.2", "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("usbhs_omap",   "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "init_60m_fclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..d60e8d6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3328,7 +3328,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "usb_tll_hs_usb_ch2_clk",   
&usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch0_clk",   
&usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch1_clk",   
&usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK("usbhs_omap",   "usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
+   CLK("usbhs_tll","usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
CLK(NULL,   "usim_ck",  &usim_ck,   
CK_443X),
CLK(NULL,   "usim_fclk",&usim_fclk, 
CK_443X),
CLK(NULL,   "usim_fck", &usim_fck,  
CK_443X),
@@ -3378,7 +3378,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_ick",&dummy_ck,  
CK_443X),
CLK(NULL,   "uart4_ick", 

[PATCH 0/5 V2 RESEND] ARM: OMAP: TLL driver implementation for USB host driver

2012-06-20 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dil's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller

Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5 V2 RESEND] ARM: OMAP: USB: HOST TLL platform driver

2012-06-20 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool "Support OMAP USBHS core driver"
+   bool "Support OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..516059b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBTLL_DRIVER_NAME "usbhs_tll"
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#def

[PATCH 4/5 V2 RESEND] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-06-20 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(&omap->lock, flags);
 
if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap->ehci_logic_fck);
 
spin_unlock_irqrestore(&omap->lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5 V2 RESEND] ARM: OMAP: USB: Remove TLL specific code

2012-06-20 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1 << 1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1 << 18)
 #define OMAP4_P2_MODE_HSIC (3 << 18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk   

[PATCH 5/5 V2 RESEND] ARM: OMAP: change the USB TLL clocks device name

2012-06-20 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0..300ca51 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap_hsmmc.2", "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("usbhs_omap",   "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "init_60m_fclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..d60e8d6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3328,7 +3328,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "usb_tll_hs_usb_ch2_clk",   
&usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch0_clk",   
&usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch1_clk",   
&usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK("usbhs_omap",   "usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
+   CLK("usbhs_tll","usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
CLK(NULL,   "usim_ck",  &usim_ck,   
CK_443X),
CLK(NULL,   "usim_fclk",&usim_fclk, 
CK_443X),
CLK(NULL,   "usim_fck", &usim_fck,  
CK_443X),
@@ -3378,7 +3378,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_ick",&dummy_ck,  
CK_443X),
CLK(NULL,   "uart4_ick", 

[PATCH 2/5 V2 RESEND] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-06-20 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  "usbhs_omap"
+#define OMAP_USBTLL_DEVICE "usbhs_tll"
 #defineUSBHS_UHH_HWMODNAME "usb_host_hs"
 #define USBHS_TLL_HWMODNAME"usb_tll_hs"
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata->port_mode[i];
+   usbtll_data.port_mode[i] = pdata->port_mode[i];
ohci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata->port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)&usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   &usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err("Could not build hwmod devices %s,%s\n",
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err("Could not build hwmod device %s\n",
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   &usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err("Could not build hwmod devices %s\n",
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] OMAP: USB : Fix the EHCI enumeration and core retention issue

2012-06-21 Thread Keshava Munegowda
This commit 354ab8567ae3107a8cbe7228c3181990ba598aac titled
"Fix OMAP EHCI suspend/resume failure (i693)" is causing
the usb hub and device detection fails in beagle XM
causeing NFS not functional. This affects the core retention too.
The same commit logic needs to be revisted adhering to hwmod and
device tree framework.
for now, this commit id 354ab8567ae3107a8cbe7228c3181990ba598aac
titled "Fix OMAP EHCI suspend/resume failure (i693)" reverted.

This patch is validated on BeagleXM with NFS support over
usb ethernet and USB mass storage and other device detection.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ehci-omap.c |  164 +-
 1 file changed, 1 insertion(+), 163 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 17cfb8a..272e661 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -56,15 +56,6 @@
 #defineEHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
 #defineEHCI_INSNREG05_ULPI_WRDATA_SHIFT0
 
-/* Errata i693 */
-static struct clk  *utmi_p1_fck;
-static struct clk  *utmi_p2_fck;
-static struct clk  *xclk60mhsp1_ck;
-static struct clk  *xclk60mhsp2_ck;
-static struct clk  *usbhost_p1_fck;
-static struct clk  *usbhost_p2_fck;
-static struct clk  *init_60m_fclk;
-
 /*-*/
 
 static const struct hc_driver ehci_omap_hc_driver;
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
return __raw_readl(base + reg);
 }
 
-/* Erratum i693 workaround sequence */
-static void omap_ehci_erratum_i693(struct ehci_hcd *ehci)
-{
-   int ret = 0;
-
-   /* Switch to the internal 60 MHz clock */
-   ret = clk_set_parent(utmi_p1_fck, init_60m_fclk);
-   if (ret != 0)
-   ehci_err(ehci, "init_60m_fclk set parent"
-   "failed error:%d\n", ret);
-
-   ret = clk_set_parent(utmi_p2_fck, init_60m_fclk);
-   if (ret != 0)
-   ehci_err(ehci, "init_60m_fclk set parent"
-   "failed error:%d\n", ret);
-
-   clk_enable(usbhost_p1_fck);
-   clk_enable(usbhost_p2_fck);
-
-   /* Wait 1ms and switch back to the external clock */
-   mdelay(1);
-   ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck);
-   if (ret != 0)
-   ehci_err(ehci, "xclk60mhsp1_ck set parent"
-   "failed error:%d\n", ret);
-
-   ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck);
-   if (ret != 0)
-   ehci_err(ehci, "xclk60mhsp2_ck set parent"
-   "failed error:%d\n", ret);
-
-   clk_disable(usbhost_p1_fck);
-   clk_disable(usbhost_p2_fck);
-}
 
 static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port)
 {
@@ -145,50 +102,6 @@ static void omap_ehci_soft_phy_reset(struct 
platform_device *pdev, u8 port)
}
 }
 
-static int omap_ehci_hub_control(
-   struct usb_hcd  *hcd,
-   u16 typeReq,
-   u16 wValue,
-   u16 wIndex,
-   char*buf,
-   u16 wLength
-)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-   u32 __iomem *status_reg = &ehci->regs->port_status[
-   (wIndex & 0xff) - 1];
-   u32 temp;
-   unsigned long   flags;
-   int retval = 0;
-
-   spin_lock_irqsave(&ehci->lock, flags);
-
-   if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
-   temp = ehci_readl(ehci, status_reg);
-   if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
-   retval = -EPIPE;
-   goto done;
-   }
-
-   temp &= ~PORT_WKCONN_E;
-   temp |= PORT_WKDISC_E | PORT_WKOC_E;
-   ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
-
-   omap_ehci_erratum_i693(ehci);
-
-   set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
-   goto done;
-   }
-
-   spin_unlock_irqrestore(&ehci->lock, flags);
-
-   /* Handle the hub control events here */
-   return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
-done:
-   spin_unlock_irqrestore(&ehci->lock, flags);
-   return retval;
-}
-
 static void disable_put_regulator(
struct ehci_hcd_omap_platform_data *pdata)
 {
@@ -353,76 +266,9 @@ static int ehci_hcd_omap_probe(struct platform_device 
*pdev)
/* root ports should always stay powered */
ehci_port_power(omap_ehci, 1);
 
-   /* get clocks */
-   utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
-   if (IS_ERR(utmi_p1_fck)) {
-   

[PATCH 0/5 V2 RESEND] ARM: OMAP: TLL driver implementation for USB host driver

2012-06-26 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dil's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller

Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/5 V2 RESEND] ARM: OMAP: USB: HOST TLL platform driver

2012-06-26 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool "Support OMAP USBHS core driver"
+   bool "Support OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..516059b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBTLL_DRIVER_NAME "usbhs_tll"
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#def

[PATCH 2/5 V2 RESEND] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-06-26 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  "usbhs_omap"
+#define OMAP_USBTLL_DEVICE "usbhs_tll"
 #defineUSBHS_UHH_HWMODNAME "usb_host_hs"
 #define USBHS_TLL_HWMODNAME"usb_tll_hs"
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata->port_mode[i];
+   usbtll_data.port_mode[i] = pdata->port_mode[i];
ohci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata->port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)&usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   &usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err("Could not build hwmod devices %s,%s\n",
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err("Could not build hwmod device %s\n",
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   &usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err("Could not build hwmod devices %s\n",
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5 V2 RESEND] ARM: OMAP: USB: Remove TLL specific code

2012-06-26 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1 << 1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1 << 18)
 #define OMAP4_P2_MODE_HSIC (3 << 18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk   

[PATCH 4/5 V2 RESEND] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-06-26 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(&omap->lock, flags);
 
if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap->ehci_logic_fck);
 
spin_unlock_irqrestore(&omap->lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/5 V2 RESEND] ARM: OMAP: change the USB TLL clocks device name

2012-06-26 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 4e1a3b0..300ca51 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap_hsmmc.2", "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("usbhs_omap",   "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "init_60m_fclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..d60e8d6 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -3328,7 +3328,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "usb_tll_hs_usb_ch2_clk",   
&usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch0_clk",   
&usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch1_clk",   
&usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK("usbhs_omap",   "usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
+   CLK("usbhs_tll","usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
CLK(NULL,   "usim_ck",  &usim_ck,   
CK_443X),
CLK(NULL,   "usim_fclk",&usim_fclk, 
CK_443X),
CLK(NULL,   "usim_fck", &usim_fck,  
CK_443X),
@@ -3378,7 +3378,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_ick",&dummy_ck,  
CK_443X),
CLK(NULL,   "uart4_ick", 

[PATCH] ARM: OMAP: EHCI: Fix the hub disconnect after resume

2012-06-27 Thread Keshava Munegowda
Its observed that in Beagle XM , during suspend/resume the OMAP
EHCI controller losing the register contents. this is causing the
hub disconnect after the resume, this is causing failure of
device detection after the resume.
to avoid the hub disconnect , The ehci config flag register is
configured again , reset the phy and issue the port powers during
resume.

Signed-off-by: Keshava Munegowda 
---
 drivers/usb/host/ehci-omap.c |   49 --
 1 file changed, 43 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index 4a54418..c9c34b7 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -46,6 +46,7 @@
 #include 
 
 /* EHCI Register Set */
+#define EHCI_CONFIGFLAG(0x50)
 #define EHCI_INSNREG04 (0xA0)
 #define EHCI_INSNREG04_DISABLE_UNSUSPEND   (1 << 5)
 #defineEHCI_INSNREG05_ULPI (0xA4)
@@ -72,9 +73,9 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
 }
 
 
-static void omap_ehci_soft_phy_reset(struct platform_device *pdev, u8 port)
+static void omap_ehci_soft_phy_reset(struct device *dev, u8 port)
 {
-   struct usb_hcd  *hcd = dev_get_drvdata(&pdev->dev);
+   struct usb_hcd  *hcd = dev_get_drvdata(dev);
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
unsigned reg = 0;
 
@@ -96,7 +97,7 @@ static void omap_ehci_soft_phy_reset(struct platform_device 
*pdev, u8 port)
cpu_relax();
 
if (time_after(jiffies, timeout)) {
-   dev_dbg(&pdev->dev, "phy reset operation timed out\n");
+   dev_dbg(dev, "phy reset operation timed out\n");
break;
}
}
@@ -223,9 +224,9 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
 
/* Soft reset the PHY using PHY reset command over ULPI */
if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
-   omap_ehci_soft_phy_reset(pdev, 0);
+   omap_ehci_soft_phy_reset(dev, 0);
if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
-   omap_ehci_soft_phy_reset(pdev, 1);
+   omap_ehci_soft_phy_reset(dev, 1);
 
omap_ehci = hcd_to_ehci(hcd);
omap_ehci->sbrn = 0x20;
@@ -328,6 +329,42 @@ static struct platform_driver ehci_hcd_omap_driver = {
}
 };
 
+static int omap_ehci_bus_resume(struct usb_hcd *hcd)
+{
+
+   struct device   *dev = hcd->self.controller;
+   struct ehci_hcd_omap_platform_data  *pdata = dev->platform_data;
+   struct resource *regs = hcd->regs;
+
+   /* In case , ports are not powered and config flag not set */
+   if (~(ehci_read(regs, EHCI_CONFIGFLAG) & 0x01)) {
+   ehci_write(regs, EHCI_CONFIGFLAG, 0x1);
+
+   /*
+* An undocumented "feature" in the OMAP3 EHCI controller,
+* causes suspended ports to be taken out of suspend when
+* the USBCMD.Run/Stop bit is cleared (for example when
+* we do ehci_bus_suspend).
+* This breaks suspend-resume if the root-hub is allowed
+* to suspend. Writing 1 to this undocumented register bit
+* disables this feature and restores normal behavior.
+*/
+   ehci_write(regs, EHCI_INSNREG04,
+  EHCI_INSNREG04_DISABLE_UNSUSPEND);
+
+   /* Soft reset the PHY using PHY reset command over ULPI */
+   if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
+   omap_ehci_soft_phy_reset(dev, 0);
+   if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
+   omap_ehci_soft_phy_reset(dev, 1);
+
+   /* root ports should always stay powered */
+   ehci_port_power(hcd_to_ehci(hcd), 1);
+   }
+
+   return ehci_bus_resume(hcd);
+}
+
 /*-*/
 
 static const struct hc_driver ehci_omap_hc_driver = {
@@ -368,7 +405,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
.hub_status_data= ehci_hub_status_data,
.hub_control= ehci_hub_control,
.bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
+   .bus_resume = omap_ehci_bus_resume,
 
.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
 };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 0/5] ARM: OMAP: TLL driver implementation for USB host driver

2012-07-02 Thread Keshava Munegowda
he TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In v3:
  - rebased on top V3 of Russ dill's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller
http://permalink.gmane.org/gmane.linux.usb.general/65988
  
  - rebased on top of patch 
OMAP: USB : Fix the EHCI enumeration and core retention issue
 http://permalink.gmane.org/gmane.linux.usb.general/66239

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dill's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller


Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 0/5] ARM: OMAP: TLL driver implementation for USB host driver

2012-07-02 Thread Keshava Munegowda
The TLL configuration is removed from the UHH driver and implemented as
a seperate platform driver. Now, the UHH driver configures the TLL
through API's exported by the TLL platform driver. The TLL is an
has independent hardware mod structure for in OMAP3 and later chips,
hence an dedicated platform driver is created.

Signed-off-by: Keshava Munegowda 

In v3:
  - rebased on top V3 of Russ dill's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller
http://permalink.gmane.org/gmane.linux.usb.general/65988
  
  - rebased on top of patch 
OMAP: USB : Fix the EHCI enumeration and core retention issue
 http://permalink.gmane.org/gmane.linux.usb.general/66239

In V2:
- covered review comments from linux omap and usb community
- rebased on top Russ dill's patch
   'ARM: OMAP3: USB: Fix the EHCI ULPI PHY reset issue'
   fixes an issue where the ULPI PHYs were not held in reset
   while initializing the EHCI controller


Keshava Munegowda (5):
  ARM: OMAP: USB: HOST TLL platform driver
  ARM: OMAP: USB: Build the USB HOST TLL omap device
  ARM: OMAP: USB: Remove TLL specific code
  ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver
  ARM: OMAP: change the USB TLL clocks device name

 arch/arm/mach-omap2/clock3xxx_data.c  |8 +-
 arch/arm/mach-omap2/clock44xx_data.c  |4 +-
 arch/arm/mach-omap2/usb-host.c|   31 ++-
 arch/arm/plat-omap/include/plat/usb.h |7 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-host.c   |  238 ++---
 drivers/mfd/omap-usb-tll.c|  471 +
 8 files changed, 523 insertions(+), 240 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 2/5] ARM: OMAP: USB: Build the USB HOST TLL omap device

2012-07-02 Thread Keshava Munegowda
The hwmod of the usb tll is retrieved and omap device build is
performed to created the platform device for the usb tll component.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/usb-host.c |   31 ++-
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/usb-host.c b/arch/arm/mach-omap2/usb-host.c
index dde8a11..b2a2dd7 100644
--- a/arch/arm/mach-omap2/usb-host.c
+++ b/arch/arm/mach-omap2/usb-host.c
@@ -35,10 +35,12 @@
 #ifdef CONFIG_MFD_OMAP_USB_HOST
 
 #define OMAP_USBHS_DEVICE  "usbhs_omap"
+#define OMAP_USBTLL_DEVICE "usbhs_tll"
 #defineUSBHS_UHH_HWMODNAME "usb_host_hs"
 #define USBHS_TLL_HWMODNAME"usb_tll_hs"
 
 static struct usbhs_omap_platform_data usbhs_data;
+static struct usbtll_omap_platform_datausbtll_data;
 static struct ehci_hcd_omap_platform_data  ehci_data;
 static struct ohci_hcd_omap_platform_data  ohci_data;
 
@@ -487,13 +489,14 @@ void __init setup_4430ohci_io_mux(const enum 
usbhs_omap_port_mode *port_mode)
 
 void __init usbhs_init(const struct usbhs_omap_board_data *pdata)
 {
-   struct omap_hwmod   *oh[2];
+   struct omap_hwmod   *uhh_hwm, *tll_hwm;
struct platform_device  *pdev;
int bus_id = -1;
int i;
 
for (i = 0; i < OMAP3_HS_USB_PORTS; i++) {
usbhs_data.port_mode[i] = pdata->port_mode[i];
+   usbtll_data.port_mode[i] = pdata->port_mode[i];
ohci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.port_mode[i] = pdata->port_mode[i];
ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i];
@@ -512,25 +515,35 @@ void __init usbhs_init(const struct usbhs_omap_board_data 
*pdata)
setup_4430ohci_io_mux(pdata->port_mode);
}
 
-   oh[0] = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
-   if (!oh[0]) {
+   uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME);
+   if (!uhh_hwm) {
pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME);
return;
}
 
-   oh[1] = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
-   if (!oh[1]) {
+   tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME);
+   if (!tll_hwm) {
pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME);
return;
}
 
-   pdev = omap_device_build_ss(OMAP_USBHS_DEVICE, bus_id, oh, 2,
-   (void *)&usbhs_data, sizeof(usbhs_data),
+   pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm,
+   &usbtll_data, sizeof(usbtll_data),
omap_uhhtll_latency,
ARRAY_SIZE(omap_uhhtll_latency), false);
if (IS_ERR(pdev)) {
-   pr_err("Could not build hwmod devices %s,%s\n",
-   USBHS_UHH_HWMODNAME, USBHS_TLL_HWMODNAME);
+   pr_err("Could not build hwmod device %s\n",
+  USBHS_TLL_HWMODNAME);
+   return;
+   }
+
+   pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm,
+   &usbhs_data, sizeof(usbhs_data),
+   omap_uhhtll_latency,
+   ARRAY_SIZE(omap_uhhtll_latency), false);
+   if (IS_ERR(pdev)) {
+   pr_err("Could not build hwmod devices %s\n",
+  USBHS_UHH_HWMODNAME);
return;
}
 }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 1/5] ARM: OMAP: USB: HOST TLL platform driver

2012-07-02 Thread Keshava Munegowda
The platform driver for the TLL component of the OMAP USB host controller
is implemented. Depending on the TLL hardware revision , the TLL channels
are configured. The USB HS core driver uses this driver through exported
APIs from the TLL platform driver.
usb_tll_enable and usb_tll_disble are the exported APIs of the USB TLL
platform driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |6 +
 drivers/mfd/Kconfig   |2 +-
 drivers/mfd/Makefile  |2 +-
 drivers/mfd/omap-usb-tll.c|  471 +
 4 files changed, 479 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mfd/omap-usb-tll.c

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 762eeb0..b8a9d5e 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -62,6 +62,10 @@ struct usbhs_omap_platform_data {
struct ehci_hcd_omap_platform_data  *ehci_data;
struct ohci_hcd_omap_platform_data  *ohci_data;
 };
+
+struct usbtll_omap_platform_data {
+   enum usbhs_omap_port_mode   port_mode[OMAP3_HS_USB_PORTS];
+};
 /*-*/
 
 #define OMAP1_OTG_BASE 0xfffb0400
@@ -100,6 +104,8 @@ enum musb_interface{MUSB_INTERFACE_ULPI, 
MUSB_INTERFACE_UTMI};
 extern void usb_musb_init(struct omap_musb_board_data *board_data);
 
 extern void usbhs_init(const struct usbhs_omap_board_data *pdata);
+extern int omap_tll_enable(void);
+extern int omap_tll_disable(void);
 
 extern int omap4430_phy_power(struct device *dev, int ID, int on);
 extern int omap4430_phy_set_clk(struct device *dev, int on);
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index e129c82..74abd60 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -823,7 +823,7 @@ config MFD_WL1273_CORE
  audio codec.
 
 config MFD_OMAP_USB_HOST
-   bool "Support OMAP USBHS core driver"
+   bool "Support OMAP USBHS core and TLL driver"
depends on USB_EHCI_HCD_OMAP || USB_OHCI_HCD_OMAP3
default y
help
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 75f6ed6..6de605d 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -107,7 +107,7 @@ obj-$(CONFIG_MFD_TPS6586X)  += tps6586x.o
 obj-$(CONFIG_MFD_VX855)+= vx855.o
 obj-$(CONFIG_MFD_WL1273_CORE)  += wl1273-core.o
 obj-$(CONFIG_MFD_CS5535)   += cs5535-mfd.o
-obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o
+obj-$(CONFIG_MFD_OMAP_USB_HOST)+= omap-usb-host.o omap-usb-tll.o
 obj-$(CONFIG_MFD_PM8921_CORE)  += pm8921-core.o
 obj-$(CONFIG_MFD_PM8XXX_IRQ)   += pm8xxx-irq.o
 obj-$(CONFIG_TPS65911_COMPARATOR)  += tps65911-comparator.o
diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c
new file mode 100644
index 000..4b7757b
--- /dev/null
+++ b/drivers/mfd/omap-usb-tll.c
@@ -0,0 +1,471 @@
+/**
+ * omap-usb-tll.c - The USB TLL driver for OMAP EHCI & OHCI
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
+ * Author: Keshava Munegowda 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define USBTLL_DRIVER_NAME "usbhs_tll"
+
+/* TLL Register Set */
+#defineOMAP_USBTLL_REVISION(0x00)
+#defineOMAP_USBTLL_SYSCONFIG   (0x10)
+#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
+#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
+#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
+#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
+#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
+
+#defineOMAP_USBTLL_SYSSTATUS   (0x14)
+#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
+
+#defineOMAP_USBTLL_IRQSTATUS   (0x18)
+#defineOMAP_USBTLL_IRQENABLE   (0x1C)
+
+#defineOMAP_TLL_SHARED_CONF(0x30)
+#def

[PATCH V3 3/5] ARM: OMAP: USB: Remove TLL specific code

2012-07-02 Thread Keshava Munegowda
The TLL specific code such as channels clocks enable/disable,
initialization functions are removed from the USBHS core
driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 drivers/mfd/omap-usb-host.c |  231 ++-
 1 file changed, 10 insertions(+), 221 deletions(-)

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 41088ec..c1baf20 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -36,63 +36,6 @@
 
 /* OMAP USBHOST Register addresses  */
 
-/* TLL Register Set */
-#defineOMAP_USBTLL_REVISION(0x00)
-#defineOMAP_USBTLL_SYSCONFIG   (0x10)
-#defineOMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
-#defineOMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
-#defineOMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
-#defineOMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
-#defineOMAP_USBTLL_SYSCONFIG_AUTOIDLE  (1 << 0)
-
-#defineOMAP_USBTLL_SYSSTATUS   (0x14)
-#defineOMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
-
-#defineOMAP_USBTLL_IRQSTATUS   (0x18)
-#defineOMAP_USBTLL_IRQENABLE   (0x1C)
-
-#defineOMAP_TLL_SHARED_CONF(0x30)
-#defineOMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
-#defineOMAP_TLL_SHARED_CONF_USB_180D_SDR_EN(1 << 5)
-#defineOMAP_TLL_SHARED_CONF_USB_DIVRATION  (1 << 2)
-#defineOMAP_TLL_SHARED_CONF_FCLK_REQ   (1 << 1)
-#defineOMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
-
-#defineOMAP_TLL_CHANNEL_CONF(num)  (0x040 + 0x004 
* num)
-#define OMAP_TLL_CHANNEL_CONF_FSLSMODE_SHIFT   24
-#defineOMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF(1 << 11)
-#defineOMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
-#defineOMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE  (1 << 9)
-#defineOMAP_TLL_CHANNEL_CONF_ULPIDDRMODE   (1 << 8)
-#define OMAP_TLL_CHANNEL_CONF_CHANMODE_FSLS(1 << 1)
-#defineOMAP_TLL_CHANNEL_CONF_CHANEN(1 << 0)
-
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DAT_SE0 0x0
-#define OMAP_TLL_FSLSMODE_6PIN_PHY_DP_DM   0x1
-#define OMAP_TLL_FSLSMODE_3PIN_PHY 0x2
-#define OMAP_TLL_FSLSMODE_4PIN_PHY 0x3
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DAT_SE0 0x4
-#define OMAP_TLL_FSLSMODE_6PIN_TLL_DP_DM   0x5
-#define OMAP_TLL_FSLSMODE_3PIN_TLL 0x6
-#define OMAP_TLL_FSLSMODE_4PIN_TLL 0x7
-#define OMAP_TLL_FSLSMODE_2PIN_TLL_DAT_SE0 0xA
-#define OMAP_TLL_FSLSMODE_2PIN_DAT_DP_DM   0xB
-
-#defineOMAP_TLL_ULPI_FUNCTION_CTRL(num)(0x804 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INTERFACE_CTRL(num)   (0x807 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_RISE(num)  (0x80D + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_EN_FALL(num)  (0x810 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_STATUS(num)   (0x813 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_INT_LATCH(num)(0x814 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_DEBUG(num)(0x815 + 0x100 
* num)
-#defineOMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 
* num)
-
-#define OMAP_TLL_CHANNEL_COUNT 3
-#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 0)
-#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 1)
-#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 2)
-
 /* UHH Register Set */
 #defineOMAP_UHH_REVISION   (0x00)
 #defineOMAP_UHH_SYSCONFIG  (0x10)
@@ -132,8 +75,6 @@
 #define OMAP4_P2_MODE_TLL  (1 << 18)
 #define OMAP4_P2_MODE_HSIC (3 << 18)
 
-#define OMAP_REV2_TLL_CHANNEL_COUNT2
-
 #defineOMAP_UHH_DEBUG_CSR  (0x44)
 
 /* Values of UHH_REVISION - Note: these are not given in the TRM */
@@ -153,15 +94,12 @@ struct usbhs_hcd_omap {
struct clk  *xclk60mhsp2_ck;
struct clk  *utmi_p1_fck;
struct clk  *usbhost_p1_fck;
-   struct clk  *usbtll_p1_fck;
struct clk   

[PATCH V3 4/5] ARM: OMAP: USB: Invoke the TLL driver from USB HS core driver

2012-07-02 Thread Keshava Munegowda
The usbhs driver invokes the enable/disable APIs of the
usb tll driver in the runtime resume/suspend callbacks
of the runtime get sync and put sync of the usbhs driver.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/mfd/omap-usb-host.c   |7 +--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index b8a9d5e..8eac78c 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -4,6 +4,7 @@
 #define__ASM_ARCH_OMAP_USB_H
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index c1baf20..23cec57 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -21,7 +21,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -287,6 +286,7 @@ static int usbhs_runtime_resume(struct device *dev)
return  -ENODEV;
}
 
+   omap_tll_enable();
spin_lock_irqsave(&omap->lock, flags);
 
if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
@@ -332,6 +332,7 @@ static int usbhs_runtime_suspend(struct device *dev)
clk_disable(omap->ehci_logic_fck);
 
spin_unlock_irqrestore(&omap->lock, flags);
+   omap_tll_disable();
 
return 0;
 }
@@ -699,8 +700,10 @@ static int __init omap_usbhs_drvinit(void)
  * init before ehci and ohci drivers;
  * The usbhs core driver should be initialized much before
  * the omap ehci and ohci probe functions are called.
+ * This usbhs core driver should be initialized after
+ * usb tll driver
  */
-fs_initcall(omap_usbhs_drvinit);
+fs_initcall_sync(omap_usbhs_drvinit);
 
 static void __exit omap_usbhs_drvexit(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH V3 5/5] ARM: OMAP: change the USB TLL clocks device name

2012-07-02 Thread Keshava Munegowda
The platform device name for the functional, interface and
channel clocks of the TLL module is changed from usbhs device
to usb tll platform device name.

Signed-off-by: Keshava Munegowda 
Reviewed-by: Partha Basak 
---
 arch/arm/mach-omap2/clock3xxx_data.c |8 
 arch/arm/mach-omap2/clock44xx_data.c |4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/clock3xxx_data.c 
b/arch/arm/mach-omap2/clock3xxx_data.c
index 1efdec2..d5a0193 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3306,7 +3306,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "cpefuse_fck",  &cpefuse_fck,   CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "ts_fck",   &ts_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_fck",   &usbtll_fck,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap-mcbsp.1", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK("omap-mcbsp.5", "prcm_fck", &core_96m_fck,  CK_3XXX),
CLK(NULL,   "core_96m_fck", &core_96m_fck,  CK_3XXX),
@@ -3342,7 +3342,7 @@ static struct omap_clk omap3xxx_clks[] = {
CLK(NULL,   "pka_ick",  &pka_ick,   CK_34XX | CK_36XX),
CLK(NULL,   "core_l4_ick",  &core_l4_ick,   CK_3XXX),
CLK(NULL,   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
-   CLK("usbhs_omap",   "usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
+   CLK("usbhs_tll","usbtll_ick",   &usbtll_ick,CK_3430ES2PLUS 
| CK_AM35XX | CK_36XX),
CLK("omap_hsmmc.2", "ick",  &mmchs3_ick,CK_3430ES2PLUS | 
CK_AM35XX | CK_36XX),
CLK(NULL,   "icr_ick",  &icr_ick,   CK_34XX | CK_36XX),
CLK("omap-aes", "ick",  &aes2_ick,  CK_34XX | CK_36XX),
@@ -3397,9 +3397,9 @@ static struct omap_clk omap3xxx_clks[] = {
CLK("usbhs_omap",   "xclk60mhsp2_ck",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p1_clk",  &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "usb_host_hs_utmi_p2_clk",  &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
-   CLK("usbhs_omap",   "usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK("usbhs_omap",   "init_60m_fclk",&dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch0_clk",   &dummy_ck,  
CK_3XXX),
+   CLK("usbhs_tll","usb_tll_hs_usb_ch1_clk",   &dummy_ck,  
CK_3XXX),
CLK(NULL,   "usim_fck", &usim_fck,  CK_3430ES2PLUS | 
CK_36XX),
CLK(NULL,   "gpt1_fck", &gpt1_fck,  CK_3XXX),
CLK(NULL,   "wkup_32k_fck", &wkup_32k_fck,  CK_3XXX),
diff --git a/arch/arm/mach-omap2/clock44xx_data.c 
b/arch/arm/mach-omap2/clock44xx_data.c
index e2b701e..3c60ab7 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -,7 +,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "usb_tll_hs_usb_ch2_clk",   
&usb_tll_hs_usb_ch2_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch0_clk",   
&usb_tll_hs_usb_ch0_clk,CK_443X),
CLK(NULL,   "usb_tll_hs_usb_ch1_clk",   
&usb_tll_hs_usb_ch1_clk,CK_443X),
-   CLK("usbhs_omap",   "usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
+   CLK("usbhs_tll","usbtll_ick",   &usb_tll_hs_ick,
CK_443X),
CLK(NULL,   "usim_ck",  &usim_ck,   
CK_443X),
CLK(NULL,   "usim_fclk",&usim_fclk, 
CK_443X),
CLK(NULL,   "usim_fck", &usim_fck,  
CK_443X),
@@ -3383,7 +3383,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL,   "uart3_ick",&dummy_ck,  
CK_443X),
CLK(NULL,   "uart4_ick", 

[PATCH] OMAP: config : disable the usb host configuration in omap2plus_defconfig

2012-07-06 Thread Keshava Munegowda
The usb host is disabled in the omap2 build; This is because
usb host is causing the retention to break in cpu idle.

Signed-off-by: Keshava Munegowda 
---
 arch/arm/configs/omap2plus_defconfig |   11 ---
 1 file changed, 11 deletions(-)

diff --git a/arch/arm/configs/omap2plus_defconfig 
b/arch/arm/configs/omap2plus_defconfig
index 9854ff4..7b32da6 100644
--- a/arch/arm/configs/omap2plus_defconfig
+++ b/arch/arm/configs/omap2plus_defconfig
@@ -170,17 +170,6 @@ CONFIG_SND_USB_AUDIO=m
 CONFIG_SND_SOC=m
 CONFIG_SND_OMAP_SOC=m
 CONFIG_SND_OMAP_SOC_OMAP3_PANDORA=m
-CONFIG_USB=y
-CONFIG_USB_DEBUG=y
-CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
-CONFIG_USB_DEVICEFS=y
-CONFIG_USB_SUSPEND=y
-CONFIG_USB_MON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_WDM=y
-CONFIG_USB_STORAGE=y
-CONFIG_USB_LIBUSUAL=y
-CONFIG_USB_TEST=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DEBUG=y
 CONFIG_USB_GADGET_DEBUG_FILES=y
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   >