From 23ff3218a524bec9b8c361caeaaa67586b7db04e Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sun, 22 Jun 2025 14:09:22 +0200 Subject: [PATCH 1/3] dts: bindings: support 15-pin and 22-pin RaspberryPi CSI camera connector Update the RaspberryPi CSI camera connector nexus gpio in order to only expose the list of GPIO pins in order to support both 15-pin and 22-pin connectors as well as 15-pin to 22-pin conversion cables. Signed-off-by: Alain Volmat --- .../raspberrypi,csi-22pins-connector.yaml | 33 ---------- .../gpio/raspberrypi,csi-connector.yaml | 66 +++++++++++++++++++ .../gpio/raspberrypi-csi-22pins-connector.h | 18 ----- .../gpio/raspberrypi-csi-connector.h | 18 +++++ 4 files changed, 84 insertions(+), 51 deletions(-) delete mode 100644 dts/bindings/gpio/raspberrypi,csi-22pins-connector.yaml create mode 100644 dts/bindings/gpio/raspberrypi,csi-connector.yaml delete mode 100644 include/zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h create mode 100644 include/zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h diff --git a/dts/bindings/gpio/raspberrypi,csi-22pins-connector.yaml b/dts/bindings/gpio/raspberrypi,csi-22pins-connector.yaml deleted file mode 100644 index dc8070e26a50..000000000000 --- a/dts/bindings/gpio/raspberrypi,csi-22pins-connector.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2025 STMicroelectronics -# SPDX-License-Identifier: Apache-2.0 - -description: | - GPIO pins exposed on the Raspberry Pi CSI 22pins Camera connector - Connector layout: - - 1 GND - 2 CSI_D0_N - 3 CSI_D0_P - 4 GND - 5 CSI_D1_N - 6 CSI_D1_P - 7 GND - 8 CSI_CK_N - 9 CSI_CK_P - 10 GND - 11 CSI_D2_N - 12 CSI_D2_P - 13 GND - 14 CSI_D3_N - 15 CSI_D3_P - 16 GND - 17 IO0 - 18 IO1 - 19 GND - 20 I2C_SCL - 21 I2C_SDA - 22 VCC (3v3) - -compatible: "raspberrypi,csi-22pins-connector" - -include: [gpio-nexus.yaml, base.yaml] diff --git a/dts/bindings/gpio/raspberrypi,csi-connector.yaml b/dts/bindings/gpio/raspberrypi,csi-connector.yaml new file mode 100644 index 000000000000..dc5e1881ca8a --- /dev/null +++ b/dts/bindings/gpio/raspberrypi,csi-connector.yaml @@ -0,0 +1,66 @@ +# Copyright 2025 STMicroelectronics +# SPDX-License-Identifier: Apache-2.0 + +title: GPIO pins exposed on the Raspberry Pi CSI Camera connector + +description: | + There are 2 variants of the Raspberry Pi CSI camera connector. Either 15-pin + or 22-pin. Here only GPIO provided by those connectors are abstracted since + others pins are directly connected to CSI PHY. + For reference, pinout of 15-pin and 22-pin connectors are references below. + In this gpio nexus, only GPIOs are represented and should be described in + the following way, allowing to have a single compatible for both 15-pin + and 22-pin connectors and also allowing to deal with 15-pin to 22-pin + conversion cables. + + Nexus mapping: + 1 IO0 pin 11 (15-pin based) / pin 17 (22-pin based) + 2 IO1 pin 12 (15-pin based) / pin 18 (22-pin based) + 3 I2C_SCL pin 13 (15-pin based) / pin 20 (22-pin based) + 4 I2C_SDA pin 14 (15-pin based) / pin 21 (22-pin based) + + For reference only, Raspberry 15-pin Connector layout: + 1 GND + 2 CSI_D0_N + 3 CSI_D0_P + 4 GND + 5 CSI_D1_N + 6 CSI_D1_P + 7 GND + 8 CSI_CK_N + 9 CSI_CK_P + 10 GND + 11 IO0 + 12 IO1 + 13 I2C_SCL + 14 I2C_SDA + 15 VCC (3v3) + + For reference only, Raspberry 22-pin Connector layout: + + 1 GND + 2 CSI_D0_N + 3 CSI_D0_P + 4 GND + 5 CSI_D1_N + 6 CSI_D1_P + 7 GND + 8 CSI_CK_N + 9 CSI_CK_P + 10 GND + 11 CSI_D2_N + 12 CSI_D2_P + 13 GND + 14 CSI_D3_N + 15 CSI_D3_P + 16 GND + 17 IO0 + 18 IO1 + 19 GND + 20 I2C_SCL + 21 I2C_SDA + 22 VCC (3v3) + +compatible: "raspberrypi,csi-connector" + +include: [gpio-nexus.yaml, base.yaml] diff --git a/include/zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h b/include/zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h deleted file mode 100644 index dbc83be305c8..000000000000 --- a/include/zephyr/dt-bindings/gpio/raspberrypi-csi-22pins-connector.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2025 STMicroelectronics - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_22PINS_CONNECTOR_H_ -#define INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_22PINS_CONNECTOR_H_ - -/** - * @name CSI 22 pins camera connector pinout - * @{ - */ -#define CSI_22PINS_IO0 17 /**< GPIO0 */ -#define CSI_22PINS_IO1 18 /**< GPIO1 */ -#define CSI_22PINS_I2C_SCL 20 /**< I2C clock pin */ -#define CSI_22PINS_I2C_SDA 21 /**< I2C data pin */ -/** @} */ - -#endif /* INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_22PINS_CONNECTOR_H_ */ diff --git a/include/zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h b/include/zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h new file mode 100644 index 000000000000..eadc896aa892 --- /dev/null +++ b/include/zephyr/dt-bindings/gpio/raspberrypi-csi-connector.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2025 STMicroelectronics + * SPDX-License-Identifier: Apache-2.0 + */ +#ifndef INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_ +#define INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_ + +/** + * @name CSI camera connector GPIO list + * @{ + */ +#define CSI_IO0 1 /**< GPIO0 */ +#define CSI_IO1 2 /**< GPIO1 */ +#define CSI_I2C_SCL 3 /**< I2C clock pin */ +#define CSI_I2C_SDA 4 /**< I2C data pin */ +/** @} */ + +#endif /* INCLUDE_ZEPHYR_DT_BINDINGS_GPIO_RASPBERRYPI_CSI_CONNECTOR_H_ */ From 5c2abc86d775f274a982db1b2c39fb3c021d84de Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sun, 22 Jun 2025 14:17:21 +0200 Subject: [PATCH 2/3] boards: stm32: stm32n6570_dk: rename 22pins CSI into CSI Following renaming of the raspberry csi connector nexus, rename all places when csi 22pins is mentioned to only keep csi instead. Signed-off-by: Alain Volmat --- .../st/stm32n6570_dk/stm32n6570_dk_common.dtsi | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi b/boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi index 6eddc4fca8bb..0e0688a5a875 100644 --- a/boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi +++ b/boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi @@ -8,7 +8,7 @@ #include #include "zephyr/dt-bindings/display/panel.h" #include -#include +#include #include #include #include "arduino_r3_connector.dtsi" @@ -56,13 +56,13 @@ }; }; - csi_22pins_connector: connector_csi_22pins { - compatible = "raspberrypi,csi-22pins-connector"; + csi_connector: connector_csi { + compatible = "raspberrypi,csi-connector"; #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; - gpio-map = , - ; + gpio-map = , + ; }; }; @@ -219,7 +219,7 @@ status = "okay"; }; -csi_22pins_i2c: &i2c1 { +csi_i2c: &i2c1 { clocks = <&rcc STM32_CLOCK(APB1, 21)>, <&rcc STM32_SRC_CKPER I2C1_SEL(1)>; pinctrl-0 = <&i2c1_scl_ph9 &i2c1_sda_pc1>; @@ -436,14 +436,14 @@ zephyr_udc0: &usbotg_hs1 { def-back-color-blue = <0xFF>; }; -csi_22pins_interface: &dcmipp { +csi_interface: &dcmipp { ports { port@0 { - csi_22pins_ep_in: endpoint { }; + csi_ep_in: endpoint { }; }; port@1 { - csi_22pins_capture_port: endpoint@1 { }; + csi_capture_port: endpoint@1 { }; }; }; }; From 3300de600ccc23c04811649c1975582906d3c5b6 Mon Sep 17 00:00:00 2001 From: Alain Volmat Date: Sun, 22 Jun 2025 14:19:37 +0200 Subject: [PATCH 3/3] shields: st_b_cams_imx_mb1854: rename 22pins CSI into CSI Following renaming of the raspberry csi connector nexus, rename all places when csi 22pins is mentioned to only keep csi instead. Signed-off-by: Alain Volmat --- .../st_b_cams_imx_mb1854.overlay | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/boards/shields/st_b_cams_imx_mb1854/st_b_cams_imx_mb1854.overlay b/boards/shields/st_b_cams_imx_mb1854/st_b_cams_imx_mb1854.overlay index 57a6ee9c2df9..cdf7185b7011 100644 --- a/boards/shields/st_b_cams_imx_mb1854/st_b_cams_imx_mb1854.overlay +++ b/boards/shields/st_b_cams_imx_mb1854/st_b_cams_imx_mb1854.overlay @@ -5,12 +5,12 @@ * */ -#include +#include #include / { chosen { - zephyr,camera = &csi_22pins_capture_port; + zephyr,camera = &csi_capture_port; }; imx335_input_clock: imx335-input-clock { @@ -20,26 +20,26 @@ }; }; -&csi_22pins_interface { +&csi_interface { status = "okay"; }; -&csi_22pins_ep_in { +&csi_ep_in { remote-endpoint-label = "imx335_ep_out"; bus-type = ; data-lanes = <1 2>; }; -&csi_22pins_i2c { +&csi_i2c { imx335: camera@1a { compatible = "sony,imx335"; clocks = <&imx335_input_clock>; reg = <0x1a>; - reset-gpios = <&csi_22pins_connector CSI_22PINS_IO0 GPIO_ACTIVE_LOW>; + reset-gpios = <&csi_connector CSI_IO0 GPIO_ACTIVE_LOW>; port { imx335_ep_out: endpoint { - remote-endpoint-label = "csi_22pins_ep_in"; + remote-endpoint-label = "csi_ep_in"; bus-type = ; data-lanes = <1 2>; }; @@ -47,11 +47,11 @@ }; }; -&csi_22pins_connector { +&csi_connector { /* Power the camera module */ en-module-gpios { gpio-hog; - gpios = ; + gpios = ; output-high; }; };