OTG on Nexus S

1,157 views
Skip to first unread message

Steve Modica

unread,
Jan 27, 2011, 6:08:27 PM1/27/11
to android...@googlegroups.com
I've been trying to get my Nexus S to act as a host via OTG.

I've discovered that plugging in a microB to female A adapter that has the ID pin grounded kicks the OTG code. The s3c_udc driver kicks out a message that it's initializing and it attempts to bring up vbus power. That's where it stops. I never get vbus.

I've tried kicking on the regulators (ldo3 and ldo8 for vUSB 3.3V and VUSB 1.1V in the mach-herring.c file but that doesn't seem to kick them on. I see no power on the pins. (I've verified that the code is being called to enabled them at boot).

My suspicion is that the regulators are just not wired. It's a microB port so maybe it's not able to drive VUSB.

Comments?

Steve
--
Steve Modica
CTO - Small Tree Communications
www.small-tree.com
phone: 651-209-6509 ext 301
mobile: 651-261-3201


Julian Pas

unread,
Jan 28, 2011, 4:27:18 AM1/28/11
to Android Linux Kernel Development
Try to use an externally powered usb hub. On the nexus one the usb
circuits of the chip were only powered through the usb itself. So in
order to use OTG or pure host mode you had to supple power from
outside. I can imagine this haven't changed in the Nexus S either.
Have a look at this page for more details on that :
http://sven.killig.de/android/N1/2.2/usb_host/ .

Steve Modica

unread,
Jan 28, 2011, 6:56:38 AM1/28/11
to android...@googlegroups.com
Hi Julian,

Thanks for the response! I've seen Sven's page and a couple of the guys I'll be working with next week have this hack working.

The first problem I see with his method is that he's pulling in ehci-hcd. The Nexus S doesn't have any host drivers. I would need something for the S5Pv210.
I've found a tree that includes drivers for this for 2.6.32 over on tarot.com.tw. There's a Samsung guy that has been updating it. It appears it's for Galaxy Tab or something. I have a tree with these included and they initialize, but no joy. (I have yet to try my power on hack below at the same time)

I dropped Sven a note asking about the modules. I'm not sure why he built the USB stuff independent of the kernel.

Lastly, it appears that the voltage regulators on the part are being wired up for the s3c_usb OTG infrastructure. You can find the declarations in arch/arm/mach-s5pv210/mach-herring:

static struct regulator_consumer_supply ldo3_consumer[] = {
REGULATOR_SUPPLY("pd_io", "s3c-usbgadget")
};

static struct regulator_consumer_supply ldo8_consumer[] = {
REGULATOR_SUPPLY("pd_core", "s3c-usbgadget")
};

I actually can get otg_enable_phy to get called (very encouraging!) and it attempts to kick power on with regulator_enable for these two guys. However I get no power because my regulators don't support: REGULATOR_CHANGE_DRMS
This is checked in the valid ops mask and the call is basically ignored.

/* check voltage and requested load before enabling */
if (rdev->constraints &&
(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_DRMS))
drms_uA_update(rdev);

These regulators only support REGULATOR_CHANGE_STATUS (on or off):

static struct regulator_init_data herring_ldo3_data = {
.constraints = {
.name = "VUSB_1.1V",
.min_uV = 1100000,
.max_uV = 1100000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = ARRAY_SIZE(ldo3_consumer),
.consumer_supplies = ldo3_consumer,
};

static struct regulator_init_data herring_ldo8_data = {
.constraints = {
.name = "VUSB_3.3V",
.min_uV = 3300000,
.max_uV = 3300000,
.apply_uV = 1,
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
.state_mem = {
.disabled = 1,
},
},
.num_consumer_supplies = ARRAY_SIZE(ldo8_consumer),
.consumer_supplies = ldo8_consumer,
};


So, as a complete hack, I enabled the registers at boot with ".boot_on" and verified that the mx8998 LDO3 and LDO8 regulators are enabled at boot. (VUSB 3.3V and VUSB 1.1V). However I get no power. So I'm starting to believe you're right and those regulators are happily cranking power, but they are not wired :(

Steve

> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel

Andrei Avramescu

unread,
Feb 4, 2011, 4:45:29 AM2/4/11
to Android Linux Kernel Development
Hi Steve,
I don;t have much experience with kernel and drivers but in the last
days I tried to understand that USB Host thing.
As you know Nexus S is somewhat similar with Galaxy S.
I know that some OTG related messages are kicked when I plug in a USB
OTG cable.

<4>[ 8681.804081] fsa9480_interrupt
<4>[ 8681.804398] [FSA9480] FSA9480_ReadIntRegister
<6>[ 8681.837806] ldo38_control : turn ON LDO3 and LDO8 (cur_stat=0,
req=1)
<4>[ 8681.837980] [otg_clock_enable] clk_enable(otg_clock) OK.
<4>[ 8681.848727] [FSA9480] FSA9480_ProcessDevice (dev1 : 0x80, dev2 :
0x0)
<4>[ 8681.849042] USB OTG

ODROID-7 sources and Samsung Galaxy S sources have some similar code
regarding ehci and ohci. (ehci-s5pv210.c and ohci-s5pv210.c)

Regards,
Andrei
Reply all
Reply to author
Forward
0 new messages