From c08fc1c34baa319fd54c2b9f011500a4bb924da5 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Wed, 30 Apr 2025 11:10:06 +0200 Subject: [PATCH 01/10] west: update hal_stm32 to take MP13 HAL update Update hal_stm32 revision to include the MP13 HAL update. Signed-off-by: Alain Volmat --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 4807f1194f490..5a91e0ca98310 100644 --- a/west.yml +++ b/west.yml @@ -243,7 +243,7 @@ manifest: groups: - hal - name: hal_stm32 - revision: 237391328ba97f70240cd30b24cffeca6152f86f + revision: fcd37242dcaa19a05b014a378c592e257083fe72 path: modules/hal/stm32 groups: - hal From dc6b08fb49725d963512ed668b8623215309de70 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Mon, 28 Apr 2025 19:06:00 +0200 Subject: [PATCH 02/10] modules: stm32: add DCMIPP and DDR modules found on STM32MP13XX Addition of the DCMIPP and DDR modules. Signed-off-by: Alain Volmat --- modules/Kconfig.stm32 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/Kconfig.stm32 b/modules/Kconfig.stm32 index c7d4437fd1316..24e90828740f1 100644 --- a/modules/Kconfig.stm32 +++ b/modules/Kconfig.stm32 @@ -117,6 +117,17 @@ config USE_STM32_HAL_DCMI_EX Enable STM32Cube Extended Digital camera interface (DCM) HAL module driver +config USE_STM32_HAL_DCMIPP + bool + help + Enable STM32Cube Digital Camera Interface Pixel Pipeline (DCMIPP) HAL module + driver + +config USE_STM32_HAL_DDR + bool + help + Enable STM32Cube DDR-SDRAM HAL module driver + config USE_STM32_HAL_DFSDM bool help From ad363faa079dfd8b2b6ad02dbc904fa032c79758 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Fri, 25 Apr 2025 17:12:04 +0200 Subject: [PATCH 03/10] clock_control: stm32: add I2C periph get_subsys_rate for mp13 Add code to handle stm32_clock_control_get_subsys_rate for all i2c instances from I2C1 to I2C5. Signed-off-by: Alain Volmat --- drivers/clock_control/clock_stm32_ll_mp13.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/clock_control/clock_stm32_ll_mp13.c b/drivers/clock_control/clock_stm32_ll_mp13.c index 4c880513732b4..09f7fed1abcb1 100644 --- a/drivers/clock_control/clock_stm32_ll_mp13.c +++ b/drivers/clock_control/clock_stm32_ll_mp13.c @@ -70,6 +70,25 @@ static int stm32_clock_control_get_subsys_rate(const struct device *dev, case LL_APB1_GRP1_PERIPH_UART4: *rate = LL_RCC_GetUARTClockFreq(LL_RCC_UART4_CLKSOURCE); break; + case LL_APB1_GRP1_PERIPH_I2C1: + case LL_APB1_GRP1_PERIPH_I2C2: + *rate = LL_RCC_GetI2CClockFreq(LL_RCC_I2C12_CLKSOURCE); + break; + default: + return -ENOTSUP; + } + break; + case STM32_CLOCK_BUS_APB6: + switch (pclken->enr) { + case LL_APB6_GRP1_PERIPH_I2C3: + *rate = LL_RCC_GetI2CClockFreq(LL_RCC_I2C3_CLKSOURCE); + break; + case LL_APB6_GRP1_PERIPH_I2C4: + *rate = LL_RCC_GetI2CClockFreq(LL_RCC_I2C4_CLKSOURCE); + break; + case LL_APB6_GRP1_PERIPH_I2C5: + *rate = LL_RCC_GetI2CClockFreq(LL_RCC_I2C5_CLKSOURCE); + break; default: return -ENOTSUP; } From 6f734cc3dcda9a8424fb56a11d89b78f50abb515 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Wed, 30 Apr 2025 10:57:57 +0200 Subject: [PATCH 04/10] display: stm32_ltdc: update macro to avoid usage of legacy API Replace the usage of __HAL_LTDC_RELOAD_CONFIG which is a legacy API with __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG Signed-off-by: Alain Volmat --- drivers/display/display_stm32_ltdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/display/display_stm32_ltdc.c b/drivers/display/display_stm32_ltdc.c index 2de41651fd9ec..5ec9510792a59 100644 --- a/drivers/display/display_stm32_ltdc.c +++ b/drivers/display/display_stm32_ltdc.c @@ -94,7 +94,7 @@ static void stm32_ltdc_global_isr(const struct device *dev) data->front_buf = data->pend_buf; LTDC_LAYER(&data->hltdc, LTDC_LAYER_1)->CFBAR = (uint32_t)data->front_buf; - __HAL_LTDC_RELOAD_CONFIG(&data->hltdc); + __HAL_LTDC_RELOAD_IMMEDIATE_CONFIG(&data->hltdc); k_sem_give(&data->sem); } From 15311371d300becf0dc12eeaecd4119c0c42d5e1 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Fri, 25 Apr 2025 17:13:26 +0200 Subject: [PATCH 05/10] dts: arm: st: mp13: add description of all i2c instances Add description of all 5 instances (i2c1 to i2c5) available on the stm32mp13 soc. Signed-off-by: Alain Volmat --- dts/arm/st/mp13/stm32mp13.dtsi | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/dts/arm/st/mp13/stm32mp13.dtsi b/dts/arm/st/mp13/stm32mp13.dtsi index d781890d1b5f6..4955d034cf491 100644 --- a/dts/arm/st/mp13/stm32mp13.dtsi +++ b/dts/arm/st/mp13/stm32mp13.dtsi @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -166,6 +167,71 @@ <8 1>, <9 1>, <10 1>, <11 1>, <12 1>, <13 1>, <14 1>, <15 1>; }; + + i2c1: i2c@40012000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x40012000 0x400>; + clocks = <&rcc STM32_CLOCK(APB1, 21)>; + interrupts = , + ; + interrupt-names = "event", "error"; + status = "disabled"; + }; + + i2c2: i2c@40013000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x40013000 0x400>; + clocks = <&rcc STM32_CLOCK(APB1, 22)>; + interrupts = , + ; + interrupt-names = "event", "error"; + status = "disabled"; + }; + + i2c3: i2c@4c004000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4c004000 0x400>; + clocks = <&rcc STM32_CLOCK(APB6, 4)>; + interrupts = , + ; + interrupt-names = "event", "error"; + status = "disabled"; + }; + + i2c4: i2c@4c005000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4c005000 0x400>; + clocks = <&rcc STM32_CLOCK(APB6, 5)>; + interrupts = , + ; + interrupt-names = "event", "error"; + status = "disabled"; + }; + + i2c5: i2c@4c006000 { + compatible = "st,stm32-i2c-v2"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x4c006000 0x400>; + clocks = <&rcc STM32_CLOCK(APB6, 6)>; + interrupts = , + ; + interrupt-names = "event", "error"; + status = "disabled"; + }; }; gic: gic@A0021000 { From 95169a5633a3d3a5383088a4f7a2d6891c71eee5 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sat, 26 Apr 2025 20:00:38 +0200 Subject: [PATCH 06/10] include: dt-bindings: clock: add LTDC specific entry for stm32mp13 The non-secure LTDC plane has its own register for clock gating hence add an entry to control this. Signed-off-by: Alain Volmat --- include/zephyr/dt-bindings/clock/stm32mp13_clock.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/zephyr/dt-bindings/clock/stm32mp13_clock.h b/include/zephyr/dt-bindings/clock/stm32mp13_clock.h index daf2d8ca2cd57..207b5793a055b 100644 --- a/include/zephyr/dt-bindings/clock/stm32mp13_clock.h +++ b/include/zephyr/dt-bindings/clock/stm32mp13_clock.h @@ -13,6 +13,7 @@ #define STM32_CLOCK_BUS_APB2 0x708 #define STM32_CLOCK_BUS_APB3 0x710 #define STM32_CLOCK_BUS_APB4 0x728 +#define STM32_CLOCK_BUS_APB4_NS 0x738 #define STM32_CLOCK_BUS_APB5 0x740 #define STM32_CLOCK_BUS_APB6 0x748 #define STM32_CLOCK_BUS_AHB2 0x750 From df8f4769d7eb4c049f61a6ee3395b90e4ba9f098 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Fri, 25 Apr 2025 17:13:55 +0200 Subject: [PATCH 07/10] dts: arm: st: mp13: add ltdc node in stm32mp135.dtsi Add the node describing the LTDC available in the stm32mp135. Signed-off-by: Alain Volmat --- dts/arm/st/mp13/stm32mp135.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dts/arm/st/mp13/stm32mp135.dtsi b/dts/arm/st/mp13/stm32mp135.dtsi index 4b754a69d583b..fddcc419f2d78 100644 --- a/dts/arm/st/mp13/stm32mp135.dtsi +++ b/dts/arm/st/mp13/stm32mp135.dtsi @@ -9,5 +9,16 @@ / { soc { compatible = "st,stm32mp135", "st,stm32mp13", "simple-bus"; + + ltdc: display-controller@5a001000 { + compatible = "st,stm32-ltdc"; + reg = <0x5a001000 0x1000>; + interrupts = , + ; + interrupt-names = "ltdc", "ltdc_er"; + clocks = <&rcc STM32_CLOCK(APB4_NS, 0)>; + resets = <&rctl STM32_RESET(APB4, 0)>; + status = "disabled"; + }; }; }; From 29f9aef24044a7f6912cb67f44cd7e92e3c026b4 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Fri, 25 Apr 2025 17:14:16 +0200 Subject: [PATCH 08/10] boards: st: enable all i2c and panel available on the stm32mp135f_dk board The stm32mp135f_dk board has 3 i2c instances enabled and feature a 480x272 panel controlled via the LTDC. Signed-off-by: Alain Volmat --- boards/st/stm32mp135f_dk/stm32mp135f_dk.dts | 55 +++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts index 5d2f343835568..7e3350133f687 100644 --- a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts +++ b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts @@ -8,6 +8,7 @@ #include #include +#include "zephyr/dt-bindings/display/panel.h" #include / { @@ -19,6 +20,7 @@ zephyr,sram = &ddr_data; zephyr,console = &uart4; zephyr,shell-uart = &uart4; + zephyr,display = <dc; }; gpio_keys { @@ -91,3 +93,56 @@ current-speed = <115200>; status = "okay"; }; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_scl_pd12 &i2c1_sda_pe8>; + status = "okay"; +}; + +&i2c4 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c4_scl_pe15 &i2c4_sda_pb9>; + status = "okay"; +}; + +&i2c5 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c5_scl_pd1 &i2c5_sda_ph6>; + status = "okay"; +}; + +<dc { + pinctrl-0 = <<dc_r2_pg7 <dc_r3_pb12 + <dc_r4_pd14 <dc_r5_pe7 <dc_r6_pe13 <dc_r7_pe9 + <dc_g2_ph13 <dc_g3_pf3 + <dc_g4_pd5 <dc_g5_pg0 <dc_g6_pc7 <dc_g7_pa15 + <dc_b2_pd10 <dc_b3_pf2 + <dc_b4_ph14 <dc_b5_pe0 <dc_b6_pb6 <dc_b7_pf1 + <dc_de_ph9 <dc_clk_pd9 <dc_hsync_pc6 <dc_vsync_pg4>; + pinctrl-names = "default"; + disp-on-gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>; + bl-ctrl-gpios = <&gpioe 12 GPIO_ACTIVE_HIGH>; + + status = "okay"; + + width = <480>; + height = <272>; + pixel-format = ; + display-timings { + compatible = "zephyr,panel-timing"; + de-active = <0>; + pixelclk-active = <0>; + hsync-active = <0>; + vsync-active = <0>; + hsync-len = <41>; + vsync-len = <10>; + hback-porch = <13>; + vback-porch = <2>; + hfront-porch = <32>; + vfront-porch = <2>; + }; + def-back-color-red = <0xFF>; + def-back-color-green = <0xFF>; + def-back-color-blue = <0xFF>; +}; From 141133af399c436f0dcf3600491a2e1f3ef1e12c Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sat, 26 Apr 2025 22:23:12 +0200 Subject: [PATCH 09/10] boards: st: stm32mp135f_dk: correct led_1 / led_2 polarity blue and red leds polarity is ACTIVE_LOW hence correct the DT to have them behave correctly. Signed-off-by: Alain Volmat --- boards/st/stm32mp135f_dk/stm32mp135f_dk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts index 7e3350133f687..903f1c7ebd0dc 100644 --- a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts +++ b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts @@ -37,12 +37,12 @@ compatible = "gpio-leds"; blue_led_1: led_1 { - gpios = <&gpioa 14 GPIO_ACTIVE_HIGH>; + gpios = <&gpioa 14 GPIO_ACTIVE_LOW>; label = "LD3"; }; red_led_2: led_2 { - gpios = <&gpioa 13 GPIO_ACTIVE_HIGH>; + gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; label = "LD4"; }; }; From 82b420dcf5a908e35d23bbb55ecbdb105dfdca39 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sat, 26 Apr 2025 22:24:43 +0200 Subject: [PATCH 10/10] boards: st: stm32mp135f_dk: add the I/O expander i2c device and led 2-3 The stm32mp135f_dk board embeds an I/O expander to get access to more I/O. Led 3 (green) and Led 4 (orange) are accessible via this I/O expander. Signed-off-by: Alain Volmat --- boards/st/stm32mp135f_dk/stm32mp135f_dk.dts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts index 903f1c7ebd0dc..3c853de283151 100644 --- a/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts +++ b/boards/st/stm32mp135f_dk/stm32mp135f_dk.dts @@ -45,6 +45,16 @@ gpios = <&gpioa 13 GPIO_ACTIVE_LOW>; label = "LD4"; }; + + green_led_3: led_3 { + gpios = <&mcp23017 14 GPIO_ACTIVE_HIGH>; + label = "LD7"; + }; + + orange_led_4: led_4 { + gpios = <&mcp23017 15 GPIO_ACTIVE_HIGH>; + label = "LD6"; + }; }; aliases { @@ -98,6 +108,14 @@ pinctrl-names = "default"; pinctrl-0 = <&i2c1_scl_pd12 &i2c1_sda_pe8>; status = "okay"; + + mcp23017: pinctrl@21 { + compatible = "microchip,mcp23017"; + reg = <0x21>; + gpio-controller; + #gpio-cells = <2>; + ngpios = <16>; + }; }; &i2c4 {