From 5a7bd38437b3fb170cea3b576975f4e4f929299a Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Thu, 1 Aug 2013 14:05:56 -0500 Subject: omap5: uevm: Change the board name to correct name Change the board name for the sys info to 5432 uEVM Signed-off-by: Dan Murphy Acked-by: Marek Vasut --- board/ti/omap5_uevm/evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board') diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 2c00648470..81209b3153 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR; const struct omap_sysinfo sysinfo = { - "Board: OMAP5430 EVM\n" + "Board: OMAP5432 uEVM\n" }; /** -- cgit From 5e5cfaf9977e5ca563889e0689ff52ae07883745 Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Thu, 1 Aug 2013 14:05:59 -0500 Subject: ARM: OMAP5-uevm: Add USB ehci support for the uEVM 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 --- board/ti/omap5_uevm/evm.c | 60 ++++++++++++++++++++++++++++++++++++++++++ board/ti/omap5_uevm/mux_data.h | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) (limited to 'board') diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 81209b3153..d0c5241cb1 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -14,6 +14,13 @@ #include "mux_data.h" +#ifdef CONFIG_USB_EHCI +#include +#include +#include +#include +#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 diff --git a/board/ti/omap5_uevm/mux_data.h b/board/ti/omap5_uevm/mux_data.h index 612c13e479..31ce363b63 100644 --- a/board/ti/omap5_uevm/mux_data.h +++ b/board/ti/omap5_uevm/mux_data.h @@ -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 */ }; -- cgit From 04025b42dc32b0f6437c24743b1c88b8ec43995a Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Thu, 1 Aug 2013 14:06:00 -0500 Subject: ARM: OMAP5-uevm: Add USB MAC ethernet address Set the usbethaddr based on the OMAP DIE_ID registers which should be unique for each processor. Then set this as the usb ethernet MAC address. Signed-off-by: Dan Murphy --- board/ti/omap5_uevm/evm.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'board') diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index d0c5241cb1..97994b0819 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -19,6 +19,10 @@ #include #include #include + +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 + #endif DECLARE_GLOBAL_DATA_PTR; @@ -144,9 +148,28 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { int ret; int auxclk; + int reg; + uint8_t device_mac[6]; enable_host_clocks(); + if (!getenv("usbethaddr")) { + reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET; + + /* + * create a fake MAC address from the processor ID code. + * first byte is 0x02 to signify locally administered. + */ + device_mac[0] = 0x02; + device_mac[1] = readl(reg + 0x10) & 0xff; + device_mac[2] = readl(reg + 0xC) & 0xff; + device_mac[3] = readl(reg + 0x8) & 0xff; + device_mac[4] = readl(reg) & 0xff; + device_mac[5] = (readl(reg) >> 8) & 0xff; + + eth_setenv_enetaddr("usbethaddr", device_mac); + } + auxclk = readl((*prcm)->scrm_auxclk1); /* Request auxilary clock */ auxclk |= AUXCLK_ENABLE_MASK; -- cgit From 1572eadfbc8e0ec7e6a4b80034eb4c30abe96739 Mon Sep 17 00:00:00 2001 From: Dan Murphy Date: Thu, 1 Aug 2013 14:06:02 -0500 Subject: ARM: OMAP5-uevm: Add usb device reset API Add the call back to reset the LAN9730 after the FEAT_POWER has been called. Signed-off-by: Dan Murphy --- board/ti/omap5_uevm/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'board') diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 97994b0819..47063309e5 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -16,6 +16,7 @@ #ifdef CONFIG_USB_EHCI #include +#include #include #include #include @@ -191,4 +192,14 @@ int ehci_hcd_stop(void) ret = omap_ehci_hcd_stop(); return ret; } + +void usb_hub_reset_devices(int port) +{ + /* The LAN9730 needs to be reset after the port power has been set. */ + if (port == 3) { + gpio_direction_output(CONFIG_OMAP_EHCI_PHY3_RESET_GPIO, 0); + udelay(10); + gpio_direction_output(CONFIG_OMAP_EHCI_PHY3_RESET_GPIO, 1); + } +} #endif -- cgit