From a52d315e89af02a63ed5d43d77626a91e3e82da5 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Wed, 21 Jul 2021 17:14:24 +0200 Subject: verdin-imx8mp: add/modify overlays for supporting ov5640 on mezzanine verdin-imx8mp_mezzanine-ov5640_overlay.dts: Modify the regular overlay to work with the default jumpering of the Mezzanine which uses the same GPIOs as the first camera interface CSI_1 and the same I2C bus as used for DSI display adapters! So, unless we modify the OV5640 driver to cope with using them same GPIOs twice or ignore absence of GPIOs this will not work for any concurrent dual camera use case. verdin-imx8mp_mezzanine-ov5640-2_overlay.dts: Add a new overlay to work with an alternate jumpering of the Mezzanine which uses the same Verdin GPIO2 as used for the Atmel MXT Touchscreen and the same I2C bus as used for DSI display adapters! So, while this can not concurrently used with our 10 inch capacitive LVDS touch screen it does work fine for any concurrent dual camera use case. While at it indicate GPIO usage of primary CSI_1 OV5640 overlay. Related-to: ELB-4035 Signed-off-by: Marcel Ziswiler --- overlays/Makefile | 1 + .../verdin-imx8mp_mezzanine-ov5640-2_overlay.dts | 89 ++++++++++++++++++++++ .../verdin-imx8mp_mezzanine-ov5640_overlay.dts | 22 ++---- overlays/verdin-imx8mp_ov5640_overlay.dts | 2 + 4 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 overlays/verdin-imx8mp_mezzanine-ov5640-2_overlay.dts diff --git a/overlays/Makefile b/overlays/Makefile index fe1aa7d..666c63c 100644 --- a/overlays/Makefile +++ b/overlays/Makefile @@ -89,6 +89,7 @@ dtb-y += verdin-imx8mm_sn65dsi84_overlay.dtbo dtb-y += verdin-imx8mp_lt8912_overlay.dtbo dtb-y += verdin-imx8mp_mezzanine-lvds-single-channel_overlay.dtbo dtb-y += verdin-imx8mp_mezzanine-lvds-dual-channel_overlay.dtbo +dtb-y += verdin-imx8mp_mezzanine-ov5640-2_overlay.dtbo dtb-y += verdin-imx8mp_mezzanine-ov5640_overlay.dtbo dtb-y += verdin-imx8mp_mezzanine-touch-atmel-mxt_overlay.dtbo dtb-y += verdin-imx8mp_native-hdmi_overlay.dtbo diff --git a/overlays/verdin-imx8mp_mezzanine-ov5640-2_overlay.dts b/overlays/verdin-imx8mp_mezzanine-ov5640-2_overlay.dts new file mode 100644 index 0000000..d94dc2e --- /dev/null +++ b/overlays/verdin-imx8mp_mezzanine-ov5640-2_overlay.dts @@ -0,0 +1,89 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Copyright 2021 Toradex + */ + +// Verdin iMX8M Plus Mezzanine orderable at Toradex. +// CSI Camera Module 5MP OV5640 previously orderable at Toradex. + +// Note: Uses the same Verdin GPIO2 as used for the Atmel MXT Touchscreen +// and the same I2C bus as used for DSI display adapters! + +/dts-v1/; +/plugin/; + +#include +#include + +/ { + compatible = "toradex,verdin-imx8mp"; +}; + +&cameradev { + status = "okay"; +}; + +/* Verdin I2C_2_DSI (JP3 2-3, JP4 2-3) */ +&i2c2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + ov5640_mipi@3c { + assigned-clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>; + assigned-clock-parents = <&clk IMX8MP_CLK_24M>; + assigned-clock-rates = <24000000>; + AVDD-supply = <®_3p3v>; + compatible = "ovti,ov5640"; + clock-names = "xclk"; + clocks = <&clk IMX8MP_CLK_IPP_DO_CLKO2>; + csi_id = <1>; + DOVDD-supply = <®_3p3v>; + DVDD-supply = <®_3p3v>; + mclk = <24000000>; + mclk_source = <0>; + mipi_csi; + pinctrl-names = "default"; + /* Verdin GPIO2 (JP6 1-2) */ + powerdown-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + PVDD-supply = <®_3p3v>; + reg = <0x3c>; + /* Verdin GPIO1 (JP5 1-2) */ + reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + status = "okay"; + + port { + ov5640_mipi_1_ep: endpoint { + clock-lanes = <0>; + data-lanes = <1 2>; + remote-endpoint = <&mipi_csi1_ep>; + }; + }; + }; +}; + +&isi_1 { + status = "okay"; + + cap_device { + status = "okay"; + }; +}; + +&mipi_csi_1 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port@1 { + reg = <1>; + + mipi_csi1_ep: endpoint { + csis-hs-settle = <13>; + csis-clk-settle = <2>; + csis-wclk; + data-lanes = <2>; + remote-endpoint = <&ov5640_mipi_1_ep>; + }; + }; +}; diff --git a/overlays/verdin-imx8mp_mezzanine-ov5640_overlay.dts b/overlays/verdin-imx8mp_mezzanine-ov5640_overlay.dts index 4a5e7fc..dc6eb18 100644 --- a/overlays/verdin-imx8mp_mezzanine-ov5640_overlay.dts +++ b/overlays/verdin-imx8mp_mezzanine-ov5640_overlay.dts @@ -6,6 +6,9 @@ // Verdin iMX8M Plus Mezzanine orderable at Toradex. // CSI Camera Module 5MP OV5640 previously orderable at Toradex. +// Note: Uses the same GPIOs as the first camera interface CSI_1 +// and the same I2C bus as used for DSI display adapters! + /dts-v1/; /plugin/; @@ -41,13 +44,13 @@ mclk_source = <0>; mipi_csi; pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_gpio1>, <&pinctrl_gpio2>; - /* Verdin GPIO2 (JP6 1-2) */ - powerdown-gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + pinctrl-0 = <&pinctrl_gpio5>, <&pinctrl_gpio6>; + /* Verdin GPIO6 (JP6 2-3) */ + powerdown-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; PVDD-supply = <®_3p3v>; reg = <0x3c>; - /* Verdin GPIO1 (JP5 1-2) */ - reset-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>; + /* Verdin GPIO5 (JP5 2-3) */ + reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; status = "okay"; port { @@ -60,15 +63,6 @@ }; }; -/* make sure Verdin GPIO1 and GPIO2 are NOT muxed by default to avoid any conflict */ -&iomuxc { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_gpio3>, <&pinctrl_gpio4>, - <&pinctrl_gpio7>, <&pinctrl_gpio8>, - <&pinctrl_gpio_hog1>, <&pinctrl_gpio_hog2>, <&pinctrl_gpio_hog3>, - <&pinctrl_hdmi_hog>, <&pinctrl_pmic_tpm_ena>; -}; - &isi_1 { status = "okay"; diff --git a/overlays/verdin-imx8mp_ov5640_overlay.dts b/overlays/verdin-imx8mp_ov5640_overlay.dts index 98fbb83..956cb38 100644 --- a/overlays/verdin-imx8mp_ov5640_overlay.dts +++ b/overlays/verdin-imx8mp_ov5640_overlay.dts @@ -41,9 +41,11 @@ mipi_csi; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gpio5>, <&pinctrl_gpio6>; + /* Verdin GPIO6 */ powerdown-gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; PVDD-supply = <®_3p3v>; reg = <0x3c>; + /* Verdin GPIO5 */ reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; status = "okay"; -- cgit v1.2.3