From 43b62393da6dfdd7f503d1b37344463a05ea47b5 Mon Sep 17 00:00:00 2001 From: "Govindraj.R" Date: Mon, 6 Feb 2012 03:55:34 +0000 Subject: ehci-omap: Clean up added ehci-omap.c Clean up added ehci-omap.c and make it generic for re-use across omap-soc having same ehci ip block. Also pass the modes to be configured from board file and configure the ports accordingly. All usb layers are not cache aligned, till then keep cache off for usb ops as ehci will use internally dma for all usb ops. * Add a generic common header ehci-omap.h having common ip block data and reg shifts. * Rename and modify ehci-omap3 to ehci.h retain only conflicting sysc reg shifts remove others and move to common header file. * pass the board data for beagle/panda accordinly to use ehci ports. Acked-by: Igor Grinberg Signed-off-by: Govindraj.R --- board/ti/beagle/beagle.c | 22 ++++++++++++++++++++++ board/ti/panda/panda.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) (limited to 'board/ti') diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index 624ff70..8757876 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -45,6 +45,11 @@ #include "beagle.h" #include +#ifdef CONFIG_USB_EHCI +#include +#include +#endif + #define pr_debug(fmt, args...) debug(fmt, ##args) #define TWL4030_I2C_BUS 0 @@ -449,6 +454,23 @@ void show_boot_progress(int val) if(val == 15) usb_stop(); } + +static struct omap_usbhs_board_data usbhs_bdata = { + .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED +}; + +int ehci_hcd_init(void) +{ + return omap_ehci_hcd_init(&usbhs_bdata); +} + +int ehci_hcd_stop(void) +{ + return omap_ehci_hcd_stop(); +} + #endif /* CONFIG_USB_EHCI */ #ifndef CONFIG_SPL_BUILD diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c index fc8c0b4..ca4b8b3 100644 --- a/board/ti/panda/panda.c +++ b/board/ti/panda/panda.c @@ -26,9 +26,16 @@ #include #include #include +#include #include "panda_mux_data.h" +#ifdef CONFIG_USB_EHCI +#include +#include +#include +#endif + #define PANDA_ULPI_PHY_TYPE_GPIO 182 DECLARE_GLOBAL_DATA_PTR; @@ -177,6 +184,37 @@ int board_mmc_init(bd_t *bis) } #endif +#ifdef CONFIG_USB_EHCI + +static struct omap_usbhs_board_data usbhs_bdata = { + .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, + .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, + .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, +}; + +int ehci_hcd_init(void) +{ + int ret; + unsigned int utmi_clk; + + /* Now we can enable our port clocks */ + utmi_clk = readl((void *)CM_L3INIT_HSUSBHOST_CLKCTRL); + utmi_clk |= HSUSBHOST_CLKCTRL_CLKSEL_UTMI_P1_MASK; + sr32((void *)CM_L3INIT_HSUSBHOST_CLKCTRL, 0, 32, utmi_clk); + + ret = omap_ehci_hcd_init(&usbhs_bdata); + if (ret < 0) + return ret; + + return 0; +} + +int ehci_hcd_stop(void) +{ + return omap_ehci_hcd_stop(); +} +#endif + /* * get_board_rev() - get board revision */ -- cgit v1.1