diff --git a/drivers/smbus/Kconfig b/drivers/smbus/Kconfig index c32eaed9c68e3..fa0b945645854 100644 --- a/drivers/smbus/Kconfig +++ b/drivers/smbus/Kconfig @@ -24,7 +24,7 @@ config SMBUS_STATS config SMBUS_INIT_PRIORITY int "Init priority" - default KERNEL_INIT_PRIORITY_DEFAULT + default KERNEL_INIT_PRIORITY_DEVICE help SMBus device driver initialization priority. diff --git a/drivers/smbus/smbus_stm32.c b/drivers/smbus/smbus_stm32.c index 1d7ed57aae120..a5fe47a8c3ed5 100644 --- a/drivers/smbus/smbus_stm32.c +++ b/drivers/smbus/smbus_stm32.c @@ -355,12 +355,12 @@ static int smbus_stm32_pcall(const struct device *dev, uint16_t periph_addr, uin .flags = I2C_MSG_WRITE, }, { - .buf = &send_word, + .buf = (uint8_t *)&send_word, .len = sizeof(send_word), .flags = I2C_MSG_WRITE, }, { - .buf = recv_word, + .buf = (uint8_t *)recv_word, .len = sizeof(*recv_word), .flags = I2C_MSG_READ | I2C_MSG_RESTART, }, diff --git a/tests/drivers/build_all/smbus/CMakeLists.txt b/tests/drivers/build_all/smbus/CMakeLists.txt new file mode 100644 index 0000000000000..518596a02f780 --- /dev/null +++ b/tests/drivers/build_all/smbus/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(build_all) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/drivers/build_all/smbus/boards/nucleo_g071rb.conf b/tests/drivers/build_all/smbus/boards/nucleo_g071rb.conf new file mode 100644 index 0000000000000..aafb657f5b9a0 --- /dev/null +++ b/tests/drivers/build_all/smbus/boards/nucleo_g071rb.conf @@ -0,0 +1 @@ +CONFIG_I2C=y diff --git a/tests/drivers/build_all/smbus/boards/nucleo_g071rb.overlay b/tests/drivers/build_all/smbus/boards/nucleo_g071rb.overlay new file mode 100644 index 0000000000000..8067e2d0a4625 --- /dev/null +++ b/tests/drivers/build_all/smbus/boards/nucleo_g071rb.overlay @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c1 { + status = "okay"; +}; + +&smbus1 { + i2c = <&i2c1>; + status = "okay"; +}; diff --git a/tests/drivers/build_all/smbus/prj.conf b/tests/drivers/build_all/smbus/prj.conf new file mode 100644 index 0000000000000..994daaf9b3019 --- /dev/null +++ b/tests/drivers/build_all/smbus/prj.conf @@ -0,0 +1,3 @@ +CONFIG_TEST=y +CONFIG_TEST_USERSPACE=y +CONFIG_SMBUS=y diff --git a/tests/drivers/build_all/smbus/src/main.c b/tests/drivers/build_all/smbus/src/main.c new file mode 100644 index 0000000000000..0ff69028dfddf --- /dev/null +++ b/tests/drivers/build_all/smbus/src/main.c @@ -0,0 +1,9 @@ +/* + * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +int main(void) +{ + return 0; +} diff --git a/tests/drivers/build_all/smbus/testcase.yaml b/tests/drivers/build_all/smbus/testcase.yaml new file mode 100644 index 0000000000000..1b58d0b86eeeb --- /dev/null +++ b/tests/drivers/build_all/smbus/testcase.yaml @@ -0,0 +1,10 @@ +common: + build_only: true + tags: + - drivers + - i2c + - smbus +tests: + drivers.smbus.build.stm32: + platform_allow: + - nucleo_g071rb