Ticket #876 (closed enhancement: fixed)

Opened 12 years ago

Last modified 11 years ago

finished usb host patch

Reported by: zeroping@… Owned by: michael@…
Priority: normal Milestone:
Component: kernel Version: current svn head
Severity: minor Keywords:
Cc: buglog@…, werner@…, cw@…, arnaud.patard@…, claytonw@… Blocked By:
Blocking: Estimated Completion (week):
HasPatchForReview: PatchReviewResult:


I took the s3c2410-usb-switch patch in svn, added in the changes from the
mailing list, and tweaked it to read values from its /sys knob properly (it
wouldn't take trailing newlines). I then added it to

SRC_URI += "file://s3c2410-usb-switch.patch;patch=1"

and rebuilt the kernel. Now I can turn my neo's usb port into a functioning
usb host! I've already tested a usb mouse, keyboard, and mass storage with

I'm not sure if this is really the right way to add a patch to the build
system, but it works. The actual file has to be
in 'openembedded/packages/linux/linux-openmoko/'.

Since I don't have svn access, and wouldn't know where to put this patch if I
did, I'm filing this as a bug for someone who knows what they're doing.
Hopefully we can all enjoy plugging random usb devices into our phones.



s3c2410-usb-switch.patch (3.6 KB) - added by zeroping@… 12 years ago.
The updated usb mode switching patch

Change History

Changed 12 years ago by zeroping@…

The updated usb mode switching patch

comment:1 Changed 12 years ago by cw@…

  • Cc cw@… added

comment:2 Changed 12 years ago by claytonw@…

  • Cc claytonw@… added

comment:3 Changed 11 years ago by willie_chen@…

  • Owner changed from laforge@… to michael@…

comment:4 Changed 11 years ago by jnealy@…

In order to get this to work, I had to edit the patch and replace two instances
of S3C2410_GPE5 with S3C2410_GPE9. I think it was using the wrong pin. Then
follow the directions attached.

comment:5 Changed 11 years ago by arnaud.patard@…

  • Cc arnaud.patard@… added

comment:6 Changed 11 years ago by werner@…

  • Cc werner@… added

GPB9 ? At least that's what the schematics of GTA01Bv4 and GTA02v4 say.

Also, arch/arm/mach-s3c2410/usb-modeswitch.c doesn't seem to be used,
so I've remove it from the patch.

It's now in the 2.6.24 tree in SVN, revision 3909.

comment:7 Changed 11 years ago by arnaud.patard@…

yeah, of course it's GPB9 :)

While it's working and nice to see it in the svn, this patch is bad and won't be
merged upstream. For instance having the pull-up pin hard-coded is a no-go.
I'll propose a patch either here on the moko kernel list later this week.

comment:8 Changed 11 years ago by me@…

The whole role switching scheme is wrong in openmoko. It should be based on
id-pin status. Such status should come from an external otg_transceiver. Role
switch should be more "automatic" and the only user interaction needed would be
for triggering HNP.

Neo's usb hardware is wrong in that sense. It's exploiting id pin to detect usb
chargers which is completely wrong. Charger detection should be done by checking
whether D+/D- lines are shortened, if they are shortened then we have a
dedicated usb charger and we can charge up to 2.5A, otherwise we can charge up
to 500mA if connected to a host charger and up to 100mA if in an otg session.

Should I open a bug about this hw issue on Neo ?

comment:9 Changed 11 years ago by andy

  • Status changed from new to closed
  • Resolution set to fixed

The patch in question works fine, I tried it.

We are stuck with charger / ID pin in hardware, so nothing to be done there now.

We can use ID pin detection to automatically select host based on cable type inserted, but we do not provide the correct cables. So for now closing as fixed.

comment:10 Changed 11 years ago by iknowjoseph

With this marked as fixed will it be included in the kernels available for download?

Would anybody be able to supply me with a prebuilt kernel to test whilst I work out how to rebuild my own?

Thanks, Joseph

comment:11 Changed 11 years ago by andy

Just to clarify what I meant on the last post, I have tried USB host mode and it works fine, whether what we have used this patch or not I am not sure. But what we got does work on kernels for some months.

Here's a cheat sheet for using USB host mode on Freerunner successfully:

# tell the USB stack the USB socket is logically a host now

echo host > /sys/devices/platform/s3c2410-ohci/usb_mode

# get the Freerunner to provide 5V out on the USB socket

echo 1 > /sys/devices/platform/neo1973-pm-host.0/hostmode

comment:12 Changed 11 years ago by iknowjoseph

That's great, many thanks :)

Note: See TracTickets for help on using tickets.