i.MX8M/8X GPIO probe failed

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

i.MX8M/8X GPIO probe failed

i.MX8M/8X GPIO probe failed

Symptoms

 

When configure a gpio pin for a driver in the dts/dtsi file like below example,

 

e.g.

 

a-switch {

           compatible = "a-switch-driver";

           pinctrl-names = "default";

           pinctrl-0 = <&pinctrl_switch>;

           gpios = <&lsio_gpio1 1 GPIO_ACTIVE_HIGH>;

           status = "okay";

};

 

pinctrl_switch: switch_gpio {
    fsl,pins = < IMX8QXP_SPI2_SDO_LSIO_GPIO1_IO01    0x21 >;
};

 

then you may get the error when request the gpio in the driver during the kernel boot up.

 

Error message like this:

a-switch: failed to request gpio

a-switch: probe of a-switch failed with error -22

 

Linux version: L5.4.x

 

Diagnosis

 

Because the gpio_mxc_init function run before the function imx_scu_driver_init. The pm_domains for gpio is not ready before running mxc_gpio_probe, so gpio request will be failed.

 

 

Solution

 

There are two ways to resolve this issue
1. Build the driver as a module. i.e. select the driver in kernel’s menuconfig as “M”. Then , run “insmod” to load the driver after the kernel boot up.

 

OR

 

2. Apply below patch, let gpio driver init after scu driver.

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 1dfe513f8fcf..52b5799040b3 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -892,7 +892,7 @@ static int __init gpio_mxc_init(void)
return platform_driver_register(&mxc_gpio_driver);
}
-subsys_initcall(gpio_mxc_init);
+device_initcall(gpio_mxc_init);

 

100% 有帮助 (2/2)
版本历史
最后更新:
‎10-27-2021 02:40 AM
更新人: