Message ID | 1373317175-28926-1-git-send-email-dmurphy@ti.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Hi Dan, On Tuesday 09 July 2013 02:29 AM, Dan Murphy wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > * Enable all usb ehci related clocks. > * Add ehci support to omap5 board file and arch specific > sysc reg mask values. > * Enable config options for usb support and ethernet support > > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > --- > arch/arm/cpu/armv7/omap5/clocks.c | 20 +++++++++++--- > arch/arm/include/asm/arch-omap5/clocks.h | 6 ++++ > arch/arm/include/asm/arch-omap5/ehci.h | 44 ++++++++++++++++++++++++++++++ > board/ti/omap5_evm/evm.c | 33 ++++++++++++++++++++++ > include/configs/omap5_evm5430.h | 23 ++++++++++++++-- > 5 files changed, 120 insertions(+), 6 deletions(-) > create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h Is this based on current mainline? Most of the above files changed are not preset in mainline. > > diff --git a/arch/arm/cpu/armv7/omap5/clocks.c b/arch/arm/cpu/armv7/omap5/clocks.c > index 7e69d2b..f914b60 100644 > --- a/arch/arm/cpu/armv7/omap5/clocks.c > +++ b/arch/arm/cpu/armv7/omap5/clocks.c > @@ -375,6 +375,8 @@ void enable_basic_clocks(void) > &prcm->cm_l4per_gpio4_clkctrl, > &prcm->cm_l4per_gpio5_clkctrl, > &prcm->cm_l4per_gpio6_clkctrl, > + &prcm->cm_clksel_usb_60mhz, > + &prcm->cm_l3init_hsusbtll_clkctrl, > 0 > }; > > @@ -385,6 +387,7 @@ void enable_basic_clocks(void) > &prcm->cm_wkup_wdtimer2_clkctrl, > &prcm->cm_l4per_uart3_clkctrl, > &prcm->cm_l4per_i2c1_clkctrl, > + &prcm->cm_l3init_hsusbhost_clkctrl, > 0 > }; > > @@ -408,10 +411,13 @@ void enable_basic_clocks(void) > setbits_le32(&prcm->cm_wkup_gptimer1_clkctrl, > GPTIMER1_CLKCTRL_CLKSEL_MASK); > > - do_enable_clocks(clk_domains_essential, > - clk_modules_hw_auto_essential, > - clk_modules_explicit_en_essential, > - 1); > + /* Enbale all 3 usb ports enable uhh, utmi and hsic clocks*/ > + setbits_le32(&prcm->cm_l3init_hsusbhost_clkctrl, > + USB_HOST_HS_CLKCTRL_MASK); > + > + /* Enbale all 3 usb host ports tll clocks*/ > + setbits_le32(&prcm->cm_l3init_hsusbtll_clkctrl, > + USB_TLL_HS_CLKCTRL_MASK); Please keep this under a CONFIG_*_USB_* macro. Thanks, Lokesh > > /* Select 384Mhz for GPU as its the POR for ES1.0 */ > setbits_le32(&prcm->cm_sgx_sgx_clkctrl, > @@ -429,6 +435,12 @@ void enable_basic_clocks(void) > setbits_le32(&prcm->cm_coreaon_bandgap_clkctrl, > ((OMAP_TS_CLK_ENABLE_MASK | OMAP_19M_TS_CLK_DIVIDER_MASK) > & ~OMAP_38M_TS_CLK_DIVIDER_MASK)); > + > + do_enable_clocks(clk_domains_essential, > + clk_modules_hw_auto_essential, > + clk_modules_explicit_en_essential, > + 1); > + > } > > void enable_basic_uboot_clocks(void) > diff --git a/arch/arm/include/asm/arch-omap5/clocks.h b/arch/arm/include/asm/arch-omap5/clocks.h > index c944f35..43fc5b8 100644 > --- a/arch/arm/include/asm/arch-omap5/clocks.h > +++ b/arch/arm/include/asm/arch-omap5/clocks.h > @@ -613,6 +613,12 @@ struct omap5_prcm_regs { > /* CM_L3INIT_USBPHY_CLKCTRL */ > #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 > > +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */ > +#define USB_HOST_HS_CLKCTRL_MASK 0xFFC0 > + > +/* CM_L3INIT_USB_TLL_HS_CLKCTRL */ > +#define USB_TLL_HS_CLKCTRL_MASK 0x700 > + > /* CM_MPU_MPU_CLKCTRL */ > #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT 24 > #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK (1 << 24) > diff --git a/arch/arm/include/asm/arch-omap5/ehci.h b/arch/arm/include/asm/arch-omap5/ehci.h > new file mode 100644 > index 0000000..49197f2 > --- /dev/null > +++ b/arch/arm/include/asm/arch-omap5/ehci.h > @@ -0,0 +1,44 @@ > +/* > + * OMAP EHCI port support > + * Based on LINUX KERNEL > + * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c > + * > + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com* > + * Author: Govindraj R <govindraj.raja@ti.com> > + * > + * 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/>. > + */ > + > +#ifndef _EHCI_H > +#define _EHCI_H > + > +#define OMAP_EHCI_BASE (OMAP54XX_L4_CORE_BASE + 0x64C00) > +#define OMAP_UHH_BASE (OMAP54XX_L4_CORE_BASE + 0x64000) > +#define OMAP_USBTLL_BASE (OMAP54XX_L4_CORE_BASE + 0x62000) > + > +/* TLL Register Set */ > +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3) > +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2) > +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1) > +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8) > +#define OMAP_USBTLL_SYSSTATUS_RESETDONE 1 > + > +#define OMAP_UHH_SYSCONFIG_SOFTRESET 1 > +#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE (1 << 2) > +#define OMAP_UHH_SYSCONFIG_NOIDLE (1 << 2) > +#define OMAP_UHH_SYSCONFIG_NOSTDBY (1 << 4) > + > +#define OMAP_UHH_SYSCONFIG_VAL (OMAP_UHH_SYSCONFIG_NOIDLE | \ > + OMAP_UHH_SYSCONFIG_NOSTDBY) > + > +#endif /* _EHCI_H */ > diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c > index 7b426d9..30fcd95 100644 > --- a/board/ti/omap5_evm/evm.c > +++ b/board/ti/omap5_evm/evm.c > @@ -29,6 +29,12 @@ > > #include "mux_data.h" > > +#ifdef CONFIG_USB_EHCI > +#include <usb.h> > +#include <asm/arch/ehci.h> > +#include <asm/ehci-omap.h> > +#endif > + > DECLARE_GLOBAL_DATA_PTR; > > const struct omap_sysinfo sysinfo = { > @@ -107,3 +113,30 @@ int board_mmc_init(bd_t *bis) > } > #endif > #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, > +}; > + > +int ehci_hcd_init(void) > +{ > + int ret; > + > + ret = omap_ehci_hcd_init(&usbhs_bdata); > + if (ret < 0) > + return ret; > + > + return 0; > +} > + > +int ehci_hcd_stop(void) > +{ > + int ret; > + > + ret = omap_ehci_hcd_stop(); > + return ret; > +} > +#endif > diff --git a/include/configs/omap5_evm5430.h b/include/configs/omap5_evm5430.h > index 3145e53..e81c560 100644 > --- a/include/configs/omap5_evm5430.h > +++ b/include/configs/omap5_evm5430.h > @@ -128,6 +128,27 @@ > /* Flash */ > #define CONFIG_SYS_NO_FLASH 1 > > +/* 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_OMAP_EHCI_PHY1_RESET_GPIO 172 > +#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 173 > + > +/* 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 > + > /* commands to include */ > #include <config_cmd_default.h> > > @@ -139,8 +160,6 @@ > #define CONFIG_CMD_SAVEENV > > /* Disabled commands */ > -#undef CONFIG_CMD_NET > -#undef CONFIG_CMD_NFS > #undef CONFIG_CMD_FPGA /* FPGA configuration Support */ > #undef CONFIG_CMD_IMLS /* List all found images */ > >
Lokesh On 07/08/2013 10:21 PM, Lokesh Vutla wrote: > Hi Dan, > On Tuesday 09 July 2013 02:29 AM, Dan Murphy wrote: >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> * Enable all usb ehci related clocks. >> * Add ehci support to omap5 board file and arch specific >> sysc reg mask values. >> * Enable config options for usb support and ethernet support >> >> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> >> --- >> arch/arm/cpu/armv7/omap5/clocks.c | 20 +++++++++++--- >> arch/arm/include/asm/arch-omap5/clocks.h | 6 ++++ >> arch/arm/include/asm/arch-omap5/ehci.h | 44 ++++++++++++++++++++++++++++++ >> board/ti/omap5_evm/evm.c | 33 ++++++++++++++++++++++ >> include/configs/omap5_evm5430.h | 23 ++++++++++++++-- >> 5 files changed, 120 insertions(+), 6 deletions(-) >> create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h > Is this based on current mainline? > Most of the above files changed are not preset in mainline. Honestly I have no idea how this patch got posted. I will remove this patch in v2. > <snip>
Lokesh On 07/08/2013 10:21 PM, Lokesh Vutla wrote: > Hi Dan, > On Tuesday 09 July 2013 02:29 AM, Dan Murphy wrote: >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> * Enable all usb ehci related clocks. >> * Add ehci support to omap5 board file and arch specific >> sysc reg mask values. >> * Enable config options for usb support and ethernet support >> >> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> >> --- >> arch/arm/cpu/armv7/omap5/clocks.c | 20 +++++++++++--- >> arch/arm/include/asm/arch-omap5/clocks.h | 6 ++++ >> arch/arm/include/asm/arch-omap5/ehci.h | 44 ++++++++++++++++++++++++++++++ >> board/ti/omap5_evm/evm.c | 33 ++++++++++++++++++++++ >> include/configs/omap5_evm5430.h | 23 ++++++++++++++-- >> 5 files changed, 120 insertions(+), 6 deletions(-) >> create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h > Is this based on current mainline? > Most of the above files changed are not preset in mainline. Honestly I have no idea how this patch got posted. I will remove this patch in v2. > <snip>
diff --git a/arch/arm/cpu/armv7/omap5/clocks.c b/arch/arm/cpu/armv7/omap5/clocks.c index 7e69d2b..f914b60 100644 --- a/arch/arm/cpu/armv7/omap5/clocks.c +++ b/arch/arm/cpu/armv7/omap5/clocks.c @@ -375,6 +375,8 @@ void enable_basic_clocks(void) &prcm->cm_l4per_gpio4_clkctrl, &prcm->cm_l4per_gpio5_clkctrl, &prcm->cm_l4per_gpio6_clkctrl, + &prcm->cm_clksel_usb_60mhz, + &prcm->cm_l3init_hsusbtll_clkctrl, 0 }; @@ -385,6 +387,7 @@ void enable_basic_clocks(void) &prcm->cm_wkup_wdtimer2_clkctrl, &prcm->cm_l4per_uart3_clkctrl, &prcm->cm_l4per_i2c1_clkctrl, + &prcm->cm_l3init_hsusbhost_clkctrl, 0 }; @@ -408,10 +411,13 @@ void enable_basic_clocks(void) setbits_le32(&prcm->cm_wkup_gptimer1_clkctrl, GPTIMER1_CLKCTRL_CLKSEL_MASK); - do_enable_clocks(clk_domains_essential, - clk_modules_hw_auto_essential, - clk_modules_explicit_en_essential, - 1); + /* Enbale all 3 usb ports enable uhh, utmi and hsic clocks*/ + setbits_le32(&prcm->cm_l3init_hsusbhost_clkctrl, + USB_HOST_HS_CLKCTRL_MASK); + + /* Enbale all 3 usb host ports tll clocks*/ + setbits_le32(&prcm->cm_l3init_hsusbtll_clkctrl, + USB_TLL_HS_CLKCTRL_MASK); /* Select 384Mhz for GPU as its the POR for ES1.0 */ setbits_le32(&prcm->cm_sgx_sgx_clkctrl, @@ -429,6 +435,12 @@ void enable_basic_clocks(void) setbits_le32(&prcm->cm_coreaon_bandgap_clkctrl, ((OMAP_TS_CLK_ENABLE_MASK | OMAP_19M_TS_CLK_DIVIDER_MASK) & ~OMAP_38M_TS_CLK_DIVIDER_MASK)); + + do_enable_clocks(clk_domains_essential, + clk_modules_hw_auto_essential, + clk_modules_explicit_en_essential, + 1); + } void enable_basic_uboot_clocks(void) diff --git a/arch/arm/include/asm/arch-omap5/clocks.h b/arch/arm/include/asm/arch-omap5/clocks.h index c944f35..43fc5b8 100644 --- a/arch/arm/include/asm/arch-omap5/clocks.h +++ b/arch/arm/include/asm/arch-omap5/clocks.h @@ -613,6 +613,12 @@ struct omap5_prcm_regs { /* CM_L3INIT_USBPHY_CLKCTRL */ #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */ +#define USB_HOST_HS_CLKCTRL_MASK 0xFFC0 + +/* CM_L3INIT_USB_TLL_HS_CLKCTRL */ +#define USB_TLL_HS_CLKCTRL_MASK 0x700 + /* CM_MPU_MPU_CLKCTRL */ #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_SHIFT 24 #define MPU_CLKCTRL_CLKSEL_EMIF_DIV_MODE_MASK (1 << 24) diff --git a/arch/arm/include/asm/arch-omap5/ehci.h b/arch/arm/include/asm/arch-omap5/ehci.h new file mode 100644 index 0000000..49197f2 --- /dev/null +++ b/arch/arm/include/asm/arch-omap5/ehci.h @@ -0,0 +1,44 @@ +/* + * OMAP EHCI port support + * Based on LINUX KERNEL + * drivers/usb/host/ehci-omap.c and drivers/mfd/omap-usb-host.c + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com* + * Author: Govindraj R <govindraj.raja@ti.com> + * + * 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/>. + */ + +#ifndef _EHCI_H +#define _EHCI_H + +#define OMAP_EHCI_BASE (OMAP54XX_L4_CORE_BASE + 0x64C00) +#define OMAP_UHH_BASE (OMAP54XX_L4_CORE_BASE + 0x64000) +#define OMAP_USBTLL_BASE (OMAP54XX_L4_CORE_BASE + 0x62000) + +/* TLL Register Set */ +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3) +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2) +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1) +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8) +#define OMAP_USBTLL_SYSSTATUS_RESETDONE 1 + +#define OMAP_UHH_SYSCONFIG_SOFTRESET 1 +#define OMAP_UHH_SYSSTATUS_EHCI_RESETDONE (1 << 2) +#define OMAP_UHH_SYSCONFIG_NOIDLE (1 << 2) +#define OMAP_UHH_SYSCONFIG_NOSTDBY (1 << 4) + +#define OMAP_UHH_SYSCONFIG_VAL (OMAP_UHH_SYSCONFIG_NOIDLE | \ + OMAP_UHH_SYSCONFIG_NOSTDBY) + +#endif /* _EHCI_H */ diff --git a/board/ti/omap5_evm/evm.c b/board/ti/omap5_evm/evm.c index 7b426d9..30fcd95 100644 --- a/board/ti/omap5_evm/evm.c +++ b/board/ti/omap5_evm/evm.c @@ -29,6 +29,12 @@ #include "mux_data.h" +#ifdef CONFIG_USB_EHCI +#include <usb.h> +#include <asm/arch/ehci.h> +#include <asm/ehci-omap.h> +#endif + DECLARE_GLOBAL_DATA_PTR; const struct omap_sysinfo sysinfo = { @@ -107,3 +113,30 @@ int board_mmc_init(bd_t *bis) } #endif #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, +}; + +int ehci_hcd_init(void) +{ + int ret; + + ret = omap_ehci_hcd_init(&usbhs_bdata); + if (ret < 0) + return ret; + + return 0; +} + +int ehci_hcd_stop(void) +{ + int ret; + + ret = omap_ehci_hcd_stop(); + return ret; +} +#endif diff --git a/include/configs/omap5_evm5430.h b/include/configs/omap5_evm5430.h index 3145e53..e81c560 100644 --- a/include/configs/omap5_evm5430.h +++ b/include/configs/omap5_evm5430.h @@ -128,6 +128,27 @@ /* Flash */ #define CONFIG_SYS_NO_FLASH 1 +/* 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_OMAP_EHCI_PHY1_RESET_GPIO 172 +#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 173 + +/* 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 + /* commands to include */ #include <config_cmd_default.h> @@ -139,8 +160,6 @@ #define CONFIG_CMD_SAVEENV /* Disabled commands */ -#undef CONFIG_CMD_NET -#undef CONFIG_CMD_NFS #undef CONFIG_CMD_FPGA /* FPGA configuration Support */ #undef CONFIG_CMD_IMLS /* List all found images */