diff --git a/CODEOWNERS b/CODEOWNERS index 6ff42cda47..ff849de6d2 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -208,6 +208,7 @@ /drivers/i2c/i2c_emul.c @sjg20 /drivers/i2c/i2c_shell.c @nashif /drivers/i2c/Kconfig.i2c_emul @sjg20 +/drivers/i2c/slave/*eeprom* @henrikbrixandersen /drivers/i2s/*litex* @mateusz-holenko @kgugala @pgielda /drivers/ieee802154/ @jukkar @tbursztyka /drivers/ieee802154/ieee802154_rf2xx* @jukkar @tbursztyka @nandojve diff --git a/doc/reference/overview.rst b/doc/reference/overview.rst index dd47749592..b66b587490 100644 --- a/doc/reference/overview.rst +++ b/doc/reference/overview.rst @@ -142,6 +142,11 @@ current :ref:`stability level `. - 1.14 - 2.3 + * - :ref:`i2c_eeprom_slave_api` + - Stable + - 1.13 + - 1.13 + * - :ref:`i2c_api` - Stable - 1.0 diff --git a/doc/reference/peripherals/i2c_eeprom_slave.rst b/doc/reference/peripherals/i2c_eeprom_slave.rst new file mode 100644 index 0000000000..c753938a14 --- /dev/null +++ b/doc/reference/peripherals/i2c_eeprom_slave.rst @@ -0,0 +1,13 @@ +.. _i2c_eeprom_slave_api: + +I2C EEPROM Slave +################ + +Overview +******** + +API Reference +************** + +.. doxygengroup:: i2c_eeprom_slave_api + :project: Zephyr diff --git a/doc/reference/peripherals/index.rst b/doc/reference/peripherals/index.rst index 6859c9297c..1c2b81e83b 100644 --- a/doc/reference/peripherals/index.rst +++ b/doc/reference/peripherals/index.rst @@ -18,6 +18,7 @@ Peripherals gna.rst gpio.rst hwinfo.rst + i2c_eeprom_slave.rst i2c.rst ipm.rst kscan.rst diff --git a/drivers/i2c/slave/CMakeLists.txt b/drivers/i2c/slave/CMakeLists.txt index 9881313609..925e0bc27c 100644 --- a/drivers/i2c/slave/CMakeLists.txt +++ b/drivers/i2c/slave/CMakeLists.txt @@ -1 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 + +zephyr_sources_ifdef(CONFIG_I2C_EEPROM_SLAVE eeprom_slave.c) diff --git a/drivers/i2c/slave/Kconfig b/drivers/i2c/slave/Kconfig index 21203c3872..6c2aa00445 100644 --- a/drivers/i2c/slave/Kconfig +++ b/drivers/i2c/slave/Kconfig @@ -6,11 +6,19 @@ # # I2C options # -config I2C_SLAVE +menuconfig I2C_SLAVE bool "I2C Slave Drivers" help Enable I2C Slave Driver Configuration if I2C_SLAVE +config I2C_SLAVE_INIT_PRIORITY + int "Init priority" + default 60 + help + I2C Slave device driver initialization priority. + +source "drivers/i2c/slave/Kconfig.eeprom" + endif # I2C_SLAVE diff --git a/drivers/i2c/slave/Kconfig.eeprom b/drivers/i2c/slave/Kconfig.eeprom new file mode 100644 index 0000000000..d854c2525d --- /dev/null +++ b/drivers/i2c/slave/Kconfig.eeprom @@ -0,0 +1,9 @@ +# I2C EEPROM Slave configuration options + +# Copyright (c) 2017 BayLibre, SAS +# SPDX-License-Identifier: Apache-2.0 + +config I2C_EEPROM_SLAVE + bool "I2C Slave EEPROM driver" + help + Enable virtual I2C Slave EEPROM driver diff --git a/tests/drivers/i2c/i2c_slave_api/src/eeprom_slave.c b/drivers/i2c/slave/eeprom_slave.c similarity index 97% rename from tests/drivers/i2c/i2c_slave_api/src/eeprom_slave.c rename to drivers/i2c/slave/eeprom_slave.c index 9de4fa7b1c..1c412f25df 100644 --- a/tests/drivers/i2c/i2c_slave_api/src/eeprom_slave.c +++ b/drivers/i2c/slave/eeprom_slave.c @@ -11,11 +11,11 @@ #include #include #include -#include "eeprom.h" +#include #define LOG_LEVEL CONFIG_I2C_LOG_LEVEL #include -LOG_MODULE_REGISTER(eeprom_slave); +LOG_MODULE_REGISTER(i2c_slave); struct i2c_eeprom_slave_data { const struct device *i2c_controller; @@ -225,8 +225,8 @@ static int i2c_eeprom_slave_init(const struct device *dev) &i2c_eeprom_slave_init, \ &i2c_eeprom_slave_##inst##_dev_data, \ &i2c_eeprom_slave_##inst##_cfg, \ - APPLICATION, \ - 0, \ + POST_KERNEL, \ + CONFIG_I2C_SLAVE_INIT_PRIORITY, \ &api_funcs); DT_INST_FOREACH_STATUS_OKAY(I2C_EEPROM_INIT) diff --git a/tests/drivers/i2c/i2c_slave_api/src/eeprom.h b/include/drivers/i2c/slave/eeprom.h similarity index 100% rename from tests/drivers/i2c/i2c_slave_api/src/eeprom.h rename to include/drivers/i2c/slave/eeprom.h diff --git a/tests/drivers/i2c/i2c_slave_api/prj.conf b/tests/drivers/i2c/i2c_slave_api/prj.conf index fab292e23b..05366eda5b 100644 --- a/tests/drivers/i2c/i2c_slave_api/prj.conf +++ b/tests/drivers/i2c/i2c_slave_api/prj.conf @@ -4,3 +4,5 @@ CONFIG_BOOT_BANNER=y CONFIG_ZTEST=y CONFIG_I2C=y CONFIG_I2C_SLAVE=y +CONFIG_I2C_EEPROM_SLAVE=y +CONFIG_I2C_VIRTUAL=y diff --git a/tests/drivers/i2c/i2c_slave_api/src/main.c b/tests/drivers/i2c/i2c_slave_api/src/main.c index 5125662108..065efeb296 100644 --- a/tests/drivers/i2c/i2c_slave_api/src/main.c +++ b/tests/drivers/i2c/i2c_slave_api/src/main.c @@ -18,7 +18,7 @@ LOG_MODULE_REGISTER(main); #include #include -#include "eeprom.h" +#include #include