Moving CSI-2 Camera from CAM0 to CAM1 in Jetson Orin Nano Device Tree

I have a device tree source include file (below) that successfully adds a 2-lane MIPI CSI-2 camera to the CAM0 connector on a Jetson Orin Nano Developer Kit (running JetPack 5.1.3). I’d like to switch the camera to the CAM1 connector, but have had no success altering the file after following other example files.

Can anyone give me a head start on which changes to make?

camera-overlay.dtsi

#include "dt-bindings/clock/tegra234-clock.h"

#define CAM_I2C_MUX 	TEGRA234_AON_GPIO(CC, 3)

/ {
	tegra-capture-vi {
		num-channels = <1>;
		ports {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			port@0 {
				reg = <0>;
				status = "okay";
				jjcamera_vi_in0: endpoint {
					port-index = <1>;
					bus-width = <2>;
					remote-endpoint = <&jjcamera_csi_out0>;
					status = "okay";
				};
			};
		};
	};

	host1x@13e00000 {
		nvcsi@15a00000 {
			num-channels = <1>;
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";
			channel@0 {
				reg = <0>;
				status = "okay";
				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					status = "okay";
					port@0 {
						reg = <0>;
						status = "okay";
						jjcamera_csi_in0: endpoint@0 {
							port-index = <1>;
							bus-width = <2>;
							remote-endpoint = <&jjcamera_out0>;
							status = "okay";
						};
					};
					port@1 {
						reg = <1>;
						status = "okay";
						jjcamera_csi_out0: endpoint@1 {
							remote-endpoint = <&jjcamera_vi_in0>;
							status = "okay";
						};
					};
				};
			};
		};
	};

	cam_i2cmux {
		status = "okay";
		compatible = "i2c-mux-gpio";
		#address-cells = <1>;
		#size-cells = <0>;
		i2c-parent = <&cam_i2c>;
		mux-gpios = <&tegra_aon_gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>;
		i2c@0 {
			status = "okay";
			reg = <0>;
			#address-cells = <1>;
			#size-cells = <0>;
			jjcamera_cam1: jjcamera0640_a@33 {
				compatible = "so,jjcamera0640";
				reg = <0x33>;
				status = "okay";

				/* Physical dimensions of sensor */
				physical_w = "6.100";
				physical_h = "4.524";

				sensor_model = "jjcamera0640";

				use_sensor_mode_id = "true";

				mode0 { /* jjcamera0640_MODE_640x512_60FPS */
					mclk_khz = "24000";
					num_lanes = "2";
					tegra_sinterface = "serial_b";
					phy_mode = "DPHY";
					lane_polarity = "6";
					discontinuous_clk = "no";
					dpcm_enable = "false";
					cil_settletime = "0";

					active_w = "640";
					active_h = "512";

					mode_type = "raw";
					csi_pixel_bit_depth = "16";
					pixel_phase = "y";
					readout_orientation = "0";

					line_length = "11200";
					inherent_gain = "1";

					/* PCLK = CLOCK RATE ACCORDING TO SPREADSHEET / 2 */
					pix_clk_hz = "23148000";

					gain_factor = "1";
					framerate_factor = "1000000";
					exposure_factor = "1000000";
					min_gain_val = "1"; /* Min Raw gain */
					max_gain_val = "240"; /* Max Raw gain */
					step_gain_val = "1";
					default_gain = "1"; /* 1.00x */
					min_hdr_ratio = "1";
					max_hdr_ratio = "1";
					min_framerate = "25000000";
					max_framerate = "72000000";
					step_framerate = "1000000";
					default_framerate = "60000000"; /* 60.0 fps */
					min_exp_time = "25"; /* us */
					max_exp_time = "683709"; /* us */
					step_exp_time = "1";
					default_exp_time = "2495"; /* us */
					embedded_metadata_height = "0";
				};

				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					status = "okay";
					port@0 {
						reg = <0>;
						status = "okay";
						jjcamera_out0: endpoint {
							status = "okay";
							port-index = <1>;
							bus-width = <2>;
							remote-endpoint = <&jjcamera_csi_in0>;
						};
					};
				};
			};
		};
	};
};

/ {
	tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";
		num_csi_lanes = <2>;
		max_lane_speed = <1500000>;
		min_bits_per_pixel = <8>;
		vi_peak_byte_per_pixel = <2>;
		vi_bw_margin_pct = <25>;
		max_pixel_rate = <240000>;
		isp_peak_byte_per_pixel = <5>;
		isp_bw_margin_pct = <25>;

		modules {
			status = "okay";
			module0 {
				badge = "jjcamera0640_cam0_aaqr1c";
				position = "cam0";
				orientation = "1";
				status = "okay";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "jjcamera0640 9-0033";
					proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/jjcamera0640_a@33";
					status = "okay";
				};
			};
		};
	};
};

hello tyler79,

it’s CAM1/J21, which utilize CSI-C/D.
please see-also Jetson Orin NX Series and Orin Nano Series Design Guide for [Figure 10-1. CSI 2-Lane Connection Options].
and, Jetson Orin Nano Developer Kit Carrier Board Specification for [3.2 Camera Connector].

so,
you’ll need to update the device tree property to port-index = <2>;.
please also set lane_polarity = "0"; since CSI2 don’t have P/N swizzled.

Thank you! The lane polarity was the setting I had failed to change during my experiments. Now video is streaming as expected.

I found that it was also necessary to switch the i2c node address from 0 to 1 (i.e. i2c@1 and reg = <1>;) to enable I2C communication.