Controlling EHCI port from userland

Hi everyone.

I want to be able to do two things from userland:

1) Turn off power to the EHCI port
2) Reset the EHCI USB port PHY chip

After reading through the docs and kernel code, I know it's possible to do
both from the kernel. For those interested: the power can be turned off through
the nEN_USB_PWR signal from the TPS65950 (through the I2C interface), and the
PHY chip can be reset by toggling it's enable pin (connected to GPIO147).
These things are done in arch/arm/mach-omap2/board-omap3beagle.c and
drivers/usb/host/ehci-omap.c.

However, I don't know how to do this from userland. I can't to it through the
sysfs gpio interface because it won't let me export 147 (presumedly because
it's already been requested by some other part of the kernel).

I'm using a 2.6.31 kernel, and it's a RevC3 beagle.

Is this currently possible? Is there a sysfs interface somewhere?

I'd also like to be able to do the same to the OTG port, but let's start with
the EHCI, and yes, I'm using external power ;-).

Thanks,
  Cameron.

I am booting kernel from Nand and i followed steps as mentioned in below link

http://elinux.org/BeagleBoardNAND#Writing_kernel_with_kernel

after booting it from Nand it is stoped, here is the log

40T�H�H�U���ᅁInstruments X-Loader 1.4.2 (Feb 19 2009 - 12:01:24)
Loading u-boot.bin from nand


U-Boot 2009.01-dirty (Feb 19 2009 - 12:22:31)

I2C: ready
OMAP3503-GP rev 2, CPU-OPP2 L3-165MHz
OMAP3 Beagle board + LPDDR/NAND
DRAM: 128 MB
NAND: 256 MiB
MUSB: using high speed
In: serial
Out: serial
Err: serial
Board revision Ax/Bx
Serial #55ba0002000000000403193412013014
Hit any key to stop autoboot: 0

NAND read: device 0 offset 0x280000, size 0x400000
4194304 bytes read: OK
## Booting kernel from Legacy Image at 80000000 …
Image Name: Linux-2.6.29-rc3-omap1
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1787480 Bytes = 1.7 MB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum … OK
Loading Kernel Image … OK
OK

Starting kernel …

Uncompressing Linux… done, boo
ting the kernel.

Please help me solve this issue

–Sanjeev

|

Anyone got any ideas where to look?

Docs? Email list posts? Crop circles?

Is this what you are looking for: http://marc.info/?l=linux-usb-users&m=116827193506484&w=2
???

/Quist

That's seems to be pretty much it. If you're following this, the usbreset
program *does* still work with a 2.6.31 kernel, and the usb suspend stuff is
about right, except that you need to echo "suspend" or "on" to power/level,
instead of 0/2 to power/state.

I'll report back on whether suspending the ehci root hub actually drops turns
off the 5V rail (to save power), and whether the usbreset can bring a crashed
EHCI port back to life.

Cameron.

Forgot to say: "Thanks, Quist"!

Bad news. Once the EHCI chip has crashed, usbreset won't work with it anymore:

root@beagleboard:~# ./usbreset /dev/usbdev2.1
Resetting USB device /dev/usbdev2.1
Error in ioctl: Is a directory

But /dev/usb2.1 is not a directory:

root@beagleboard:~# ls -l /dev/usbdev*
crw-rw---- 1 root root 189, 0 2009-11-10 01:43 /dev/usbdev1.1
crw-rw---- 1 root root 189, 1 2009-11-10 01:43 /dev/usbdev1.2
crw-rw---- 1 root root 189, 128 2009-11-10 01:43 /dev/usbdev2.1

I guess it's back to reading kernel source....

Cameron.

Also, suspending the high speed root hub does *not* disable the 5V power
rail.

Can anyone recommend an introduction to adding sysfs features to a kernel
driver?

Cameron.

Cameron:

You've probably already moved (way) beyond this point, but does
adding "gpio_export(147, 0);" to the init function in board-
omap3beagle.c cause gpio147 to be available by default in the /sys/
class/gpio directory? This worked for me when I could no longer
successfully do "echo 170 > export" in that directory (for the DVI-
Framer).

-Bill Bock
DFT