Re: am335x: GPIOs in userspace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Drew,

On Mon, May 30, 2022 at 12:55 AM Drew Fustini <drew@xxxxxxxxxxxxxxx> wrote:
>
> On Fri, May 27, 2022 at 1:01 PM Yegor Yefremov
> <yegorslists@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxx/
> >
> > 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



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux