Latest hcm's patchset, non-working hcm-patch
authorHagen Meyer <hagen@hcmeyer.de>
Mon, 30 Aug 2010 18:58:34 +0000 (22:58 +0400)
committerPaul Fertser <fercerpav@gmail.com>
Mon, 30 Aug 2010 18:58:34 +0000 (22:58 +0400)
commit209dfe96bc69f8f330e6b76f2bd911c92ac921f6
treeaa8e462cbf0e3767fb42edd0ccb386466f171f5f
parenta78d411c6518eb7dd038eef6668f78a7e6c14ec4
Latest hcm's patchset, non-working

I've been trying to cleanly implement hostmode, based on Datasheets and
proposals in the forum.

It doesn't work, yet, but maybe some of you can merge my ideas with
their own to make some progress.

I'll try to explain the different chunks of the patch, and after that
some remarks:

-#################################
1. isp1704.h
-#################################
Just changed some definitions, e.g. the XCVRSELECT_SHIFT was wrong in my
opinion (was 1 instead of 0). HIGH_SPEED and LOW_SPEED were missing, I
added them for convenience.

-#################################
2. musb_core.c
-#################################
functions to configure ISP1704/1707 in host/otg mode. Refer to datasheet
The ??? is because of DP/DM Pullup, the Datasheet somewhat contradicts
the code used in omap2430.c:musb_restore_ctx_and_resume (ISP1704 ds, p29)

In some of my tests, the ulpi_read/write requests timeouted. So maybe
the chip is somehow misconfigured somewhere.

NOTE: CTRL_RESET causes an USB Reset, this should not affect the chip
itself and its registers

-#################################
3. musb_core.h
-#################################
only an enum and the prototypes of above functions

-#################################
4. musb_procfs.c
-#################################
- Output TESTMODE with cat /proc/driver/musb_hdrc
- 'M' enters hostmode (hypothetically)
 - configure ISP1707 as host (lowspeed for testing)
 - deactivate MUSB suspendmodes (needed?)
 - FORCE_HOST mode
 - set SESSION (should actually start host session)
- 'm' leaves hostmode (hypothetically)
 - reset SESSION
 - reset FORCE_HOST
 - configure ISP1707 as otg

Also, I deactivated musb_platform_try_idle after access to
/proc/driver/musb_hdrc. Not sure if this is needed.
Somewhat redundant to the next chunk: do not idle if FORCE_HOST is set.

-#################################
5. twl4030-usb.c
-#################################
This chunk seems to be rather IMPORTANT!
Disables suspending the PHY, it seems that without this chunk, the MUSB
registers (POWER, DEVCTL, TESTMODE) are reset from time to time.
Probably because the musb_save_ctx_and_suspend and
musb_restore_ctx_and_resume routines are not host-aware.
It seems that these routines can also be deactivated by applying VBUS at
the right moment.

-#################################
-#################################
My Remarks
-#################################
-#################################

- I did NOT change the Software-Statemachine at all.
 - Maybe it is needed to force the SW-Statemachine into another state
 - It should not be needed to change the IRQ-Routine which controls the
Statmachine, as this is exactly as proposed in the docs, also for
hostmode (SPRUF98D, p3232).

My Tests:
1. stop bme
2. echo M > /proc/driver/musb_hdrc
3. start vbus
with or without device attached, sometimes I changed 2+3.

Most of the time, the BDEVICE bit in DEVCTL was set, strangely, also the
LSDEV (LS dev recognized) was set sometimes.
drivers/usb/musb/isp1704.h
drivers/usb/musb/musb_core.c
drivers/usb/musb/musb_core.h
drivers/usb/musb/musb_procfs.c
drivers/usb/musb/omap2430.c
drivers/usb/otg/twl4030-usb.c