linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Chris Ball <chris@printf.net>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	GTA04 owners <gta04-owner@goldelico.com>,
	Doug Anderson <dianders@chromium.org>,
	Olof Johansson <olof@lixom.net>, Arnd Bergmann <arnd@arndb.de>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 1/2] mmc: core: allow a reset gpio to be configured.
Date: Tue, 2 Dec 2014 12:55:39 +1100	[thread overview]
Message-ID: <20141202125539.42f22074@notabene.brown> (raw)
In-Reply-To: <CAPDyKFrx98NspRU1nV3uJ6XwTuA4tZQkrYTfDoeXGR+f5htODQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3199 bytes --]

On Fri, 28 Nov 2014 12:56:33 +0100 Ulf Hansson <ulf.hansson@linaro.org> wrote:

> On 8 November 2014 at 01:14, NeilBrown <neilb@suse.de> wrote:
> > If the regulator supplying an SDIO device is shared
> > with another device, the turning the regulator 'on' and 'off'
> > will not actually cycle power and so will not reset
> > the device.
> >
> > This is particularly a problem for some wi2si wireless modules which
> > have a BT module on chip and can share power lines.
> > Without the power-cycle, subsequent reset commands fail.
> >
> > So allow a 'reset' gpio to be specified.  If provided, the
> > line is asserted during power-up.
> 
> There have been several attempts to fix similar issues as this patch
> does. The latest one I posted a few month ago, which wasn't accepted.
> http://comments.gmane.org/gmane.linux.power-management.general/46635

Thanks for that link.

> 
> There has also been some off-list discussions on especially how we
> should describe this in DT and there were actually some consensus made
> around that. Still I haven't seen any patches on the mailing lists.

Wish I could have a link for those off-list discussions :-)

Based on what I read and my own thoughts about other devices that I'm having
trouble managing I wonder if the right approach might be to admit that these
buses are *not* 100% discoverable.

i.e. you can discover what is there once it is turned on, but you cannot
discover how to turn it on.

So the *fix* is to allow attached devices to be explicitly listed.
In my case I would create a child node of the mmc1 node, which is
compatible="libertas,wifi" (or whatever the proper name is).

Then when the mmc1 wants to power-up, it does:

   device_for_each_child(mmc_dev, NULL, power_up)

where:

static int power_up(struct device *dev, void *data)
{
       pm_runtime_get_sync(dev);
       return 0;
}

Then I can put my reset-line management in the libertas driver instead of
trying to include some of it in the mmc driver.

This has the advantage of the devicetree actually describing the hardware
(there is a libertas wifi SDIO chip attached) rather than the behaviour
(please turn on this regulator and toggle this GPIO to initialise the device).

I want to do a very similar thing for UARTs (so my GPS and Bluetooth turn on
when /dev/ttyO? is opened), and I've been thinking about something similar
for USB - I have a USB attached GSM module, but it also has an Audio link and
some reset/interrupt lines that need to be configured.
If I could say to device tree "This USB port has this device attached", I
think it would be a step in the right direction.



> 
> So to summarize, I am really concerned that we keep having these power
> sequence issues for SDIO devices and right now the discussion has been
> on hold. I am considering to hack on it myself, since I am tired of
> waiting. :-)

Please Cc me if you do.  Meanwhile I'll try to hack together code supporting
my latest idea and let you know if I get anywhere.

> 
> Regarding this patch, I don't intent to apply it.

Fair enough, I'm starting to not like it so much anyway.

Thanks,
NeilBrown



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

  parent reply	other threads:[~2014-12-02  1:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-08  0:14 [PATCH 0/2] mmc: improve power-on for sdio wifi card NeilBrown
2014-11-08  0:14 ` [PATCH 1/2] mmc: core: allow a reset gpio to be configured NeilBrown
2014-11-28 11:56   ` Ulf Hansson
2014-11-28 14:45     ` Mark Brown
2014-12-02  1:55     ` NeilBrown [this message]
2014-12-02  6:05       ` [Gta04-owner] " Dr. H. Nikolaus Schaller
2014-12-02 12:11       ` Ulf Hansson
2014-11-08  0:14 ` [PATCH 2/2] mmc: core: reset sdio card properly on resume NeilBrown
2014-11-10 13:29   ` Ulf Hansson
     [not found]     ` <CAPDyKFrrOozTO5xR8RO=4L8xZ9hLGizH=2mxZE=5zvwMhhgD+w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-11-11  0:17       ` NeilBrown
2014-11-11  8:12         ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141202125539.42f22074@notabene.brown \
    --to=neilb@suse.de \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=gta04-owner@goldelico.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).