Initialisation of SOC USB pads

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

plyatov
Posts: 3
Joined: Fri May 11, 2007 12:01 pm

Initialisation of SOC USB pads

Tue May 14, 2019 9:22 am

Hello everybody!

Can you please explain which software must configure AT91SAM9G20 SOC pads to operate as USB Host port? Is it AT91Bootstrap, U-Boot bootloader, Linux kernel or this is not required at all?

I ask, because during connection of USB disk, my board complains
usb 1-1: device descriptor read/64, error -62
usb 1-1: device descriptor read/64, error -62
usb 1-1: device descriptor read/64, error -62
usb 1-1: device descriptor read/64, error -62
usb 1-1: device not accepting address 4, error -62
usb 1-1: device not accepting address 5, error -62
usb usb1-port1: unable to enumerate USB device

Looks like there is no connectivity between USB Host module of SOC and USB device. Or am I wrong?


My setup is:
  • AT91SAM9G20 based custom board;
  • Linux kernel 4.9.36, from LINUX4SAM project;
  • USB disk connected to USB Host port 0 (HDPA, HDMA pins of SOC). 39 Ohm series resistors and 15 Kohm pull-down resistors added at these lines. Connectivity between SOC and USB device confirmed by Ohmmeter;
  • USB_VBUS voltage measured at USB connector = 4.96 VDC.
USB related kernel log:
[ 0.180000] usbcore: registered new interface driver usbfs
[ 0.180000] usbcore: registered new interface driver hub
[ 0.180000] usbcore: registered new device driver usb
[ 0.480000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.480000] ohci-atmel: OHCI Atmel driver
[ 0.480000] at91_ohci 500000.ohci: failed to find sfr node
[ 0.480000] at91_ohci 500000.ohci: USB Host Controller
[ 0.480000] at91_ohci 500000.ohci: new USB bus registered, assigned bus number 1
[ 0.480000] at91_ohci 500000.ohci: irq 37, io mem 0x00500000
[ 0.550000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
[ 0.550000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 0.550000] usb usb1: Product: USB Host Controller
[ 0.550000] usb usb1: Manufacturer: Linux 4.9.36+ ohci_hcd
[ 0.550000] usb usb1: SerialNumber: at91
[ 0.550000] hub 1-0:1.0: USB hub found
[ 0.550000] hub 1-0:1.0: 2 ports detected
[ 0.550000] usbcore: registered new interface driver usb-storage
[ 0.620000] usbcore: registered new interface driver usbhid
[ 0.620000] usbhid: USB HID core driver
Best wishes
--
Igor Plyatov
blue_z
Location: USA
Posts: 1940
Joined: Thu Apr 19, 2007 10:15 pm

Re: Initialisation of SOC USB pads

Tue May 14, 2019 8:59 pm

plyatov wrote: Can you please explain which software must configure AT91SAM9G20 SOC pads to operate as USB Host port? Is it AT91Bootstrap, U-Boot bootloader, Linux kernel or this is not required at all?
Each boot program stage must perform its own device initialization for the device it expects to use.
AT91Bootstrap doesn't have USB capability because it is memory-space constrained.
U-Boot would have its own USB initialization, although the AT91SAM9260-EK code doesn't implement it.
Modern Linux kernels use the Device Tree to specify the pins used by each peripheral, and the pinctrl subsystem automagically performs the pin multiplexing before the device driver is executed.

Recent at91 versions of the kernel (can) enable the USB host peripheral in the Device Tree, but do not have a pinctrl definition for USB pins because they are not multiplexed.

BTW if the functionality of the hardware is in question, then Linux is the least friendly environment to check out the hardware.

Regards
plyatov
Posts: 3
Joined: Fri May 11, 2007 12:01 pm

Re: Initialisation of SOC USB pads

Wed May 22, 2019 4:33 pm

Hi all!

Update of topic.

I see USB traffic on the bus by Logical analyser.

This is definitely Linux kernel 4.9.52 issue, because USB works fine at U-Boot, when I try to load kernel image and device tree from USB disk.

Additionally, USB works fine, when same board flashed with old Linux kernel 2.6.39.

Current Linux kernel (4.9.52), has issue with USB speed on AT91SAM9G20. I see different USB speeds in U-Boot and in Linux-4.9.52. U-Boot has 12 MHz USB speed, while Linux-4.9.52 has 6 MHz USB speed.

I guess, what need to be changed to have correct USB speed?

I have try to attach resulting Device Tree source code, but looks like forum does not support this.

Best wishes.
--
Igor Plyatov
blue_z
Location: USA
Posts: 1940
Joined: Thu Apr 19, 2007 10:15 pm

Re: Initialisation of SOC USB pads

Wed May 22, 2019 8:11 pm

plyatov wrote: This is definitely Linux kernel 4.9.52 issue, because USB works fine at U-Boot ...
To be clear, the issue is probably restricted to the older AT91SAM9 SoCs that only have an OHCI controller and do not also have an EHCI controller (as found in the AT91SAM9G45 and later SoCs) in the USB Host peripheral.
It's the EHCI controller that implements USB V2.0 high-speed capability (in the AT91SAM9G45 and later SoCs).
Both the OHCI and EHCI controllers can support USB full-speed 12 Mbps USB devices.

plyatov wrote: Additionally, USB works fine, when same board flashed with old Linux kernel 2.6.39.
Then you only have a decade's worth of commits to consider.

plyatov wrote: I guess, what need to be changed to have correct USB speed?
Study section 26.4, USB Clock Controller, of the SAM9G20 datasheet.
There's mention of a divider that halves or doubles one of the clock inputs to the USB host controller.


Regards

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 6 guests