devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Romain Izard <romain.izard.pro@gmail.com>
To: Linux GPIO List <linux-gpio@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	devicetree@vger.kernel.org
Subject: Device probing proceeds even when the default pinctrl state is invalid
Date: Thu, 18 Feb 2016 11:37:08 +0100	[thread overview]
Message-ID: <CAGkQfmOHgOoFrVyKtB+vpmwqs5s2DnLay9zjaksFj5Rbn+4h0g@mail.gmail.com> (raw)

Hello Linus,

The current code for device probing tries to map the default pinctrl
state (in pinctrl_bind_pins), but is returning 0 or -EDEFER. If there
is an other error, it is not reported. This means that devices that do
not have any specified pinctrl state can be probed, which is a correct
behaviour that should be conserved, but it can also be an issue, as it
will fail to report any other issue with the specified pinctrl state.

Did I miss something that would explain why all other errors are ignored ?

This also leads to a larger problem, as currently the device tree for
existing boards may specify invalid pinctrl configurations, but the
boards look like they work correctly, as long as nothing else tries to
use the same pins. Correcting the issue may require a new
'strict-mapping' property in the pinctrl node in the device tree,
otherwise this correction would be an ABI regression.

Is this pattern really a good one ? We're moving away from describing
hardware in here.

For an existing example, in the device tree for Atmel's
SAMA5D2_Xplained board, the mapping for the Ethernet transceiver's IRQ
line was missing it bias configuration, and thus the pins were not
reserved for the Ethernet use. I've just send a patch to correct it,
but breaking Ethernet on kernel upgrade for the boards using the
previous revisions would be an issue.

I encountered this problem because I wanted to model in device tree a
system where the main SoC running Linux is connected to a secondary
chip, using two different protocols on the same pins. Using the
SAMA5D2's pin muxing, the secondary chip can be accessed either by a
serial port in normal use, or by bitbanging on the multiplexed GPIOs
when programming it. I created two devices with conflicting pinctrl
configurations, expecting only one of them to be successfully probed,
and to use the "bind" and "unbind" sysfs files to select the correct
driver. Choosing which device to probe first on startup is an other
issue in this case, that remains to be addressed.

In the current state of things, both devices are probed successfully
as conflicting pin sets are not recognized as an issue, which means
that my use case does not work.

Is the direction I'm taking something correct ?

Best regards,
-- 
Romain Izard

             reply	other threads:[~2016-02-18 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18 10:37 Romain Izard [this message]
2016-02-18 20:07 ` Device probing proceeds even when the default pinctrl state is invalid Linus Walleij
2016-02-19 13:30   ` romain izard
2016-02-19 13:54     ` Ludovic Desroches

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=CAGkQfmOHgOoFrVyKtB+vpmwqs5s2DnLay9zjaksFj5Rbn+4h0g@mail.gmail.com \
    --to=romain.izard.pro@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    /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).