Skip to contentSkip to conversation

usb: imx: Allow multiple USB ports to be used at the same time on mx5

PATCH New Matthew Starr 3 participants 5 messages May 21, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 usb: imx: Allow multiple USB ports to be used at the same time on mx5

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.

---

 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(-)
drivers/usb/host/ehci-mx5.c +4 -4
index d319962..dd0fefe 100644
@@ -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;
 }
include/configs/m53evk.h +1 -1
index 0cc1282..5c0a9c7 100644
@@ -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
include/configs/mx51_efikamx.h +1 -0
index fce7ead..545d9ce 100644
@@ -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)
include/configs/mx51evk.h +1 -1
index b0c9717..61c8e11 100644
@@ -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
 
include/configs/mx53loco.h +1 -1
index a56e72e..32a2c2c 100644
@@ -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
 
include/configs/usbarmory.h +1 -1
index f29ab2d..edc4fc6 100644
@@ -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
 
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/1 usb: imx: Allow multiple USB ports to be used at the same time on mx5

Hi,

Quoted 22 lines · Matthew Starr

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.

---

Quoted 7 lines
 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(-)

Perhaps instead this should move to driver model - it supports EHCI. See tegra, exynos, sunxi and sandbox.

Regards,
Simon

#3 lore raw

PATCH 1/1 usb: imx: Allow multiple USB ports to be used at the same time on mx5

Simon,

Quoted 33 lines · Matthew Starr
Quoted 8 lines

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.

Quoted 4 lines

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

Quoted 2 lines

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

Quoted 8 lines

and port 1) even though port 0 will not be used.

Configurations for all boards affected are updated.

---

Quoted 7 lines
 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(-)
Quoted 2 lines

Perhaps instead this should move to driver model - it supports EHCI. See tegra, exynos, sunxi and sandbox.

Wouldn't that require imx53 support for device trees? Currently I don't believe that is implemented yet.

Regards,
Matthew

#4 lore raw

PATCH 1/1 usb: imx: Allow multiple USB ports to be used at the same time on mx5

Hi,

Quoted 35 lines · Matthew Starr

Simon,

Quoted 33 lines · Matthew Starr
Quoted 8 lines

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.

Quoted 4 lines

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

Quoted 2 lines

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

Quoted 15 lines

and port 1) even though port 0 will not be used.

Configurations for all boards affected are updated.

---

 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(-)
Quoted 4 lines
Quoted 2 lines

Perhaps instead this should move to driver model - it supports EHCI. See tegra, exynos, sunxi and sandbox.

Wouldn't that require imx53 support for device trees? Currently I don't believe that is implemented yet.

Yes, although it's pretty simple. Add CONFIG_OF_CONTROL and CONFIG_OF_SEPARATE, copy the files in from the kernel and all should be well.

Regards,
Simon

#5 lore raw

PATCH 1/1 usb: imx: Allow multiple USB ports to be used at the same time on mx5

In reply to Matthew Starr
Quoted 15 lines · Matthew Starr

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.

Quoted 3 lines

Configurations for all boards affected are updated.

Hi! Why don't you just define a list of controllers which should be initialized instead ?

#define CONTROLLERS_TO_INIT { USB1, USB3 }

Where USB1 and USB3 is the address of the controller. Note that these addresses are defined in arch/arm/include/ headers.

Best regards,
Marek Vasut