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