linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: l.stach@pengutronix.de (Lucas Stach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/4] dt-bindings: Add pinctrl bindings for mt65xx/mt81xx.
Date: Thu, 02 Oct 2014 16:41:29 +0200	[thread overview]
Message-ID: <1412260889.4875.11.camel@pengutronix.de> (raw)
In-Reply-To: <CACRpkdbiKSvX2dipnq3oyc6YSGWFgCk69onzF=-B9UWLjAYNWQ@mail.gmail.com>

Am Donnerstag, den 02.10.2014, 16:00 +0200 schrieb Linus Walleij:
> On Tue, Sep 23, 2014 at 5:39 AM, Hongzhou.Yang
> <srv_hongzhou.yang@mediatek.com> wrote:
> 
> > From: Hongzhou Yang <hongzhou.yang@mediatek.com>
> >
> > Add devicetree bindings for Mediatek SoC pinctrl driver.
> >
> > Signed-off-by: Hongzhou Yang <hongzhou.yang@mediatek.com>
> 
> I have worked on generic pin control bindings a bit because it
> is getting out of hand with all these custom bindings.
> 
> See:
> http://marc.info/?l=devicetree&m=141223584006648&w=2
> 
> Especially.
> 
> > +- mediatek,pinfunc: List of gpio number and function to mux.
> 
> A "GPIO number" and a "pin number" is not the same thing at all,
> this is very confusing. Those are two separate number spaces.
> This is likely about the pin numbers.
> 
> > +The mediatek,pinfunc can use defines directly,
> > +which are already defind in boot/dts/mt8135-pinfunc.h.
> > +
> > +Optional subnode-properties:
> > +- generic pin configuration option to use, bias-disable, bias-pull-down,
> > +  bias-pull,up, output-low and output-high are valid.
> > +  Example :
> > +       i2c0_pins_a {
> > +               mediatek,pinfunc = <MT8135_PIN_195_SDA1__FUNC_SDA1>;
> > +               bias-disable;
> > +       };
> 
> I don't like this approach at all.
> 
> I prefer that pins are put into groups named by strings, like "i2c0-pos0"
> inside the driver and then connected to function with a certain
> device-related name, such as "i2c0".
> 
So we should create artificial software groups where there are none in
hardware? This sounds really backward to me. Almost every new SoC out
there has the ability to mux every pin on it's own.

By defining artificial software groups in the driver we are pushing
constraints in the binding that don't really exist in hardware. So if
someone comes up with a pin usage that isn't covered by the existing
groups we need to change the binding. Experience from working with lots
of hardware engineers tells us that if something can be done (if there
are no constraints in HW) it will be done sooner or later.
If the hardware allows this much freedom we should also allow it in the
pinctrl binding.

> Then put the pin configuration (bias etc) in a separate node in the same
> state definition like that:
> 
> i2c0_pins_a {
>          function = "i2c0";
>          groups = "i2c0-pos0";
> };
> i2c0_pins_b {
>          bias-disable;
> };

The problem with that is that different pins might need different
configuration for the same muxed function. To properly reflect this we
would need to duplicate the pin definitions. One popular example is the
MMC interface where part of the pins need to have a pull-up, while
others don't. How would you reflect this with the DT description above?

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

  reply	other threads:[~2014-10-02 14:41 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  3:39 [PATCH v2 0/4] Add Mediatek SoC Pinctrl/GPIO driver for MT8135 Hongzhou.Yang
2014-09-23  3:39 ` [PATCH v2 1/4] arm: mediatek: Add config option for mediatek SoCs Hongzhou.Yang
2014-09-23  3:39 ` [PATCH v2 2/4] ARM: mediatek: Add Pinctrl/GPIO driver for mt8135 Hongzhou.Yang
2014-10-02 13:38   ` Linus Walleij
2014-10-06 10:35     ` Joe.C
2014-10-21  9:08       ` Linus Walleij
2014-09-23  3:39 ` [PATCH v2 3/4] dt-bindings: Add pinctrl bindings for mt65xx/mt81xx Hongzhou.Yang
2014-10-02 14:00   ` Linus Walleij
2014-10-02 14:41     ` Lucas Stach [this message]
2014-10-21  8:45       ` Linus Walleij
2014-09-23  3:39 ` [PATCH v2 4/4] ARM: dts: mt8135: Add pinctrl node for mt8135 Hongzhou.Yang
2014-09-23 13:03   ` Arnd Bergmann
2014-09-23 13:58     ` Joe.C
2014-09-23 14:10       ` Arnd Bergmann
2014-09-23 14:29         ` Joe.C
2014-09-23 14:55         ` Sascha Hauer
2014-09-23 14:16       ` Chen-Yu Tsai
2014-09-23 15:08         ` Joe.C
2014-09-24 11:23   ` Linus Walleij
2014-09-24 12:40     ` Sascha Hauer
2014-09-26  5:32       ` Sascha Hauer
2014-10-02 14:02       ` Linus Walleij
2014-10-02 14:28         ` Lucas Stach
2014-10-21  8:58           ` Linus Walleij
2014-10-06  7:18         ` Sascha Hauer
2014-10-21  9:02           ` Linus Walleij
2014-09-23 13:28 ` [PATCH v2 0/4] Add Mediatek SoC Pinctrl/GPIO driver for MT8135 Matthias Brugger

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=1412260889.4875.11.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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).