Skip to contentSkip to conversation

mx5: USB host support for mx51evk and mx53loco

PATCH New Wolfgang Grandegger 6 participants 16 messages Nov 11, 2011 – Nov 24, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover mx5: USB host support for mx51evk and mx53loco

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174 +++++++++++++++++++++++++++++
 include/configs/mx51evk.h                 |   13 ++
 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/5 mx5: add helper functions to enable USB clocks

---
 arch/arm/cpu/armv7/mx5/clock.c           |   72 ++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h    |    5 ++
 arch/arm/include/asm/arch-mx5/crm_regs.h |    3 +
 3 files changed, 80 insertions(+), 0 deletions(-)
arch/arm/cpu/armv7/mx5/clock.c +72 -0
index 0769a64..c8dad17 100644
@@ -50,6 +50,78 @@ struct mxc_pll_reg *mxc_plls[PLL_CLOCKS] = {
 
 struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)MXC_CCM_BASE;
 
+void set_usboh3_clk(void)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->cscmr1) &
+		 ~MXC_CCM_CSCMR1_USBOH3_CLK_SEL_MASK;
+	reg |= 1 << MXC_CCM_CSCMR1_USBOH3_CLK_SEL_OFFSET;
+	writel(reg, &mxc_ccm->cscmr1);
+
+	reg = readl(&mxc_ccm->cscdr1);
+	reg &= ~MXC_CCM_CSCDR1_USBOH3_CLK_PODF_MASK;
+	reg &= ~MXC_CCM_CSCDR1_USBOH3_CLK_PRED_MASK;
+	reg |= 4 << MXC_CCM_CSCDR1_USBOH3_CLK_PRED_OFFSET;
+	reg |= 1 << MXC_CCM_CSCDR1_USBOH3_CLK_PODF_OFFSET;
+
+	writel(reg, &mxc_ccm->cscdr1);
+}
+
+void enable_usboh3_clk(unsigned char enable)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->CCGR2);
+	if (enable)
+		reg |= 1 << MXC_CCM_CCGR2_CG14_OFFSET;
+	else
+		reg &= ~(1 << MXC_CCM_CCGR2_CG14_OFFSET);
+	writel(reg, &mxc_ccm->CCGR2);
+}
+
+void set_usb_phy1_clk(void)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->cscmr1);
+	reg &= ~MXC_CCM_CSCMR1_USB_PHY_CLK_SEL;
+	writel(reg, &mxc_ccm->cscmr1);
+}
+
+void enable_usb_phy1_clk(unsigned char enable)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->CCGR4);
+	if (enable)
+		reg |= 1 << MXC_CCM_CCGR4_CG5_OFFSET;
+	else
+		reg &= ~(1 << MXC_CCM_CCGR4_CG5_OFFSET);
+	writel(reg, &mxc_ccm->CCGR4);
+}
+
+void set_usb_phy2_clk(void)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->cscmr1);
+	reg &= ~MXC_CCM_CSCMR1_USB_PHY_CLK_SEL;
+	writel(reg, &mxc_ccm->cscmr1);
+}
+
+void enable_usb_phy2_clk(unsigned char enable)
+{
+	unsigned int reg;
+
+	reg = readl(&mxc_ccm->CCGR4);
+	if (enable)
+		reg |= 1 << MXC_CCM_CCGR4_CG6_OFFSET;
+	else
+		reg &= ~(1 << MXC_CCM_CCGR4_CG6_OFFSET);
+	writel(reg, &mxc_ccm->CCGR4);
+}
+
 /*
  * Calculate the frequency of PLLn.
  */
arch/arm/include/asm/arch-mx5/clock.h +5 -0
index 1f8a537..ea972a3 100644
@@ -40,4 +40,9 @@ u32 imx_get_uartclk(void);
 u32 imx_get_fecclk(void);
 unsigned int mxc_get_clock(enum mxc_clock clk);
 
+void set_usb_phy2_clk(void);
+void enable_usb_phy2_clk(unsigned char enable);
+void set_usboh3_clk(void);
+void enable_usboh3_clk(unsigned char enable);
+
 #endif /* __ASM_ARCH_CLOCK_H */
arch/arm/include/asm/arch-mx5/crm_regs.h +3 -0
index fcc0e36..7972147 100644
@@ -195,7 +195,10 @@ struct mxc_ccm_reg {
 /* Define the bits in register CCGRx */
 #define MXC_CCM_CCGR_CG_MASK				0x3
 
+#define MXC_CCM_CCGR4_CG5_OFFSET                        10
+#define MXC_CCM_CCGR4_CG6_OFFSET			12
 #define MXC_CCM_CCGR5_CG5_OFFSET			10
+#define MXC_CCM_CCGR2_CG14_OFFSET                       28
 
 /* Define the bits in register CLPCR */
 #define MXC_CCM_CLPCR_BYPASS_IPU_LPM_HS                 (0x1 << 18)
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/5 mx5: add helper function to retrieve the GPIO number

In reply to Wolfgang Grandegger
---
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/include/asm/arch-mx5/mx5x_pins.h +4 -0
index 4e3a31b..3978bd5 100644
@@ -25,6 +25,10 @@
 
 #ifndef __ASSEMBLY__
 
+/* There's a off-by-one betweem the gpio bank number and the gpiochip */
+/* range e.g. GPIO_1_5 is gpio 5 under linux */
+#define IMX_GPIO_NR(bank, nr)           (((bank) - 1) * 32 + (nr))
+
 /*
  * In order to identify pins more effectively, each mux-controlled pin's
  * enumerated value is constructed in the following way:
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/5 mx5: add generic USB EHCI support for mx51 and mx53

In reply to Wolfgang Grandegger

It's derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() has been introduced to allow for board-specific setup when USB is started.

---
 drivers/usb/host/Makefile   |    1 +
 drivers/usb/host/ehci-mx5.c |  174 +++++++++++++++++++++++++++++++++++++++++++
 include/usb/ehci-fsl.h      |   10 +++
 3 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
drivers/usb/host/Makefile +1 -0
index 51b2494..60632ba 100644
@@ -41,6 +41,7 @@ else
 COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
 endif
 COBJS-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o
+COBJS-$(CONFIG_USB_EHCI_MX5) += ehci-mx5.o
 COBJS-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o
 COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o
drivers/usb/host/ehci-mx5.c new file +174 -0

174 lines not on this page · raw message

include/usb/ehci-fsl.h +10 -0
index 67600ed..26551c6 100644
@@ -242,4 +242,14 @@ struct usb_ehci {
 	u8	res13[0xafc];
 };
 
+/*
+ * For MXC SOCs
+ */
+#define MXC_EHCI_POWER_PINS_ENABLED	(1 << 5)
+#define MXC_EHCI_TTL_ENABLED		(1 << 6)
+#define MXC_EHCI_INTERNAL_PHY		(1 << 7)
+
+/* Board-specific initialization */
+int board_ehci_hcd_init(int port);
+
 #endif /* _EHCI_FSL_H */
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 3/5 mx5: add generic USB EHCI support for mx51 and mx53

Hi Wolfgang,

Quoted 8 lines · Wolfgang Grandegger

It's derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() has been introduced to allow for board-specific setup when USB is started.

Quoted 6 lines

---

?drivers/usb/host/Makefile ? | ? ?1 +
?drivers/usb/host/ehci-mx5.c | ?174 +++++++++++++++++++++++++++++++++++++++++++
?include/usb/ehci-fsl.h ? ? ?| ? 10 +++

?3 files changed, 185 insertions(+), 0 deletions(-) ?create mode 100644 drivers/usb/host/ehci-mx5.c

Do we really need to create a drivers/usb/host/ehci-mx5.c?

Can't mx5 USB support be included inside drivers/usb/host/ehci-mxc.c instead?

Regards,

Fabio Estevam

#5 lore raw

PATCH 3/5 mx5: add generic USB EHCI support for mx51 and mx53

Quoted 18 lines · Fabio Estevam

Hi Wolfgang,

Quoted 8 lines · Wolfgang Grandegger

It's derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() has been introduced to allow for board-specific setup when USB is started.

Quoted 6 lines
---
 drivers/usb/host/Makefile   |    1 +
 drivers/usb/host/ehci-mx5.c |  174 +++++++++++++++++++++++++++++++++++++++++++
 include/usb/ehci-fsl.h      |   10 +++
 3 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Quoted 3 lines

Do we really need to create a drivers/usb/host/ehci-mx5.c?

Can't mx5 USB support be included inside drivers/usb/host/ehci-mxc.c instead?

it could be included into ehci-mxc.c using #ifdef's, of course. Would that be the better solution?

Wolfgang.

#6 lore raw

PATCH 4/5 mx53loco: add end enable USB host support on port 1

In reply to Wolfgang Grandegger
---
 board/freescale/mx53loco/mx53loco.c |   10 ++++++++++
 include/configs/mx53loco.h          |   13 +++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
board/freescale/mx53loco/mx53loco.c +10 -0
index b4c7f33..7bccfa9 100644
@@ -78,6 +78,16 @@ static void setup_iomux_uart(void)
 				PAD_CTL_ODE_OPENDRAIN_ENABLE);
 }
 
+#ifdef CONFIG_USB_EHCI_MX5
+void board_ehci_hcd_init(int port)
+{
+	/* request VBUS power enable pin, GPIO[8}, gpio7 */
+	mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1);
+	gpio_direction_output(IMX_GPIO_NR(7, 8), 0);
+	gpio_set_value(IMX_GPIO_NR(7, 8), 1);
+}
+#endif
+
 static void setup_iomux_fec(void)
 {
 	/*FEC_MDIO*/
include/configs/mx53loco.h +13 -0
index d699010..9ce43d7 100644
@@ -72,6 +72,19 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 
+/* USB Configs */
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_FAT
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX5
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS	0
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX		1
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 4/5 mx53loco: add end enable USB host support on port 1

2011/11/11 Wolfgang Grandegger <[email protected]>:

Quoted 12 lines

---
?board/freescale/mx53loco/mx53loco.c | ? 10 ++++++++++ ?include/configs/mx53loco.h ? ? ? ? ?| ? 13 +++++++++++++ ?2 files changed, 23 insertions(+), 0 deletions(-)

board/freescale/mx53loco/mx53loco.c +0 -0
index b4c7f33..7bccfa9 100644

board/freescale/mx53loco/mx53loco.c static void setup_iomux_uart(void) · line 84

Quoted 7 lines
board/freescale/mx53loco/mx53loco.c +4 -0
@@ -78,6 +78,16 @@ static void setup_iomux_uart(void)
 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?PAD_CTL_ODE_OPENDRAIN_ENABLE);
 ?}
 
+#ifdef CONFIG_USB_EHCI_MX5
+void board_ehci_hcd_init(int port)
+{
+ ? ? ? /* request VBUS power enable pin, GPIO[8}, gpio7 */
           ^^

here: :%s/}/]

Quoted 41 lines
board/freescale/mx53loco/mx53loco.c +6 -0
+ ? ? ? mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1);
+ ? ? ? gpio_direction_output(IMX_GPIO_NR(7, 8), 0);
+ ? ? ? gpio_set_value(IMX_GPIO_NR(7, 8), 1);
+}
+#endif
+
 ?static void setup_iomux_fec(void)
 ?{

? ? ? ?/*FEC_MDIO*/

include/configs/mx53loco.h +0 -0
index d699010..9ce43d7 100644
@@ -72,6 +72,19 @@

?#define CONFIG_CMD_MII
?#define CONFIG_CMD_NET

include/configs/mx53loco.h +13 -0
+/* USB Configs */
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_FAT
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX5
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_MXC_USB_PORT ? ?1
+#define CONFIG_MXC_USB_PORTSC ?(PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS ? 0
+

?/* allow to overwrite serial and ethaddr */
?#define CONFIG_ENV_OVERWRITE
?#define CONFIG_CONS_INDEX ? ? ? ? ? ? ?1
--
1.7.4.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#8 lore raw

PATCH 4/5 mx53loco: add end enable USB host support on port 1

In reply to Wolfgang Grandegger
Quoted 12 lines
---
 board/freescale/mx53loco/mx53loco.c |   10 ++++++++++
 include/configs/mx53loco.h          |   13 +++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/board/freescale/mx53loco/mx53loco.c index b4c7f33..7bccfa9 100644

board/freescale/mx53loco/mx53loco.c static void setup_iomux_uart(void) · line 87

Quoted 10 lines
board/freescale/mx53loco/mx53loco.c +7 -0
@@ -78,6 +78,16 @@ static void setup_iomux_uart(void)
 				PAD_CTL_ODE_OPENDRAIN_ENABLE);
 }
 
+#ifdef CONFIG_USB_EHCI_MX5
+void board_ehci_hcd_init(int port)
+{
+	/* request VBUS power enable pin, GPIO[8}, gpio7 */
+	mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1);
+	gpio_direction_output(IMX_GPIO_NR(7, 8), 0);
+	gpio_set_value(IMX_GPIO_NR(7, 8), 1);

We don't have this GPIO defined by standard means?

Quoted 30 lines
board/freescale/mx53loco/mx53loco.c +3 -0
+}
+#endif
+
 static void setup_iomux_fec(void)
 {
 	/*FEC_MDIO*/
include/configs/mx53loco.h +13 -0
index d699010..9ce43d7 100644
@@ -72,6 +72,19 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 
+/* USB Configs */
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_FAT
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX5
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
+#define CONFIG_MXC_USB_FLAGS	0
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX		1
#9 lore raw

PATCH 5/5 mx51evk: add end enable USB host support on port 1

In reply to Wolfgang Grandegger
---
 board/freescale/mx51evk/mx51evk.c |   92 +++++++++++++++++++++++++++++++++++++
 include/configs/mx51evk.h         |   13 +++++
 2 files changed, 105 insertions(+), 0 deletions(-)
board/freescale/mx51evk/mx51evk.c +92 -0
index 37e6e4d..12354b3 100644
@@ -172,6 +172,95 @@ static void setup_iomux_spi(void)
 }
 #endif
 
+#ifdef CONFIG_USB_EHCI_MX5
+#define MX51EVK_USBH1_HUB_RST	IMX_GPIO_NR(1, 7)	/* GPIO_1_7 */
+#define MX51EVK_USBH1_STP	IMX_GPIO_NR(1, 27)	/* GPIO_1_27 */
+#define MX51EVK_USB_CLK_EN_B	IMX_GPIO_NR(2, 1)	/* GPIO_2_1 */
+#define MX51EVK_USB_PHY_RESET	IMX_GPIO_NR(2, 5)	/* GPIO_2_5 */
+
+#define USBH1_PAD	(PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |		\
+			 PAD_CTL_100K_PU | PAD_CTL_PUE_PULL |		\
+			 PAD_CTL_PKE_ENABLE | PAD_CTL_HYS_ENABLE)
+#define GPIO_PAD	(PAD_CTL_DRV_HIGH | PAD_CTL_PKE_ENABLE |	\
+			 PAD_CTL_SRE_FAST)
+#define NO_PAD		(1 << 16)
+
+static void setup_usb_h1(void)
+{
+	mxc_request_iomux(MX51_PIN_USBH1_CLK, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_CLK, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DIR, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DIR, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_NXT, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_NXT, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA0, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA0, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA1, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA1, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA2, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA2, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA3, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA3, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA4, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA4, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA5, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA5, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA6, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA6, USBH1_PAD);
+
+	mxc_request_iomux(MX51_PIN_USBH1_DATA7, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_DATA7, USBH1_PAD);
+
+	/* GPIO_1_7 for USBH1 hub reset */
+	mxc_request_iomux(MX51_PIN_GPIO1_7, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_GPIO1_7, NO_PAD);
+
+	/* GPIO_2_1 */
+	mxc_request_iomux(MX51_PIN_EIM_D17, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_D17, GPIO_PAD);
+
+	/* GPIO_2_5 for USB PHY reset */
+	mxc_request_iomux(MX51_PIN_EIM_D21, IOMUX_CONFIG_ALT1);
+	mxc_iomux_set_pad(MX51_PIN_EIM_D21, GPIO_PAD);
+}
+
+void board_ehci_hcd_init(int port)
+{
+	/* Set USBH1_STP to GPIO and toggle it */
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_GPIO);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USBH1_PAD);
+
+	gpio_direction_output(MX51EVK_USBH1_STP, 0);
+	gpio_direction_output(MX51EVK_USB_PHY_RESET, 0);
+	mdelay(10);
+	gpio_set_value(MX51EVK_USBH1_STP, 1);
+
+	/* Set back USBH1_STP to be function */
+	mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_ALT0);
+	mxc_iomux_set_pad(MX51_PIN_USBH1_STP, USBH1_PAD);
+
+	/* De-assert USB PHY RESETB */
+	gpio_set_value(MX51EVK_USB_PHY_RESET, 1);
+
+	/* Drive USB_CLK_EN_B line low */
+	gpio_direction_output(MX51EVK_USB_CLK_EN_B, 0);
+
+	/* Reset USB hub */
+	gpio_direction_output(MX51EVK_USBH1_HUB_RST, 0);
+	mdelay(2);
+	gpio_set_value(MX51EVK_USBH1_HUB_RST, 1);
+}
+#endif
+
 static void power_init(void)
 {
 	unsigned int val;
@@ -391,6 +480,9 @@ int board_early_init_f(void)
 {
 	setup_iomux_uart();
 	setup_iomux_fec();
+#ifdef CONFIG_USB_EHCI_MX5
+	setup_usb_h1();
+#endif
 
 	return 0;
 }
include/configs/mx51evk.h +13 -0
index 7c7544f..18f1ebd 100644
@@ -110,6 +110,19 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 
+/* USB Configs */
+#define CONFIG_CMD_USB
+#define CONFIG_CMD_FAT
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_MX5
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_HOST_ETHER
+#define CONFIG_USB_ETHER_ASIX
+#define CONFIG_USB_ETHER_SMSC95XX
+#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_MXC_USB_PORTSC	PORT_PTS_ULPI
+#define CONFIG_MXC_USB_FLAGS	MXC_EHCI_POWER_PINS_ENABLED
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX		1
Signature · 1 line
1.7.4.1
#10 lore raw

cover mx5: USB host support for mx51evk and mx53loco

In reply to Wolfgang Grandegger
Quoted 15 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

Quoted 14 lines
 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
+++++++++++++++++++++++++++++ include/configs/mx51evk.h                 | 
 13 ++
 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c

Hi,

isn't Jana already doing this kind of USB support for mx5 based on my old patches? You didn't notice?

M

#11 lore raw

cover mx5: USB host support for mx51evk and mx53loco

Quoted 30 lines · Marek Vasut
Quoted 15 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

Quoted 14 lines
 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
+++++++++++++++++++++++++++++ include/configs/mx51evk.h                 | 
 13 ++
 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Quoted 4 lines

Hi,

isn't Jana already doing this kind of USB support for mx5 based on my old patches? You didn't notice?

Well, I already responded on Jana's patches and presented my ideas here:

http://marc.info/?l=u-boot&m=132067806107887&w=2

Unfortunately, only the mails with subject "[PATCH] ..." get enough attention ;-).

The big difference to Jana's patch is that he uses a board-specific implementation (ehci_hcd_init() is in board specific code). I think we should share some code.

Wolfgang.

#12 lore raw

cover mx5: USB host support for mx51evk and mx53loco

Quoted 39 lines · Marek Vasut
Quoted 33 lines
Quoted 24 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
Quoted 8 lines

+++++++++++++++++++++++++++++ include/configs/mx51evk.h |

13 ++

 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Quoted 4 lines

Hi,

isn't Jana already doing this kind of USB support for mx5 based on my old patches? You didn't notice?

Quoted 6 lines

Well, I already responded on Jana's patches and presented my ideas here:

http://marc.info/?l=u-boot&m=132067806107887&w=2

Unfortunately, only the mails with subject "[PATCH] ..." get enough attention ;-).

Well aparently she isn't even signed to the ML ... so you need to CC her ... doh :-/

Quoted 4 lines

The big difference to Jana's patch is that he uses a board-specific implementation (ehci_hcd_init() is in board specific code). I think we should share some code.

Please do.

Quoted 2 lines

Wolfgang.

M

#13 lore raw

cover mx5: USB host support for mx51evk and mx53loco

Quoted 41 lines · Marek Vasut
Quoted 41 lines · Marek Vasut
Quoted 33 lines
Quoted 24 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
Quoted 8 lines

+++++++++++++++++++++++++++++ include/configs/mx51evk.h |

13 ++

 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Quoted 4 lines

Hi,

isn't Jana already doing this kind of USB support for mx5 based on my old patches? You didn't notice?

Well, I already responded on Jana's patches and presented my ideas here:

Quoted 7 lines
Quoted 4 lines

http://marc.info/?l=u-boot&m=132067806107887&w=2

Unfortunately, only the mails with subject "[PATCH] ..." get enough attention ;-).

Well aparently she isn't even signed to the ML ... so you need to CC her ... doh :-/

What do you mean? I replied to *all*!

Quoted 5 lines
Quoted 3 lines

The big difference to Jana's patch is that he uses a board-specific implementation (ehci_hcd_init() is in board specific code). I think we should share some code.

Please do.

See my patches ;-). Well, maybe it's more straight forward if we try to get my patches for the MX51/53 boards accepted first and then Jana could then use the negotiated interface. But also vise versa is fine for me.

Wolfgang.

#14 lore raw

cover mx5: USB host support for mx51evk and mx53loco

In reply to Wolfgang Grandegger
Quoted 15 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

Quoted 14 lines
 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
+++++++++++++++++++++++++++++ include/configs/mx51evk.h                 | 
 13 ++
 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c

Hi, I'm working on MX51 USB support based on some patches from Marek Vasut. It solves the problem in another way (uses structure-based offsets and generic ULPI implementation I've written for this) and is probably more polished because it's spent in the mailing list something like 2 months.
However, your patch supports both mx51 and mx53, so I think it would be nice to find some way to get them together.
Last but not least, I'm sorry that I didn't respond to your first e-mail, but I had to study for a test and hadn't time to look at your patch better.

Regards,
Jana Rapava

#15 lore raw

cover mx5: USB host support for mx51evk and mx53loco

Hi Jana,

Quoted 30 lines · Jana Rapava
Quoted 15 lines

This patches series provides USB host support for the mx51evk and mx53loco. The generic ehci-mx5 interface is derived from ehci-mxc and uses the header files of the ehci-fsl interface. The callback board_ehci_hcd_init() allows to do board-specific setup when USB is started.

Wolfgang.

Wolfgang Grandegger (5):
mx5: add helper functions to enable USB clocks
mx5: add helper function to retrieve the GPIO number
mx5: add generic USB EHCI support for mx51 and mx53
mx53loco: add end enable USB host support on port 1
mx51evk: add end enable USB host support on port 1

Quoted 14 lines
 arch/arm/cpu/armv7/mx5/clock.c            |   72 ++++++++++++
 arch/arm/include/asm/arch-mx5/clock.h     |    5 +
 arch/arm/include/asm/arch-mx5/crm_regs.h  |    3 +
 arch/arm/include/asm/arch-mx5/mx5x_pins.h |    4 +
 board/freescale/mx51evk/mx51evk.c         |   92 +++++++++++++++
 board/freescale/mx53loco/mx53loco.c       |   10 ++
 drivers/usb/host/Makefile                 |    1 +
 drivers/usb/host/ehci-mx5.c               |  174
+++++++++++++++++++++++++++++ include/configs/mx51evk.h                 | 
 13 ++
 include/configs/mx53loco.h                |   13 ++
 include/usb/ehci-fsl.h                    |   10 ++
 11 files changed, 397 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-mx5.c
Quoted 4 lines

Hi, I'm working on MX51 USB support based on some patches from Marek Vasut. It solves the problem in another way (uses structure-based offsets and generic ULPI implementation I've written for this) and is probably more polished because it's spent in the mailing list something like 2 months.

The structure-based offsets are nice. For my boards I do not need special ULPI support and therefore it's a clearly separated interface.

Quoted 2 lines

However, your patch supports both mx51 and mx53, so I think it would be nice to find some way to get them together.

I think we should share some code, especially the ehci_hcd_init() callback. If my recent patch series, I call a board-specific board_hcd_init() in the common ehci_hcd_init() which would be fine for your hardware as well.

Quoted 2 lines

Last but not least, I'm sorry that I didn't respond to your first e-mail, but I had to study for a test and hadn't time to look at your patch better.

No problem, you are welcome.

Unfortuantely, the existing interface ehci for the mxc is kind of mess and if derived from various existing interfaces, mainly ehci-fsl from u-boot and ehci-mxc from linux.

I'm going to comment on your recent patch series now...

Wolfgang.