mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
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:
committed by
Christopher Friedt
parent
a5c2a6169b
commit
836651b453
@@ -7,6 +7,9 @@ config BOARD
|
||||
|
||||
if GPIO
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
default 70
|
||||
|
||||
config GPIO_DW
|
||||
default y
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ config BOARD
|
||||
|
||||
if GPIO
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
default 70
|
||||
|
||||
config GPIO_DW
|
||||
default y
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@ config BOARD
|
||||
|
||||
if GPIO
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
default 60
|
||||
|
||||
config GPIO_DW
|
||||
default y
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ config BOARD_VDD_PWR_CTRL_INIT_PRIORITY
|
||||
depends on GPIO
|
||||
help
|
||||
Initialization priority for the VDD power rail. Has to be greater
|
||||
than GPIO_NRF_INIT_PRIORITY.
|
||||
than GPIO_INIT_PRIORITY.
|
||||
|
||||
config BOARD_CCS_VDD_PWR_CTRL_INIT_PRIORITY
|
||||
int "CCS_VDD power rail init priority"
|
||||
|
||||
@@ -42,8 +42,8 @@ static int pwr_ctrl_init(const struct device *dev)
|
||||
* constraints.
|
||||
*/
|
||||
|
||||
#if CONFIG_BOARD_VDD_PWR_CTRL_INIT_PRIORITY <= CONFIG_GPIO_NRF_INIT_PRIORITY
|
||||
#error GPIO_NRF_INIT_PRIORITY must be lower than \
|
||||
#if CONFIG_BOARD_VDD_PWR_CTRL_INIT_PRIORITY <= CONFIG_GPIO_INIT_PRIORITY
|
||||
#error GPIO_INIT_PRIORITY must be lower than \
|
||||
BOARD_VDD_PWR_CTRL_INIT_PRIORITY
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,6 +19,13 @@ config ADC_INIT_PRIORITY
|
||||
|
||||
endif # ADC
|
||||
|
||||
if GPIO
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
default 99
|
||||
|
||||
endif # GPIO
|
||||
|
||||
if EEPROM
|
||||
|
||||
config I2C
|
||||
|
||||
@@ -119,6 +119,9 @@ config INTEL_GNA
|
||||
|
||||
if GPIO
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
default 70
|
||||
|
||||
config GPIO_DW
|
||||
default y
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ config GPIO_SHELL
|
||||
help
|
||||
Enable GPIO Shell for testing.
|
||||
|
||||
config GPIO_INIT_PRIORITY
|
||||
int "GPIO init priority"
|
||||
default KERNEL_INIT_PRIORITY_DEFAULT
|
||||
help
|
||||
GPIO driver device initialization priority.
|
||||
|
||||
source "drivers/gpio/Kconfig.b91"
|
||||
|
||||
source "drivers/gpio/Kconfig.dw"
|
||||
|
||||
@@ -6,18 +6,8 @@
|
||||
# Workaround for not being able to have commas in macro arguments
|
||||
DT_COMPAT_SNPS_CREG_GPIO := snps,creg-gpio
|
||||
|
||||
menuconfig GPIO_SNPS_CREG
|
||||
config GPIO_SNPS_CREG
|
||||
bool "SNPS CREG GPIO"
|
||||
default $(dt_compat_enabled,$(DT_COMPAT_SNPS_CREG_GPIO))
|
||||
help
|
||||
Enable driver for SNPS CREG GPIO.
|
||||
|
||||
if GPIO_SNPS_CREG
|
||||
|
||||
config GPIO_SNPS_CREG_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 70
|
||||
help
|
||||
Device driver initialization priority.
|
||||
|
||||
endif # GPIO_SNPS_CREG
|
||||
|
||||
@@ -13,12 +13,6 @@ if GPIO_DW
|
||||
config GPIO_DW_SHARED_IRQ
|
||||
bool
|
||||
|
||||
config GPIO_DW_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 60
|
||||
help
|
||||
Device driver initialization priority.
|
||||
|
||||
config GPIO_DW_CLOCK_GATE
|
||||
bool "Enable clock gating"
|
||||
select CLOCK_CONTROL
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Copyright (c) 2019 Vestas Wind Systems A/S
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
menuconfig GPIO_LMP90XXX
|
||||
config GPIO_LMP90XXX
|
||||
bool "LMP90xxx GPIO driver"
|
||||
depends on ADC_LMP90XXX_GPIO
|
||||
help
|
||||
@@ -14,11 +14,3 @@ menuconfig GPIO_LMP90XXX
|
||||
|
||||
The GPIO port of the LMP90xxx (D6 to D0) is exposed as a
|
||||
GPIO controller driver with read/write support.
|
||||
|
||||
config GPIO_LMP90XXX_INIT_PRIORITY
|
||||
int "Driver init priority"
|
||||
default 99
|
||||
depends on GPIO_LMP90XXX
|
||||
help
|
||||
Device driver initialization priority. This driver must be
|
||||
initialized after the LMP90xxx ADC driver.
|
||||
|
||||
@@ -11,12 +11,6 @@ menuconfig GPIO_NRFX
|
||||
|
||||
if GPIO_NRFX
|
||||
|
||||
config GPIO_NRF_INIT_PRIORITY
|
||||
int "nRF GPIO initialization priority"
|
||||
default 40
|
||||
help
|
||||
Initialization priority for nRF GPIO.
|
||||
|
||||
choice
|
||||
prompt "nRF GPIO edge interrupts mechanism"
|
||||
default GPIO_NRF_INT_EDGE_USING_GPIOTE
|
||||
|
||||
@@ -15,12 +15,6 @@ menuconfig GPIO_SX1509B
|
||||
|
||||
if GPIO_SX1509B
|
||||
|
||||
config GPIO_SX1509B_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 70
|
||||
help
|
||||
Device driver initialization priority.
|
||||
|
||||
config GPIO_SX1509B_INTERRUPT
|
||||
bool "Interrupt enable"
|
||||
default n
|
||||
|
||||
@@ -353,7 +353,7 @@ static int gpio_atcgpio100_init(const struct device *port)
|
||||
&gpio_atcgpio100_data_##n, \
|
||||
&gpio_atcgpio100_config_##n, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
CONFIG_GPIO_INIT_PRIORITY, \
|
||||
&gpio_atcgpio100_api); \
|
||||
\
|
||||
static void gpio_atcgpio100_cfg_func_##n(void) \
|
||||
|
||||
@@ -562,7 +562,7 @@ static void gpio_b91_irq_connect_4(void)
|
||||
&gpio_b91_data_##n, \
|
||||
&gpio_b91_config_##n, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||
CONFIG_GPIO_INIT_PRIORITY, \
|
||||
&gpio_b91_driver_api);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(GPIO_B91_INIT)
|
||||
|
||||
@@ -283,5 +283,5 @@ static const struct gpio_driver_api gpio_cc13xx_cc26xx_driver_api = {
|
||||
DEVICE_DT_INST_DEFINE(0, gpio_cc13xx_cc26xx_init,
|
||||
NULL, &gpio_cc13xx_cc26xx_data_0,
|
||||
&gpio_cc13xx_cc26xx_cfg_0,
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||
POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&gpio_cc13xx_cc26xx_driver_api);
|
||||
|
||||
@@ -263,7 +263,7 @@ static const struct gpio_driver_api api_funcs = {
|
||||
DEVICE_DT_INST_DEFINE(n, &gpio_cc32xx_a##n##_init, \
|
||||
NULL, &gpio_cc32xx_a##n##_data, \
|
||||
&gpio_cc32xx_a##n##_config, \
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \
|
||||
&api_funcs)
|
||||
|
||||
#define GPIO_CC32XX_INIT(n) \
|
||||
|
||||
@@ -277,7 +277,7 @@ static int gpio_cmsdk_ahb_init(const struct device *dev)
|
||||
NULL, \
|
||||
&gpio_cmsdk_port_##n##_data, \
|
||||
&gpio_cmsdk_port_## n ##_config, \
|
||||
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||
POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY, \
|
||||
&gpio_cmsdk_ahb_drv_api_funcs); \
|
||||
\
|
||||
static void gpio_cmsdk_port_##n##_config_func(const struct device *dev) \
|
||||
|
||||
@@ -156,5 +156,5 @@ static struct creg_gpio_drv_data creg_gpio_drvdata = {
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0, creg_gpio_init, NULL,
|
||||
&creg_gpio_drvdata, &creg_gpio_cfg,
|
||||
POST_KERNEL, CONFIG_GPIO_SNPS_CREG_INIT_PRIORITY,
|
||||
POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&api_table);
|
||||
|
||||
@@ -536,7 +536,7 @@ static struct gpio_dw_runtime gpio_0_runtime = {
|
||||
|
||||
DEVICE_DT_INST_DEFINE(0,
|
||||
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_0_runtime,
|
||||
&gpio_config_0, POST_KERNEL, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&gpio_config_0, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
|
||||
#if DT_INST_IRQ_HAS_CELL(0, flags)
|
||||
@@ -598,7 +598,7 @@ static struct gpio_dw_runtime gpio_1_runtime = {
|
||||
|
||||
DEVICE_DT_INST_DEFINE(1,
|
||||
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_1_runtime,
|
||||
&gpio_dw_config_1, POST_KERNEL, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&gpio_dw_config_1, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
|
||||
#if DT_INST_IRQ_HAS_CELL(1, flags)
|
||||
@@ -659,7 +659,7 @@ static struct gpio_dw_runtime gpio_2_runtime = {
|
||||
|
||||
DEVICE_DT_INST_DEFINE(2,
|
||||
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_2_runtime,
|
||||
&gpio_dw_config_2, POST_KERNEL, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&gpio_dw_config_2, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
|
||||
#if DT_INST_IRQ_HAS_CELL(2, flags)
|
||||
@@ -720,7 +720,7 @@ static struct gpio_dw_runtime gpio_3_runtime = {
|
||||
|
||||
DEVICE_DT_INST_DEFINE(3,
|
||||
gpio_dw_initialize, gpio_dw_device_pm_action, &gpio_3_runtime,
|
||||
&gpio_dw_config_3, POST_KERNEL, CONFIG_GPIO_DW_INIT_PRIORITY,
|
||||
&gpio_dw_config_3, POST_KERNEL, CONFIG_GPIO_INIT_PRIORITY,
|
||||
&api_funcs);
|
||||
|
||||
#if DT_INST_IRQ_HAS_CELL(3, flags)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user