mbox series

[0/3] pinctrl: sunxi: Start to enforce the strict mode

Message ID cover.7a61d0bb31530def29efd8b4286d8c0afdaab347.1507236823.git-series.maxime.ripard@free-electrons.com
Headers show
Series pinctrl: sunxi: Start to enforce the strict mode | expand

Message

Maxime Ripard Oct. 5, 2017, 8:54 p.m. UTC
Hi,

Here is an attempt to enable pinctrl's strict mode on our pinctrl drivers.
Indeed, our controllers should have had that mode enabled since its
introduction.

However, there's a number of issues with old device trees that prevent from
just enabling it for all the devices. There's basically two of them:

  - Most of our old DTs have a pinctrl node for GPIOs, which will result in
    an error when the driver is going to request the gpio because it would
    already be requested automatically by pinctrl. We cannot break those.

  - Some of these GPIOs also need to change their pin configuration to add
    a bias or change the current output, and there isn't a migration path.

Let's just keep the old behaviour for the old SoCs, and enforce it on the
new one, and enabled it by default so that the situation at least doesn't
get worse.

This has been tested on an A83t (strict on) and an H3 (strict off) board.

Let me know what you think,
Maxime

Maxime Ripard (3):
  pinctrl: sunxi: Introduce the strict flag
  pinctrl: sunxi: Disable strict mode for old pinctrl drivers
  pinctrl: sunxi: Enforce the strict mode by default

 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-
 drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +
 drivers/pinctrl/sunxi/pinctrl-sunxi.c     | 6 +++++-
 drivers/pinctrl/sunxi/pinctrl-sunxi.h     | 1 +
 9 files changed, 14 insertions(+), 2 deletions(-)

base-commit: c27ad2958485126c3828e59d53013d3b45ec14f2
-- 
git-series 0.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chen-Yu Tsai Oct. 6, 2017, 8:34 a.m. UTC | #1
On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Old pinctrl drivers will need to disable strict mode for various reasons,

> among which:

>   - Some DT will still have a pinctrl group for each GPIO used, which will

>     be rejected by pin_request. While we could remove those nodes, we still

>     have to deal with old DTs.

>   - Some GPIOs on these boards need to have their pin configuration changed

>     (for bias or current), and there's no clear migration path

>

> Let's disable the strict mode on those SoCs so that there's no breakage.

>

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

> ---

>  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +

>  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +

>  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +

>  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +

>  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +

>  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-

>  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +


You should also set it for the R_PIO drivers.
IIRC you removed some entries for them in your
other patchset.

Otherwise,

Acked-by: Chen-Yu Tsai <wens@csie.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chen-Yu Tsai Oct. 6, 2017, 8:34 a.m. UTC | #2
On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> The strict mode should always have been enabled on our driver, and leaving

> it unchecked just makes it harder to find a migration path as time passes.

>

> Let's enable it by default now so that hopefully the new SoCs should be

> safe.

>

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>


Acked-by: Chen-Yu Tsai <wens@csie.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Maxime Ripard Oct. 9, 2017, 8:45 a.m. UTC | #3
Hi,

On Fri, Oct 06, 2017 at 08:34:07AM +0000, Chen-Yu Tsai wrote:
> On Fri, Oct 6, 2017 at 4:54 AM, Maxime Ripard

> <maxime.ripard@free-electrons.com> wrote:

> > Old pinctrl drivers will need to disable strict mode for various reasons,

> > among which:

> >   - Some DT will still have a pinctrl group for each GPIO used, which will

> >     be rejected by pin_request. While we could remove those nodes, we still

> >     have to deal with old DTs.

> >   - Some GPIOs on these boards need to have their pin configuration changed

> >     (for bias or current), and there's no clear migration path

> >

> > Let's disable the strict mode on those SoCs so that there's no breakage.

> >

> > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

> > ---

> >  drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1 +

> >  drivers/pinctrl/sunxi/pinctrl-sun5i.c     | 1 +

> >  drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 1 +

> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a23.c | 1 +

> >  drivers/pinctrl/sunxi/pinctrl-sun8i-a33.c | 1 +

> >  drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c  | 3 ++-

> >  drivers/pinctrl/sunxi/pinctrl-sun9i-a80.c | 1 +

> 

> You should also set it for the R_PIO drivers.  IIRC you removed some

> entries for them in your other patchset.


I'll look into the R_PIO that can be switched on, but we won't be able
to enable that flag on the one where we removed nodes.

That would break the old DTs.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com