pinctrl: single: Add hack to prevent gpio driver failure 37/316537/1
authorMichal Wilczynski <m.wilczynski@samsung.com>
Thu, 22 Aug 2024 07:42:17 +0000 (09:42 +0200)
committerMichal Wilczynski <m.wilczynski@samsung.com>
Thu, 22 Aug 2024 11:53:40 +0000 (13:53 +0200)
The pinctrl driver must finish before the gpio probe starts. This is
because as for now, the k1-x gpio driver doesn't handle deferred probe
correctly. It can be fixed by registering pinctrl-single in
postcore_initcall. This way the pinctrl will always finish before gpio
starts.

Ported from [1].

[1] - https://github.com/BPI-SINOVOIP/pi-linux.git

Change-Id: Ib748db78932829c0eaaf074e51a9603b7708c1d5
Signed-off-by: Michal Wilczynski <m.wilczynski@samsung.com>
drivers/pinctrl/pinctrl-single.c

index 461a7c02d4a392344604d3625f8db609759ac0fd..fd542eadf82bc18e3186182c791f5e655ea91bd2 100644 (file)
@@ -1993,7 +1993,22 @@ static struct platform_driver pcs_driver = {
 #endif
 };
 
+
+#ifdef CONFIG_ARCH_SPACEMIT
+static int __init pcs_driver_init(void)
+{
+       return platform_driver_register(&pcs_driver);
+}
+postcore_initcall(pcs_driver_init);
+
+static void __exit pcs_driver_exit(void)
+{
+       platform_driver_unregister(&pcs_driver);
+}
+module_exit(pcs_driver_exit);
+#else
 module_platform_driver(pcs_driver);
+#endif
 
 MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
 MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl driver");