Bug 766

Summary: [mpc8315e-rdb] USB does not work on mpc8315e-rdb
Product: [Build System, Metadata & Runtime] BSPs Reporter: Yi Zhao <yi.zhao>
Component: bsps-configurationAssignee: Bruce Ashfield <bruce.ashfield>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: jiajun.xu, jingdong.lu, liang.li2, liangliang.wang, sgw, wenhuax.fan, yi.zhao, yp.bsp.watcher, yp.watcher
Version: 1.0   
Target Milestone: 1.0 M4   
Hardware: mpc8315e-rdb   
OS: ppc   
Whiteboard: waiting for verification of the fix (June 21, 2011)
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---

Description Yi Zhao 2011-02-23 23:47:33 UTC
Testing Env:    
Host: Ubuntu 10.10 x86_64
Kernel: 2.6.35-25-generic

Mpc8315e-rdb kernel and rootfs from poky build
git commit information:
commit 974ea1a190167dcfd831ba1fc5f733e0dc9a6fda
Author: Richard Purdie <richard.purdie@linuxfoundation.org>
Date:   Tue Feb 15 23:20:54 2011 +0000

    bitbake/runqueue: When we successfully fork off a task and there are more processes we can start do so immediately
    
    Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

When the board boot up, I insert the usb module.

####################
root@mpc8315e-rdb:~# modprobe fsl-mph-dr-of
/immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode
root@mpc8315e-rdb:~# usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub 
usbcore: registered new device driver usb 
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
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 38, io mem 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb 1-1: new full speed USB device using fsl-ehci and address 2

root@mpc8315e-rdb:~# modprobe usb-storage
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.

root@mpc8315e-rdb:~# lsmod
Module                  Size  Used by
fsl_mph_dr_of           3437  0
nls_base                6241  1 usbcore
ipv6                  272561  12
usbcore               132987  3 usb_storage,ehci_hcd
ehci_hcd               45787  0
usb_storage            39954  0
root@mpc8315e-rdb:~#
root@mpc8315e-rdb:~# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#########################

But there is no response when I plug a usb stick.

I got some usb error message from dmesg
#########################
root@mpc8315e-rdb:~# dmesg |grep usb -i
/immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
usb 1-1: new full speed USB device using fsl-ehci and address 2
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
usb 1-1: new full speed USB device using fsl-ehci and address 3
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
usb 1-1: new full speed USB device using fsl-ehci and address 4
usb 1-1: device not accepting address 4, error -110
usb 1-1: new full speed USB device using fsl-ehci and address 5
usb 1-1: device not accepting address 5, error -110
hub 1-0:1.0: unable to enumerate USB device on port 1
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
#####################
Comment 1 Bruce Ashfield 2011-02-24 06:58:55 UTC
Looks like some missing options here. Did this same test work on the
2.6.34 kernel ?

I'll compare the 2.6.37 and 2.6.34 USB options to see if anything obvious
jumps out.
Comment 2 Bruce Ashfield 2011-02-24 13:02:42 UTC
After some digging, this comes back to my question about the behaviour on 2.6.34.
I compared the USB options between 2.6.34 and 2.6.37, there are no significant
differences except 2.6.34 does *not* have CONFIG_USB_FSL_MPH_DR_OF enabled/available.

So if USB works in 2.6.34, it works without  fsl-mph-dr-of and we shouldn't
be using it in 2.6.37 either.
Comment 3 Bruce Ashfield 2011-02-25 05:43:31 UTC
*** Bug 773 has been marked as a duplicate of this bug. ***
Comment 4 Bruce Ashfield 2011-03-03 17:57:40 UTC
Attempted to fix this with the routerstation pro USB. I don't have hardware, so this
needs a retest.
Comment 5 liang li 2011-03-04 00:43:43 UTC
use sato-sdk image of nightly build 20110301-4:
http://autobuilder.pokylinux.org/nightly/20110301-4/machines/mpc8315e-rdb/ppc/
the usb stick not supported by the image.

after these steps , the usb stick can be used:

1.download the modules file of that build:
modules-2.6.37.2-yocto-standard+-r16-mpc8315e-rdb.tgz 
2. decompress the modules file 
3. replace the kernel modules dir of the image by the above modules file.
4. cd /lib/modules/2.6.37.2-yocto-standard+/kernel/drivers/usb/host
5.insmod ./fsl-mph-dr-of.ko
the output the command below: 
/immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode
root@mpc8315e-rdb:/lib/modules/2.6.37.2-yocto-standard+/kernel/drivers/usb/host# usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
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 38, io mem 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb 1-1: new high speed USB device using fsl-ehci and address 2
hub 1-1:1.0: USB hub found
hub 1-1:1.0: 4 ports detected
6.insert the usb stick, output below:
root@mpc8315e-rdb:/lib/modules/2.6.37.2-yocto-standard+/kernel/drivers/usb/host# usb 1-1.3: new high speed USB device using fsl-ehci and 3
Initializing USB Mass Storage driver...
scsi2 : usb-storage 1-1.3:1.0
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
scsi 2:0:0:0: Direct-Access     Lenovo   USB Flash Drive  1100 PQ: 0 ANSI: 0 CCS
sd 2:0:0:0: [sdb] 7831552 512-byte logical blocks: (4.00 GB/3.73 GiB)
sd 2:0:0:0: Attached scsi generic sg1 type 0
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sd 2:0:0:0: [sdb] Assuming drive cache: write through
 sdb: sdb1
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sd 2:0:0:0: [sdb] Attached SCSI removable disk
7.can mount the /dev/sdb (usb stick device) , can write and read file from the usb device.
Comment 6 liang li 2011-05-31 04:23:30 UTC
use sato-sdk images and modules images from nightly build (20110527-1):
http://autobuilder.pokylinux.org/nightly/20110527-1/machines/mpc8315e-rdb/ppc/
steps:
insert a usb disk to the board.
1.boot the sato-sdk images .
2.extract modules images to /lib/modules
3.depmod -a
4.modprobe ehci-hcd
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
5.modprobe usb-storage
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
modprobe usb-storage

6.modprobe  fsl-mph-dr-of

/immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode

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 38, io mem 0xe0023000

fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 1 port detected

/usb/host# 
hub 1-1:1.0: USB hub found

hub 1-1:1.0: 4 ports detected

usb 1-1.2: new high speed USB device using fsl-ehci and address 3

scsi2 : usb-storage 1-1.2:1.0

scsi 2:0:0:0: Direct-Access     USB      Flash Disk       0.11 PQ: 0 ANSI: 2

sd 2:0:0:0: [sdb] 7900336 512-byte logical blocks: (4.04 GB/3.76 GiB)

sd 2:0:0:0: Attached scsi generic sg1 type 0

sd 2:0:0:0: [sdb] Write Protect is off

sd 2:0:0:0: [sdb] Assuming drive cache: write through

sd 2:0:0:0: [sdb] Assuming drive cache: write through

 sdb: sdb1 sdb2 sdb3 sdb4

sd 2:0:0:0: [sdb] Assuming drive cache: write through

sd 2:0:0:0: [sdb] Attached SCSI disk
7.lsmod 
Module                  Size  Used by

fsl_mph_dr_of           3481  0 

ipv6                  270232  12 

usbcore               132661  3 usb_storage,ehci_hcd

ehci_hcd               47561  0 

usb_storage            40180  0 
8. ls /dev/sdb 
ls: cannot access /dev/sdb: No such file or directory

usb stick can not mount and read,write.
Comment 7 liang li 2011-05-31 04:28:11 UTC
git info:
commit 4ff7af11ef69849ef9c16f585eae58ac920b222b
Comment 8 liang li 2011-05-31 04:31:18 UTC
git tree/branch: poky/1.1_M1
Comment 9 Bruce Ashfield 2011-05-31 08:16:51 UTC
If you run the new kernel, against the last known working rootfs, do we see /dev/sdb ?
Since the dmesg looks the same between the working and non-working case, I suspect udev isn't working properly. What if the device nodes are created manually ?
Comment 10 liang li 2011-05-31 21:28:35 UTC
(In reply to comment #9)
> If you run the new kernel, against the last known working rootfs, do we see
> /dev/sdb ?
> Since the dmesg looks the same between the working and non-working case, I
> suspect udev isn't working properly. What if the device nodes are created
> manually ?

tried the newest git master , also can not find /dev/sdb.
tried manually create device node /dev/sdb:
mknod /dev/sdb b 8 16 

and modprobe usb related modules , can fdisk /dev/sdb and get partitons info. 
root@mpc8315e-rdb:/lib/modules/2.6.37.6-yocto-standard+/kernel/drivers/usb/host
 fdisk /dev/sdb

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): p

Disk /dev/sdb: 4044 MB, 4044972032 bytes
255 heads, 63 sectors/track, 491 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x8c6968c0

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         133     1068291   83  Linux
/dev/sdb2             134         246      907672+   6  FAT16
/dev/sdb3             247         377     1052257+  82  Linux swap / Solaris
/dev/sdb4             378         491      915705   83  Linux

when mount ,it failed:
mount /dev/sdb /mnt
FAT: invalid media value (0x01)
VFS: Can't find a valid FAT filesystem on dev sdb.
mount: you must specify the filesystem type
Comment 11 liang li 2011-05-31 22:04:23 UTC
after manually mknod /dev/sdb1 :
mknod /dev/sdb1 b 8 17
can mount /dev/sdb1 and read and write.
Comment 12 Bruce Ashfield 2011-06-02 11:04:02 UTC
So this is basically u-dev not creating the device node
properly for the device. 

Who's familiar with the udev changes (if any) that have
occurred. I can't see anything obvious, but the kernel is
unchanged in this area.

Is this the minimal image ? If so, do we have mdev enabled
in busybox ?
Comment 13 liang li 2011-06-02 19:09:34 UTC
(In reply to comment #12)
> So this is basically u-dev not creating the device node
> properly for the device. 
> 
> Who's familiar with the udev changes (if any) that have
> occurred. I can't see anything obvious, but the kernel is
> unchanged in this area.
> 
> Is this the minimal image ? If so, do we have mdev enabled
> in busybox ?

no this is sato-sdk image.
found in minimal images project built manually, from tmp/work/ppc603e-poky-linux/busybox-1.18.4-r1/busybox-1.18.4, the MDEV option in the .config file is not set :
....
# CONFIG_MDEV is not set
# CONFIG_FEATURE_MDEV_CONF is not set
# CONFIG_FEATURE_MDEV_RENAME is not set
# CONFIG_FEATURE_MDEV_RENAME_REGEXP is not set
# CONFIG_FEATURE_MDEV_EXEC is not set
# CONFIG_FEATURE_MDEV_LOAD_FIRMWARE is not set
....
Comment 14 Bruce Ashfield 2011-06-03 08:49:46 UTC
ok. so mdev shouldn't be the problem if we are booting
the sato image. Can you attach a copy of the udev rules
in play here ?
Comment 15 liang li 2011-06-06 18:35:53 UTC
(In reply to comment #14)
> ok. so mdev shouldn't be the problem if we are booting
> the sato image. Can you attach a copy of the udev rules
> in play here ?

two files in dir "/etc/udev/rules.d" :
60-sysprof.rules and local.rules.

60-sysprof.rules:
KERNEL=="sysprof-trace",                  MODE="0644"

local.rules:
# There are a number of modifiers that are allowed to be used in some
# of the different fields. They provide the following subsitutions:
#
# %n the "kernel number" of the device.
#    For example, 'sda3' has a "kernel number" of '3'
# %e the smallest number for that name which does not matches an existing node
# %k the kernel name for the device
# %M the kernel major number for the device
# %m the kernel minor number for the device
# %b the bus id for the device
# %c the string returned by the PROGRAM
# %s{filename} the content of a sysfs attribute
# %% the '%' char itself
#

# Media automounting
SUBSYSTEM=="block", ACTION=="add"    RUN+="/etc/udev/scripts/mount.sh"
SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"

# Handle network interface setup
SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh"
SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh"

# The first framebuffer is symlinked to /dev/fb                       
KERNEL=="fb0", SYMLINK+="fb"

# The first rtc device is symlinked to /dev/rtc
KERNEL=="rtc0", SYMLINK+="rtc"

# Try and modprobe for drivers for new hardware
ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}"

# Create a symlink to any touchscreen input device
SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{modalias}=="input:*-e0*,3,*a0,1,*18,*", SYMLINK+="input/touchscreen0"
Comment 16 Yi Zhao 2011-06-07 19:38:23 UTC
This should be a udev issue. udevd daemon doesn't start up since second boot. There is a bug 1146 report it.
Comment 17 liang li 2011-06-20 20:36:55 UTC
(In reply to comment #6)
> use sato-sdk images and modules images from nightly build (20110527-1):
> http://autobuilder.pokylinux.org/nightly/20110527-1/machines/mpc8315e-rdb/ppc/
> steps:
> insert a usb disk to the board.
> 1.boot the sato-sdk images .
> 2.extract modules images to /lib/modules
> 3.depmod -a
> 4.modprobe ehci-hcd
> usbcore: registered new interface driver usbfs
> usbcore: registered new interface driver hub
> usbcore: registered new device driver usb
> ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> 5.modprobe usb-storage
> Initializing USB Mass Storage driver...
> usbcore: registered new interface driver usb-storage
> USB Mass Storage support registered.
> modprobe usb-storage
> 
> 6.modprobe  fsl-mph-dr-of
> 
> /immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode
> 
> 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 38, io mem 0xe0023000
> 
> fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
> 
> hub 1-0:1.0: USB hub found
> 
> hub 1-0:1.0: 1 port detected
> 
> /usb/host# 
> hub 1-1:1.0: USB hub found
> 
> hub 1-1:1.0: 4 ports detected
> 
> usb 1-1.2: new high speed USB device using fsl-ehci and address 3
> 
> scsi2 : usb-storage 1-1.2:1.0
> 
> scsi 2:0:0:0: Direct-Access     USB      Flash Disk       0.11 PQ: 0 ANSI: 2
> 
> sd 2:0:0:0: [sdb] 7900336 512-byte logical blocks: (4.04 GB/3.76 GiB)
> 
> sd 2:0:0:0: Attached scsi generic sg1 type 0
> 
> sd 2:0:0:0: [sdb] Write Protect is off
> 
> sd 2:0:0:0: [sdb] Assuming drive cache: write through
> 
> sd 2:0:0:0: [sdb] Assuming drive cache: write through
> 
>  sdb: sdb1 sdb2 sdb3 sdb4
> 
> sd 2:0:0:0: [sdb] Assuming drive cache: write through
> 
> sd 2:0:0:0: [sdb] Attached SCSI disk
> 7.lsmod 
> Module                  Size  Used by
> 
> fsl_mph_dr_of           3481  0 
> 
> ipv6                  270232  12 
> 
> usbcore               132661  3 usb_storage,ehci_hcd
> 
> ehci_hcd               47561  0 
> 
> usb_storage            40180  0 
> 8. ls /dev/sdb 
> ls: cannot access /dev/sdb: No such file or directory
> 
> usb stick can not mount and read,write.

No such error using sato-sdk images from nightly build 20110617-4:
http://autobuilder.pokylinux.org/nightly/20110617-4/machines/mpc8315e-rdb/ppc/
/dev/sdb can be found and can mount,read,write,umount the usb stick.

git info : 2163461ec94528ecf046a04edc5db3d2dd3a6b8b
git branch : master
Comment 18 Bruce Ashfield 2011-06-21 10:46:07 UTC
I changed the state to accepted. Can we have the submitter confirm that this is fixed?
Comment 19 liang li 2011-07-20 02:37:15 UTC
(In reply to comment #17)
> (In reply to comment #6)
> > use sato-sdk images and modules images from nightly build (20110527-1):
> > http://autobuilder.pokylinux.org/nightly/20110527-1/machines/mpc8315e-rdb/ppc/
> > steps:
> > insert a usb disk to the board.
> > 1.boot the sato-sdk images .
> > 2.extract modules images to /lib/modules
> > 3.depmod -a
> > 4.modprobe ehci-hcd
> > usbcore: registered new interface driver usbfs
> > usbcore: registered new interface driver hub
> > usbcore: registered new device driver usb
> > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> > 5.modprobe usb-storage
> > Initializing USB Mass Storage driver...
> > usbcore: registered new interface driver usb-storage
> > USB Mass Storage support registered.
> > modprobe usb-storage
> > 
> > 6.modprobe  fsl-mph-dr-of
> > 
> > /immr@e0000000/usb@23000: Invalid 'dr_mode' property, fallback to host mode
> > 
> > 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 38, io mem 0xe0023000
> > 
> > fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
> > 
> > hub 1-0:1.0: USB hub found
> > 
> > hub 1-0:1.0: 1 port detected
> > 
> > /usb/host# 
> > hub 1-1:1.0: USB hub found
> > 
> > hub 1-1:1.0: 4 ports detected
> > 
> > usb 1-1.2: new high speed USB device using fsl-ehci and address 3
> > 
> > scsi2 : usb-storage 1-1.2:1.0
> > 
> > scsi 2:0:0:0: Direct-Access     USB      Flash Disk       0.11 PQ: 0 ANSI: 2
> > 
> > sd 2:0:0:0: [sdb] 7900336 512-byte logical blocks: (4.04 GB/3.76 GiB)
> > 
> > sd 2:0:0:0: Attached scsi generic sg1 type 0
> > 
> > sd 2:0:0:0: [sdb] Write Protect is off
> > 
> > sd 2:0:0:0: [sdb] Assuming drive cache: write through
> > 
> > sd 2:0:0:0: [sdb] Assuming drive cache: write through
> > 
> >  sdb: sdb1 sdb2 sdb3 sdb4
> > 
> > sd 2:0:0:0: [sdb] Assuming drive cache: write through
> > 
> > sd 2:0:0:0: [sdb] Attached SCSI disk
> > 7.lsmod 
> > Module                  Size  Used by
> > 
> > fsl_mph_dr_of           3481  0 
> > 
> > ipv6                  270232  12 
> > 
> > usbcore               132661  3 usb_storage,ehci_hcd
> > 
> > ehci_hcd               47561  0 
> > 
> > usb_storage            40180  0 
> > 8. ls /dev/sdb 
> > ls: cannot access /dev/sdb: No such file or directory
> > 
> > usb stick can not mount and read,write.
> 
> No such error using sato-sdk images from nightly build 20110617-4:
> http://autobuilder.pokylinux.org/nightly/20110617-4/machines/mpc8315e-rdb/ppc/
> /dev/sdb can be found and can mount,read,write,umount the usb stick.
> 
> git info : 2163461ec94528ecf046a04edc5db3d2dd3a6b8b
> git branch : master

also no such error using sato-sdk images from nightly build 20110715-1:
http://autobuilder.pokylinux.org/nightly/20110715-1/machines/mpc8315e-rdb/ppc/
git info :93a2ca70482f09e93469481936302e7b6847156e
git branch :Poky/1.1_M2
Comment 20 Bruce Ashfield 2011-07-27 10:52:00 UTC
from the comments in the case, this is fixed, so marking this as resolved.
Comment 21 liang li 2011-07-28 00:37:49 UTC
verified on nightly-build 20110723-2:
http://autobuilder.pokylinux.org/nightly/20110723-2/
git info:eea4bd731ef286516ee1fb934fe2222a09c06e70
git branch: poky/master