USB Host 2 (i.MX31)

Aus BECOM Systems Support
Zur Navigation springen Zur Suche springen

Using USB Host 2

If USB Host 2 is used, make sure that only Host Port 2 is selected in the kernel configuration. I you also use the OTG port, select that as well. Anyway, you need to make sure that Host 1 and Host 2 are NOT selected simultaneously as this will cause problems when loading the EHCI module. To use a usb mass storage device, make sure that you also select the Mass storage module.

Simply load the ehci module to use the usb device:

  * modprobe ehci-hcd

Plug in the usb stick and it should be detected as a SCSI removeable disk. Check the UsbOtgDriver article or the commands below on how to use the device.

mx31# modprobe ehci-hcd
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 36, io mem 0x43f88400
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 2
fsl-ehci fsl-ehci.1: irq 37, io mem 0x43f88000
fsl-ehci fsl-ehci.1: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected

<-- Plug in USB stick

mx31# usb 1-1: new full speed USB device using fsl-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
scsi 0:0:0:0: Direct-Access     UrDisk   USB FLASH DISK   1.00 PQ: 0 ANSI: 2
sd 0:0:0:0: [sda] 256000 512-byte hardware sectors (131 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:0:0: [sda] 256000 512-byte hardware sectors (131 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Assuming drive cache: write through
 sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk

mx31# mkdir /mnt/usbstick
mx31# mount /dev/sda1 /mnt/usbstick
mx31# ls /mnt/usbstick
chipse~1.exe  graphi~1.exe  kassab~1.mdb  musike~1.lnk
ethern~1.exe  heimman.csl   macsta~1.txt  musikv~1

Using USB Host 2 with devices requiring more than 150mA

USB Host 2 is able to deliver more than 150mA to a device. The USB specification describes 500mA as a maximum value. Since the driver for the ISP1504 is used on both, the Host 2 and the OTG port, but only the Host 2 port is able to source 500mA, a workaround was developed which enables 500mA on that port. the value bus_mA of the hub device and mA_per_port are set to 500mA if the port number is 1. Port #1 is the Host 2 Port on the iMX31.

The patch for this is pasted below, it was created using the command diff -urNb hub.c.orig hub.c and affects the file linux/drivers/usb/core/hub.c

--- hub.c.orig	2008-02-14 15:02:36.000000000 +0100
+++ hub.c	2008-02-14 15:34:09.000000000 +0100
@@ -767,6 +767,27 @@
 			hub->mA_per_port = hdev->bus_mA;
 			hub->limited_power = 1;
 		}
+		
+	  /* Now this is some workaround for the isp1504 driver on
+	   * the BT Developer board. This driver is used twice and
+	   * it's not possible to determine in the driver, if it
+	   * has an external current source.
+	   * Therefore we will decide based on the bus number which
+	   * IC we are and will set the maximum current manually for
+	   * bus #1 (Host 2 Port on the i.MX31).
+	   *
+	   * You need to be aware that this is ONLY inteded for use
+	   * with the specified board/IC
+	   */
+
+			if (hdev->bus->busnum == 1)
+			{
+				dev_dbg(hub_dev, "setting max power for this port to 500mA manually\n");
+				hdev->bus_mA = 500;
+				hub->mA_per_port = hdev->bus_mA;
+				hub->limited_power = 1;
+			}
+		
 	} else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
 		dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
 			hub->descriptor->bHubContrCurrent);