View Single Post
Posts: 946 | Thanked: 1,650 times | Joined on Oct 2009 @ Germany
#1032
this my HOWNOTTO get USB hostmode working.
I hope someone can replicate MohammadAG's success or at least find out what I did wrong.
Warning: This is only for experts! i2cset may damage your device.

0. you need a USB F/F adapter, the N900 USB cable and a USB device with < 200mA power consumption (verify on your PC)
1. install MohammadAG's kernel (with sarahn's patches + power ignore patch + appropriate configuration), i2ctools (i2cset in PATH) and sysklogd
I have PR1.2 installed, wifi on, bluetooth off, 2.5G, autodisconnect on. egoshin's method works (set to host while connected to PC)
2. boot device with USB cable but without USB device connected
3.
Code:
pcsuite-enable.sh
optional:
Code:
echo USB debug start > /var/log/syslog
and
Code:
echo 10 > /sys/module/musb_hdrc/parameters/debug
4. run the attached script ("sh host.txt -d" shows the state after every step)
5. immediately plug in the USB device
6. check dmesg and /proc/driver/musb_hdrc
7. to retry, unplug USB device,
Code:
killall sh; start bme; sleep 2; cat /proc/driver/musb_hdrc
after about 30sec you should see:
Code:
Status: MHDRC, Mode=Peripheral (Power=20, DevCtl=80)
then go to 4.

my results: (with -d flag)
start: Mode=Peripheral (Power=20, DevCtl=80)
echo H: Mode=Peripheral (Power=20, DevCtl=82)
echo e: Mode=Peripheral (Power=20, DevCtl=82)
echo F: Mode=Peripheral (Power=60, DevCtl=83)
bme stopped: Mode=Peripheral (Power=60, DevCtl=83)
slept 3sec: Mode=Peripheral (Power=20, DevCtl=80)
i2cset: Mode=Peripheral (Power=f1, DevCtl=99)
later: Mode=Peripheral (Power=e1, DevCtl=99)

for the description of the power+devctl flags see drivers/usb/musb/musb_regs.h

with egoshin's method:
Status: MHDRC, Mode=Host (Power=f0, DevCtl=dd)
OTG state: b_peripheral:3; active

dmesg:
Code:
[ 1863.465087] musb_restore_ctx_and_resume  435: restoring register context for musb_restore_ctx_and_resume
[ 1863.465087] rx51_xceiv_power 1
[ 1863.465698] rx51_xceiv_reset
[ 1863.850799] musb_interrupt       1948: ** IRQ peripheral usb0001 tx0000 rx0000
[ 1863.850830] musb_stage0_irq       643: <== Power=e5, DevCtl=99, int_usb=0x1
[ 1863.850860] musb_stage0_irq       829: SUSPEND (b_idle) devctl 99 power e5
[ 1863.874389] musb_interrupt       1948: ** IRQ peripheral usb0001 tx0000 rx0000
[ 1863.874420] musb_stage0_irq       643: <== Power=e1, DevCtl=99, int_usb=0x1
[ 1863.874420] musb_stage0_irq       829: SUSPEND (b_idle) devctl 99 power e1
[ 1871.680358] musb_platform_try_idle  160: b_idle inactive, for idle timer for 7 ms
what MohammadAG got with the same commands (his device is in R&D mode, but it didn't make a difference for me):
Status: MHDRC, Mode=Host (Power=f0, DevCtl=dd)
OTG state: a_host:9; active

with flash plugged in (not powered on)
Status: MHDRC, Mode=Host (Power=e0, DevCtl=99)

with bme:
Status: MHDRC, Mode=Host (Power=20, DevCtl=80)
MohammadAG: OTG state: b_idle:1; inactive

If I first apply egoshin's method I get
Status: MHDRC, Mode=Host (Power=e1, DevCtl=99)
OTG state: b_idle:1; inactive
but again no device is detected.
Attached Files
File Type: txt host.txt (526 Bytes, 445 views)

Last edited by titan; 2010-06-03 at 08:16.
 

The Following 12 Users Say Thank You to titan For This Useful Post: