drivers: gpio: Refactor drivers to use shared init priority

Refactors all of the on-chip GPIO drivers to use a shared driver class
initialization priority configuration, CONFIG_GPIO_INIT_PRIORITY, to
allow configuring GPIO drivers separately from other devices. This is
similar to other driver classes like I2C and SPI.

Most drivers previously used CONFIG_KERNEL_INIT_PRIORITY_DEFAULT or
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, therefore the default for this new
option is the lower of the two, which means earlier initialization.

Driver-specific options for off-chip I2C- or SPI-based GPIO drivers are
left intact because they often need to be initialized at a different
priority than on-chip GPIO drivers.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
Maureen Helm 2021-11-05 16:58:21 -05:00 committed by Christopher Friedt
commit 836651b453
49 changed files with 85 additions and 91 deletions

View file

@ -13,6 +13,11 @@
#include "gpio_utils.h"
#if CONFIG_GPIO_GECKO_COMMON_INIT_PRIORITY >= CONFIG_GPIO_INIT_PRIORITY
#error CONFIG_GPIO_GECKO_COMMON_INIT_PRIORITY must be less than \
CONFIG_GPIO_INIT_PRIORITY.
#endif
/*
* Macros to set the GPIO MODE registers
*
@ -325,7 +330,7 @@ DEVICE_DT_INST_DEFINE(idx, \
NULL, \
&gpio_gecko_port##idx##_data, \
&gpio_gecko_port##idx##_config, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \
&gpio_gecko_driver_api); \
\
static int gpio_gecko_port##idx##_init(const struct device *dev) \