
Fabio,
I added the '#define CONFIG_USB_MAX_CONTROLLER_COUNT 2' to my include config file and I see that it loads both USB port 0 and 1.
To me it looks like using CONFIG_USB_MAX_CONTROLLER_COUNT produces that number of duplicate devices all of the USB port defined by CONFIG_MXC_USB_PORT.
If CONFIG_MXC_USB_PORT is set 0, I only get port 0 duplicated CONFIG_USB_MAX_CONTROLLER_COUNT times. The ums command works, but I don't see any USB devices connected to port 1. If CONFIG_MXC_USB_PORT is set 1, I only get port 1 duplicated CONFIG_USB_MAX_CONTROLLER_COUNT times. The ums command shows nothing on the host side, but I can see USB devices (although multiple of the same single device, one on each port)
I looked at drivers/usb/host/ehci-mx5.c and found that the loading of USB is not dynamic and depends on the CONFIG_MXC_USB_PORT value. In drivers/usb/host/ehci-hcd.c, the CONFIG_USB_MAX_CONTROLLER_COUNT value defines how many devices to create and the index of the current device is passed to the usb_lowlevel_init() function in drivers/usb/host/ehci-mx5.c but is ignored.
Here is the output when running 'usb start' and then 'usb tree' when CONFIG_MXC_USB_PORT is 1 and CONFIG_USB_MAX_CONTROLLER_COUNT is 2 and a USB mass storage device is only connected to port 1:
U-Boot > usb start starting USB... USB0: USB EHCI 1.00 scanning bus 0 for devices... 2 USB Device(s) found USB1: USB EHCI 1.00 scanning bus 1 for devices... 2 USB Device(s) found scanning usb for storage devices... EHCI timed out on TD - token=0x80008c80 EHCI timed out on TD - token=0x80008d80 EHCI timed out on TD - token=0x80008d80 EHCI timed out on TD - token=0x80008d80 EHCI timed out on TD - token=0x80008d80 EHCI timed out on TD - token=0x80008d80 error in inquiry 1 Storage Device(s) found scanning usb for ethernet devices... 0 Ethernet Device(s) found U-Boot > usb tree USB device tree: 1 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-2 Mass Storage (480 Mb/s, 100mA) Generic Mass Storage 30820100
3 Hub (480 Mb/s, 0mA) | u-boot EHCI Host Controller | +-4 Mass Storage (480 Mb/s, 100mA) Generic Mass Storage 30820100
I fixed the issues by switching all instances of CONFIG_MXC_USB_PORT with index in drivers/usb/host/ehci-mx5.c and CONFIG_MXC_USB_PORT is no longer used. Even if index is used in place of CONFIG_MXC_USB_PORT, if you wanted to just use port 1 you would need to populate both port 0 and 1 by setting CONFIG_USB_MAX_CONTROLLER_COUNT to 2.
Here is the patch I made to drivers/usb/host/ehci-hcd.c to make USB client work on port 0 and USB host work on port 1 at the same time:
diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c index 7566c61..f7ecff5 100644 --- a/drivers/usb/host/ehci-mx5.c +++ b/drivers/usb/host/ehci-mx5.c @@ -231,10 +231,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))); @@ -243,11 +243,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; }
Regards,
Matthew Starr
-----Original Message----- From: Fabio Estevam [mailto:festevam@gmail.com] Sent: Tuesday, May 19, 2015 9:45 PM To: Matthew Starr Cc: U-Boot-Denx; Marek VaĊĦut Subject: Re: [U-Boot] i.MX53 USB Client not working
Hi Matthew,
On Thu, May 14, 2015 at 7:39 PM, Matthew Starr mstarr@hedonline.com wrote:
It appears that setting CONFIG_MXC_USB_PORT to 0 then loads the OTG
port on the i.MX53. The code appears to be in drivers/usb/host/ehci-mx5.c. The problem then is that the USB host port is then not usable since my i.MX53 board dedicates the OTG port to USB client functionality only.
Now I am trying to get both USB Host port 1 and USB OTG port 0 working at
the same time. Does u-boot allow using multiple USB controller ports at the same time?
Yes, you can use both ports.
In order to do so, you need to pass #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 in your config file.
Regards,
Fabio Estevam