This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Using GPIO in driver linux 6

Part Number: PROCESSOR-SDK-AM62X

Tool/software:

Hello,

I’m trying to use a GPIO on the AM6X-SK board with kernel 6.4.16. Specifically, I want to use GPIO0_42, which is intended to be controlled in a driver with:

status = gpio_request(42, "SPI_HANDSHAKE_PIN");

However, I’m encountering an error -517.

I added the following to my device tree (k3-am625-sk.dts):

       mygpio0_pins_default: mygpio0-default-pins {
               pinctrl-single,pins = <
                       AM62X_IOPAD(0x00ac, PIN_INPUT, 7) /* (L21) CPMC0_CSn1.GPIO0_42 */
                       AM62X_IOPAD(0x009c, PIN_INPUT, 7) /* (V25) GPMC0_WAIT1.GPIO0_38 */
                       AM62X_IOPAD(0x00a0, PIN_INPUT, 7) /* (K25) GPMC0_WPn.GPIO0_39 */
               >;
        };

};

&main_gpio0 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&mygpio0_pins_default>;

};

Can anyone point out what might be wrong with my configuration or why I am getting this error?

Thanks in advance!

Translator

qetzgry

Hello,

I’m trying to use a GPIO on the AM6X-SK board with kernel 6.4.16. Specifically, I want to use GPIO0_42, which is intended to be controlled in a driver with:

ggreTranslato
  • Hello,

    We cannot provide support on the E2E Forums about Linux Kernel 6.4 because TI does not test nor validate Linux Kernel 6.4 since its not packaged with our Linux SDK.

    From the device tree you provided, there doesn't seem to be an issue in either node. Error 517 code is listed here: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/include/linux/errno.h?h=ti-linux-6.6.y

    Best Regards,

    Anshu

  • Hi,

    Maybe you can check sys/kernel/debug/gpio interface to verify the exact gpio num.

    For example,

    In my system, gpio-567 is GPIO0_31.

    root@am62axx-evm:~# cat /sys/kernel/debug/gpio
    gpiochip0: GPIOs 512-535, parent: platform/4201000.gpio, 4201000.gpio:

    gpiochip1: GPIOs 536-627, parent: platform/600000.gpio, 600000.gpio:
    gpio-567 ( |vddshv_sdio ) out lo

    gpiochip2: GPIOs 628-679, parent: platform/601000.gpio, 601000.gpio:
    gpio-677 ( |am62a-sk:green:heart) out lo

    And dts can also config this gpio, and get it in driver.

    vddshv_sdio_pins_default: vddshv-sdio-default-pins {
    pinctrl-single,pins = <
    AM62AX_IOPAD(0x07c, PIN_OUTPUT, 7) /* (M19) GPMC0_CLK.GPIO0_31 */
    >;
    };

    vddshv_sdio: regulator-5 {
    ...
    pinctrl-0 = <&vddshv_sdio_pins_default>;
    ...
    gpios = <&main_gpio0 31 GPIO_ACTIVE_HIGH>;
    ...
    };