Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SMBus for STM32 #66260

Merged
merged 6 commits into from
Dec 12, 2023
Merged

Conversation

benediktibk
Copy link
Collaborator

Add a driver for SMBus on STM32 SoCs. The new driver reuses as much as possible from the already existing I2C drivers, as within the STM32 SoCs SMBus is part of the I2C peripheral.

@benediktibk
Copy link
Collaborator Author

This PR can actually only be used when zephyrproject-rtos/hal_stm32#189 is done. Without pinctrl-definitions it is kinda hard to use it.

@benediktibk benediktibk force-pushed the add_smbus_stm32 branch 3 times, most recently from 09bb1a9 to 23a78a0 Compare December 7, 2023 10:22
@benediktibk benediktibk marked this pull request as ready for review December 7, 2023 14:06
@zephyrbot zephyrbot added area: SMBus area: Devicetree Binding PR modifies or adds a Device Tree binding area: I2C platform: STM32 ST Micro STM32 labels Dec 7, 2023
Copy link
Collaborator

@finikorg finikorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with minor comments.

drivers/smbus/smbus_utils.c Show resolved Hide resolved
drivers/smbus/smbus_stm32.c Show resolved Hide resolved
drivers/smbus/smbus_stm32.c Outdated Show resolved Hide resolved
dts/arm/st/f1/stm32f1.dtsi Outdated Show resolved Hide resolved
tests/drivers/smbus/smbus_emul/prj.conf Show resolved Hide resolved
Add includes which are actually required for the compilation
in the headers themselves to avoid include dependencies.

Signed-off-by: Benedikt Schmidt <[email protected]>
Extract a helper function for handling an SMB alert, as every
SMBus implementation will have to loop through the peripheral
address which might have triggered the alert.

Signed-off-by: Benedikt Schmidt <[email protected]>
Add a dts binding for STM32 SMBus.

Signed-off-by: Benedikt Schmidt <[email protected]>
Implement a SMBus driver for STM32, which reuses
the I2C implementation.

Signed-off-by: Benedikt Schmidt <[email protected]>
Add SMBus devices to all SoCs which have either
a st,stm32-i2c-v1 or st,stm32-i2c-v2.

Signed-off-by: Benedikt Schmidt <[email protected]>
Enable SMBus for the smbus_emul test.

Signed-off-by: Benedikt Schmidt <[email protected]>
@benediktibk benediktibk requested a review from finikorg December 11, 2023 10:58
@benediktibk
Copy link
Collaborator Author

@erwango @ABOSTM @FRASTM It might be great if somebody from ST could take a look at this one? The corresponding pinctrl-changes are available in zephyrproject-rtos/hal_stm32#189.

@carlescufi carlescufi merged commit 995824a into zephyrproject-rtos:main Dec 12, 2023
18 checks passed
@benediktibk benediktibk deleted the add_smbus_stm32 branch January 16, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: I2C area: SMBus platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants