OMAP5 uEVM USB eHCI patch set
Subsystems (4)
This patch set is for the OMAP5 uEVM for the USB eHCI host. This patch set will enable the LAN9730 ethernet IC and the USB3503 usb hub.
PATCH v3 1/7 omap5: uevm: Change the board name to correct name
Change the board name for the sys info to
5432 uEVM
---
v3 - No change - http://patchwork.ozlabs.org/patch/258226/
board/ti/omap5_uevm/evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/ti/omap5_uevm/evm.c +1 -1
@@ -32,7 +32,7 @@DECLARE_GLOBAL_DATA_PTR ;const struct omap_sysinfo sysinfo = { -"Board: OMAP5430 EVM\n" +"Board: OMAP5432 uEVM\n" };/**
Signature · 1 line
1.7.9.5
PATCH v3 1/7 omap5: uevm: Change the board name to correct name
Dear Dan Murphy,
Quoted 4 lines
Change the board name for the sys info to
5432 uEVMSigned-off-by Dan Murphy <[email protected]>
Quoted 11 lines
---
v3 - No change - http://patchwork.ozlabs.org/patch/258226/board/ti/omap5_uevm/evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/ti/omap5_uevm/evm.c +0
-0
board/ti/omap5_uevm/evm.c line 38
Quoted 8 lines
board/ti/omap5_uevm/evm.c +1
-1@@ -32,7 +32,7 @@DECLARE_GLOBAL_DATA_PTR ;const struct omap_sysinfo sysinfo = { -"Board: OMAP5430 EVM\n" +"Board: OMAP5432 uEVM\n" };/**
Best regards,
Marek Vasut
PATCH v3 2/7 ARM: OMAP5: USB: Add OMAP5 common USB EHCI information
In reply to Dan Murphy* Enable the OMAP5 EHCI host clocks
* Add OMAP5 EHCI register definitions
* Add OMAP5 ES2 host revision
---
v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/
arch/arm/cpu/armv7/omap5/hw_data.c | 17 ++++++++++++ arch/arm/include/asm/arch-omap5/clock.h | 6 +++++ arch/arm/include/asm/arch-omap5/ehci.h | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/ehci-omap.h | 1 + drivers/usb/host/ehci-omap.c | 2 +- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-omap5/ehci.h
arch/arm/cpu/armv7/omap5/hw_data.c +17 -0
@@ -414,6 +414,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_clksel_usb_60mhz, + (*prcm)->cm_l3init_hsusbtll_clkctrl, +#endif 0 };
@@ -425,6 +429,9 @@ void enable_basic_clocks(void) (*prcm)->cm_wkup_wdtimer2_clkctrl, (*prcm)->cm_l4per_uart3_clkctrl, (*prcm)->cm_l4per_i2c1_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_l3init_hsusbhost_clkctrl, +#endif 0 };
@@ -448,6 +455,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_wkup_gptimer1_clkctrl,GPTIMER1_CLKCTRL_CLKSEL_MASK ); +#ifdef CONFIG_USB_EHCI +/* Enable port 2 and 3 clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbhost_clkctrl, +USB_HOST_HS_CLKCTRL_MASK ); + +/* Enable all 3 usb host ports tll clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbtll_clkctrl, +USB_TLL_HS_CLKCTRL_MASK ); +#endif + do_enable_clocks(clk_domains_essential, clk_modules_hw_auto_essential, clk_modules_explicit_en_essential,
arch/arm/include/asm/arch-omap5/clock.h +6 -0
@@ -165,6 +165,12 @@/* CM_L3INIT_USBPHY_CLKCTRL */ #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */ +#define USB_HOST_HS_CLKCTRL_MASK 0x56C0 + +/* 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 (3 << 24)
arch/arm/include/asm/arch-omap5/ehci.h new file +43 -0
43 lines not on this page · raw message
arch/arm/include/asm/ehci-omap.h +1 -0
@@ -42,6 +42,7 @@ enum usbhs_omap_port_mode {/* Values of UHH_REVISION - Note: these are not given in the TRM */ #define OMAP_USBHS_REV1 0x00000010/* OMAP3 */ #define OMAP_USBHS_REV2 0x50700100/* OMAP4 */ +#define OMAP_USBHS_REV2_1 0x50700101/* OMAP5 */ /* UHH Register Set */ #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)
drivers/usb/host/ehci-omap.c +1 -1
@@ -208,7 +208,7 @@ int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,clrbits_le32 (®,OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS ); else setbits_le32(®, OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS); - }else if (rev ==OMAP_USBHS_REV2 ) { + }else if ((rev ==OMAP_USBHS_REV2 ) || (rev ==OMAP_USBHS_REV2_1 )) {clrsetbits_le32 (®, (OMAP_P1_MODE_CLEAR |OMAP_P2_MODE_CLEAR ),OMAP4_UHH_HOSTCONFIG_APP_START_CLK );
Signature · 1 line
1.7.9.5
PATCH v3 2/7 ARM: OMAP5: USB: Add OMAP5 common USB EHCI information
Dan,
Quoted 42 lines · Dan Murphy
* Enable the OMAP5 EHCI host clocks
* Add OMAP5 EHCI register definitions
* Add OMAP5 ES2 host revisionSigned-off-by Dan Murphy <[email protected]>---
v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/arch/arm/cpu/armv7/omap5/hw_data.c | 17 ++++++++++++ arch/arm/include/asm/arch-omap5/clock.h | 6 +++++ arch/arm/include/asm/arch-omap5/ehci.h | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/ehci-omap.h | 1 + drivers/usb/host/ehci-omap.c | 2 +- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-omap5/ehci.harch/arm/cpu/armv7/omap5/hw_data.c +7
-0@@ -414,6 +414,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_clksel_usb_60mhz, + (*prcm)->cm_l3init_hsusbtll_clkctrl, +#endif 0 };@@ -425,6 +429,9 @@ void enable_basic_clocks(void) (*prcm)->cm_wkup_wdtimer2_clkctrl, (*prcm)->cm_l4per_uart3_clkctrl, (*prcm)->cm_l4per_i2c1_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_l3init_hsusbhost_clkctrl, +#endif 0 };
arch/arm/cpu/armv7/omap5/hw_data.c void enable_basic_clocks(void) · line 461
Quoted 7 lines
arch/arm/cpu/armv7/omap5/hw_data.c +4
-0@@ -448,6 +455,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_wkup_gptimer1_clkctrl,GPTIMER1_CLKCTRL_CLKSEL_MASK ); +#ifdef CONFIG_USB_EHCI +/* Enable port 2 and 3 clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbhost_clkctrl, +USB_HOST_HS_CLKCTRL_MASK );
For consistency, maybe you should enable all 3 port clocks since you are enabling all 3 TLL clocks below?
Quoted 92 lines
arch/arm/cpu/armv7/omap5/hw_data.c +6
-0+ +/* Enable all 3 usb host ports tll clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbtll_clkctrl, +USB_TLL_HS_CLKCTRL_MASK ); +#endif + do_enable_clocks(clk_domains_essential, clk_modules_hw_auto_essential, clk_modules_explicit_en_essential,arch/arm/include/asm/arch-omap5/clock.h +6
-0@@ -165,6 +165,12 @@/* CM_L3INIT_USBPHY_CLKCTRL */ #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */ +#define USB_HOST_HS_CLKCTRL_MASK 0x56C0 + +/* 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 (3 << 24)arch/arm/include/asm/arch-omap5/ehci.h new file +43
-0@@ -0,0 +1,43 @@ +/* +* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com* +* Author: Govindraj R <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#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 */ arch/arm/include/asm/ehci-omap.h +1
-0@@ -42,6 +42,7 @@ enum usbhs_omap_port_mode {/* Values of UHH_REVISION - Note: these are not given in the TRM */ #define OMAP_USBHS_REV1 0x00000010/* OMAP3 */ #define OMAP_USBHS_REV2 0x50700100/* OMAP4 */ +#define OMAP_USBHS_REV2_1 0x50700101/* OMAP5 */ /* UHH Register Set */ #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)drivers/usb/host/ehci-omap.c +0
-0
drivers/usb/host/ehci-omap.c int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata, · line 214
Quoted 8 lines
drivers/usb/host/ehci-omap.c +1
-1@@ -208,7 +208,7 @@ int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,clrbits_le32 (®,OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS ); else setbits_le32(®, OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS); - }else if (rev ==OMAP_USBHS_REV2 ) { + }else if ((rev ==OMAP_USBHS_REV2 ) || (rev ==OMAP_USBHS_REV2_1 )) {clrsetbits_le32 (®, (OMAP_P1_MODE_CLEAR |OMAP_P2_MODE_CLEAR ),OMAP4_UHH_HOSTCONFIG_APP_START_CLK );
As OMAP5 has 3 ports, are we missing OMAP_P3_MODE_CLEAR here? Better to put REV2_1 in a separate else {}?
Also, REV2 is for OMAP4 which has only 2 ports so I don't understand why this is in the code for REV2.
if (is_ehci_hsic_mode(usbhs_pdata->port_mode[2]))
setbits_le32(®, OMAP_P3_MODE_HSIC);That could be moved into REV2_1 as well.
A little below in the file I see this.
omap_ehci_phy_reset(0, 10);
This function takes care only of PHY1 and PHY2 but not PHY3. Could this be the reason why the PORT3 (i.e. LAN chip) is not working?
Alternatively that function should be called there only be called if we are in PHY mode. i.e. is_ehci_phy_mode(), as it seems to release the PHY reset.
cheers,
-roger
cheers,
-roger
PATCH v3 2/7 ARM: OMAP5: USB: Add OMAP5 common USB EHCI information
Dear Roger
Quoted 48 lines · Roger Quadros
Dan,
Quoted 45 lines · Dan Murphy
* Enable the OMAP5 EHCI host clocks
* Add OMAP5 EHCI register definitions
* Add OMAP5 ES2 host revisionSigned-off-by Dan Murphy <[email protected]>---
v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/arch/arm/cpu/armv7/omap5/hw_data.c | 17 ++++++++++++ arch/arm/include/asm/arch-omap5/clock.h | 6 +++++ arch/arm/include/asm/arch-omap5/ehci.h | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/ehci-omap.h | 1 + drivers/usb/host/ehci-omap.c | 2 +- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-omap5/ehci.harch/arm/cpu/armv7/omap5/hw_data.c +7
-0@@ -414,6 +414,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_clksel_usb_60mhz, + (*prcm)->cm_l3init_hsusbtll_clkctrl, +#endif 0 };@@ -425,6 +429,9 @@ void enable_basic_clocks(void) (*prcm)->cm_wkup_wdtimer2_clkctrl, (*prcm)->cm_l4per_uart3_clkctrl, (*prcm)->cm_l4per_i2c1_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_l3init_hsusbhost_clkctrl, +#endif 0 };@@ -448,6 +455,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_wkup_gptimer1_clkctrl,GPTIMER1_CLKCTRL_CLKSEL_MASK );
Quoted 6 lines
arch/arm/cpu/armv7/omap5/hw_data.c void enable_basic_clocks(void) · line 461
Quoted 4 lines
arch/arm/cpu/armv7/omap5/hw_data.c +4
-0+#ifdef CONFIG_USB_EHCI +/* Enable port 2 and 3 clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbhost_clkctrl, +USB_HOST_HS_CLKCTRL_MASK );For consistency, maybe you should enable all 3 port clocks since you are enabling all 3 TLL clocks below?
So I thought about this we should enable all 3 clocks since it is a common file and disable the unused clocks in the board file.
Or we should enable the specific port clocks during ehci_hcd_init in the board file only since it is a board implementation detail.
Thoughts?
Quoted 103 lines
Quoted 92 lines
arch/arm/cpu/armv7/omap5/hw_data.c +6
-0+ +/* Enable all 3 usb host ports tll clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbtll_clkctrl, +USB_TLL_HS_CLKCTRL_MASK ); +#endif + do_enable_clocks(clk_domains_essential, clk_modules_hw_auto_essential, clk_modules_explicit_en_essential,arch/arm/include/asm/arch-omap5/clock.h +6
-0@@ -165,6 +165,12 @@/* CM_L3INIT_USBPHY_CLKCTRL */ #define USBPHY_CLKCTRL_OPTFCLKEN_PHY_48M_MASK 8 +/* CM_L3INIT_USB_HOST_HS_CLKCTRL */ +#define USB_HOST_HS_CLKCTRL_MASK 0x56C0 + +/* 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 (3 << 24)arch/arm/include/asm/arch-omap5/ehci.h new file +43
-0@@ -0,0 +1,43 @@ +/* +* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com* +* Author: Govindraj R <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#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 */ arch/arm/include/asm/ehci-omap.h +1
-0@@ -42,6 +42,7 @@ enum usbhs_omap_port_mode {/* Values of UHH_REVISION - Note: these are not given in the TRM */ #define OMAP_USBHS_REV1 0x00000010/* OMAP3 */ #define OMAP_USBHS_REV2 0x50700100/* OMAP4 */ +#define OMAP_USBHS_REV2_1 0x50700101/* OMAP5 */ /* UHH Register Set */ #define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)drivers/usb/host/ehci-omap.c +0
-0drivers/usb/host/ehci-omap.c int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata, · line 214
Quoted 8 lines
drivers/usb/host/ehci-omap.c +1
-1@@ -208,7 +208,7 @@ int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,clrbits_le32 (®,OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS ); else setbits_le32(®, OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS); - }else if (rev ==OMAP_USBHS_REV2 ) { + }else if ((rev ==OMAP_USBHS_REV2 ) || (rev ==OMAP_USBHS_REV2_1 )) {clrsetbits_le32 (®, (OMAP_P1_MODE_CLEAR |OMAP_P2_MODE_CLEAR ),OMAP4_UHH_HOSTCONFIG_APP_START_CLK );As OMAP5 has 3 ports, are we missing
OMAP_P3_MODE_CLEARhere? Better to putREV2_1in a separate else {}?
Quoted 6 lines
Also, REV2 is for OMAP4 which has only 2 ports so I don't understand why this is in the code for REV2.
if (is_ehci_hsic_mode(usbhs_pdata->port_mode[2])) setbits_le32(®, OMAP_P3_MODE_HSIC);That could be moved into
REV2_1as well.
OK will add else case for rev 2.1.
Quoted 6 lines
A little below in the file I see this.
omap_ehci_phy_reset(0, 10);This function takes care only of PHY1 and PHY2 but not PHY3. Could this be the reason why the PORT3 (i.e. LAN chip) is not working?
No that is not the reason. The GPIO would be reset based on PHY1 value in this patch series. But I should technically add the PHY3 GPIO as well.
Quoted 8 lines
Alternatively that function should be called there only be called if we are in PHY mode. i.e.
is_ehci_phy_mode(), as it seems to release the PHY reset.cheers,
-rogercheers,
-roger
Signature · 2 lines
------------------ Dan Murphy
PATCH v3 2/7 ARM: OMAP5: USB: Add OMAP5 common USB EHCI information
Quoted 57 lines · Dan Murphy
Dear Roger
Quoted 48 lines · Roger Quadros
Dan,
Quoted 45 lines · Dan Murphy
* Enable the OMAP5 EHCI host clocks
* Add OMAP5 EHCI register definitions
* Add OMAP5 ES2 host revisionSigned-off-by Dan Murphy <[email protected]>---
v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/arch/arm/cpu/armv7/omap5/hw_data.c | 17 ++++++++++++ arch/arm/include/asm/arch-omap5/clock.h | 6 +++++ arch/arm/include/asm/arch-omap5/ehci.h | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/ehci-omap.h | 1 + drivers/usb/host/ehci-omap.c | 2 +- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-omap5/ehci.harch/arm/cpu/armv7/omap5/hw_data.c +7
-0@@ -414,6 +414,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_clksel_usb_60mhz, + (*prcm)->cm_l3init_hsusbtll_clkctrl, +#endif 0 };@@ -425,6 +429,9 @@ void enable_basic_clocks(void) (*prcm)->cm_wkup_wdtimer2_clkctrl, (*prcm)->cm_l4per_uart3_clkctrl, (*prcm)->cm_l4per_i2c1_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_l3init_hsusbhost_clkctrl, +#endif 0 };@@ -448,6 +455,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_wkup_gptimer1_clkctrl,GPTIMER1_CLKCTRL_CLKSEL_MASK );Quoted 6 lines
arch/arm/cpu/armv7/omap5/hw_data.c void enable_basic_clocks(void) · line 461
Quoted 4 lines
arch/arm/cpu/armv7/omap5/hw_data.c +4
-0+#ifdef CONFIG_USB_EHCI +/* Enable port 2 and 3 clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbhost_clkctrl, +USB_HOST_HS_CLKCTRL_MASK );For consistency, maybe you should enable all 3 port clocks since you are enabling all 3 TLL clocks below?
Quoted 5 lines
So I thought about this we should enable all 3 clocks since it is a common file and disable the unused clocks in the board file.
Or we should enable the specific port clocks during
ehci_hcd_initin the board file only since it is a board implementation detail.Thoughts?
IMHO enabling the clocks based on board is best.
cheers,
-roger
PATCH v3 2/7 ARM: OMAP5: USB: Add OMAP5 common USB EHCI information
Quoted 58 lines · Roger Quadros
Quoted 57 lines · Dan Murphy
Dear Roger
Quoted 54 lines · Roger Quadros
Dan,
Quoted 42 lines · Dan Murphy
* Enable the OMAP5 EHCI host clocks
* Add OMAP5 EHCI register definitions
* Add OMAP5 ES2 host revisionSigned-off-by Dan Murphy <[email protected]>---
v3 - Updated per comments - http://patchwork.ozlabs.org/patch/258230/arch/arm/cpu/armv7/omap5/hw_data.c | 17 ++++++++++++ arch/arm/include/asm/arch-omap5/clock.h | 6 +++++ arch/arm/include/asm/arch-omap5/ehci.h | 43 +++++++++++++++++++++++++++++++ arch/arm/include/asm/ehci-omap.h | 1 + drivers/usb/host/ehci-omap.c | 2 +- 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-omap5/ehci.harch/arm/cpu/armv7/omap5/hw_data.c +7
-0@@ -414,6 +414,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_clksel_usb_60mhz, + (*prcm)->cm_l3init_hsusbtll_clkctrl, +#endif 0 };@@ -425,6 +429,9 @@ void enable_basic_clocks(void) (*prcm)->cm_wkup_wdtimer2_clkctrl, (*prcm)->cm_l4per_uart3_clkctrl, (*prcm)->cm_l4per_i2c1_clkctrl, +#ifdef CONFIG_USB_EHCI_OMAP + (*prcm)->cm_l3init_hsusbhost_clkctrl, +#endif 0 };arch/arm/cpu/armv7/omap5/hw_data.c void enable_basic_clocks(void) · line 461
Quoted 7 lines
arch/arm/cpu/armv7/omap5/hw_data.c +4
-0@@ -448,6 +455,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_wkup_gptimer1_clkctrl,GPTIMER1_CLKCTRL_CLKSEL_MASK ); +#ifdef CONFIG_USB_EHCI +/* Enable port 2 and 3 clocks*/ +setbits_le32 ((*prcm)->cm_l3init_hsusbhost_clkctrl, +USB_HOST_HS_CLKCTRL_MASK );For consistency, maybe you should enable all 3 port clocks since you are enabling all 3 TLL clocks below?
Quoted 7 lines
Quoted 5 lines
So I thought about this we should enable all 3 clocks since it is a common file and disable the unused clocks in the board file.
Or we should enable the specific port clocks during
ehci_hcd_initin the board file only since it is a board implementation detail.Thoughts?
IMHO enabling the clocks based on board is best.
Agree. We only enable what we need, not enable and then disable as someone will forget to disable (or not know they need to). Even if this means adding a define or 3 for which ports we do have.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130722/a95add0d/attachment.pgp>
PATCH v3 3/7 ARM: OMAP: USB: Fix linker error when ULPI is not defined
In reply to Dan MurphyFix the linker error for missing ulpi_reset when ulpi is not defined in the board config.
---
v3 - No updates - http://patchwork.ozlabs.org/patch/258228/
drivers/usb/host/ehci-omap.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/host/ehci-omap.c +7 -0
@@ -90,6 +90,7 @@ static void omap_usbhs_hsic_init(int port)writel (reg, &usbtll->channel_conf + port); } +#ifdef CONFIG_USB_ULPI static void omap_ehci_soft_phy_reset (int port) {struct ulpi_viewport ulpi_vp;
@@ -99,6 +100,12 @@ static void omap_ehci_soft_phy_reset(int port) ulpi_reset(&ulpi_vp); } +#else +static void omap_ehci_soft_phy_reset (int port) +{ +return ; +} +#endif inline int __board_usb_init (void ) {
Signature · 1 line
1.7.9.5
PATCH v3 3/7 ARM: OMAP: USB: Fix linker error when ULPI is not defined
Dear Dan Murphy,
Quoted 4 lines
Fix the linker error for missing
ulpi_resetwhen ulpi is not defined in the board config.Signed-off-by Dan Murphy <[email protected]>
Quoted 21 lines
---
v3 - No updates - http://patchwork.ozlabs.org/patch/258228/drivers/usb/host/ehci-omap.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/usb/host/ehci-omap.c +1
-0@@ -90,6 +90,7 @@ static void omap_usbhs_hsic_init(int port)writel (reg, &usbtll->channel_conf + port); } +#ifdef CONFIG_USB_ULPI static void omap_ehci_soft_phy_reset (int port) {struct ulpi_viewport ulpi_vp;@@ -99,6 +100,12 @@ static void omap_ehci_soft_phy_reset(int port)ulpi_reset (&ulpi_vp);
drivers/usb/host/ehci-omap.c static void omap_ehci_soft_phy_reset(int port) · line 111
Quoted 10 lines
drivers/usb/host/ehci-omap.c +6
-0} +#else +static void omap_ehci_soft_phy_reset (int port) +{ +return ; +} +#endif inline int __board_usb_init (void ) {
Best regards,
Marek Vasut
PATCH v3 4/7 ARM: OMAP5-uevm: Add USB ehci support for the uEVM
In reply to Dan MurphyAdd 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
---
v3 - Updated per comments and removed reset function - http://patchwork.ozlabs.org/patch/258231/
board/ti/omap5_uevm/evm.c | 41 ++++++++++++++++++++++++++++++++++++++++ board/ti/omap5_uevm/mux_data.h | 4 +++- include/configs/omap5_uevm.h | 22 +++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-)
board/ti/omap5_uevm/evm.c +41 -0
@@ -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 = {
@@ -103,3 +109,38 @@ 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 , +}; + +int ehci_hcd_init (int index,struct ehci_hccr **hccr,struct ehci_hcor **hcor) +{ +int ret; +int auxclk; + + 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 ) { +printf ("Failed to initialize ehci\n" ); +return ret; + } + +return 0 ; +} + +int ehci_hcd_stop (void ) +{ +int ret; + + ret =omap_ehci_hcd_stop (); +return ret; +} +#endif
board/ti/omap5_uevm/mux_data.h +3 -1
@@ -56,7 +56,8 @@ const struct pad_conf_entry core_padconf_array_essential[] = { {USBD0_HS_DP, (IEN | M0)}, /* USBD0_HS_DP */ {USBD0_HS_DM, (IEN | M0)}, /* USBD0_HS_DM */ {USBD0_SS_RX, (IEN | M0)}, /* USBD0_SS_RX */ - + {HSI2_ACWAKE, (PTU | M6)}, /* HSI2_ACWAKE */ + {HSI2_CAFLAG, (PTU | M6)}, /* HSI2_CAFLAG */ }; const struct pad_conf_entry wkup_padconf_array_essential[] = {
@@ -64,6 +65,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 */ };
include/configs/omap5_uevm.h +22 -0
@@ -53,6 +53,28 @@#define CONFIG_PARTITION_UUIDS #define CONFIG_CMD_PART +/* 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_PHY1_RESET_GPIO 79 +#define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 80 + +/* 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"
Signature · 1 line
1.7.9.5
PATCH v3 4/7 ARM: OMAP5-uevm: Add USB ehci support for the uEVM
Quoted 7 lines · Dan Murphy
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 controllerSigned-off-by Dan Murphy <[email protected]>
[sinp]
board/ti/omap5_uevm/evm.c int board_mmc_init(bd_t *bis) · line 132
Quoted 2 lines
board/ti/omap5_uevm/evm.c +2
-0+if (ret <0 ) { +printf ("Failed to initialize ehci\n" );
puts("...") when we don't have format characters, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130722/a56b2a73/attachment.pgp>
PATCH v3 5/7 ARM: OMAP5-uevm: Add USB MAC ethernet address
In reply to Dan MurphySet 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.
---
v3 - new patch
board/ti/omap5_uevm/evm.c | 26 ++++++++++++++++++++++++++ include/configs/omap5_uevm.h | 2 ++ 2 files changed, 28 insertions(+)
board/ti/omap5_uevm/evm.c +26 -0
@@ -33,6 +33,11 @@#include <usb.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> + +#define MAX_DEVICE_MAC 20 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) {int ret;int auxclk; +int val[4 ] = {0 }; +int reg; +char device_mac[MAX_DEVICE_MAC ]; + + reg =DIE_ID_REG_BASE +DIE_ID_REG_OFFSET ; + + val[0 ] =readl (reg); + val[1 ] =readl (reg +0x8 ); + val[2 ] =readl (reg +0xC ); + val[3 ] =readl (reg +0x10 ); + +/* create a fake MAC address from the processor ID code. +* first byte is 0x02 to signify locally administered. +*/ +snprintf (device_mac,MAX_DEVICE_MAC ,"%02X:%02X:%02X:%02X:%02X:%02X" , +0x02 , val[3 ] &0xff , val[2 ] &0xff , val[1 ] &0xff , + val[0 ] &0xff , (val[0 ] >>8 &0xff )); + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +setenv ("usbethaddr" , device_mac); +#endif auxclk =readl ((*prcm)->scrm_auxclk1);/* Request auxilary clock */
include/configs/omap5_uevm.h +2 -0
@@ -79,5 +79,7 @@#define CONSOLEDEV "ttyO2" +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +#define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296#endif /* __CONFIG_OMAP5_EVM_H */
Signature · 1 line
1.7.9.5
PATCH v3 5/7 ARM: OMAP5-uevm: Add USB MAC ethernet address
Dear Dan Murphy,
Quoted 37 lines
Set the usbethaddr based on the OMAP
DIE_IDregisters which should be unique for each processor.Then set this as the usb ethernet MAC address.
Signed-off-by Dan Murphy <[email protected]>---
v3 - new patchboard/ti/omap5_uevm/evm.c | 26 ++++++++++++++++++++++++++ include/configs/omap5_uevm.h | 2 ++ 2 files changed, 28 insertions(+)board/ti/omap5_uevm/evm.c +9
-0@@ -33,6 +33,11 @@#include <usb.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> + +#define MAX_DEVICE_MAC 20 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 +#endif DECLARE_GLOBAL_DATA_PTR ;@@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) {int ret;int auxclk; +int val[4 ] = {0 }; +int reg; +char device_mac[MAX_DEVICE_MAC ]; +
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, · line 142
Quoted 10 lines
board/ti/omap5_uevm/evm.c +10
-0+ reg =DIE_ID_REG_BASE +DIE_ID_REG_OFFSET ; + + val[0 ] =readl (reg); + val[1 ] =readl (reg +0x8 ); + val[2 ] =readl (reg +0xC ); + val[3 ] =readl (reg +0x10 ); + +/* create a fake MAC address from the processor ID code. +* first byte is 0x02 to signify locally administered. +*/
/*
* valid
* multiline
* comment ... has that leading newline on the top. [1] */
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, · line 144
Quoted 2 lines
board/ti/omap5_uevm/evm.c +2
-0+ snprintf(device_mac, MAX_DEVICE_MAC, "%02X:%02X:%02X:%02X:%02X:%02X", + 0x02, val[3] & 0xff, val[2] & 0xff, val[1] &
0xff,
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) · line 149
Quoted 5 lines
board/ti/omap5_uevm/evm.c +5
-0+ val[0] & 0xff, (val[0] >> 8 & 0xff)); + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +setenv ("usbethaddr" , device_mac); +#endif
Urgh ... this is a big fat NAK. No, just don't do this, please. A kitten will die if you set variables in the code like this. Another one will die for such a config option.
You might work around this problem by setting a different env variable (yet I am still unhappy to see this) and then in the board environment have a command to load the USB mac address from that other variable. But do not enforce the mac address on users.
Quoted 8 lines
board/ti/omap5_uevm/evm.c +0
-0auxclk =readl ((*prcm)->scrm_auxclk1);/* Request auxilary clock */ include/configs/omap5_uevm.h +0
-0
include/configs/omap5_uevm.h line 85
Quoted 7 lines
include/configs/omap5_uevm.h +2
-0@@ -79,5 +79,7 @@#define CONSOLEDEV "ttyO2" +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +#define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296#endif /* __CONFIG_OMAP5_EVM_H */
[1] http://www.denx.de/wiki/U-Boot/CodingStyle
Best regards,
Marek Vasut
PATCH v3 5/7 ARM: OMAP5-uevm: Add USB MAC ethernet address
Quoted 46 lines · Marek Vasut
Dear Dan Murphy,
Quoted 44 lines
Set the usbethaddr based on the OMAP
DIE_IDregisters which should be unique for each processor.Then set this as the usb ethernet MAC address.
Signed-off-by Dan Murphy <[email protected]>---
v3 - new patchboard/ti/omap5_uevm/evm.c | 26 ++++++++++++++++++++++++++ include/configs/omap5_uevm.h | 2 ++ 2 files changed, 28 insertions(+)board/ti/omap5_uevm/evm.c +16
-0@@ -33,6 +33,11 @@#include <usb.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> + +#define MAX_DEVICE_MAC 20 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 +#endif DECLARE_GLOBAL_DATA_PTR ;@@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) {int ret;int auxclk; +int val[4 ] = {0 }; +int reg; +char device_mac[MAX_DEVICE_MAC ]; + + reg =DIE_ID_REG_BASE +DIE_ID_REG_OFFSET ; + + val[0 ] =readl (reg); + val[1 ] =readl (reg +0x8 ); + val[2 ] =readl (reg +0xC ); + val[3 ] =readl (reg +0x10 ); +
Quoted 9 lines
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) · line 142
Quoted 3 lines
board/ti/omap5_uevm/evm.c +3
-0+/* create a fake MAC address from the processor ID code. +* first byte is 0x02 to signify locally administered. +*/ /*
* valid
* multiline
* comment ... has that leading newline on the top. [1] */
Will fix
Quoted 12 lines
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, · line 144
Quoted 2 lines
board/ti/omap5_uevm/evm.c +2
-0+ snprintf(device_mac, MAX_DEVICE_MAC, "%02X:%02X:%02X:%02X:%02X:%02X", + 0x02, val[3] & 0xff, val[2] & 0xff, val[1] &
0xff,board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) · line 149
Quoted 5 lines
board/ti/omap5_uevm/evm.c +5
-0+ val[0] & 0xff, (val[0] >> 8 & 0xff)); + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +setenv ("usbethaddr" , device_mac); +#endif Urgh ... this is a big fat NAK. No, just don't do this, please. A kitten will die if you set variables in the code like this. Another one will die for such a config option.
Quoted 4 lines
You might work around this problem by setting a different env variable (yet I am still unhappy to see this) and then in the board environment have a command to load the USB mac address from that other variable. But do not enforce the mac address on users.
I will modify the usbethaddr only if the user has not already set the variable. This is the way I see it in other code as well.
Is that acceptable?
Quoted 19 lines
Quoted 8 lines
board/ti/omap5_uevm/evm.c +0
-0auxclk =readl ((*prcm)->scrm_auxclk1);/* Request auxilary clock */ include/configs/omap5_uevm.h +0
-0include/configs/omap5_uevm.h line 85
Quoted 7 lines
include/configs/omap5_uevm.h +2
-0@@ -79,5 +79,7 @@#define CONSOLEDEV "ttyO2" +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +#define CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC 16296#endif /* __CONFIG_OMAP5_EVM_H */ [1] http://www.denx.de/wiki/U-Boot/CodingStyle
Best regards,
Marek Vasut
Signature · 2 lines
------------------ Dan Murphy
PATCH v3 5/7 ARM: OMAP5-uevm: Add USB MAC ethernet address
Dear Dan Murphy,
Quoted 86 lines · Marek Vasut
Quoted 58 lines
Dear Dan Murphy,
Quoted 43 lines
Set the usbethaddr based on the OMAP
DIE_IDregisters which should be unique for each processor.Then set this as the usb ethernet MAC address.
Signed-off-by Dan Murphy <[email protected]>---
v3 - new patchboard/ti/omap5_uevm/evm.c | 26 ++++++++++++++++++++++++++ include/configs/omap5_uevm.h | 2 ++ 2 files changed, 28 insertions(+)board/ti/omap5_uevm/evm.c +5
-0@@ -33,6 +33,11 @@#include <usb.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> + +#define MAX_DEVICE_MAC 20 +#define DIE_ID_REG_BASE (OMAP54XX_L4_CORE_BASE + 0x2000) +#define DIE_ID_REG_OFFSET 0x200 +#endif
DECLARE_GLOBAL_DATA_PTR;board/ti/omap5_uevm/evm.c +4
-0@@ -121,6 +126,27 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) {int ret;int auxclk; +int val[4 ] = {0 }; +int reg; +char device_mac[MAX_DEVICE_MAC ]; +board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr · line 144
Quoted 10 lines
board/ti/omap5_uevm/evm.c +10
-0+ reg =DIE_ID_REG_BASE +DIE_ID_REG_OFFSET ; + + val[0 ] =readl (reg); + val[1 ] =readl (reg +0x8 ); + val[2 ] =readl (reg +0xC ); + val[3 ] =readl (reg +0x10 ); + +/* create a fake MAC address from the processor ID code. +* first byte is 0x02 to signify locally administered. +*/ /*
Quoted 4 lines
* valid
* multiline
* comment ... has that leading newline on the top. [1] */Will fix
Quoted 15 lines
board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr · line 146
Quoted 2 lines
board/ti/omap5_uevm/evm.c +2
-0+ snprintf(device_mac, MAX_DEVICE_MAC, "%02X:%02X:%02X:%02X:%02X:%02X", + 0x02, val[3] & 0xff, val[2] & 0xff, val[1] &
0xff,board/ti/omap5_uevm/evm.c int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor) · line 149
Quoted 5 lines
board/ti/omap5_uevm/evm.c +5
-0+ val[0] & 0xff, (val[0] >> 8 & 0xff)); + +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +setenv ("usbethaddr" , device_mac); +#endif Urgh ... this is a big fat NAK. No, just don't do this, please. A kitten will die if you set variables in the code like this. Another one will die for such a config option.
Quoted 4 lines
You might work around this problem by setting a different env variable (yet I am still unhappy to see this) and then in the board environment have a command to load the USB mac address from that other variable. But do not enforce the mac address on users.
Quoted 4 lines
I will modify the usbethaddr only if the user has not already set the variable. This is the way I see it in other code as well.
Is that acceptable?
That'd also make sense, yeah.
Best regards,
Marek Vasut
PATCH v3 6/7 USB: usb-hub: Add a weak function for resetting devices
In reply to Dan MurphyAdd a __weak function that can be overridden to reset devices attached to an ehci devices after the FEAT_POWER has been submitted
---
v3 - Modified location of the weak function - http://patchwork.ozlabs.org/patch/258229/
common/usb_hub.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
common/usb_hub.c +12 -0
@@ -62,6 +62,10 @@static struct usb_hub_device hub_dev[USB_MAX_HUB ];static int usb_hub_index; +__weak void usb_hub_reset_devices (int port) +{ +return ; +}static int usb_get_hub_descriptor (struct usb_device *dev,void *data,int size) {
@@ -444,6 +448,14 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no "); usb_hub_power_on(hub); +/* +* Reset any devices that may be in a bad state when applying +* the power. This is a __weak function. Resettig of the devices +* should occur in the board file of the device. +*/ +for (i =0 ; i < dev->maxchild; i++) +usb_hub_reset_devices (i +1 ); +for (i =0 ; i < dev->maxchild; i++) { ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);unsigned short portstatus, portchange;
Signature · 1 line
1.7.9.5
PATCH v3 6/7 USB: usb-hub: Add a weak function for resetting devices
Dear Dan Murphy,
Quoted 31 lines
Add a
__weakfunction that can be overridden to reset devices attached to an ehci devices after theFEAT_POWERhas been submittedSigned-off-by Dan Murphy <[email protected]>---
v3 - Modified location of the weak function -
http://patchwork.ozlabs.org/patch/258229/common/usb_hub.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)common/usb_hub.c +5
-0@@ -62,6 +62,10 @@static struct usb_hub_device hub_dev[USB_MAX_HUB ];static int usb_hub_index; +__weak void usb_hub_reset_devices (int port) +{ +return ; +}static int usb_get_hub_descriptor (struct usb_device *dev,void *data,int size) {@@ -444,6 +448,14 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no "); usb_hub_power_on(hub); +/*
common/usb_hub.c static int usb_hub_configure(struct usb_device *dev) · line 461
Quoted 10 lines
common/usb_hub.c +7
-0+* Reset any devices that may be in a bad state when applying +* the power. This is a __weak function. Resettig of the devices +* should occur in the board file of the device. +*/ +for (i =0 ; i < dev->maxchild; i++) +usb_hub_reset_devices (i +1 ); +for (i =0 ; i < dev->maxchild; i++) { ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);unsigned short portstatus, portchange;
We hae like 10 reset hooks in the usb code, this means something just isn't right. The device doesn't enumerate, right ? Have you tried waiting a little after releasing the reset and before starting the EHCI ?
Best regards,
Marek Vasut
PATCH v3 6/7 USB: usb-hub: Add a weak function for resetting devices
Marek
Quoted 47 lines · Marek Vasut
Dear Dan Murphy,
Quoted 31 lines
Add a
__weakfunction that can be overridden to reset devices attached to an ehci devices after theFEAT_POWERhas been submittedSigned-off-by Dan Murphy <[email protected]>---
v3 - Modified location of the weak function -
http://patchwork.ozlabs.org/patch/258229/common/usb_hub.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)common/usb_hub.c +5
-0@@ -62,6 +62,10 @@static struct usb_hub_device hub_dev[USB_MAX_HUB ];static int usb_hub_index; +__weak void usb_hub_reset_devices (int port) +{ +return ; +}static int usb_get_hub_descriptor (struct usb_device *dev,void *data,int size) {@@ -444,6 +448,14 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no "); usb_hub_power_on(hub); +/* common/usb_hub.c static int usb_hub_configure(struct usb_device *dev) · line 461
Quoted 10 lines
common/usb_hub.c +7
-0+* Reset any devices that may be in a bad state when applying +* the power. This is a __weak function. Resettig of the devices +* should occur in the board file of the device. +*/ +for (i =0 ; i < dev->maxchild; i++) +usb_hub_reset_devices (i +1 ); +for (i =0 ; i < dev->maxchild; i++) { ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);unsigned short portstatus, portchange;We hae like 10 reset hooks in the usb code, this means something just isn't right. The device doesn't enumerate, right ? Have you tried waiting a little after releasing the reset and before starting the EHCI ?
Quoted 2 lines
Best regards,
Marek Vasut
Sorry for the delay in the response I have been looking heavily into this.
I see we have many reset hooks but they all seem to mean something for different components.
The one I am introducing is for the device itself and made it weak as there are devices that work properly like the 3503.
What I am finding is that I have to apply port power and then hit the device's reset line to get the device to enumerate. Or I can hold the 9730 device in reset throughout the full USB init sequence and upon releasing it after port power the device is detected.
There is no opportunity to release the reset while the USB detection state machine is running
I have contacted the vendor to see if there are any known anomalies with this part if there is then I can document this in the commit.
Dan
Signature · 2 lines
------------------ Dan Murphy
PATCH v3 6/7 USB: usb-hub: Add a weak function for resetting devices
Dear Dan Murphy,
Quoted 76 lines
Marek
Quoted 57 lines · Marek Vasut
Dear Dan Murphy,
Quoted 45 lines
Add a
__weakfunction that can be overridden to reset devices attached to an ehci devices after theFEAT_POWERhas been submittedSigned-off-by Dan Murphy <[email protected]>---
v3 - Modified location of the weak function -
http://patchwork.ozlabs.org/patch/258229/common/usb_hub.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)common/usb_hub.c +4
-0@@ -62,6 +62,10 @@static struct usb_hub_device hub_dev[USB_MAX_HUB ];static int usb_hub_index; +__weak void usb_hub_reset_devices (int port) +{ +return ; +} static int usb_get_hub_descriptor(struct usb_device *dev, void *data,int
size) {
common/usb_hub.c +8
-0@@ -444,6 +448,14 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no ");usb_hub_power_on (hub); +/* +* Reset any devices that may be in a bad state when applying +* the power. This is a __weak function. Resettig of the devices +* should occur in the board file of the device. +*/ +for (i =0 ; i < dev->maxchild; i++) +usb_hub_reset_devices (i +1 ); +common/usb_hub.c static int usb_hub_configure(struct usb_device *dev) · line 461
Quoted 4 lines
common/usb_hub.c +0
-0for (i =0 ; i < dev->maxchild; i++) { ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);unsigned short portstatus, portchange;We hae like 10 reset hooks in the usb code, this means something just isn't right. The device doesn't enumerate, right ? Have you tried waiting a little after releasing the reset and before starting the EHCI ?
Quoted 2 lines
Best regards,
Marek VasutSorry for the delay in the response I have been looking heavily into this.
I see we have many reset hooks but they all seem to mean something for different components.
The one I am introducing is for the device itself and made it weak as there are devices that work properly like the 3503.
What I am finding is that I have to apply port power and then hit the device's reset line to get the device to enumerate. Or I can hold the 9730 device in reset throughout the full USB init sequence and upon releasing it after port power the device is detected.
Quoted 5 lines
There is no opportunity to release the reset while the USB detection state machine is running
I have contacted the vendor to see if there are any known anomalies with this part if there is then I can document this in the commit.
Sigh, ok, that's unfortunate. I keep wondering how come it works in Linux. But anyway, if the manufacturer won't come up with anything, we will apply this stuff.
Best regards,
Marek Vasut
PATCH v3 6/7 USB: usb-hub: Add a weak function for resetting devices
Hi Marek,
Quoted 81 lines · Marek Vasut
Dear Dan Murphy,
Quoted 79 lines
Marek
Quoted 57 lines · Marek Vasut
Dear Dan Murphy,
Quoted 45 lines
Add a
__weakfunction that can be overridden to reset devices attached to an ehci devices after theFEAT_POWERhas been submittedSigned-off-by Dan Murphy <[email protected]>---
v3 - Modified location of the weak function -
http://patchwork.ozlabs.org/patch/258229/common/usb_hub.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)common/usb_hub.c +4
-0@@ -62,6 +62,10 @@static struct usb_hub_device hub_dev[USB_MAX_HUB ];static int usb_hub_index; +__weak void usb_hub_reset_devices (int port) +{ +return ; +} static int usb_get_hub_descriptor(struct usb_device *dev, void *data,int
size) {
common/usb_hub.c +8
-0@@ -444,6 +448,14 @@ static int usb_hub_configure(struct usb_device *dev) "" : "no ");usb_hub_power_on (hub); +/* +* Reset any devices that may be in a bad state when applying +* the power. This is a __weak function. Resettig of the devices +* should occur in the board file of the device. +*/ +for (i =0 ; i < dev->maxchild; i++) +usb_hub_reset_devices (i +1 ); +common/usb_hub.c static int usb_hub_configure(struct usb_device *dev) · line 461
Quoted 4 lines
common/usb_hub.c +0
-0for (i =0 ; i < dev->maxchild; i++) { ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);unsigned short portstatus, portchange;We hae like 10 reset hooks in the usb code, this means something just isn't right. The device doesn't enumerate, right ? Have you tried waiting a little after releasing the reset and before starting the EHCI ?
Quoted 2 lines
Best regards,
Marek VasutSorry for the delay in the response I have been looking heavily into this.
I see we have many reset hooks but they all seem to mean something for different components.
The one I am introducing is for the device itself and made it weak as there are devices that work properly like the 3503.
What I am finding is that I have to apply port power and then hit the device's reset line to get the device to enumerate. Or I can hold the 9730 device in reset throughout the full USB init sequence and upon releasing it after port power the device is detected.
There is no opportunity to release the reset while the USB detection state machine is running
Quoted 7 lines
Quoted 2 lines
I have contacted the vendor to see if there are any known anomalies with this part if there is then I can document this in the commit.
Sigh, ok, that's unfortunate. I keep wondering how come it works in Linux. But anyway, if the manufacturer won't come up with anything, we will apply this stuff.
On Linux, we don't toggle Port power of the root hub once it has been enabled (i.e. EHCI started) and RESET line to 9730 is released.
Dan, mentioned to me that on u-boot we toggle the Port power of the root hub each time a USB session is started. This seems to be causing problems with the 9730 as it seems to need an explicit reset after the Port power bit is toggled, in order to be detected.
cheers,
-roger
PATCH v3 7/7 ARM: OMAP5-uevm: Add usb device reset API
In reply to Dan MurphyAdd the call back to reset the LAN9730 after
the FEAT_POWER has been called.
---
v3 - Added this patch to separate the patch series - http://patchwork.ozlabs.org/patch/258229/
board/ti/omap5_uevm/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
board/ti/omap5_uevm/evm.c +11 -0
@@ -31,6 +31,7 @@#ifdef CONFIG_USB_EHCI #include <usb.h> +#include <asm/gpio.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h>
@@ -169,4 +170,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_PHY1_RESET_GPIO ,0 ); +udelay (10 ); +gpio_direction_output (CONFIG_OMAP_EHCI_PHY1_RESET_GPIO ,1 ); + } +}#endif
Signature · 1 line
1.7.9.5
PATCH v3 7/7 ARM: OMAP5-uevm: Add usb device reset API
Dear Dan Murphy,
Quoted 27 lines
Add the call back to reset the LAN9730 after
theFEAT_POWERhas been called.Signed-off-by Dan Murphy <[email protected]>---
v3 - Added this patch to separate the patch series -
http://patchwork.ozlabs.org/patch/258229/board/ti/omap5_uevm/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)board/ti/omap5_uevm/evm.c +1
-0@@ -31,6 +31,7 @@#ifdef CONFIG_USB_EHCI #include <usb.h> +#include <asm/gpio.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h> @@ -169,4 +170,14 @@ int ehci_hcd_stop(void) ret =omap_ehci_hcd_stop ();return ret; }
board/ti/omap5_uevm/evm.c int ehci_hcd_stop(void) · line 182
Quoted 10 lines
board/ti/omap5_uevm/evm.c +10
-0+ +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_PHY1_RESET_GPIO ,0 ); +udelay (10 ); +gpio_direction_output (CONFIG_OMAP_EHCI_PHY1_RESET_GPIO ,1 ); + } +}
Do you really need a config option for a board-specific GPIO used in a board file?
board/ti/omap5_uevm/evm.c int ehci_hcd_stop(void) · line 183
Quoted 1 line
board/ti/omap5_uevm/evm.c +0
-0#endif
Best regards,
Marek Vasut
PATCH v3 7/7 ARM: OMAP5-uevm: Add usb device reset API
Marek
Quoted 25 lines · Marek Vasut
Dear Dan Murphy,
Quoted 23 lines
Add the call back to reset the LAN9730 after
theFEAT_POWERhas been called.Signed-off-by Dan Murphy <[email protected]>---
v3 - Added this patch to separate the patch series -
http://patchwork.ozlabs.org/patch/258229/board/ti/omap5_uevm/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)board/ti/omap5_uevm/evm.c +1
-0@@ -31,6 +31,7 @@#ifdef CONFIG_USB_EHCI #include <usb.h> +#include <asm/gpio.h> #include <asm/arch/ehci.h> #include <asm/ehci-omap.h>
Quoted 16 lines
Quoted 4 lines
board/ti/omap5_uevm/evm.c +0
-0@@ -169,4 +170,14 @@ int ehci_hcd_stop(void) ret =omap_ehci_hcd_stop ();return ret; }board/ti/omap5_uevm/evm.c int ehci_hcd_stop(void) · line 182
Quoted 10 lines
board/ti/omap5_uevm/evm.c +10
-0+ +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_PHY1_RESET_GPIO ,0 ); +udelay (10 ); +gpio_direction_output (CONFIG_OMAP_EHCI_PHY1_RESET_GPIO ,1 ); + } +}Do you really need a config option for a board-specific GPIO used in a board file?
Sorry I missed addressing this comment.
I am not adding a config option but I am re-using the CONFIG option that already exists. I did not want to define the GPIO number twice.
This CONFIG option is also used in the ehci-omap.c file.
Dan
Quoted 4 lines
board/ti/omap5_uevm/evm.c int ehci_hcd_stop(void) · line 183
Quoted 2 lines
board/ti/omap5_uevm/evm.c +0
-0#endif Best regards,
Marek Vasut
Signature · 2 lines
------------------ Dan Murphy
PATCH v3 7/7 ARM: OMAP5-uevm: Add usb device reset API
Dear Dan Murphy,
Quoted 51 lines
Marek
Quoted 34 lines · Marek Vasut
Dear Dan Murphy,
Quoted 32 lines
Add the call back to reset the LAN9730 after
theFEAT_POWERhas been called.Signed-off-by Dan Murphy <[email protected]>---
v3 - Added this patch to separate the patch series -
http://patchwork.ozlabs.org/patch/258229/board/ti/omap5_uevm/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)board/ti/omap5_uevm/evm.c +1
-0@@ -31,6 +31,7 @@#ifdef CONFIG_USB_EHCI #include <usb.h> +#include <asm/gpio.h> #include <asm/arch/ehci.h> #include <
asm/ehci-omap.h>board/ti/omap5_uevm/evm.c +0
-0@@ -169,4 +170,14 @@ int ehci_hcd_stop(void) ret =omap_ehci_hcd_stop ();return ret; }Quoted 13 lines
board/ti/omap5_uevm/evm.c int ehci_hcd_stop(void) · line 182
Quoted 10 lines
board/ti/omap5_uevm/evm.c +10
-0+ +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_PHY1_RESET_GPIO ,0 ); +udelay (10 ); +gpio_direction_output (CONFIG_OMAP_EHCI_PHY1_RESET_GPIO ,1 ); + } +}Do you really need a config option for a board-specific GPIO used in a board file?
Quoted 6 lines
Sorry I missed addressing this comment.
I am not adding a config option but I am re-using the CONFIG option that already exists. I did not want to define the GPIO number twice.
This CONFIG option is also used in the
ehci-omap.cfile.
OK. I can't say I'm happy about it being called CONFIG_ tho, maybe this can be fixed (in later patch).
Best regards,
Marek Vasut