Controlling the System Controller GPIO from Linux IMX8QM

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Controlling the System Controller GPIO from Linux IMX8QM

561 Views
st3v3n
Contributor I

I have a custom board using the IMX8QM and I need to be able to control the SCU GPIO from linux.

I have enabled the scu gpio from the kernel found the imx_scu gpio driver.


Added the libgpiod and when doing gpioinfo I was able to see scu gpio showing with 8 lines, but when I try to read a value from it using 'gpioget gpiochip8 4'   I get the following:


imxscfw_get: failed -22

gpioget: error reading GPIO values: Invalid argument

 


Added this to the device tree:


scu_gpio0: scu-gpio0 {
compatible = "fsl,imx-scu-gpio";
gpio-controller;
#gpio-cells = <2>;
#interrupt-cells = <2>;
};

 

Using buildroot to build the linux(5.15.5) and bootloader.

SCFW Version:

imx-scfw-porting-kit-1.14.0

Labels (1)
Tags (4)
0 Kudos
Reply
1 Reply

532 Views
joanxie
NXP TechSupport
NXP TechSupport

pls add more debug information in the function as below to check which one is wrong, it seems this gpio you add doesn't controlled by the scu correctly,

if (offset >= sizeof(sc_arr)/sizeof(unsigned int))
return err;

err = imx_sc_misc_get_control(scu->handle, sc_arr[offset],
0, &level)

https://github.com/nxp-imx/linux-imx/blob/lf-5.15.y/drivers/gpio/gpio-scu.c#L37

0 Kudos
Reply