// SPDX-License-Identifier: GPL-2.0
/*
 * Device Tree Source for the Silicon Linux RZ/G2E 96board platform (CAT874)
 * connected with aistarvision-mipi-v2-adapter board
 *
 * Copyright (C) 2020 Renesas Electronics Corp.
 */

/dts-v1/;
#include "r8a774c0-ek874.dts"
#define MIPI_OV5645_PARENT_I2C i2c3
#define MIPI_IMX219_PARENT_I2C i2c3
#include "aistarvision-mipi-adapter-2.1.dtsi"

/ {
	model = "Silicon Linux RZ/G2E evaluation kit EK874 (CAT874 + CAT875) with aistarvision-mipi-v2-adapter board";
	compatible = "si-linux,cat875", "si-linux,cat874", "renesas,r8a774c0";
};

&i2c3 {
	status = "okay";
};

&vin4 {
	status = "okay";
};

&vin5 {
	status = "okay";
};

&csi40 {
	status = "okay";

	ports {
		port@0 {
			csi40_in: endpoint {
				clock-lanes = <0>;
				data-lanes = <1 2>;
				remote-endpoint = <&ov5645_ep>;
			};
		};
	};
};

&ov5645 {
	enable-gpios = <&gpio5 5 GPIO_ACTIVE_HIGH>;
	reset-gpios = <&gpio5 3 GPIO_ACTIVE_LOW>;

	port {
		ov5645_ep: endpoint {
			clock-lanes = <0>;
			data-lanes = <1 2>;
			remote-endpoint = <&csi40_in>;
		};
	};
};

&imx219 {
	port {
		imx219_ep: endpoint {
			clock-lanes = <0>;
			data-lanes = <1 2>;
			link-frequencies = /bits/ 64 <456000000>;
			/* uncomment remote-endpoint property to tie imx219 to
			 * CSI2 also make sure remote-endpoint for ov5645 camera
			 * is commented and remote endpoint phandle in csi40_in
			 * is imx219_ep
			 */
			/* remote-endpoint = <&csi40_in>; */
		};
	};
};