1*ad6a6ed4SKieran Bingham// SPDX-License-Identifier: GPL-2.0+ 2*ad6a6ed4SKieran Bingham/* 3*ad6a6ed4SKieran Bingham * Copyright (C) 2017 Ideas on Board <kieran.bingham@ideasonboard.com> 4*ad6a6ed4SKieran Bingham * Copyright (C) 2021 Jacopo Mondi <jacopo+renesas@jmondi.org> 5*ad6a6ed4SKieran Bingham * 6*ad6a6ed4SKieran Bingham * Device Tree Source (overlay) that describes GMSL camera connected to 7*ad6a6ed4SKieran Bingham * Fakra connectors for the Eagle V3M and Condor V3H (and compatible) boards. 8*ad6a6ed4SKieran Bingham * 9*ad6a6ed4SKieran Bingham * The following cameras are currently supported: RDACM20 and RDACM21. 10*ad6a6ed4SKieran Bingham * 11*ad6a6ed4SKieran Bingham * The board .dts file that include this has to select which cameras are in use 12*ad6a6ed4SKieran Bingham * by specifying the camera model with: 13*ad6a6ed4SKieran Bingham * 14*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_RDACM20 15*ad6a6ed4SKieran Bingham * or 16*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_RDACM21 17*ad6a6ed4SKieran Bingham * 18*ad6a6ed4SKieran Bingham * And which cameras are connected to the board by defining: 19*ad6a6ed4SKieran Bingham * for GMSL channel 0: 20*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_0 21*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_1 22*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_2 23*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_3 24*ad6a6ed4SKieran Bingham * 25*ad6a6ed4SKieran Bingham * for GMSL channel 1: 26*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_4 27*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_5 28*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_6 29*ad6a6ed4SKieran Bingham * #define GMSL_CAMERA_7 30*ad6a6ed4SKieran Bingham */ 31*ad6a6ed4SKieran Bingham 32*ad6a6ed4SKieran Bingham#include <dt-bindings/gpio/gpio.h> 33*ad6a6ed4SKieran Bingham 34*ad6a6ed4SKieran Bingham/* Validate the board file settings. */ 35*ad6a6ed4SKieran Bingham#if !defined(GMSL_CAMERA_RDACM20) && !defined(GMSL_CAMERA_RDACM21) 36*ad6a6ed4SKieran Bingham#error "Camera model should be defined by the board file" 37*ad6a6ed4SKieran Bingham#endif 38*ad6a6ed4SKieran Bingham 39*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_RDACM20) && defined(GMSL_CAMERA_RDACM21) 40*ad6a6ed4SKieran Bingham#error "A single camera model should be selected" 41*ad6a6ed4SKieran Bingham#endif 42*ad6a6ed4SKieran Bingham 43*ad6a6ed4SKieran Bingham#if !defined(GMSL_CAMERA_0) && !defined(GMSL_CAMERA_1) && \ 44*ad6a6ed4SKieran Bingham !defined(GMSL_CAMERA_2) && !defined(GMSL_CAMERA_3) && \ 45*ad6a6ed4SKieran Bingham !defined(GMSL_CAMERA_4) && !defined(GMSL_CAMERA_5) && \ 46*ad6a6ed4SKieran Bingham !defined(GMSL_CAMERA_6) && !defined(GMSL_CAMERA_7) 47*ad6a6ed4SKieran Bingham#error "At least one camera should be selected" 48*ad6a6ed4SKieran Bingham#endif 49*ad6a6ed4SKieran Bingham 50*ad6a6ed4SKieran Bingham/* Deduce from the enabled cameras which GMSL channels are active. */ 51*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_0) || defined(GMSL_CAMERA_1) || \ 52*ad6a6ed4SKieran Bingham defined(GMSL_CAMERA_2) || defined(GMSL_CAMERA_3) 53*ad6a6ed4SKieran Bingham#define GMSL_0 54*ad6a6ed4SKieran Bingham#endif 55*ad6a6ed4SKieran Bingham 56*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_4) || defined(GMSL_CAMERA_5) || \ 57*ad6a6ed4SKieran Bingham defined(GMSL_CAMERA_6) || defined(GMSL_CAMERA_7) 58*ad6a6ed4SKieran Bingham#define GMSL_1 59*ad6a6ed4SKieran Bingham#endif 60*ad6a6ed4SKieran Bingham 61*ad6a6ed4SKieran Bingham/* Deduce the camera model compatible string. */ 62*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_RDACM20) 63*ad6a6ed4SKieran Bingham#define GMSL_CAMERA_MODEL "imi,rdacm20" 64*ad6a6ed4SKieran Bingham#elif defined(GMSL_CAMERA_RDACM21) 65*ad6a6ed4SKieran Bingham#define GMSL_CAMERA_MODEL "imi,rdacm21" 66*ad6a6ed4SKieran Bingham#endif 67*ad6a6ed4SKieran Bingham 68*ad6a6ed4SKieran Bingham#ifdef GMSL_0 69*ad6a6ed4SKieran Bingham&vin0 { 70*ad6a6ed4SKieran Bingham status = "okay"; 71*ad6a6ed4SKieran Bingham}; 72*ad6a6ed4SKieran Bingham 73*ad6a6ed4SKieran Bingham&vin1 { 74*ad6a6ed4SKieran Bingham status = "okay"; 75*ad6a6ed4SKieran Bingham}; 76*ad6a6ed4SKieran Bingham 77*ad6a6ed4SKieran Bingham&vin2 { 78*ad6a6ed4SKieran Bingham status = "okay"; 79*ad6a6ed4SKieran Bingham}; 80*ad6a6ed4SKieran Bingham 81*ad6a6ed4SKieran Bingham&vin3 { 82*ad6a6ed4SKieran Bingham status = "okay"; 83*ad6a6ed4SKieran Bingham}; 84*ad6a6ed4SKieran Bingham 85*ad6a6ed4SKieran Bingham&gmsl0 { 86*ad6a6ed4SKieran Bingham status = "okay"; 87*ad6a6ed4SKieran Bingham 88*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_RDACM21) 89*ad6a6ed4SKieran Bingham maxim,reverse-channel-microvolt = <100000>; 90*ad6a6ed4SKieran Bingham#endif 91*ad6a6ed4SKieran Bingham 92*ad6a6ed4SKieran Bingham ports { 93*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_0 94*ad6a6ed4SKieran Bingham port@0 { 95*ad6a6ed4SKieran Bingham max9286_in0: endpoint { 96*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con0>; 97*ad6a6ed4SKieran Bingham }; 98*ad6a6ed4SKieran Bingham }; 99*ad6a6ed4SKieran Bingham#endif 100*ad6a6ed4SKieran Bingham 101*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_1 102*ad6a6ed4SKieran Bingham port@1 { 103*ad6a6ed4SKieran Bingham max9286_in1: endpoint { 104*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con1>; 105*ad6a6ed4SKieran Bingham }; 106*ad6a6ed4SKieran Bingham 107*ad6a6ed4SKieran Bingham }; 108*ad6a6ed4SKieran Bingham#endif 109*ad6a6ed4SKieran Bingham 110*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_2 111*ad6a6ed4SKieran Bingham port@2 { 112*ad6a6ed4SKieran Bingham max9286_in2: endpoint { 113*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con2>; 114*ad6a6ed4SKieran Bingham }; 115*ad6a6ed4SKieran Bingham 116*ad6a6ed4SKieran Bingham }; 117*ad6a6ed4SKieran Bingham#endif 118*ad6a6ed4SKieran Bingham 119*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_3 120*ad6a6ed4SKieran Bingham port@3 { 121*ad6a6ed4SKieran Bingham max9286_in3: endpoint { 122*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con3>; 123*ad6a6ed4SKieran Bingham }; 124*ad6a6ed4SKieran Bingham 125*ad6a6ed4SKieran Bingham }; 126*ad6a6ed4SKieran Bingham#endif 127*ad6a6ed4SKieran Bingham }; 128*ad6a6ed4SKieran Bingham 129*ad6a6ed4SKieran Bingham i2c-mux { 130*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_0 131*ad6a6ed4SKieran Bingham i2c@0 { 132*ad6a6ed4SKieran Bingham status = "okay"; 133*ad6a6ed4SKieran Bingham 134*ad6a6ed4SKieran Bingham camera@51 { 135*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 136*ad6a6ed4SKieran Bingham reg = <0x51>, <0x61>; 137*ad6a6ed4SKieran Bingham 138*ad6a6ed4SKieran Bingham port { 139*ad6a6ed4SKieran Bingham fakra_con0: endpoint { 140*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in0>; 141*ad6a6ed4SKieran Bingham }; 142*ad6a6ed4SKieran Bingham }; 143*ad6a6ed4SKieran Bingham }; 144*ad6a6ed4SKieran Bingham }; 145*ad6a6ed4SKieran Bingham#endif 146*ad6a6ed4SKieran Bingham 147*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_1 148*ad6a6ed4SKieran Bingham i2c@1 { 149*ad6a6ed4SKieran Bingham status = "okay"; 150*ad6a6ed4SKieran Bingham 151*ad6a6ed4SKieran Bingham camera@52 { 152*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 153*ad6a6ed4SKieran Bingham reg = <0x52>, <0x62>; 154*ad6a6ed4SKieran Bingham 155*ad6a6ed4SKieran Bingham port { 156*ad6a6ed4SKieran Bingham fakra_con1: endpoint { 157*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in1>; 158*ad6a6ed4SKieran Bingham }; 159*ad6a6ed4SKieran Bingham }; 160*ad6a6ed4SKieran Bingham }; 161*ad6a6ed4SKieran Bingham }; 162*ad6a6ed4SKieran Bingham#endif 163*ad6a6ed4SKieran Bingham 164*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_2 165*ad6a6ed4SKieran Bingham i2c@2 { 166*ad6a6ed4SKieran Bingham status = "okay"; 167*ad6a6ed4SKieran Bingham 168*ad6a6ed4SKieran Bingham camera@53 { 169*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 170*ad6a6ed4SKieran Bingham reg = <0x53>, <0x63>; 171*ad6a6ed4SKieran Bingham 172*ad6a6ed4SKieran Bingham port { 173*ad6a6ed4SKieran Bingham fakra_con2: endpoint { 174*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in2>; 175*ad6a6ed4SKieran Bingham }; 176*ad6a6ed4SKieran Bingham }; 177*ad6a6ed4SKieran Bingham }; 178*ad6a6ed4SKieran Bingham }; 179*ad6a6ed4SKieran Bingham#endif 180*ad6a6ed4SKieran Bingham 181*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_3 182*ad6a6ed4SKieran Bingham i2c@3 { 183*ad6a6ed4SKieran Bingham status = "okay"; 184*ad6a6ed4SKieran Bingham 185*ad6a6ed4SKieran Bingham camera@54 { 186*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 187*ad6a6ed4SKieran Bingham reg = <0x54>, <0x64>; 188*ad6a6ed4SKieran Bingham 189*ad6a6ed4SKieran Bingham port { 190*ad6a6ed4SKieran Bingham fakra_con3: endpoint { 191*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in3>; 192*ad6a6ed4SKieran Bingham }; 193*ad6a6ed4SKieran Bingham }; 194*ad6a6ed4SKieran Bingham }; 195*ad6a6ed4SKieran Bingham }; 196*ad6a6ed4SKieran Bingham#endif 197*ad6a6ed4SKieran Bingham }; 198*ad6a6ed4SKieran Bingham}; 199*ad6a6ed4SKieran Bingham#endif /* ifdef GMSL_0 */ 200*ad6a6ed4SKieran Bingham 201*ad6a6ed4SKieran Bingham#ifdef GMSL_1 202*ad6a6ed4SKieran Bingham&vin4 { 203*ad6a6ed4SKieran Bingham status = "okay"; 204*ad6a6ed4SKieran Bingham}; 205*ad6a6ed4SKieran Bingham 206*ad6a6ed4SKieran Bingham&vin5 { 207*ad6a6ed4SKieran Bingham status = "okay"; 208*ad6a6ed4SKieran Bingham}; 209*ad6a6ed4SKieran Bingham 210*ad6a6ed4SKieran Bingham&vin6 { 211*ad6a6ed4SKieran Bingham status = "okay"; 212*ad6a6ed4SKieran Bingham}; 213*ad6a6ed4SKieran Bingham 214*ad6a6ed4SKieran Bingham&vin7 { 215*ad6a6ed4SKieran Bingham status = "okay"; 216*ad6a6ed4SKieran Bingham}; 217*ad6a6ed4SKieran Bingham 218*ad6a6ed4SKieran Bingham&gmsl1 { 219*ad6a6ed4SKieran Bingham status = "okay"; 220*ad6a6ed4SKieran Bingham 221*ad6a6ed4SKieran Bingham#if defined(GMSL_CAMERA_RDACM21) 222*ad6a6ed4SKieran Bingham maxim,reverse-channel-microvolt = <100000>; 223*ad6a6ed4SKieran Bingham#endif 224*ad6a6ed4SKieran Bingham 225*ad6a6ed4SKieran Bingham ports { 226*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_4 227*ad6a6ed4SKieran Bingham port@0 { 228*ad6a6ed4SKieran Bingham max9286_in4: endpoint { 229*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con4>; 230*ad6a6ed4SKieran Bingham }; 231*ad6a6ed4SKieran Bingham }; 232*ad6a6ed4SKieran Bingham#endif 233*ad6a6ed4SKieran Bingham 234*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_5 235*ad6a6ed4SKieran Bingham port@1 { 236*ad6a6ed4SKieran Bingham max9286_in5: endpoint { 237*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con5>; 238*ad6a6ed4SKieran Bingham }; 239*ad6a6ed4SKieran Bingham 240*ad6a6ed4SKieran Bingham }; 241*ad6a6ed4SKieran Bingham#endif 242*ad6a6ed4SKieran Bingham 243*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_6 244*ad6a6ed4SKieran Bingham port@2 { 245*ad6a6ed4SKieran Bingham max9286_in6: endpoint { 246*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con6>; 247*ad6a6ed4SKieran Bingham }; 248*ad6a6ed4SKieran Bingham 249*ad6a6ed4SKieran Bingham }; 250*ad6a6ed4SKieran Bingham#endif 251*ad6a6ed4SKieran Bingham 252*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_7 253*ad6a6ed4SKieran Bingham port@3 { 254*ad6a6ed4SKieran Bingham max9286_in7: endpoint { 255*ad6a6ed4SKieran Bingham remote-endpoint = <&fakra_con7>; 256*ad6a6ed4SKieran Bingham }; 257*ad6a6ed4SKieran Bingham 258*ad6a6ed4SKieran Bingham }; 259*ad6a6ed4SKieran Bingham#endif 260*ad6a6ed4SKieran Bingham }; 261*ad6a6ed4SKieran Bingham 262*ad6a6ed4SKieran Bingham i2c-mux { 263*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_4 264*ad6a6ed4SKieran Bingham i2c@0 { 265*ad6a6ed4SKieran Bingham status = "okay"; 266*ad6a6ed4SKieran Bingham 267*ad6a6ed4SKieran Bingham camera@55 { 268*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 269*ad6a6ed4SKieran Bingham reg = <0x55>, <0x65>; 270*ad6a6ed4SKieran Bingham 271*ad6a6ed4SKieran Bingham port { 272*ad6a6ed4SKieran Bingham fakra_con4: endpoint { 273*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in4>; 274*ad6a6ed4SKieran Bingham }; 275*ad6a6ed4SKieran Bingham }; 276*ad6a6ed4SKieran Bingham }; 277*ad6a6ed4SKieran Bingham }; 278*ad6a6ed4SKieran Bingham#endif 279*ad6a6ed4SKieran Bingham 280*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_5 281*ad6a6ed4SKieran Bingham i2c@1 { 282*ad6a6ed4SKieran Bingham status = "okay"; 283*ad6a6ed4SKieran Bingham 284*ad6a6ed4SKieran Bingham camera@56 { 285*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 286*ad6a6ed4SKieran Bingham reg = <0x56>, <0x66>; 287*ad6a6ed4SKieran Bingham 288*ad6a6ed4SKieran Bingham port { 289*ad6a6ed4SKieran Bingham fakra_con5: endpoint { 290*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in5>; 291*ad6a6ed4SKieran Bingham }; 292*ad6a6ed4SKieran Bingham }; 293*ad6a6ed4SKieran Bingham }; 294*ad6a6ed4SKieran Bingham }; 295*ad6a6ed4SKieran Bingham#endif 296*ad6a6ed4SKieran Bingham 297*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_6 298*ad6a6ed4SKieran Bingham i2c@2 { 299*ad6a6ed4SKieran Bingham status = "okay"; 300*ad6a6ed4SKieran Bingham 301*ad6a6ed4SKieran Bingham camera@57 { 302*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 303*ad6a6ed4SKieran Bingham reg = <0x57>, <0x67>; 304*ad6a6ed4SKieran Bingham 305*ad6a6ed4SKieran Bingham port { 306*ad6a6ed4SKieran Bingham fakra_con6: endpoint { 307*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in6>; 308*ad6a6ed4SKieran Bingham }; 309*ad6a6ed4SKieran Bingham }; 310*ad6a6ed4SKieran Bingham }; 311*ad6a6ed4SKieran Bingham }; 312*ad6a6ed4SKieran Bingham#endif 313*ad6a6ed4SKieran Bingham 314*ad6a6ed4SKieran Bingham#ifdef GMSL_CAMERA_7 315*ad6a6ed4SKieran Bingham i2c@3 { 316*ad6a6ed4SKieran Bingham status = "okay"; 317*ad6a6ed4SKieran Bingham 318*ad6a6ed4SKieran Bingham camera@58 { 319*ad6a6ed4SKieran Bingham compatible = GMSL_CAMERA_MODEL; 320*ad6a6ed4SKieran Bingham reg = <0x58>, <0x68>; 321*ad6a6ed4SKieran Bingham 322*ad6a6ed4SKieran Bingham port { 323*ad6a6ed4SKieran Bingham fakra_con7: endpoint { 324*ad6a6ed4SKieran Bingham remote-endpoint = <&max9286_in7>; 325*ad6a6ed4SKieran Bingham }; 326*ad6a6ed4SKieran Bingham }; 327*ad6a6ed4SKieran Bingham }; 328*ad6a6ed4SKieran Bingham }; 329*ad6a6ed4SKieran Bingham#endif 330*ad6a6ed4SKieran Bingham }; 331*ad6a6ed4SKieran Bingham}; 332*ad6a6ed4SKieran Bingham#endif /* ifdef GMSL_1 */ 333