[Gta04-owner] [Letux-kernel] Openmoke charger detection

Andreas Kemnade andreas at kemnade.info
Sun Dec 30 09:58:29 CET 2018

On Sun, 30 Dec 2018 08:42:49 +0100
"H. Nikolaus Schaller" <hns at goldelico.com> wrote:

> Hi Andreas,
> > Am 29.12.2018 um 22:14 schrieb Andreas Kemnade <andreas at kemnade.info>:
> > 
> > Hi,
> > 
> > On Sat, 29 Dec 2018 17:36:18 +0100
> > Andreas Kemnade <andreas at kemnade.info> wrote:
> >   
> >> Hi,
> >> 
> >> I heard reports there that some people have usb problems if the
> >> gta04 is booted with usb cable attached, so the cable needs to be
> >> re-attached. I do not have the trouble.
> >> Before doing more research, one thing comes to my mind. The id pin
> >> status check. I have disabled it in my systems because I do not have an
> >> openmoke charger anymore. I think I have forgotten it on some trip.
> >> If the id status pin check is done during probing, I am quite sure
> >> that there is a race condition that under some circumstances triggers.
> >> 
> >> What I am wondering here is: Are people still using the om charger so
> >> that it is something worth fixing? Or is it simply enough to disable
> >> the om charger check in the udev rules.  
> Well, I use the OM charger sometimes. But the effect is visible with
> usb cable to some host. So I think it is not related to charger detection.
> >> 
> >> I will probably try to use a fresh, plain letux system and try to
> >> reproduce problems there. The id pin status check was just something 
> >> coming to my mind. If there is a race condition involved I might also
> >> be just on the lucky side.
> >>   
> > ok, fresh letux-lxde + letux-4.20:
> > poweron->wait->ssh via usb->shutdown -h 0->wait till off
> > 
> > a dozen times. USB was connected all the time. No problems. So perhaps
> > not the charger detection.  
> Yes it is strange. I only see this on GTA04. Not on BeagleBone or Pyra
> or Udoo neo. The effect is that it needs:
> poweron->wait->login->ifdown usb0->ifup usb0->ssh via usb->shutdown -h 0->wait till off
> Maybe it is something with dhcpd or ifup run automatically during boot.
> It may run too early if cable is already connected.
> Hm. Or is it the charger detection although it starts up with 500mA
> (USB client cable)? I can try by disabling the udev rule.
The point there is not the current set but that reading out id pin
status is not trivial or atomic. 

static ssize_t twl4030_usb_id_show(struct device *dev,
                struct device_attribute *attr, char *buf)
        int ret;
        int n = 0;
        struct twl4030_usb *twl = dev_get_drvdata(dev);

        twl4030_i2c_access(twl, 1);
        ret = twl4030_usb_read(twl, ULPI_OTG_CTRL);
        if ((ret < 0) || (!(ret & ULPI_OTG_ID_PULLUP))) {
                 * enable ID pullup so that the id pin state can be measured,
                 * seems to be disabled sometimes for some reasons
                dev_dbg(dev, "ULPI_OTG_ID_PULLUP not set (%x)\n", ret);
                twl4030_usb_set_bits(twl, ULPI_OTG_CTRL, ULPI_OTG_ID_PULLUP);
        ret = twl4030_usb_read(twl, ID_STATUS);
        twl4030_i2c_access(twl, 0);
        if (ret < 0)
                return ret;

At least that looks dangerous if that is run during device probe
(triggered by udev rule to check for that 100k resistor in the om
charger). twl4030_i2c_access needs usecounting probably. Is the problem
only limited to your mac or do you see it also with other devices?
Do you see that on mainline?

Does it also happen with g_ether in /etc/modules instead of if-pre-up?
And then using this stanza in /etc/network/interfaces:
auto usb0
allow-hotplug usb0
iface usb0 inet static
        # set up OpenDNS by default
        up echo nameserver >/etc/resolv.conf

Well, I tried both (plain letux setup and the above), no difference.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20181230/91e67034/attachment.asc>

More information about the Gta04-owner mailing list