Skip to contentSkip to conversation

usb: mxs: Disable USB Port 1 for i.MX23

PATCH Superseded Otavio Salvador 3 participants 7 messages Jan 28, 2013

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 usb: mxs: Disable USB Port 1 for i.MX23

The i.MX23 just one USB port so disable the second controller probe when building for i.MX23.

---
Changes in v2: None

 drivers/usb/host/ehci-mxs.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/host/ehci-mxs.c +2 -0
index 5062af5..28c8cde 100644
@@ -50,10 +50,12 @@ int mxs_ehci_get_port(struct ehci_mxs *mxs_usb, int port)
 		usb_base = MXS_USBCTRL0_BASE;
 		phy_base = MXS_USBPHY0_BASE;
 		break;
+#ifdef CONFIG_MX28
 	case 1:
 		usb_base = MXS_USBCTRL1_BASE;
 		phy_base = MXS_USBPHY1_BASE;
 		break;
+#endif
 	default:
 		printf("CONFIG_EHCI_MXS_PORT (port = %d)\n", port);
 		return -1;
Signature · 1 line
1.8.1
#1 lore raw

PATCH v2 2/4 mx23evk: Enable USB support

---
Changes in v2: None

 include/configs/mx23evk.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/mx23evk.h +10 -0
index d206c95..99dfb8f 100644
@@ -58,6 +58,7 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_GPIO
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_USB
 #define CONFIG_CMD_BOOTZ
 
 /* Memory configurations */
@@ -122,6 +123,15 @@
 #define CONFIG_MXS_MMC
 #endif
 
+/* USB */
+#ifdef	CONFIG_CMD_USB
+#define	CONFIG_USB_EHCI
+#define	CONFIG_USB_EHCI_MXS
+#define	CONFIG_EHCI_MXS_PORT 0
+#define	CONFIG_EHCI_IS_TDI
+#define	CONFIG_USB_STORAGE
+#endif
+
 /* Boot Linux */
 #define CONFIG_CMDLINE_TAG
 #define CONFIG_SETUP_MEMORY_TAGS
Signature · 1 line
1.8.1
#2 lore raw

PATCH v2 3/4 mx23_olinuxino: Enable USB support

In reply to Otavio Salvador

---
Changes in v2: None

 include/configs/mx23_olinuxino.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/configs/mx23_olinuxino.h +10 -0
index d019944..e081c49 100644
@@ -60,6 +60,7 @@
 #define	CONFIG_CMD_GPIO
 #define	CONFIG_CMD_LED
 #define	CONFIG_CMD_MMC
+#define	CONFIG_CMD_USB
 
 /*
  * Memory configurations
@@ -140,6 +141,15 @@
  */
 #define CONFIG_APBH_DMA
 
+/* USB */
+#ifdef	CONFIG_CMD_USB
+#define	CONFIG_USB_EHCI
+#define	CONFIG_USB_EHCI_MXS
+#define	CONFIG_EHCI_MXS_PORT 0
+#define	CONFIG_EHCI_IS_TDI
+#define	CONFIG_USB_STORAGE
+#endif
+
 /*
  * Boot Linux
  */
Signature · 1 line
1.8.1
#3 lore raw

PATCH v2 4/4 mx23_olinuxino: Add ethernet support

In reply to Otavio Salvador

This adds support to the LAN9212 chip included in the board and extend the environment to easy netboot use.

---
Changes in v2:
- Move GPIO initialization to board_early_init_f;
- Extend commitlog;

 board/olimex/mx23_olinuxino/mx23_olinuxino.c |  6 +++++
 board/olimex/mx23_olinuxino/spl_boot.c       |  4 +++
 include/configs/mx23_olinuxino.h             | 40 +++++++++++++++++++++++++---
 3 files changed, 47 insertions(+), 3 deletions(-)
board/olimex/mx23_olinuxino/mx23_olinuxino.c +6 -0
index 2501417..b2090b2 100644
@@ -45,6 +45,11 @@ int board_early_init_f(void)
 	/* SSP0 clock at 96MHz */
 	mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
 
+#ifdef CONFIG_USB_EHCI
+	/* Enable LAN9512 */
+	gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
+#endif
+
 	return 0;
 }
 
@@ -53,6 +58,7 @@ int dram_init(void)
 	return mxs_dram_init();
 }
 
+
 #ifdef	CONFIG_CMD_MMC
 static int mx23_olx_mmc_cd(int id)
 {
board/olimex/mx23_olinuxino/spl_boot.c +4 -0
index 3bbf5ad..8f7ba0b 100644
@@ -95,6 +95,10 @@ const iomux_cfg_t iomux_setup[] = {
 	MX23_PAD_SSP1_DATA2__SSP1_DATA2 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_DATA3__SSP1_DATA3 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP,
+
+	/* Ethernet */
+	MX23_PAD_GPMI_ALE__GPIO_0_17 |
+		(MXS_PAD_12MA | MXS_PAD_3V3),
 };
 
 void board_init_ll(void)
include/configs/mx23_olinuxino.h +37 -3
index e081c49..2c81fb6 100644
@@ -55,11 +55,13 @@
 #define	CONFIG_DOS_PARTITION
 
 #define	CONFIG_CMD_CACHE
+#define	CONFIG_CMD_DHCP
 #define	CONFIG_CMD_EXT2
 #define	CONFIG_CMD_FAT
 #define	CONFIG_CMD_GPIO
 #define	CONFIG_CMD_LED
 #define	CONFIG_CMD_MMC
+#define	CONFIG_CMD_NET
 #define	CONFIG_CMD_USB
 
 /*
@@ -150,6 +152,12 @@
 #define	CONFIG_USB_STORAGE
 #endif
 
+/* Ethernet */
+#ifdef	CONFIG_CMD_NET
+#define	CONFIG_USB_HOST_ETHER
+#define	CONFIG_USB_ETHER_SMSC95XX
+#endif
+
 /*
  * Boot Linux
  */
@@ -175,6 +183,7 @@
 /*
  * Extra Environments
  */
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"update_sd_firmware_filename=u-boot.sd\0" \
 	"update_sd_firmware="		/* Update the SD firmware partition */ \
@@ -191,6 +200,7 @@
 	"fdt_file=imx23-olinuxino.dtb\0" \
 	"fdt_addr=0x41000000\0" \
 	"boot_fdt=try\0" \
+	"ip_dyn=yes\0" \
 	"mmcdev=0\0" \
 	"mmcpart=2\0" \
 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
@@ -216,6 +226,31 @@
 			"fi; " \
 		"else " \
 			"bootm; " \
+		"fi;\0" \
+	"netargs=setenv bootargs console=${console_mainline},${baudrate} " \
+		"root=/dev/nfs " \
+		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+	"netboot=echo Booting from net ...; " \
+		"usb start; " \
+		"run netargs; "	\
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${uimage}; " \
+		"if test ${boot_fdt} = yes; then " \
+			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi;" \
+			"fi; " \
+		"else " \
+			"bootm; " \
 		"fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
@@ -225,10 +260,9 @@
 		"else " \
 			"if run loaduimage; then " \
 				"run mmcboot; " \
-			"else " \
-				"echo ERR: Fail to boot from MMC; " \
+			"else run netboot; " \
 			"fi; " \
 		"fi; " \
-	"else exit; fi"
+	"else run netboot; fi"
 
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */
Signature · 1 line
1.8.1
#4 lore raw

PATCH v2 4/4 mx23_olinuxino: Add ethernet support

Dear Otavio Salvador,
[...]

board/olimex/mx23_olinuxino/spl_boot.c const iomux_cfg_t iomux_setup[] = { · line 101

Quoted 12 lines
(quoted diff) +0 -0

b/board/olimex/mx23_olinuxino/spl_boot.c index 3bbf5ad..8f7ba0b 100644

board/olimex/mx23_olinuxino/spl_boot.c +4 -0
@@ -95,6 +95,10 @@ const iomux_cfg_t iomux_setup[] = {
 	MX23_PAD_SSP1_DATA2__SSP1_DATA2 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_DATA3__SSP1_DATA3 | MUX_CONFIG_SSP,
 	MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP,
+
+	/* Ethernet */
+	MX23_PAD_GPMI_ALE__GPIO_0_17 |
+		(MXS_PAD_12MA | MXS_PAD_3V3),

PULLUP/NOPULL missing

Quoted 3 lines
board/olimex/mx23_olinuxino/spl_boot.c +0 -0
 };
 
 void board_init_ll(void)

[...]

board/olimex/mx23_olinuxino/spl_boot.c line 186

Quoted 5 lines
board/olimex/mx23_olinuxino/spl_boot.c +1 -0
@@ -175,6 +183,7 @@
 /*
  * Extra Environments
  */
+

Spurious newline

Quoted 46 lines
board/olimex/mx23_olinuxino/spl_boot.c +26 -0
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"update_sd_firmware_filename=u-boot.sd\0" \
 	"update_sd_firmware="		/* Update the SD firmware partition */ \
@@ -191,6 +200,7 @@
 	"fdt_file=imx23-olinuxino.dtb\0" \
 	"fdt_addr=0x41000000\0" \
 	"boot_fdt=try\0" \
+	"ip_dyn=yes\0" \
 	"mmcdev=0\0" \
 	"mmcpart=2\0" \
 	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
@@ -216,6 +226,31 @@
 			"fi; " \
 		"else " \
 			"bootm; " \
+		"fi;\0" \
+	"netargs=setenv bootargs console=${console_mainline},${baudrate} " \
+		"root=/dev/nfs " \
+		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+	"netboot=echo Booting from net ...; " \
+		"usb start; " \
+		"run netargs; "	\
+		"if test ${ip_dyn} = yes; then " \
+			"setenv get_cmd dhcp; " \
+		"else " \
+			"setenv get_cmd tftp; " \
+		"fi; " \
+		"${get_cmd} ${uimage}; " \
+		"if test ${boot_fdt} = yes; then " \
+			"if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi;" \
+			"fi; " \
+		"else " \
+			"bootm; " \
 		"fi;\0"
 
 #define CONFIG_BOOTCOMMAND \
@@ -225,10 +260,9 @@
 		"else " \
 			"if run loaduimage; then " \

board/olimex/mx23_olinuxino/spl_boot.c line 268

Quoted 10 lines
board/olimex/mx23_olinuxino/spl_boot.c +2 -3
 				"run mmcboot; " \
-			"else " \
-				"echo ERR: Fail to boot from MMC; " \
+			"else run netboot; " \
 			"fi; " \
 		"fi; " \
-	"else exit; fi"
+	"else run netboot; fi"
 
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */

Best regards,
Marek Vasut

reviewer
#5 lore raw

PATCH v2 4/4 mx23_olinuxino: Add ethernet support

In reply to Otavio Salvador
Quoted 1 line · Otavio Salvador

This adds support to the LAN9212 chip included in the board and extend

My schematics says it is a LAN9512.

board/olimex/mx23_olinuxino/mx23_olinuxino.c int board_early_init_f(void) · line 51

Quoted 4 lines
board/olimex/mx23_olinuxino/mx23_olinuxino.c +4 -0
+#ifdef CONFIG_USB_EHCI
+       /* Enable LAN9512 */
+       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
+#endif

You would better use #ifdef CONFIG_CMD_USB instead, like we do on mx28evk.

This would make things easier for someone that wants to test the board without USB support, by just undefing CONFIG_CMD_USB, which in turn remove all USB related support.

#6 lore raw

PATCH v2 4/4 mx23_olinuxino: Add ethernet support

Quoted 5 lines · Fabio Estevam
Quoted 1 line · Otavio Salvador

This adds support to the LAN9212 chip included in the board and extend

My schematics says it is a LAN9512.

Right; a typo!

Quoted 10 lines

board/olimex/mx23_olinuxino/mx23_olinuxino.c int board_early_init_f(void) · line 51

Quoted 4 lines
board/olimex/mx23_olinuxino/mx23_olinuxino.c +4 -0
+#ifdef CONFIG_USB_EHCI
+       /* Enable LAN9512 */
+       gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
+#endif

You would better use #ifdef CONFIG_CMD_USB instead, like we do on mx28evk.

This would make things easier for someone that wants to test the board without USB support, by just undefing CONFIG_CMD_USB, which in turn remove all USB related support.

Done; v3 being rolling out ... :)

--
Otavio Salvador O.S. Systems
E-mail: otavio at ossystems.com.br http://www.ossystems.com.br
Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br