diff options
author | Shawn Guo <shawn.guo@freescale.com> | 2013-07-14 20:41:00 +0800 |
---|---|---|
committer | Leonard Crestez <leonard.crestez@nxp.com> | 2018-08-23 16:57:37 +0300 |
commit | 5daf9682e66c9c107bcaab024d9170c52dc946df (patch) | |
tree | 23709692523bf685be46a5064d17d53a301fff0b /drivers/reset | |
parent | bddbe5b0c5ee1c46f47a485d065b0ca6c39f5763 (diff) |
MLK-11395-1: reset: register gpio-reset driver in arch_initcall
It's a little bit late to register gpio-reset driver at module_init
time, because gpio-reset provides reset control via gpio for other
devices which are mostly probed at module_init time too. And it
becomes even worse, when the gpio comes from IO expander on I2C bus,
e.g. pca953x. In that case, gpio-reset needs to be ready before I2C
bus driver which is generally ready at subsys_initcall time. Let's
register gpio-reset driver in arch_initcall() to have it ready early
enough.
The defer probe mechanism is not used here, because a reset controller
driver should be reasonably registered early than other devices. More
importantly, defer probe doe not help in some nasty cases, e.g. the
gpio-pca953x device itself needs a reset from gpio-reset driver start
working.
[shawn.guo: cherry-pick commit 7153f05108ef from imx_3.10.y]
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
(cherry picked from commit 11e3543010d4ed50db78a5fc809f24c89e8c6e30)
Diffstat (limited to 'drivers/reset')
-rw-r--r-- | drivers/reset/gpio-reset.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/reset/gpio-reset.c b/drivers/reset/gpio-reset.c index 5d2515af6a5f..4cb9929127c8 100644 --- a/drivers/reset/gpio-reset.c +++ b/drivers/reset/gpio-reset.c @@ -165,7 +165,17 @@ static struct platform_driver gpio_reset_driver = { }, }; -module_platform_driver(gpio_reset_driver); +static int __init gpio_reset_init(void) +{ + return platform_driver_register(&gpio_reset_driver); +} +arch_initcall(gpio_reset_init); + +static void __exit gpio_reset_exit(void) +{ + platform_driver_unregister(&gpio_reset_driver); +} +module_exit(gpio_reset_exit); MODULE_AUTHOR("Philipp Zabel <p.zabel@pengutronix.de>"); MODULE_DESCRIPTION("gpio reset controller"); |