ARM: OMAP5-uevm: Add USB ehci support for the uEVM
authorDan Murphy <dmurphy@ti.com>
Thu, 1 Aug 2013 19:05:59 +0000 (14:05 -0500)
committerMarek Vasut <marex@denx.de>
Mon, 26 Aug 2013 19:56:31 +0000 (21:56 +0200)
Add the USB ehci support for the OMAP5 uEVM.

Configure the uEVM mux data
Add the flags to build the appropriate modules
Add the usb call backs to initialize the EHCI controller

Signed-off-by: Dan Murphy <dmurphy@ti.com>
board/ti/omap5_uevm/evm.c
board/ti/omap5_uevm/mux_data.h
include/configs/omap5_uevm.h

index 81209b31531df6a24f5b1ebd137bd54f2492d19b..d0c5241cb1a24d42a398b5e0809b55cd6fddb078 100644 (file)
 
 #include "mux_data.h"
 
+#ifdef CONFIG_USB_EHCI
+#include <usb.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/ehci.h>
+#include <asm/ehci-omap.h>
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 const struct omap_sysinfo sysinfo = {
@@ -109,3 +116,56 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 #endif
+
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC,
+       .port_mode[2] = OMAP_EHCI_PORT_MODE_HSIC,
+};
+
+static void enable_host_clocks(void)
+{
+       int hs_clk_ctrl_val = (OPTFCLKEN_HSIC60M_P3_CLK |
+                               OPTFCLKEN_HSIC480M_P3_CLK |
+                               OPTFCLKEN_HSIC60M_P2_CLK |
+                               OPTFCLKEN_HSIC480M_P2_CLK |
+                               OPTFCLKEN_UTMI_P3_CLK | OPTFCLKEN_UTMI_P2_CLK);
+
+       /* Enable port 2 and 3 clocks*/
+       setbits_le32((*prcm)->cm_l3init_hsusbhost_clkctrl, hs_clk_ctrl_val);
+
+       /* Enable port 2 and 3 usb host ports tll clocks*/
+       setbits_le32((*prcm)->cm_l3init_hsusbtll_clkctrl,
+                       (OPTFCLKEN_USB_CH1_CLK_ENABLE | OPTFCLKEN_USB_CH2_CLK_ENABLE));
+}
+
+int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
+{
+       int ret;
+       int auxclk;
+
+       enable_host_clocks();
+
+       auxclk = readl((*prcm)->scrm_auxclk1);
+       /* Request auxilary clock */
+       auxclk |= AUXCLK_ENABLE_MASK;
+       writel(auxclk, (*prcm)->scrm_auxclk1);
+
+       ret = omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
+       if (ret < 0) {
+               puts("Failed to initialize ehci\n");
+               return ret;
+       }
+
+       return 0;
+}
+
+int ehci_hcd_stop(void)
+{
+       int ret;
+
+       ret = omap_ehci_hcd_stop();
+       return ret;
+}
+#endif
index 612c13e4792f2b617df27155ed7cc7f5effad0a5..31ce363b63f14354f3859337426cdae1f427731f 100644 (file)
@@ -42,7 +42,8 @@ const struct pad_conf_entry core_padconf_array_essential[] = {
        {USBD0_SS_RX, (IEN | M0)},      /*  USBD0_SS_RX */
        {I2C5_SCL, (IEN | M0)}, /* I2C5_SCL */
        {I2C5_SDA, (IEN | M0)}, /* I2C5_SDA */
-
+       {HSI2_ACWAKE, (PTU | M6)},    /*  HSI2_ACWAKE */
+       {HSI2_CAFLAG, (PTU | M6)},    /*  HSI2_CAFLAG */
 };
 
 const struct pad_conf_entry wkup_padconf_array_essential[] = {
@@ -50,6 +51,7 @@ const struct pad_conf_entry wkup_padconf_array_essential[] = {
        {SR_PMIC_SCL, (PTU | IEN | M0)}, /* SR_PMIC_SCL */
        {SR_PMIC_SDA, (PTU | IEN | M0)}, /* SR_PMIC_SDA */
        {SYS_32K, (IEN | M0)}, /*  SYS_32K     */
+       {FREF_CLK1_OUT, (PTD | IEN | M0)},    /*  FREF_CLK1_OUT  */
 
 };
 
index d10c2b56f9498ddea6708ff6b63c497364ec9a4b..0bba84bd4372bdb18dca2a63dd67f9b29cc70e2d 100644 (file)
 #define CONFIG_SYS_I2C_TCA642X_BUS_NUM 4
 #define CONFIG_SYS_I2C_TCA642X_ADDR 0x22
 
+/* USB UHH support options */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_HOST
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_OMAP
+#define CONFIG_USB_STORAGE
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
+#define CONFIG_EHCI_HCD_INIT_AFTER_RESET
+
+#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 80
+#define CONFIG_OMAP_EHCI_PHY3_RESET_GPIO 79
+
+/* Enabled commands */
+#define CONFIG_NET_MULTI
+#define CONFIG_CMD_DHCP                /* DHCP Support                 */
+#define CONFIG_CMD_NET         /* bootp, tftpboot, rarpboot    */
+#define CONFIG_CMD_NFS         /* NFS support                  */
+
+/* USB Networking options */
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_SMSC95XX
+
+#define CONFIG_SYS_PROMPT              "OMAP5432 uEVM # "
+
 #define CONSOLEDEV             "ttyO2"
 #define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC       16296