drivers: eeprom: Refactor drivers to use shared init priority
Refactors all of the EEPROM drivers to use a shared driver class initialization priority configuration, CONFIG_EEPROM_INIT_PRIORITY, to allow configuring EEPROM drivers separately from other devices. This is similar to other driver classes like I2C and SPI. The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to preserve the existing default initialization priority for most drivers. The exceptions are at2x and emul drivers which have dependencies on SPI, I2C, or flash drivers and must therefore initialize later than the default device priority. Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
parent
4d2e46ddd6
commit
32b4950c61
11 changed files with 19 additions and 15 deletions
|
@ -27,6 +27,9 @@ config I2C
|
|||
config EEPROM_AT24
|
||||
default y
|
||||
|
||||
config EEPROM_INIT_PRIORITY
|
||||
default 75
|
||||
|
||||
endif # EEPROM
|
||||
|
||||
endif # SHIELD_LMP90100_EVB
|
||||
|
|
|
@ -17,6 +17,9 @@ config I2C
|
|||
config EEPROM_AT24
|
||||
default y
|
||||
|
||||
config EEPROM_INIT_PRIORITY
|
||||
default 75
|
||||
|
||||
endif # EEPROM
|
||||
|
||||
endif # SHIELD_X_NUCLEO_EEPRMA2
|
||||
|
|
|
@ -14,6 +14,12 @@ module = EEPROM
|
|||
module-str = eeprom
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
||||
config EEPROM_INIT_PRIORITY
|
||||
int "EEPROM init priority"
|
||||
default KERNEL_INIT_PRIORITY_DEVICE
|
||||
help
|
||||
EEPROM driver device initialization priority.
|
||||
|
||||
config EEPROM_SHELL
|
||||
bool "Enable EEPROM shell"
|
||||
default y
|
||||
|
@ -49,11 +55,6 @@ config EEPROM_AT25
|
|||
help
|
||||
Enable support for Atmel AT25 (and compatible) SPI EEPROMs.
|
||||
|
||||
config EEPROM_AT2X_INIT_PRIORITY
|
||||
int "AT2X EEPROM init priority"
|
||||
default 75
|
||||
depends on EEPROM_AT2X
|
||||
|
||||
source "drivers/eeprom/Kconfig.lpc11u6x"
|
||||
source "drivers/eeprom/Kconfig.stm32"
|
||||
source "drivers/eeprom/Kconfig.eeprom_emu"
|
||||
|
|
|
@ -10,8 +10,3 @@ config EEPROM_EMULATOR
|
|||
performed to the EEPROM is maximized by using a flash area that is
|
||||
larger than the EEPROM area and by storing only changes to the EEPROM
|
||||
data.
|
||||
|
||||
config EEPROM_EMULATOR_INIT_PRIORITY
|
||||
int "EEPROM emulator init priority"
|
||||
default 75
|
||||
depends on EEPROM_EMULATOR
|
||||
|
|
|
@ -629,7 +629,7 @@ static const struct eeprom_driver_api eeprom_at2x_api = {
|
|||
DEVICE_DT_DEFINE(INST_DT_AT2X(n, t), &eeprom_at2x_init, \
|
||||
NULL, &eeprom_at##t##_data_##n, \
|
||||
&eeprom_at##t##_config_##n, POST_KERNEL, \
|
||||
CONFIG_EEPROM_AT2X_INIT_PRIORITY, \
|
||||
CONFIG_EEPROM_INIT_PRIORITY, \
|
||||
&eeprom_at2x_api)
|
||||
|
||||
#define EEPROM_AT24_DEVICE(n) EEPROM_AT2X_DEVICE(n, 24)
|
||||
|
|
|
@ -809,6 +809,6 @@ static const struct eeprom_driver_api eeprom_emu_api = {
|
|||
DEVICE_DT_INST_DEFINE(n, &eeprom_emu_init, \
|
||||
NULL, &eeprom_emu_##n##_data, \
|
||||
&eeprom_emu_##n##_config, POST_KERNEL, \
|
||||
CONFIG_EEPROM_EMULATOR_INIT_PRIORITY, &eeprom_emu_api); \
|
||||
CONFIG_EEPROM_INIT_PRIORITY, &eeprom_emu_api); \
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(EEPROM_EMU_INIT)
|
||||
|
|
|
@ -117,4 +117,4 @@ static const struct eeprom_lpc11u6x_config eeprom_config = {
|
|||
|
||||
DEVICE_DT_INST_DEFINE(0, &eeprom_lpc11u6x_init, NULL, NULL,
|
||||
&eeprom_config, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &eeprom_lpc11u6x_api);
|
||||
CONFIG_EEPROM_INIT_PRIORITY, &eeprom_lpc11u6x_api);
|
||||
|
|
|
@ -269,7 +269,7 @@ static int eeprom_sim_init(const struct device *dev)
|
|||
|
||||
DEVICE_DT_INST_DEFINE(0, &eeprom_sim_init, NULL,
|
||||
NULL, &eeprom_sim_config_0, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &eeprom_sim_api);
|
||||
CONFIG_EEPROM_INIT_PRIORITY, &eeprom_sim_api);
|
||||
|
||||
#ifdef CONFIG_ARCH_POSIX
|
||||
|
||||
|
|
|
@ -124,4 +124,4 @@ static const struct eeprom_stm32_config eeprom_config = {
|
|||
|
||||
DEVICE_DT_INST_DEFINE(0, &eeprom_stm32_init, NULL, NULL,
|
||||
&eeprom_config, POST_KERNEL,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &eeprom_stm32_api);
|
||||
CONFIG_EEPROM_INIT_PRIORITY, &eeprom_stm32_api);
|
||||
|
|
|
@ -5,4 +5,5 @@ CONFIG_EMUL=y
|
|||
CONFIG_I2C=y
|
||||
CONFIG_I2C_EMUL=y
|
||||
CONFIG_EEPROM_AT24=y
|
||||
CONFIG_EEPROM_INIT_PRIORITY=75
|
||||
CONFIG_EMUL_EEPROM_AT2X=y
|
||||
|
|
|
@ -3,3 +3,4 @@ CONFIG_TEST_USERSPACE=y
|
|||
CONFIG_EEPROM=y
|
||||
CONFIG_EEPROM_SIMULATOR=y
|
||||
CONFIG_EEPROM_EMULATOR=y
|
||||
CONFIG_EEPROM_INIT_PRIORITY=75
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue