USB max speed

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB max speed

6,199 Views
Maddis
Contributor IV

Hi,

We have iMX53 based board running Linux and for hw reason we want to limit the USB speed to 12Mbit/s (Full speed). I know the EHCI- host controller supports that, but I'm not sure how to do that on Linux side or is that even possible? Is it module option for ehci_hcd module or should it be done via sysfs - interface if only some ports needs to be full speed other high speed?

Labels (2)
Tags (3)
0 Kudos
10 Replies

2,420 Views
Maddis
Contributor IV

OTG port seems to be work in host mode just fine so I'm guessing that the ENDPTCTRLn[TXE/RXE]  isn't the problem.

It seems like the PFSC-bit doesn't have any effect although I set it in place where the PORTSC1 - register is accessed otherwise too. The devices are still recognized as high speed devices and tests show that the actual speed is greater than full speed.

0 Kudos

2,420 Views
Yuri
NXP Employee
NXP Employee

I found the following information about the problem if full-speed mode is used.

Immediately after bus reset, ENDPTCTRLn[TXE/RXE] couldn't be set 1 (Enable) immediately.

It is needed to wait approximately 1msec after bus reset before setting.

0 Kudos

2,420 Views
Maddis
Contributor IV

I've been trying to set the PFSC bit in usb_common.c in arch/arm/plat-mxc - directory without any success. I've tried OTG/H1/H2 although the usb port used is OTG. I've just tried to see if there are any changes, but no. Devices are still recognized as high speed and actual speed is also the same as before.

This is how I did it.

#define PORTSC_PFSC                     (1 << 24)       /* Force Full speed */

UH1_PORTSC1 |= PORTSC_PFSC;

Also UH2_PORTSC1 and UOG_PORTSC1.

Clearly I'm doing something wrong. Does any one have any good suggestion how to actually got the speed set to full?

0 Kudos

2,420 Views
stolzem
Contributor I

oha, I tried your approach patching usb_common.c. And it works for me.

What I did in file kernel/linux-2.6.31/arch/arm/plat-mxc/usb_common.c:

#define PORTSC_PFSC                     (1 << 24)       /* Force Full speed */

In the following methods I modified the code as below:

  • static void usbh1_set_ulpi_xcvr(void)
  • static void usbh2_set_ulpi_xcvr(void)
  • static void otg_set_utmi_xcvr(void)

/* allow controller to reset, and leave time for
 * the ULPI transceiver to reset too.
 */
 msleep(100);
 
 // new
 UH1_PORTSC1 |= PORTSC_PFSC;
 msleep(100);
 // new
 
 clk_disable(usb_clk);

My output is now:

 usb 1-1.2: new full speed USB device using fsl-ehci and address 4
 usb 1-1.2: not running at top speed; connect to a high speed hub
 usb 1-1.2: New USB device found, idVendor=0bb4, idProduct=0ffe
 usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
 usb 1-1.2: Product: Android Phone
 usb 1-1.2: Manufacturer: HTC
 usb 1-1.2: SerialNumber: HT12STJ00146
 usb 1-1.2: configuration #1 chosen from 1 choice 

Hope that helps.

Cheers

0 Kudos

2,420 Views
Maddis
Contributor IV

I tested this and added the PORTSC_PFSC on each port (otg, usb1 and usb2) like you suggested. Still, if I plug in USB-stick it gets identified as high speed device and not full speed.

I don't know if it has anything to do that I'm using kernel 2.6.35.3 and you are running 2.6.31. I think it shouldn't matter on this case, but who knows.

0 Kudos

2,420 Views
Maddis
Contributor IV

Hi,

Back to this issue. No one does have an idea if it's possible to do that from command line somehow or does it really need driver change? If so, then where should the change be? Looks bit complicated the whole USB driver thing.

Maybe the Freescale driver doesn't support that companion-option so other ways are needed. Or is 2.6.35.3 too old kernel for that?

0 Kudos

2,420 Views
stolzem
Contributor I

Hi,

I just found this thread. I know it's a couple of month old... - but did you find a solution? I have the exact same problem. I also need to slow down a high speed device to full speed.

I managed to get the companion files to show up in sysfs. For that you disable the following kernel config option:

CONFIG_USB_EHCI_ROOT_HUB_TT.

By that you disable the Transaction Translator which normally handles full speed connections. It now falls back to companion file style.

Still I have no luck forcing the USB device (android phone) to use full speed only.

I have the following device connected:

usb 1-1.2.1: new high speed USB device using fsl-ehci and address 8

usb 1-1.2.1: New USB device found, idVendor=0bb4, idProduct=0cab

usb 1-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3

usb 1-1.2.1: Product: Android Phone

usb 1-1.2.1: Manufacturer: HTC

usb 1-1.2.1: SerialNumber: HT12STJ00146

usb 1-1.2.1: configuration #1 chosen from 1 choice

According to the article you mentioned this should force it to use the companion drivers:

# echo 1 > /sys/bus/usb/devices/usb1/../companion

# cat /sys/bus/usb/devices/usb1/../companion

1

But nothing happens....

Did you get any further??

0 Kudos

2,420 Views
Maddis
Contributor IV

Sorry no. The issue is still open.

0 Kudos

2,420 Views
Yuri
NXP Employee
NXP Employee

At first sight -  it is needed to set the PFSC bit to enforce full speed, and this should be set after the controller has

been reset (USBCMD.RST) and before the controller is started.

0 Kudos

2,420 Views
Maddis
Contributor IV

But can that be done from command line or does it need driver modifications?

I found this article: http://lists.en.qi-hardware.com/pipermail/discussion/2011-August/008508.html

There is mentioned 'companion' - option in usb sysfs, but that option does not exist on MX53 Linux.

If it needs driver modification then what is the correct driver? Looking at the drivers/usb/host/ehci_mxc.c there is ehci_mxc_setup that looks like a place that might be the correct one or is there a better place? I'm not sure how to add the PFSC bit there. I found it from the manual though.

0 Kudos