Part Number: AM62L-LINUX-SDK
Hello,
I have a driver statically compiled in the kernel image. The driver configured the gpio, interrupt to detect a power failure and wakeup interrupt as well to wakeup the device from deep sleep. The driver works fine but I would like to run it in early boot.
I tried to use subsys_initcall_sync(test_driver_init) and saw the driver loaded early. But the problem is that the driver couldn't get the gpio.
static int boot_gpio_init(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "test,node");
if (!np)
return -ENODEV;
int pwr_boot_gpio = of_get_named_gpio(np, "test-pin-gpios", 0);
of_node_put(np);
if (pwr_boot_gpio < 0)
{
pr_err("boot_gpio_init: pwr_boot_gpio %d\n", pwr_boot_gpio);
return pwr_boot_gpio;
}
if (gpio_request(pwr_boot_gpio, "pfail-boot"))
return -EBUSY;
gpio_direction_input(pwr_boot_gpio);
return 0;
}
static int __init test_driver_init(void)
{
boot_gpio_init();
return platform_driver_register(&test_driver);
}
subsys_initcall_sync(test_driver_init);
The output is:
boot_gpio_init: pwr_boot_gpio -517 or (-EPROBE_DEFER).
I would like to know if there's a way to initialize the gpio, interrupt and the wakeup interrupt early?
Thanks,
John Tobias