User:Joerg rw/hostmode/summary

(SUBJ1)
m (Reverted edits by 178.137.89.194 (Talk) to last revision by joerg_rw)
Line 1: Line 1:
 +
<pre>
 +
N900 (rx51) hostmode notes
 +
There were several (semi-) successful encounters of using the
 +
hostmode, some via tricking the OTG statemachine, some via
 +
implementing the FORCE_HOST testmode properly, we'll concentrate on
 +
the latter
 +
 +
* Hardware
 +
The detailed overview is at http://wiki.maemo.org/N900_Hardware_USB
 +
 +
** There're leaked schematics
 +
 +
** There're datasheets for SoC (spurf98d is the best version) and
 +
ISP1707/1074
 +
 +
** Comparision with N8x0
 +
*** Same USB core
 +
*** N8x0 uses a discrete component TUSB6010 that integrates musb core and phy
 +
while N900 uses SoC-integrated musb with ISP1707 PHY via ULPI link
 +
*** ID pin of the USB core on N8x0 can be forcibly grounded
 +
programmatically, thus activating the host mode in the core, not
 +
possible with ISP1707
 +
*** ID pin is connected to the micro-usb receptable on N8x0, but some
 +
stupid decided to not route it to ISP1707 on N900 (he routed it to
 +
TWL4030 instead)
 +
 +
** The battery charger chip is controlled via i2c and can
 +
supply 5V/200mA on usb vbus when asked to.
 +
** twl4030 has connection to the ID pin and can sense it
 +
OTG-like operation (at least automatic switching to/from hostmode)
 +
possible?
 +
 +
 +
* Software
 +
** Driver
 +
*** Shitty
 +
*** There's a considerably improved version at linux-omap
 +
(nobody's tried to use it on N900 so far)
 +
*** Needs implementation of forced hostmode via one of the testmodes
 +
See the patchsets in the repository, there're no incremental patches
 +
accompanied by the meaningful logs (yet); when it starts working,
 +
implement it in a separate file as a "platform" function for ``echo
 +
host >/sys/devices/platform/musb_hdrc/mode'' to start working.
 +
*** Needs (why?) disabling of some current limiting features
 +
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
 +
index 7e912f2..b51e5ea 100644
 +
--- a/drivers/usb/core/generic.c
 +
+++ b/drivers/usb/core/generic.c
 +
@@ -97,10 +97,10 @@ int usb_choose_configuration(struct usb_device *udev)
 +
                */
 +
 +
                /* Rule out configs that draw too much bus current */
 +
-              if (c->desc.bMaxPower * 2 > udev->bus_mA) {
 +
+              /*if (c->desc.bMaxPower * 2 > udev->bus_mA) {
 +
                        insufficient_power++;
 +
                        continue;
 +
-              }
 +
+              }*/
 +
 +
                /* When the first config's first interface is one of Microsoft's
 +
                * pet nonstandard Ethernet-over-USB protocols, ignore it unless
 +
@@ -132,10 +132,10 @@ int usb_choose_configuration(struct usb_device *udev)
 +
                        best = c;
 +
        }
 +
 +
-      if (insufficient_power > 0)
 +
+      /*if (insufficient_power > 0)
 +
                dev_info(&udev->dev, "rejected %d configuration%s "
 +
                        "due to insufficient available bus power\n",
 +
-                      insufficient_power, plural(insufficient_power));
 +
+                      insufficient_power, plural(insufficient_power));*/
 +
 +
        if (best) {
 +
                i = best->desc.bConfigurationValue;
 +
 +
*** Needs (why?) disabling of some suspend features
 +
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
 +
index ecffb2a..1577e7a 100644
 +
--- a/drivers/usb/otg/twl4030-usb.c
 +
+++ b/drivers/usb/otg/twl4030-usb.c
 +
@@ -480,7 +480,7 @@ extern void musb_restore_ctx_and_resume(struct usb_gadget *gadget);
 +
 +
static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
 +
{
 +
-      if (twl->asleep)
 +
+      if (!twl->asleep)
 +
                return;
 +
 +
        twl4030_phy_power(twl, 0);
 +
 +
*** Needs (why?) manual step-through to get device recognised, enumerated, etc
 +
pcsuite-enable.sh
 +
echo H >/proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo e > /proc/driver/musb_hdrc
 +
echo F > /proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo H >/proc/driver/musb_hdrc
 +
echo I > /proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo H >/proc/driver/musb_hdrc
 +
echo "Done echo'ing"
 +
#echo "Connect the flash drive in 3 seconds!"
 +
stop bme; sleep 3; i2cset -y -m 0x07 2 0x6b 0x01 0x05; while true; do sleep 28; i2cset -y -m 0x80 2 0x6b 0x00 0x80; done
 +
 +
*** How can it switch out of "waiting Vbus to rise" state?
 +
*** No way to distinguish between full-speed and high-speed modes
 +
by just looking at the D+, D- states (via debug register of isp1704),
 +
needs special care
 +
 +
** BME
 +
*** Messes with charging so should be disabled
 +
stop bme
 +
*** Incapable of providing VBUS to external device
 +
One can use ``i2cset -y -m 0x07 2 0x6b 0x01 0x05'' instead to enable
 +
the reverse boost converter and ``i2cset -y -m 0x80 2 0x6b 0x00 0x80''
 +
to disable
 +
 +
** twl4030-usb.c
 +
*** Gets in the way by switching states behind your back
 +
Switches state to b_idle if the ID pin is not grounded), so should be
 +
(at least partially) disabled.
 +
*** Is registered as an OTG controller
 +
Should we provide a minimal OTG driver for isp1407 instead? Or should
 +
we rather get the whole stuff somehow working and then try to port the
 +
upstream driver (it's supposed to be saner)?
 +
 +
** musb
 +
*** SESSREQ (Session request) interrupt preconditions?
 +
*** CONNECT interrupt preconditions?
 +
<pre>
 +
N900 (rx51) hostmode notes
 +
 +
There were several (semi-) successful encounters of using the
 +
hostmode, some via tricking the OTG statemachine, some via
 +
implementing the FORCE_HOST testmode properly, we'll concentrate on
 +
the latter
 +
 +
* Hardware
 +
The detailed overview is at http://wiki.maemo.org/N900_Hardware_USB
 +
 +
** There're leaked schematics
 +
 +
** There're datasheets for SoC (spurf98d is the best version) and
 +
ISP1707/1074
 +
 +
** Comparision with N8x0
 +
*** Same USB core
 +
*** N8x0 uses a discrete component TUSB6010 that integrates musb core and phy
 +
while N900 uses SoC-integrated musb with ISP1707 PHY via ULPI link
 +
*** ID pin of the USB core on N8x0 can be forcibly grounded
 +
programmatically, thus activating the host mode in the core, not
 +
possible with ISP1707
 +
*** ID pin is connected to the micro-usb receptable on N8x0, but some
 +
stupid decided to not route it to ISP1707 on N900 (he routed it to
 +
TWL4030 instead)
 +
 +
** The battery charger chip is controlled via i2c and can
 +
supply 5V/200mA on usb vbus when asked to.
 +
** twl4030 has connection to the ID pin and can sense it
 +
OTG-like operation (at least automatic switching to/from hostmode)
 +
possible?
 +
 +
 +
* Software
 +
** Driver
 +
*** Shitty
 +
*** There's a considerably improved version at linux-omap
 +
(nobody's tried to use it on N900 so far)
 +
*** Needs implementation of forced hostmode via one of the testmodes
 +
See the patchsets in the repository, there're no incremental patches
 +
accompanied by the meaningful logs (yet); when it starts working,
 +
implement it in a separate file as a "platform" function for ``echo
 +
host >/sys/devices/platform/musb_hdrc/mode'' to start working.
 +
*** Needs (why?) disabling of some current limiting features
 +
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
 +
index 7e912f2..b51e5ea 100644
 +
--- a/drivers/usb/core/generic.c
 +
+++ b/drivers/usb/core/generic.c
 +
@@ -97,10 +97,10 @@ int usb_choose_configuration(struct usb_device *udev)
 +
                */
 +
 +
                /* Rule out configs that draw too much bus current */
 +
-              if (c->desc.bMaxPower * 2 > udev->bus_mA) {
 +
+              /*if (c->desc.bMaxPower * 2 > udev->bus_mA) {
 +
                        insufficient_power++;
 +
                        continue;
 +
-              }
 +
+              }*/
 +
 +
                /* When the first config's first interface is one of Microsoft's
 +
                * pet nonstandard Ethernet-over-USB protocols, ignore it unless
 +
@@ -132,10 +132,10 @@ int usb_choose_configuration(struct usb_device *udev)
 +
                        best = c;
 +
        }
 +
 +
-      if (insufficient_power > 0)
 +
+      /*if (insufficient_power > 0)
 +
                dev_info(&udev->dev, "rejected %d configuration%s "
 +
                        "due to insufficient available bus power\n",
 +
-                      insufficient_power, plural(insufficient_power));
 +
+                      insufficient_power, plural(insufficient_power));*/
 +
 +
        if (best) {
 +
                i = best->desc.bConfigurationValue;
 +
 +
*** Needs (why?) disabling of some suspend features
 +
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
 +
index ecffb2a..1577e7a 100644
 +
--- a/drivers/usb/otg/twl4030-usb.c
 +
+++ b/drivers/usb/otg/twl4030-usb.c
 +
@@ -480,7 +480,7 @@ extern void musb_restore_ctx_and_resume(struct usb_gadget *gadget);
 +
 +
static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
 +
{
 +
-      if (twl->asleep)
 +
+      if (!twl->asleep)
 +
                return;
 +
 +
        twl4030_phy_power(twl, 0);
 +
 +
*** Needs (why?) manual step-through to get device recognised, enumerated, etc
 +
pcsuite-enable.sh
 +
echo H >/proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo e > /proc/driver/musb_hdrc
 +
echo F > /proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo H >/proc/driver/musb_hdrc
 +
echo I > /proc/driver/musb_hdrc
 +
echo host >/sys/devices/platform/musb_hdrc/mode
 +
echo H >/proc/driver/musb_hdrc
 +
echo "Done echo'ing"
 +
#echo "Connect the flash drive in 3 seconds!"
 +
stop bme; sleep 3; i2cset -y -m 0x07 2 0x6b 0x01 0x05; while true; do sleep 28; i2cset -y -m 0x80 2 0x6b 0x00 0x80; done
 +
 +
*** How can it switch out of "waiting Vbus to rise" state?
 +
*** No way to distinguish between full-speed and high-speed modes
 +
by just looking at the D+, D- states (via debug register of isp1704),
 +
needs special care
 +
 +
** BME
 +
*** Messes with charging so should be disabled
 +
stop bme
 +
*** Incapable of providing VBUS to external device
 +
One can use ``i2cset -y -m 0x07 2 0x6b 0x01 0x05'' instead to enable
 +
the reverse boost converter and ``i2cset -y -m 0x80 2 0x6b 0x00 0x80''
 +
to disable
 +
 +
** twl4030-usb.c
 +
*** Gets in the way by switching states behind your back
 +
Switches state to b_idle if the ID pin is not grounded), so should be
 +
(at least partially) disabled.
 +
*** Is registered as an OTG controller
 +
Should we provide a minimal OTG driver for isp1407 instead? Or should
 +
we rather get the whole stuff somehow working and then try to port the
 +
upstream driver (it's supposed to be saner)?
 +
 +
** musb
 +
*** SESSREQ (Session request) interrupt preconditions?
 +
*** CONNECT interrupt preconditions?
 +
 +
</pre>

Revision as of 07:00, 6 February 2014

N900 (rx51) hostmode notes

There were several (semi-) successful encounters of using the
hostmode, some via tricking the OTG statemachine, some via
implementing the FORCE_HOST testmode properly, we'll concentrate on
the latter

* Hardware
The detailed overview is at http://wiki.maemo.org/N900_Hardware_USB

** There're leaked schematics

** There're datasheets for SoC (spurf98d is the best version) and
ISP1707/1074

** Comparision with N8x0
*** Same USB core
*** N8x0 uses a discrete component TUSB6010 that integrates musb core and phy
while N900 uses SoC-integrated musb with ISP1707 PHY via ULPI link
*** ID pin of the USB core on N8x0 can be forcibly grounded
programmatically, thus activating the host mode in the core, not
possible with ISP1707
*** ID pin is connected to the micro-usb receptable on N8x0, but some
stupid decided to not route it to ISP1707 on N900 (he routed it to
TWL4030 instead)

** The battery charger chip is controlled via i2c and can
supply 5V/200mA on usb vbus when asked to.
** twl4030 has connection to the ID pin and can sense it
OTG-like operation (at least automatic switching to/from hostmode)
possible?


* Software
** Driver
*** Shitty
*** There's a considerably improved version at linux-omap
(nobody's tried to use it on N900 so far)
*** Needs implementation of forced hostmode via one of the testmodes
See the patchsets in the repository, there're no incremental patches
accompanied by the meaningful logs (yet); when it starts working,
implement it in a separate file as a "platform" function for ``echo
host >/sys/devices/platform/musb_hdrc/mode'' to start working.
*** Needs (why?) disabling of some current limiting features
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index 7e912f2..b51e5ea 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -97,10 +97,10 @@ int usb_choose_configuration(struct usb_device *udev)
                 */
 
                /* Rule out configs that draw too much bus current */
-               if (c->desc.bMaxPower * 2 > udev->bus_mA) {
+               /*if (c->desc.bMaxPower * 2 > udev->bus_mA) {
                        insufficient_power++;
                        continue;
-               }
+               }*/
 
                /* When the first config's first interface is one of Microsoft's
                 * pet nonstandard Ethernet-over-USB protocols, ignore it unless
@@ -132,10 +132,10 @@ int usb_choose_configuration(struct usb_device *udev)
                        best = c;
        }
 
-       if (insufficient_power > 0)
+       /*if (insufficient_power > 0)
                dev_info(&udev->dev, "rejected %d configuration%s "
                        "due to insufficient available bus power\n",
-                       insufficient_power, plural(insufficient_power));
+                       insufficient_power, plural(insufficient_power));*/
 
        if (best) {
                i = best->desc.bConfigurationValue;

*** Needs (why?) disabling of some suspend features
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index ecffb2a..1577e7a 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -480,7 +480,7 @@ extern void musb_restore_ctx_and_resume(struct usb_gadget *gadget);
 
 static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
 {
-       if (twl->asleep)
+       if (!twl->asleep)
                return;
 
        twl4030_phy_power(twl, 0);

*** Needs (why?) manual step-through to get device recognised, enumerated, etc
pcsuite-enable.sh
echo H >/proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo e > /proc/driver/musb_hdrc
echo F > /proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo H >/proc/driver/musb_hdrc
echo I > /proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo H >/proc/driver/musb_hdrc
echo "Done echo'ing"
#echo "Connect the flash drive in 3 seconds!"
stop bme; sleep 3; i2cset -y -m 0x07 2 0x6b 0x01 0x05; while true; do sleep 28; i2cset -y -m 0x80 2 0x6b 0x00 0x80; done

*** How can it switch out of "waiting Vbus to rise" state?
*** No way to distinguish between full-speed and high-speed modes
by just looking at the D+, D- states (via debug register of isp1704),
needs special care

** BME
*** Messes with charging so should be disabled
stop bme
*** Incapable of providing VBUS to external device
One can use ``i2cset -y -m 0x07 2 0x6b 0x01 0x05'' instead to enable
the reverse boost converter and ``i2cset -y -m 0x80 2 0x6b 0x00 0x80''
to disable

** twl4030-usb.c
*** Gets in the way by switching states behind your back
Switches state to b_idle if the ID pin is not grounded), so should be
(at least partially) disabled.
*** Is registered as an OTG controller
Should we provide a minimal OTG driver for isp1407 instead? Or should
we rather get the whole stuff somehow working and then try to port the
upstream driver (it's supposed to be saner)?

** musb
*** SESSREQ (Session request) interrupt preconditions?
*** CONNECT interrupt preconditions?
<pre>
N900 (rx51) hostmode notes

There were several (semi-) successful encounters of using the
hostmode, some via tricking the OTG statemachine, some via
implementing the FORCE_HOST testmode properly, we'll concentrate on
the latter

* Hardware
The detailed overview is at http://wiki.maemo.org/N900_Hardware_USB

** There're leaked schematics

** There're datasheets for SoC (spurf98d is the best version) and
ISP1707/1074

** Comparision with N8x0
*** Same USB core
*** N8x0 uses a discrete component TUSB6010 that integrates musb core and phy
while N900 uses SoC-integrated musb with ISP1707 PHY via ULPI link
*** ID pin of the USB core on N8x0 can be forcibly grounded
programmatically, thus activating the host mode in the core, not
possible with ISP1707
*** ID pin is connected to the micro-usb receptable on N8x0, but some
stupid decided to not route it to ISP1707 on N900 (he routed it to
TWL4030 instead)

** The battery charger chip is controlled via i2c and can
supply 5V/200mA on usb vbus when asked to.
** twl4030 has connection to the ID pin and can sense it
OTG-like operation (at least automatic switching to/from hostmode)
possible?


* Software
** Driver
*** Shitty
*** There's a considerably improved version at linux-omap
(nobody's tried to use it on N900 so far)
*** Needs implementation of forced hostmode via one of the testmodes
See the patchsets in the repository, there're no incremental patches
accompanied by the meaningful logs (yet); when it starts working,
implement it in a separate file as a "platform" function for ``echo
host >/sys/devices/platform/musb_hdrc/mode'' to start working.
*** Needs (why?) disabling of some current limiting features
diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
index 7e912f2..b51e5ea 100644
--- a/drivers/usb/core/generic.c
+++ b/drivers/usb/core/generic.c
@@ -97,10 +97,10 @@ int usb_choose_configuration(struct usb_device *udev)
                 */
 
                /* Rule out configs that draw too much bus current */
-               if (c->desc.bMaxPower * 2 > udev->bus_mA) {
+               /*if (c->desc.bMaxPower * 2 > udev->bus_mA) {
                        insufficient_power++;
                        continue;
-               }
+               }*/
 
                /* When the first config's first interface is one of Microsoft's
                 * pet nonstandard Ethernet-over-USB protocols, ignore it unless
@@ -132,10 +132,10 @@ int usb_choose_configuration(struct usb_device *udev)
                        best = c;
        }
 
-       if (insufficient_power > 0)
+       /*if (insufficient_power > 0)
                dev_info(&udev->dev, "rejected %d configuration%s "
                        "due to insufficient available bus power\n",
-                       insufficient_power, plural(insufficient_power));
+                       insufficient_power, plural(insufficient_power));*/
 
        if (best) {
                i = best->desc.bConfigurationValue;

*** Needs (why?) disabling of some suspend features
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index ecffb2a..1577e7a 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -480,7 +480,7 @@ extern void musb_restore_ctx_and_resume(struct usb_gadget *gadget);
 
 static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off)
 {
-       if (twl->asleep)
+       if (!twl->asleep)
                return;
 
        twl4030_phy_power(twl, 0);

*** Needs (why?) manual step-through to get device recognised, enumerated, etc
pcsuite-enable.sh
echo H >/proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo e > /proc/driver/musb_hdrc
echo F > /proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo H >/proc/driver/musb_hdrc
echo I > /proc/driver/musb_hdrc
echo host >/sys/devices/platform/musb_hdrc/mode
echo H >/proc/driver/musb_hdrc
echo "Done echo'ing"
#echo "Connect the flash drive in 3 seconds!"
stop bme; sleep 3; i2cset -y -m 0x07 2 0x6b 0x01 0x05; while true; do sleep 28; i2cset -y -m 0x80 2 0x6b 0x00 0x80; done

*** How can it switch out of "waiting Vbus to rise" state?
*** No way to distinguish between full-speed and high-speed modes
by just looking at the D+, D- states (via debug register of isp1704),
needs special care

** BME
*** Messes with charging so should be disabled
stop bme
*** Incapable of providing VBUS to external device
One can use ``i2cset -y -m 0x07 2 0x6b 0x01 0x05'' instead to enable
the reverse boost converter and ``i2cset -y -m 0x80 2 0x6b 0x00 0x80''
to disable

** twl4030-usb.c
*** Gets in the way by switching states behind your back
Switches state to b_idle if the ID pin is not grounded), so should be
(at least partially) disabled.
*** Is registered as an OTG controller
Should we provide a minimal OTG driver for isp1407 instead? Or should
we rather get the whole stuff somehow working and then try to port the
upstream driver (it's supposed to be saner)?

** musb
*** SESSREQ (Session request) interrupt preconditions?
*** CONNECT interrupt preconditions?