linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: Support pin that does not support configuration option
@ 2021-01-30  8:21 Michael Trimarchi
  2021-02-01 11:47 ` Fabio Estevam
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Trimarchi @ 2021-01-30  8:21 UTC (permalink / raw)
  To: Linus Walleij, Dong Aisheng
  Cc: linux-gpio, linux-kernel, Fabio Estevam, Sascha Hauer,
	Michael Trimarchi, Angelo Compagnucci

Some of the iMX25 pins have not an associated configuration register so
when they are configured the standard way through the device tree the
kernel complains with:

imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
config function

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Tested-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 drivers/pinctrl/core.c                  | 2 +-
 drivers/pinctrl/freescale/pinctrl-imx.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9fc4433fece4..7115b0b5689c 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1273,7 +1273,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
 			break;
 		}
 
-		if (ret < 0) {
+		if (ret < 0 && ret != -ENOTSUPP) {
 			goto unapply_new_state;
 		}
 
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index daf28bc5661d..2c7c1de9cca7 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -356,7 +356,7 @@ static int imx_pinconf_get_mmio(struct pinctrl_dev *pctldev, unsigned pin_id,
 	if (pin_reg->conf_reg == -1) {
 		dev_err(ipctl->dev, "Pin(%s) does not support config function\n",
 			info->pins[pin_id].name);
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 
 	*config = readl(ipctl->base + pin_reg->conf_reg);
@@ -391,7 +391,7 @@ static int imx_pinconf_set_mmio(struct pinctrl_dev *pctldev,
 	if (pin_reg->conf_reg == -1) {
 		dev_err(ipctl->dev, "Pin(%s) does not support config function\n",
 			info->pins[pin_id].name);
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 
 	dev_dbg(ipctl->dev, "pinconf set pin %s\n",
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: Support pin that does not support configuration option
  2021-01-30  8:21 [PATCH] pinctrl: Support pin that does not support configuration option Michael Trimarchi
@ 2021-02-01 11:47 ` Fabio Estevam
  2021-02-01 11:53   ` Michael Nazzareno Trimarchi
  0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2021-02-01 11:47 UTC (permalink / raw)
  To: Michael Trimarchi
  Cc: Linus Walleij, Dong Aisheng, open list:GPIO SUBSYSTEM,
	linux-kernel, Sascha Hauer, Angelo Compagnucci

Hi Michael,

On Sat, Jan 30, 2021 at 5:21 AM Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Some of the iMX25 pins have not an associated configuration register so
> when they are configured the standard way through the device tree the
> kernel complains with:
>
> imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
> config function

Could you please share your device tree that causes this warning?

Shouldn't you pass 0x80000000 in the devicetree for this pad then?

0x80000000 means that the kernel should not touch the PAD_CTL register
and use the default configuration from the bootloader/POR.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: Support pin that does not support configuration option
  2021-02-01 11:47 ` Fabio Estevam
@ 2021-02-01 11:53   ` Michael Nazzareno Trimarchi
  2021-02-12  8:26     ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Nazzareno Trimarchi @ 2021-02-01 11:53 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Linus Walleij, Dong Aisheng, open list:GPIO SUBSYSTEM,
	linux-kernel, Sascha Hauer, Angelo Compagnucci

Hi Fabio

On Mon, Feb 1, 2021 at 12:47 PM Fabio Estevam <festevam@gmail.com> wrote:
>
> Hi Michael,
>
> On Sat, Jan 30, 2021 at 5:21 AM Michael Trimarchi
> <michael@amarulasolutions.com> wrote:
> >
> > Some of the iMX25 pins have not an associated configuration register so
> > when they are configured the standard way through the device tree the
> > kernel complains with:
> >
> > imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
> > config function
>
> Could you please share your device tree that causes this warning?
>
> Shouldn't you pass 0x80000000 in the devicetree for this pad then?
>
> 0x80000000 means that the kernel should not touch the PAD_CTL register
> and use the default configuration from the bootloader/POR.

arch/arm/boot/dts/imx25-lisa.dts:
MX25_PAD_EXT_ARMCLK__GPIO_3_15  0x80000000

The problem that exists pad that can be muxed but not configured

Michael


-- 
Michael Nazzareno Trimarchi
Amarula Solutions BV
COO Co-Founder
Cruquiuskade 47 Amsterdam 1018 AM NL
T. +31(0)851119172
M. +39(0)3479132170
[`as] https://www.amarulasolutions.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: Support pin that does not support configuration option
  2021-02-01 11:53   ` Michael Nazzareno Trimarchi
@ 2021-02-12  8:26     ` Linus Walleij
  2021-02-12  8:31       ` Michael Nazzareno Trimarchi
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2021-02-12  8:26 UTC (permalink / raw)
  To: Michael Nazzareno Trimarchi
  Cc: Fabio Estevam, Dong Aisheng, open list:GPIO SUBSYSTEM,
	linux-kernel, Sascha Hauer, Angelo Compagnucci

On Mon, Feb 1, 2021 at 12:54 PM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:
> On Mon, Feb 1, 2021 at 12:47 PM Fabio Estevam <festevam@gmail.com> wrote:
> >
> > Hi Michael,
> >
> > On Sat, Jan 30, 2021 at 5:21 AM Michael Trimarchi
> > <michael@amarulasolutions.com> wrote:
> > >
> > > Some of the iMX25 pins have not an associated configuration register so
> > > when they are configured the standard way through the device tree the
> > > kernel complains with:
> > >
> > > imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
> > > config function
> >
> > Could you please share your device tree that causes this warning?
> >
> > Shouldn't you pass 0x80000000 in the devicetree for this pad then?
> >
> > 0x80000000 means that the kernel should not touch the PAD_CTL register
> > and use the default configuration from the bootloader/POR.
>
> arch/arm/boot/dts/imx25-lisa.dts:
> MX25_PAD_EXT_ARMCLK__GPIO_3_15  0x80000000
>
> The problem that exists pad that can be muxed but not configured

Did you reach any conclusion on this?

I need Fabio's consent to apply the patch, but it seems maybe the
DTS should be changed instead?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: Support pin that does not support configuration option
  2021-02-12  8:26     ` Linus Walleij
@ 2021-02-12  8:31       ` Michael Nazzareno Trimarchi
  2021-02-13 11:26         ` Michael Nazzareno Trimarchi
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Nazzareno Trimarchi @ 2021-02-12  8:31 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Fabio Estevam, Dong Aisheng, open list:GPIO SUBSYSTEM,
	linux-kernel, Sascha Hauer, Angelo Compagnucci

Hi

On Fri, Feb 12, 2021 at 9:26 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Mon, Feb 1, 2021 at 12:54 PM Michael Nazzareno Trimarchi
> <michael@amarulasolutions.com> wrote:
> > On Mon, Feb 1, 2021 at 12:47 PM Fabio Estevam <festevam@gmail.com> wrote:
> > >
> > > Hi Michael,
> > >
> > > On Sat, Jan 30, 2021 at 5:21 AM Michael Trimarchi
> > > <michael@amarulasolutions.com> wrote:
> > > >
> > > > Some of the iMX25 pins have not an associated configuration register so
> > > > when they are configured the standard way through the device tree the
> > > > kernel complains with:
> > > >
> > > > imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
> > > > config function
> > >
> > > Could you please share your device tree that causes this warning?
> > >
> > > Shouldn't you pass 0x80000000 in the devicetree for this pad then?
> > >
> > > 0x80000000 means that the kernel should not touch the PAD_CTL register
> > > and use the default configuration from the bootloader/POR.
> >
> > arch/arm/boot/dts/imx25-lisa.dts:
> > MX25_PAD_EXT_ARMCLK__GPIO_3_15  0x80000000
> >
> > The problem that exists pad that can be muxed but not configured
>
> Did you reach any conclusion on this?
>
> I need Fabio's consent to apply the patch, but it seems maybe the
> DTS should be changed instead?
>

Let me re-check with the latest linux code. I did not find any change
there. It's on my side
now

Michael

> Yours,
> Linus Walleij



-- 
Michael Nazzareno Trimarchi
Amarula Solutions BV
COO Co-Founder
Cruquiuskade 47 Amsterdam 1018 AM NL
T. +31(0)851119172
M. +39(0)3479132170
[`as] https://www.amarulasolutions.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] pinctrl: Support pin that does not support configuration option
  2021-02-12  8:31       ` Michael Nazzareno Trimarchi
@ 2021-02-13 11:26         ` Michael Nazzareno Trimarchi
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Nazzareno Trimarchi @ 2021-02-13 11:26 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Fabio Estevam, Dong Aisheng, open list:GPIO SUBSYSTEM,
	linux-kernel, Sascha Hauer, Angelo Compagnucci

Hi Fabio

On Fri, Feb 12, 2021 at 9:31 AM Michael Nazzareno Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Hi
>
> On Fri, Feb 12, 2021 at 9:26 AM Linus Walleij <linus.walleij@linaro.org> wrote:
> >
> > On Mon, Feb 1, 2021 at 12:54 PM Michael Nazzareno Trimarchi
> > <michael@amarulasolutions.com> wrote:
> > > On Mon, Feb 1, 2021 at 12:47 PM Fabio Estevam <festevam@gmail.com> wrote:
> > > >
> > > > Hi Michael,
> > > >
> > > > On Sat, Jan 30, 2021 at 5:21 AM Michael Trimarchi
> > > > <michael@amarulasolutions.com> wrote:
> > > > >
> > > > > Some of the iMX25 pins have not an associated configuration register so
> > > > > when they are configured the standard way through the device tree the
> > > > > kernel complains with:
> > > > >
> > > > > imx25-pinctrl 43fac000.iomuxc: Pin(MX25_PAD_EXT_ARMCLK) does not support
> > > > > config function
> > > >
> > > > Could you please share your device tree that causes this warning?
> > > >
> > > > Shouldn't you pass 0x80000000 in the devicetree for this pad then?
> > > >
> > > > 0x80000000 means that the kernel should not touch the PAD_CTL register
> > > > and use the default configuration from the bootloader/POR.
> > >
> > > arch/arm/boot/dts/imx25-lisa.dts:
> > > MX25_PAD_EXT_ARMCLK__GPIO_3_15  0x80000000
> > >
> > > The problem that exists pad that can be muxed but not configured
> >
> > Did you reach any conclusion on this?
> >
> > I need Fabio's consent to apply the patch, but it seems maybe the
> > DTS should be changed instead?
> >
>
> Let me re-check with the latest linux code. I did not find any change
> there. It's on my side
> now

Looking at the code (I will ask to check on real hw) seems that
conf_reg is -1 when there is no conf_reg.
the pinmux core set_state just calls the pin_config_set and one pin
can have the mux supported and the config
not supported. And imx25 has several of them that are only muxed.
Seems that this NO_CTL_PAD is something
that is nxp

 clk_osc_audio: clk-osc-audio {
                compatible = "gpio-gate-clock";
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_clk26mhz_osc>;
                clocks = <&clksis>;
                #clock-cells = <0>;
                enable-gpios = <&gpio3 15 GPIO_ACTIVE_LOW>;
        };

this is my use case
 pinctrl_clk26mhz_osc: clk26mhzosc {
                        fsl,pins = <
                                MX25_PAD_EXT_ARMCLK__GPIO_3_15  0x80000000
                        >;
                };

Michael




>
> Michael
>
> > Yours,
> > Linus Walleij
>
>
>
> --
> Michael Nazzareno Trimarchi
> Amarula Solutions BV
> COO Co-Founder
> Cruquiuskade 47 Amsterdam 1018 AM NL
> T. +31(0)851119172
> M. +39(0)3479132170
> [`as] https://www.amarulasolutions.com



-- 
Michael Nazzareno Trimarchi
Amarula Solutions BV
COO Co-Founder
Cruquiuskade 47 Amsterdam 1018 AM NL
T. +31(0)851119172
M. +39(0)3479132170
[`as] https://www.amarulasolutions.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-13 11:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-30  8:21 [PATCH] pinctrl: Support pin that does not support configuration option Michael Trimarchi
2021-02-01 11:47 ` Fabio Estevam
2021-02-01 11:53   ` Michael Nazzareno Trimarchi
2021-02-12  8:26     ` Linus Walleij
2021-02-12  8:31       ` Michael Nazzareno Trimarchi
2021-02-13 11:26         ` Michael Nazzareno Trimarchi

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).