All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mark Brown <broonie@kernel.org>
Cc: Tomasz Figa <tomasz.figa@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
	Arend van Spriel <arend@broadcom.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Chris Ball <chris@printf.net>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Maxime Ripard <maxime.ripard@free-electrons.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	devicetree <devicetree@vger.kernel.org>,
	Olof Johansson <olof@lixom.net>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Fabio Estevam <festevam@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Jyri Sarha <jsarha@ti.com>
Subject: Re: RFC: representing sdio devices oob interrupt, clks, etc. in device tree
Date: Mon, 26 May 2014 16:59:38 +0200	[thread overview]
Message-ID: <538356DA.7090302@redhat.com> (raw)
In-Reply-To: <20140526142225.GF22111@sirena.org.uk>

Hi,

On 05/26/2014 04:22 PM, Mark Brown wrote:
> On Mon, May 26, 2014 at 01:12:43PM +0200, Hans de Goede wrote:
>> On 05/26/2014 12:38 PM, Mark Brown wrote:
>>> On Sun, May 25, 2014 at 09:20:52PM +0200, Hans de Goede wrote:
> 
>>> until we've powered up and enumerated.  The only time that there's a
>>> problem and would need to specify exactly what the device is in the DTS
>>> is if we need the custom sequence prior to being able to do that at
>>> which point I don't see much option.
> 
>> Specified != driver available. Determining whether or not we should power
>> up based purely on there being a compatible string is not going to work, as
>> even when using simple powerup we still need compatible strings for non
>> powerup settings like sdio signal drive strength, oob irq, etc.
> 
> If there are compatible strings but not one we've heard of then we're
> back in the situation where we may as well not bother powering up in the
> first place since we've no idea what to do with the device once it's
> powered.  If we fall down a list of compatibles and decide that the
> only thing we know about the device is that we can power it up (this is
> distinct from the case where we probe the device) I'd expect the device
> to be turned off.

We won't know if we have a valid driver until we power on the device,
and probe it, not all sdio drivers will have compatibles, actually most of
them won't since sdio is a discoverable bus.

> 
>> So the only way this will work is if we delay powerup until we've a driver
>> available, which may be never if the module is not build, or whatever,
>> and without powerup the user is never going to figure out he is missing
>> a module. Basically adding a driver flag for blacklisting from the simple
>> power up logic means inserting an unnecessary initialization ordering issue,
>> which we really don't need as each ordering dependency is usually one too many.
> 
> I'm afraid I'm really not seeing a substantial problem either way here,
> powering up the device isn't going to help us find a driver for it and
> the UI around reporting that the device is there without a driver should
> hopefully be unaffected by its power state.

How can the UI be unaffected if we cannot tell userspace that there is
a device there and what its vendor / product ids are ?  We need to power
up the device before it will respond to probes...

> 
>>> I don't understand why not powering the device up would be a sensible
>>> default or why other OSs would also choose to implement things that way.
> 
>> Because if we are not 100% sure that our simple power up logic will do the
>> job properly (i.e. in the right order), then the SAFE thing to do is to
>> not power up.
> 
> So long as we've got a clear way of saying that we might need to do
> something special I don't think we should have an issue either way;
> it's mostly a case of how we specify.
> 
>> What if a user takes an older distro kernel, where the driver does not
>> set the opt-out flag you're suggesting since at that time it did not
>> have its own power logic, then tries to boot that with a dtb file written
>> for a newer kernel (where the driver does have the opt out flag), and we
>> start powering up things in the wrong order and let the magic smoke out
>> of various components on the board ?
> 
> Conversely what if someone fixes a bug in the standard power up sequence
> in a newer version of the kernel but then tries to run older software?
> There's plenty of ways things can go wrong with this stuff.
> 
>> Also note that this is a perfectly standard use of compatibles, compatibles
>> are typically used to indicate which driver should be used, in this case
>> the compatible indicates that the simple powerup driver should be used,
>> where as if another powerup driver should be used another compatbile will
>> be there instead.
> 
> We don't typically actually bind multiple compatibles for a single
> device.  We've got a bunch of options we can choose from but we
> generally pick the one that matches best and ignore the others.
> 
>> Where as what you're suggesting is to always pick driver foo, unless
>> driver bar is available and has a special flag saying to not use foo, this
>> is a whole new way to use compatibles really, and not one which I think
>> we want to introduce.
> 
> I'm not sure I'm buying the idea that we have a powerup driver that's
> meaningfully not part of the main device driver.

Well, if we merge some variant of Olof's code, we will have a powerup driver
that is part of the mmc core, and thus not of the sdio function driver.

>>> Well, if things aren't going to work either way for these devices
>>> without extra stuff it seems it doesn't much matter but it helps the
>>> simple case to have things default to working.
> 
>> The simple case still needs a child node describing the needed resources,
>> adding a compatible = "simple-sdio-powerup" to that at the same as creating
>> the child node in the first place really is no extra effort at all.
> 
> From where I'm sitting it's more effort since instead of just putting
> the device in there (and possibly also some other devices that are
> software compatible) we have to put in another compatible string which
> is really just a boolean flag to be used in conjunction with the others.
> That's harder to think about and we clearly don't want to go through the
> compatible list, decide that we don't know how to handle the device
> except power it up so go and do that.
> 
> If it were done as something like "set boolean property X or
> powerup-method = Y in the card description" or whatever it'd seem a bit
> annoying but not a big deal, I think it's the fact that it's getting put
> into the compatible list that's really concerning me.

Ok, so lets switch it over to a boolean, options for the name I see are:

linux,mmc-host-powerup  (opt in to powerup being dealt with by the mmc core, implementation specific)
simple-powerup		(platform neutral opt in to say just enable all resources and be done with it)
custom-powerup		(platform neutral opt out version of simple-powerup)
linux,custom-powerup	(same, but consider this something linux specific)

I think that it may be best to go with one of the 2 linux prefixed options.

Regards,

Hans

WARNING: multiple messages have this Message-ID (diff)
From: hdegoede@redhat.com (Hans de Goede)
To: linux-arm-kernel@lists.infradead.org
Subject: RFC: representing sdio devices oob interrupt, clks, etc. in device tree
Date: Mon, 26 May 2014 16:59:38 +0200	[thread overview]
Message-ID: <538356DA.7090302@redhat.com> (raw)
In-Reply-To: <20140526142225.GF22111@sirena.org.uk>

Hi,

On 05/26/2014 04:22 PM, Mark Brown wrote:
> On Mon, May 26, 2014 at 01:12:43PM +0200, Hans de Goede wrote:
>> On 05/26/2014 12:38 PM, Mark Brown wrote:
>>> On Sun, May 25, 2014 at 09:20:52PM +0200, Hans de Goede wrote:
> 
>>> until we've powered up and enumerated.  The only time that there's a
>>> problem and would need to specify exactly what the device is in the DTS
>>> is if we need the custom sequence prior to being able to do that at
>>> which point I don't see much option.
> 
>> Specified != driver available. Determining whether or not we should power
>> up based purely on there being a compatible string is not going to work, as
>> even when using simple powerup we still need compatible strings for non
>> powerup settings like sdio signal drive strength, oob irq, etc.
> 
> If there are compatible strings but not one we've heard of then we're
> back in the situation where we may as well not bother powering up in the
> first place since we've no idea what to do with the device once it's
> powered.  If we fall down a list of compatibles and decide that the
> only thing we know about the device is that we can power it up (this is
> distinct from the case where we probe the device) I'd expect the device
> to be turned off.

We won't know if we have a valid driver until we power on the device,
and probe it, not all sdio drivers will have compatibles, actually most of
them won't since sdio is a discoverable bus.

> 
>> So the only way this will work is if we delay powerup until we've a driver
>> available, which may be never if the module is not build, or whatever,
>> and without powerup the user is never going to figure out he is missing
>> a module. Basically adding a driver flag for blacklisting from the simple
>> power up logic means inserting an unnecessary initialization ordering issue,
>> which we really don't need as each ordering dependency is usually one too many.
> 
> I'm afraid I'm really not seeing a substantial problem either way here,
> powering up the device isn't going to help us find a driver for it and
> the UI around reporting that the device is there without a driver should
> hopefully be unaffected by its power state.

How can the UI be unaffected if we cannot tell userspace that there is
a device there and what its vendor / product ids are ?  We need to power
up the device before it will respond to probes...

> 
>>> I don't understand why not powering the device up would be a sensible
>>> default or why other OSs would also choose to implement things that way.
> 
>> Because if we are not 100% sure that our simple power up logic will do the
>> job properly (i.e. in the right order), then the SAFE thing to do is to
>> not power up.
> 
> So long as we've got a clear way of saying that we might need to do
> something special I don't think we should have an issue either way;
> it's mostly a case of how we specify.
> 
>> What if a user takes an older distro kernel, where the driver does not
>> set the opt-out flag you're suggesting since at that time it did not
>> have its own power logic, then tries to boot that with a dtb file written
>> for a newer kernel (where the driver does have the opt out flag), and we
>> start powering up things in the wrong order and let the magic smoke out
>> of various components on the board ?
> 
> Conversely what if someone fixes a bug in the standard power up sequence
> in a newer version of the kernel but then tries to run older software?
> There's plenty of ways things can go wrong with this stuff.
> 
>> Also note that this is a perfectly standard use of compatibles, compatibles
>> are typically used to indicate which driver should be used, in this case
>> the compatible indicates that the simple powerup driver should be used,
>> where as if another powerup driver should be used another compatbile will
>> be there instead.
> 
> We don't typically actually bind multiple compatibles for a single
> device.  We've got a bunch of options we can choose from but we
> generally pick the one that matches best and ignore the others.
> 
>> Where as what you're suggesting is to always pick driver foo, unless
>> driver bar is available and has a special flag saying to not use foo, this
>> is a whole new way to use compatibles really, and not one which I think
>> we want to introduce.
> 
> I'm not sure I'm buying the idea that we have a powerup driver that's
> meaningfully not part of the main device driver.

Well, if we merge some variant of Olof's code, we will have a powerup driver
that is part of the mmc core, and thus not of the sdio function driver.

>>> Well, if things aren't going to work either way for these devices
>>> without extra stuff it seems it doesn't much matter but it helps the
>>> simple case to have things default to working.
> 
>> The simple case still needs a child node describing the needed resources,
>> adding a compatible = "simple-sdio-powerup" to that at the same as creating
>> the child node in the first place really is no extra effort at all.
> 
> From where I'm sitting it's more effort since instead of just putting
> the device in there (and possibly also some other devices that are
> software compatible) we have to put in another compatible string which
> is really just a boolean flag to be used in conjunction with the others.
> That's harder to think about and we clearly don't want to go through the
> compatible list, decide that we don't know how to handle the device
> except power it up so go and do that.
> 
> If it were done as something like "set boolean property X or
> powerup-method = Y in the card description" or whatever it'd seem a bit
> annoying but not a big deal, I think it's the fact that it's getting put
> into the compatible list that's really concerning me.

Ok, so lets switch it over to a boolean, options for the name I see are:

linux,mmc-host-powerup  (opt in to powerup being dealt with by the mmc core, implementation specific)
simple-powerup		(platform neutral opt in to say just enable all resources and be done with it)
custom-powerup		(platform neutral opt out version of simple-powerup)
linux,custom-powerup	(same, but consider this something linux specific)

I think that it may be best to go with one of the 2 linux prefixed options.

Regards,

Hans

  reply	other threads:[~2014-05-26 15:00 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  9:49 RFC: representing sdio devices oob interrupt, clks, etc. in device tree Hans de Goede
2014-05-22  9:49 ` Hans de Goede
2014-05-22 10:23 ` Chen-Yu Tsai
2014-05-22 10:23   ` Chen-Yu Tsai
2014-05-22 11:38   ` Hans de Goede
2014-05-22 11:38     ` Hans de Goede
2014-05-22 17:20     ` Tomasz Figa
2014-05-22 17:20       ` Tomasz Figa
2014-05-23  9:13       ` Hans de Goede
2014-05-23  9:13         ` Hans de Goede
2014-05-23 11:22         ` Mark Brown
2014-05-23 11:22           ` Mark Brown
2014-05-23 11:50           ` Hans de Goede
2014-05-23 11:50             ` Hans de Goede
2014-05-23 13:21             ` Arend van Spriel
2014-05-23 13:21               ` Arend van Spriel
2014-05-23 13:28               ` Hans de Goede
2014-05-23 13:28                 ` Hans de Goede
2014-05-23 14:54                 ` Arend van Spriel
2014-05-23 14:54                   ` Arend van Spriel
2014-05-24 10:10                   ` Hans de Goede
2014-05-24 10:10                     ` Hans de Goede
2014-05-23 16:27             ` Mark Brown
2014-05-23 16:27               ` Mark Brown
2014-05-24 10:06               ` Hans de Goede
2014-05-24 10:06                 ` Hans de Goede
2014-05-25 12:34                 ` Mark Brown
2014-05-25 12:34                   ` Mark Brown
2014-05-25 19:20                   ` Hans de Goede
2014-05-25 19:20                     ` Hans de Goede
2014-05-26  7:51                     ` Arend van Spriel
2014-05-26  7:51                       ` Arend van Spriel
2014-05-26  7:59                       ` Chen-Yu Tsai
2014-05-26  7:59                         ` Chen-Yu Tsai
2014-05-26  8:07                         ` Hans de Goede
2014-05-26  8:07                           ` Hans de Goede
2014-05-26  9:08                           ` Arend van Spriel
2014-05-26  9:08                             ` Arend van Spriel
2014-05-26 10:38                     ` Mark Brown
2014-05-26 10:38                       ` Mark Brown
2014-05-26 11:12                       ` Hans de Goede
2014-05-26 11:12                         ` Hans de Goede
2014-05-26 14:22                         ` Mark Brown
2014-05-26 14:22                           ` Mark Brown
2014-05-26 14:59                           ` Hans de Goede [this message]
2014-05-26 14:59                             ` Hans de Goede
2014-05-26 16:07                             ` Ulf Hansson
2014-05-26 16:07                               ` Ulf Hansson
2014-05-26 16:14                               ` Mark Brown
2014-05-26 16:14                                 ` Mark Brown
2014-05-26 17:55                               ` Hans de Goede
2014-05-26 17:55                                 ` Hans de Goede
2014-05-27 13:50                                 ` Ulf Hansson
2014-05-27 13:50                                   ` Ulf Hansson
2014-05-27 17:53                                   ` Mark Brown
2014-05-27 17:53                                     ` Mark Brown
2014-05-27 18:55                                     ` Olof Johansson
2014-05-27 18:55                                       ` Olof Johansson
2014-05-27 20:27                                       ` Arend van Spriel
2014-05-27 20:27                                         ` Arend van Spriel
2014-05-28  8:43                                       ` Ulf Hansson
2014-05-28  8:43                                         ` Ulf Hansson
2014-05-28  8:19                                     ` Ulf Hansson
2014-05-28  8:19                                       ` Ulf Hansson
2014-05-28 11:03                                       ` Mark Brown
2014-05-28 11:03                                         ` Mark Brown
2014-06-03 10:57                                         ` Ulf Hansson
2014-06-03 10:57                                           ` Ulf Hansson
2014-06-04 15:55                                           ` Mark Brown
2014-06-04 15:55                                             ` Mark Brown
2014-06-09 14:07                                             ` Ulf Hansson
2014-06-09 14:07                                               ` Ulf Hansson
2014-05-28  9:42                                   ` Hans de Goede
2014-05-28  9:42                                     ` Hans de Goede
2014-05-28 10:12                                     ` Arend van Spriel
2014-05-28 10:12                                       ` Arend van Spriel
2014-05-28 10:27                                       ` Hans de Goede
2014-05-28 10:27                                         ` Hans de Goede
2014-05-28 11:47                                     ` Tomasz Figa
2014-05-28 11:47                                       ` Tomasz Figa
     [not found]                                       ` <5385CCE6.9070204-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-28 16:43                                         ` Mark Brown
2014-05-28 16:43                                           ` Mark Brown
2014-05-30  8:17                                           ` Hans de Goede
2014-05-30  8:17                                             ` Hans de Goede
2014-06-03 10:14                                     ` Ulf Hansson
2014-06-03 10:14                                       ` Ulf Hansson
2014-06-03 11:07                                       ` Hans de Goede
2014-06-03 11:07                                         ` Hans de Goede
2014-06-03 12:58                                         ` Ulf Hansson
2014-06-03 12:58                                           ` Ulf Hansson
2014-06-03 13:06                                           ` Hans de Goede
2014-06-03 13:06                                             ` Hans de Goede
2014-06-03 13:28                                             ` Ulf Hansson
2014-06-03 13:28                                               ` Ulf Hansson
2014-05-27 15:47                                 ` Mark Brown
2014-05-27 15:47                                   ` Mark Brown
2014-05-23 13:34       ` Ulf Hansson
2014-05-23 13:34         ` Ulf Hansson
2014-05-23 16:47       ` Olof Johansson
2014-05-23 16:47         ` Olof Johansson
2014-05-24 10:09         ` Hans de Goede
2014-05-24 10:09           ` Hans de Goede

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=538356DA.7090302@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=arend@broadcom.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=chris@printf.net \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=jsarha@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=maxime.ripard@free-electrons.com \
    --cc=olof@lixom.net \
    --cc=s.hauer@pengutronix.de \
    --cc=tomasz.figa@gmail.com \
    --cc=ulf.hansson@linaro.org \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.