[U-Boot] [PATCH] usb: imx: Allow multiple USB ports to be used at the same time on mx5

Matthew Starr mstarr at hedonline.com
Thu May 21 23:02:55 CEST 2015


CONFIG_MXC_USB_PORT was used to define which USB port was to be
initialized.  If CONFIG_USB_MAX_CONTROLLER_COUNT > 1, then the
port specified by CONFIG_MXC_USB_PORT would be duplicated
CONFIG_USB_MAX_CONTROLLER_COUNT times including duplicating all
devices connected to the ports.  None of the other USB ports would
be available for use.

The fix is to remove all instances of CONFIG_MXC_USB_PORT from the
imx53 ehci driver since it was only allowing the port specified by
CONFIG_MXC_USB_PORT to be populated.  Then use
CONFIG_USB_MAX_CONTROLLER_COUNT to specifiy which USB ports should be
enabled, starting with port 0.  If port 1 is needed, then set
CONFIG_USB_MAX_CONTROLLER_COUNT to 2 so 2 ports get populated (port 0
and port 1) even though port 0 will not be used.

Configurations for all boards affected are updated.

Signed-off-by: Matthew Starr <mstarr at hedonline.com>

---

 drivers/usb/host/ehci-mx5.c    | 8 ++++----
 include/configs/m53evk.h       | 2 +-
 include/configs/mx51_efikamx.h | 1 +
 include/configs/mx51evk.h      | 2 +-
 include/configs/mx53loco.h     | 2 +-
 include/configs/usbarmory.h    | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
index d319962..dd0fefe 100644
--- a/drivers/usb/host/ehci-mx5.c
+++ b/drivers/usb/host/ehci-mx5.c
@@ -243,10 +243,10 @@ int ehci_hcd_init(int index, enum usb_init_type init,
 	mdelay(1);
 
 	/* Do board specific initialization */
-	board_ehci_hcd_init(CONFIG_MXC_USB_PORT);
+	board_ehci_hcd_init(index);
 
 	ehci = (struct usb_ehci *)(OTG_BASE_ADDR +
-		(0x200 * CONFIG_MXC_USB_PORT));
+		(0x200 * index));
 	*hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength);
 	*hcor = (struct ehci_hcor *)((uint32_t)*hccr +
 			HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase)));
@@ -255,11 +255,11 @@ int ehci_hcd_init(int index, enum usb_init_type init,
 	__raw_writel(CONFIG_MXC_USB_PORTSC, &ehci->portsc);
 	setbits_le32(&ehci->portsc, USB_EN);
 
-	mxc_set_usbcontrol(CONFIG_MXC_USB_PORT, CONFIG_MXC_USB_FLAGS);
+	mxc_set_usbcontrol(index, CONFIG_MXC_USB_FLAGS);
 	mdelay(10);
 
 	/* Do board specific post-initialization */
-	board_ehci_hcd_postinit(ehci, CONFIG_MXC_USB_PORT);
+	board_ehci_hcd_postinit(ehci, index);
 
 	return 0;
 }
diff --git a/include/configs/m53evk.h b/include/configs/m53evk.h
index 0cc1282..5c0a9c7 100644
--- a/include/configs/m53evk.h
+++ b/include/configs/m53evk.h
@@ -199,7 +199,7 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 #define CONFIG_USB_ETHER_SMSC95XX
-#define CONFIG_MXC_USB_PORT		1
+#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS		0
 #endif
diff --git a/include/configs/mx51_efikamx.h b/include/configs/mx51_efikamx.h
index fce7ead..545d9ce 100644
--- a/include/configs/mx51_efikamx.h
+++ b/include/configs/mx51_efikamx.h
@@ -172,6 +172,7 @@
 #define	CONFIG_USB_EHCI_MX5
 #define	CONFIG_USB_ULPI
 #define	CONFIG_USB_ULPI_VIEWPORT
+#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #define	CONFIG_MXC_USB_PORT	1
 #if	(CONFIG_MXC_USB_PORT == 0)
 #define	CONFIG_MXC_USB_PORTSC	(1 << 28)
diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
index b0c9717..61c8e11 100644
--- a/include/configs/mx51evk.h
+++ b/include/configs/mx51evk.h
@@ -103,7 +103,7 @@
 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_SMSC95XX
-#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #define CONFIG_MXC_USB_PORTSC	PORT_PTS_ULPI
 #define CONFIG_MXC_USB_FLAGS	MXC_EHCI_POWER_PINS_ENABLED
 
diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
index a56e72e..32a2c2c 100644
--- a/include/configs/mx53loco.h
+++ b/include/configs/mx53loco.h
@@ -69,7 +69,7 @@
 #define CONFIG_USB_ETHER_ASIX
 #define CONFIG_USB_ETHER_MCS7830
 #define CONFIG_USB_ETHER_SMSC95XX
-#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_USB_MAX_CONTROLLER_COUNT	2
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
 
diff --git a/include/configs/usbarmory.h b/include/configs/usbarmory.h
index f29ab2d..edc4fc6 100644
--- a/include/configs/usbarmory.h
+++ b/include/configs/usbarmory.h
@@ -61,7 +61,7 @@
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_MX5
 #define CONFIG_USB_STORAGE
-#define CONFIG_MXC_USB_PORT	1
+#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_MXC_USB_PORTSC	(PORT_PTS_UTMI | PORT_PTS_PTW)
 #define CONFIG_MXC_USB_FLAGS	0
 
-- 
2.1.4


More information about the U-Boot mailing list