All of lore.kernel.org
 help / color / mirror / Atom feed
* am335x: GPIOs in userspace
@ 2022-05-27 11:01 Yegor Yefremov
  2022-05-29 22:56 ` Drew Fustini
  0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov @ 2022-05-27 11:01 UTC (permalink / raw)
  To: Linux-OMAP

I have the following problem. The latest kernel version I am using for
my devices is 5.4.x. In my DTS I don't explicitly expose the GPIOs to
the usespace but I can read input both via sysfs as also libgpiod API.

With the newest kernel like 5.17 or 5.18, I can read the same input
pin but I always read 0. I have also tried to add my GPIOs as
"default" into the am33xx_pinmux section (the way it is done in [1]) but
it didn't help.

[1] https://patchwork.kernel.org/project/linux-omap/patch/20200712103717.1219765-1-drew@beagleboard.org/

Regards,
Yegor

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

* Re: am335x: GPIOs in userspace
  2022-05-27 11:01 am335x: GPIOs in userspace Yegor Yefremov
@ 2022-05-29 22:56 ` Drew Fustini
  2022-05-30 10:04   ` Yegor Yefremov
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Fustini @ 2022-05-29 22:56 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: Linux-OMAP

On Fri, May 27, 2022 at 1:01 PM Yegor Yefremov
<yegorslists@googlemail.com> wrote:
>
> I have the following problem. The latest kernel version I am using for
> my devices is 5.4.x. In my DTS I don't explicitly expose the GPIOs to
> the usespace but I can read input both via sysfs as also libgpiod API.
>
> With the newest kernel like 5.17 or 5.18, I can read the same input
> pin but I always read 0. I have also tried to add my GPIOs as
> "default" into the am33xx_pinmux section (the way it is done in [1]) but
> it didn't help.
>
> [1] https://patchwork.kernel.org/project/linux-omap/patch/20200712103717.1219765-1-drew@beagleboard.org/
>
> Regards,
> Yegor

Hello Yegor,

Which am335x board are you using?  Is it the PocketBeagle?

Have you tried reverting abe4e4675dfc ("ARM: dts: am335x-pocketbeagle:
set default mux for gpio pins") to see if the results change?

Please post the dts files you created or modified so I can better
familiarize myself with your environment.

Unfortunately, I'm currently traveling with only a BeagleBone Black,
but it might be useful for testing depending on what the issue is.

Thanks,
Drew

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

* Re: am335x: GPIOs in userspace
  2022-05-29 22:56 ` Drew Fustini
@ 2022-05-30 10:04   ` Yegor Yefremov
  2022-06-14 12:32     ` Yegor Yefremov
  0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov @ 2022-05-30 10:04 UTC (permalink / raw)
  To: Drew Fustini; +Cc: Linux-OMAP

Hello Drew,

On Mon, May 30, 2022 at 12:55 AM Drew Fustini <drew@beagleboard.org> wrote:
>
> On Fri, May 27, 2022 at 1:01 PM Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
> >
> > I have the following problem. The latest kernel version I am using for
> > my devices is 5.4.x. In my DTS I don't explicitly expose the GPIOs to
> > the usespace but I can read input both via sysfs as also libgpiod API.
> >
> > With the newest kernel like 5.17 or 5.18, I can read the same input
> > pin but I always read 0. I have also tried to add my GPIOs as
> > "default" into the am33xx_pinmux section (the way it is done in [1]) but
> > it didn't help.
> >
> > [1] https://patchwork.kernel.org/project/linux-omap/patch/20200712103717.1219765-1-drew@beagleboard.org/
> >
> > Regards,
> > Yegor
>
> Hello Yegor,
>
> Which am335x board are you using?  Is it the PocketBeagle?
>
> Have you tried reverting abe4e4675dfc ("ARM: dts: am335x-pocketbeagle:
> set default mux for gpio pins") to see if the results change?
>
> Please post the dts files you created or modified so I can better
> familiarize myself with your environment.
>
> Unfortunately, I'm currently traveling with only a BeagleBone Black,
> but it might be useful for testing depending on what the issue is.

This is a diff to the DTS of our board Baltos ir5221:

diff --git a/arch/arm/boot/dts/am335x-baltos-ir5221.dts
b/arch/arm/boot/dts/am335x-baltos-ir5221.dts
index 2f3872dbf4f4..f596cc60e9c0 100644
--- a/arch/arm/boot/dts/am335x-baltos-ir5221.dts
+++ b/arch/arm/boot/dts/am335x-baltos-ir5221.dts
@@ -18,6 +18,19 @@
 };

 &am33xx_pinmux {
+       compatible = "pinconf-single";
+       pinctrl-names = "default";
+
+       pinctrl-0 =   < &wifi_switch>;
+
+       wifi_switch: pinmux_wifi_switch {
+               pinctrl-single,pins = <
+                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1,
PIN_INPUT_PULLUP, MUX_MODE7)      /* spi0_cs1.gpio0[6] wifi switch */
+               >;
+               pinctrl-single,bias-pullup   =   < 0x10  0x10  0x00  0x18>;
+               pinctrl-single,bias-pulldown   = < 0x10  0x00  0x10  0x18>;
+       };
+
        tca6416_pins: pinmux_tca6416_pins {
                pinctrl-single,pins = <
                        AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1,
PIN_INPUT_PULLUP, MUX_MODE7)      /* xdma_event_intr1.gpio0[20]
tca6416 stuff */

This is my related kernel configuration:

# zcat /proc/config.gz | grep "PINCTRL\|PINCONF"
CONFIG_PINCTRL=y
CONFIG_GENERIC_PINCTRL_GROUPS=y
CONFIG_PINCONF=y
CONFIG_GENERIC_PINCONF=y
CONFIG_DEBUG_PINCTRL=y
# CONFIG_PINCTRL_MCP23S08 is not set
# CONFIG_PINCTRL_MICROCHIP_SGPIO is not set
# CONFIG_PINCTRL_OCELOT is not set
# CONFIG_PINCTRL_PALMAS is not set
CONFIG_PINCTRL_SINGLE=y
# CONFIG_PINCTRL_STMFX is not set
# CONFIG_PINCTRL_SX150X is not set
CONFIG_PINCTRL_TI_IODELAY=y

This command should deliver "1":

# gpioget gpiochip0 6
[   55.371155] gpio gpiochip0: Persistence not supported for GPIO 6
[   55.377503] gpio gpiochip0: registered chardev handle for line 6
[   55.383611] gpio gpiochip0: registered chardev handle for 1 lines
0

Regards,
Yegor

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

* Re: am335x: GPIOs in userspace
  2022-05-30 10:04   ` Yegor Yefremov
@ 2022-06-14 12:32     ` Yegor Yefremov
  2022-06-15  8:31       ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Yegor Yefremov @ 2022-06-14 12:32 UTC (permalink / raw)
  To: Drew Fustini; +Cc: Linux-OMAP

Hi Drew,

On Mon, May 30, 2022 at 12:04 PM Yegor Yefremov
<yegorslists@googlemail.com> wrote:
>
> Hello Drew,
>
> On Mon, May 30, 2022 at 12:55 AM Drew Fustini <drew@beagleboard.org> wrote:
> >
> > On Fri, May 27, 2022 at 1:01 PM Yegor Yefremov
> > <yegorslists@googlemail.com> wrote:
> > >
> > > I have the following problem. The latest kernel version I am using for
> > > my devices is 5.4.x. In my DTS I don't explicitly expose the GPIOs to
> > > the usespace but I can read input both via sysfs as also libgpiod API.
> > >
> > > With the newest kernel like 5.17 or 5.18, I can read the same input
> > > pin but I always read 0. I have also tried to add my GPIOs as
> > > "default" into the am33xx_pinmux section (the way it is done in [1]) but
> > > it didn't help.
> > >
> > > [1] https://patchwork.kernel.org/project/linux-omap/patch/20200712103717.1219765-1-drew@beagleboard.org/
> > >
> > > Regards,
> > > Yegor
> >
> > Hello Yegor,
> >
> > Which am335x board are you using?  Is it the PocketBeagle?
> >
> > Have you tried reverting abe4e4675dfc ("ARM: dts: am335x-pocketbeagle:
> > set default mux for gpio pins") to see if the results change?
> >
> > Please post the dts files you created or modified so I can better
> > familiarize myself with your environment.
> >
> > Unfortunately, I'm currently traveling with only a BeagleBone Black,
> > but it might be useful for testing depending on what the issue is.
>
> This is a diff to the DTS of our board Baltos ir5221:
>
> diff --git a/arch/arm/boot/dts/am335x-baltos-ir5221.dts
> b/arch/arm/boot/dts/am335x-baltos-ir5221.dts
> index 2f3872dbf4f4..f596cc60e9c0 100644
> --- a/arch/arm/boot/dts/am335x-baltos-ir5221.dts
> +++ b/arch/arm/boot/dts/am335x-baltos-ir5221.dts
> @@ -18,6 +18,19 @@
>  };
>
>  &am33xx_pinmux {
> +       compatible = "pinconf-single";
> +       pinctrl-names = "default";
> +
> +       pinctrl-0 =   < &wifi_switch>;
> +
> +       wifi_switch: pinmux_wifi_switch {
> +               pinctrl-single,pins = <
> +                       AM33XX_PADCONF(AM335X_PIN_SPI0_CS1,
> PIN_INPUT_PULLUP, MUX_MODE7)      /* spi0_cs1.gpio0[6] wifi switch */
> +               >;
> +               pinctrl-single,bias-pullup   =   < 0x10  0x10  0x00  0x18>;
> +               pinctrl-single,bias-pulldown   = < 0x10  0x00  0x10  0x18>;
> +       };
> +
>         tca6416_pins: pinmux_tca6416_pins {
>                 pinctrl-single,pins = <
>                         AM33XX_PADCONF(AM335X_PIN_XDMA_EVENT_INTR1,
> PIN_INPUT_PULLUP, MUX_MODE7)      /* xdma_event_intr1.gpio0[20]
> tca6416 stuff */
>
> This is my related kernel configuration:
>
> # zcat /proc/config.gz | grep "PINCTRL\|PINCONF"
> CONFIG_PINCTRL=y
> CONFIG_GENERIC_PINCTRL_GROUPS=y
> CONFIG_PINCONF=y
> CONFIG_GENERIC_PINCONF=y
> CONFIG_DEBUG_PINCTRL=y
> # CONFIG_PINCTRL_MCP23S08 is not set
> # CONFIG_PINCTRL_MICROCHIP_SGPIO is not set
> # CONFIG_PINCTRL_OCELOT is not set
> # CONFIG_PINCTRL_PALMAS is not set
> CONFIG_PINCTRL_SINGLE=y
> # CONFIG_PINCTRL_STMFX is not set
> # CONFIG_PINCTRL_SX150X is not set
> CONFIG_PINCTRL_TI_IODELAY=y
>
> This command should deliver "1":
>
> # gpioget gpiochip0 6
> [   55.371155] gpio gpiochip0: Persistence not supported for GPIO 6
> [   55.377503] gpio gpiochip0: registered chardev handle for line 6
> [   55.383611] gpio gpiochip0: registered chardev handle for 1 lines
> 0

I found the problem. Between 5.10 and 5.11 gpiochip assignment has
changed: gpiochip1 -> gpiochip4. Hence, I'll have to work with gpio
labels.

Regards,
Yegor

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

* Re: am335x: GPIOs in userspace
  2022-06-14 12:32     ` Yegor Yefremov
@ 2022-06-15  8:31       ` Tony Lindgren
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2022-06-15  8:31 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: Drew Fustini, Linux-OMAP

* Yegor Yefremov <yegorslists@googlemail.com> [220614 12:32]:
> I found the problem. Between 5.10 and 5.11 gpiochip assignment has
> changed: gpiochip1 -> gpiochip4. Hence, I'll have to work with gpio
> labels.

OK good to hear you found the problem.

Tony

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

end of thread, other threads:[~2022-06-15  8:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27 11:01 am335x: GPIOs in userspace Yegor Yefremov
2022-05-29 22:56 ` Drew Fustini
2022-05-30 10:04   ` Yegor Yefremov
2022-06-14 12:32     ` Yegor Yefremov
2022-06-15  8:31       ` Tony Lindgren

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.