From 83fb969cfbd51143be09ce290cc3b342f5fe155c Mon Sep 17 00:00:00 2001 From: Christophe Priouzeau Date: Tue, 25 Jun 2019 08:54:37 +0200 Subject: [PATCH] soc: stm32mp157: add I2c support Add I2C support and I2C5 configuration for arduino connector. Signed-off-by: Christophe Priouzeau Signed-off-by: Arnaud Pouliquen --- dts/arm/st/mp1/stm32mp157.dtsi | 15 ++++++++++++++- .../st_stm32/stm32mp1/Kconfig.defconfig.series | 7 +++++++ soc/arm/st_stm32/stm32mp1/dts_fixup.h | 12 ++++++++++++ soc/arm/st_stm32/stm32mp1/soc.h | 4 ++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dts/arm/st/mp1/stm32mp157.dtsi b/dts/arm/st/mp1/stm32mp157.dtsi index 73eccc1d8eb..294ae2e6cc9 100644 --- a/dts/arm/st/mp1/stm32mp157.dtsi +++ b/dts/arm/st/mp1/stm32mp157.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include / { cpus { @@ -210,6 +211,19 @@ label = "UART_8"; }; + i2c5: i2c@40015000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + reg = <0x40015000 0x400>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&rcc STM32_CLOCK_BUS_APB1 0x01000000>; + interrupt-names = "event", "error"; + interrupts = <107 0>, <108 0>; + status = "disabled"; + label = "I2C_5"; + }; + mailbox: mailbox@4c001000 { compatible = "st,stm32-ipcc-mailbox"; reg = <0x4c001000 0x400>; @@ -219,7 +233,6 @@ status = "disabled"; label = "MAILBOX_0"; }; - }; }; diff --git a/soc/arm/st_stm32/stm32mp1/Kconfig.defconfig.series b/soc/arm/st_stm32/stm32mp1/Kconfig.defconfig.series index d798e19108a..de33fa96488 100644 --- a/soc/arm/st_stm32/stm32mp1/Kconfig.defconfig.series +++ b/soc/arm/st_stm32/stm32mp1/Kconfig.defconfig.series @@ -47,4 +47,11 @@ config IPM_STM32_IPCC endif # IPM +if I2C_STM32 + +config I2C_STM32_V2 + default y + +endif # I2C_STM32 + endif # SOC_SERIES_STM32MP1X diff --git a/soc/arm/st_stm32/stm32mp1/dts_fixup.h b/soc/arm/st_stm32/stm32mp1/dts_fixup.h index 92692224b7a..23adcf8622b 100644 --- a/soc/arm/st_stm32/stm32mp1/dts_fixup.h +++ b/soc/arm/st_stm32/stm32mp1/dts_fixup.h @@ -313,4 +313,16 @@ DT_ST_STM32_UART_40019000_CLOCK_BUS #define DT_UART_STM32_UART_8_HW_FLOW_CONTROL \ DT_ST_STM32_UART_40019000_HW_FLOW_CONTROL + +#define DT_I2C_5_BASE_ADDRESS DT_ST_STM32_I2C_V2_40015000_BASE_ADDRESS +#define DT_I2C_5_EVENT_IRQ_PRI DT_ST_STM32_I2C_V2_40015000_IRQ_EVENT_PRIORITY +#define DT_I2C_5_ERROR_IRQ_PRI DT_ST_STM32_I2C_V2_40015000_IRQ_ERROR_PRIORITY +#define CONFIG_I2C_5_NAME DT_ST_STM32_I2C_V2_40015000_LABEL +#define DT_I2C_5_EVENT_IRQ DT_ST_STM32_I2C_V2_40015000_IRQ_EVENT +#define DT_I2C_5_ERROR_IRQ DT_ST_STM32_I2C_V2_40015000_IRQ_ERROR +#define DT_I2C_5_BITRATE DT_ST_STM32_I2C_V2_40015000_CLOCK_FREQUENCY +#define DT_I2C_5_CLOCK_BITS DT_ST_STM32_I2C_V2_40015000_CLOCK_BITS +#define DT_I2C_5_CLOCK_BUS DT_ST_STM32_I2C_V2_40015000_CLOCK_BUS + + /* End of SoC Level DTS fixup file */ diff --git a/soc/arm/st_stm32/stm32mp1/soc.h b/soc/arm/st_stm32/stm32mp1/soc.h index e0cd9747abf..2a8b3668cd6 100644 --- a/soc/arm/st_stm32/stm32mp1/soc.h +++ b/soc/arm/st_stm32/stm32mp1/soc.h @@ -50,6 +50,10 @@ #include #endif +#ifdef CONFIG_I2C +#include +#endif + #endif /* !_ASMLANGUAGE */ #endif /* _STM32MP1SOC_H_ */