@@ -100,6 +100,48 @@ static const struct adt_tunable_info atc_tunables[] = {
100100 {"tunable_CIO_LN1_AUSPMA_RX_EQ" , "apple,tunable-lane1-cio" , 0x11000 , 0x1000 , true},
101101};
102102
103+ static const struct adt_tunable_info atc_tunables_t8122 [] = {
104+ {"tunable_ATC0AXI2AF" , "apple,tunable-axi2af" , 0x0 , 0x4000 , true},
105+ {"tunable_ATC_FABRIC" , "apple,tunable-common-b" , 0x44000 , 0x4000 , true},
106+
107+ {"tunable_CIO3PLL_CORE" , "apple,tunable-common-b" , 0x2a00 , 0x200 , true},
108+ {"tunable_CIO3PLL_TOP" , "apple,tunable-common-b" , 0x2800 , 0x200 , true},
109+ {"tunable_ACIOPHY_LANE_USBC0" , "apple,tunable-common-b" , 0x5000 , 0x1000 , true},
110+ {"tunable_ACIOPHY_PLL_TOP" , "apple,tunable-common-b" , 0x1000 , 0x4000 , true},
111+ {"tunable_ACIOPHY_TOP" , "apple,tunable-common-b" , 0x0 , 0x4000 , true},
112+
113+ {"tunable_AUSCMN_DIG" , "apple,tunable-common-b" , 0x800 , 0x200 , true},
114+ {"tunable_AUSPLL_CORE" , "apple,tunable-common-b" , 0x2200 , 0x4000 , true},
115+ //{"tunable_AUX_SHM", "apple,tunable-common-b", 0x0, 0x0, true}, // TODO: offset?
116+ {"tunable_AUX_TOP" , "apple,tunable-common-b" , 0x16000 , 0x4000 , true},
117+ {"tunable_AUSCMN_SHM" , "apple,tunable-common-b" , 0xa00 , 0x200 , true},
118+ {"tunable_CLKMON_CFG" , "apple,tunable-common-b" , 0x2600 , 0x100 , false},
119+
120+ {"tunable_LN0_RX_TOP_USB_DFLT" , "apple,tunable-lane0-usb" , 0x9000 , 0x1000 , true},
121+ //{"tunable_LN0_RX_TOP_USB_EQA", "apple,tunable-lane0-usb", 0x0, 0x1000, true}, // TODO: offset?
122+ {"tunable_LN0_RX_EQ_USB_EQA" , "apple,tunable-lane0-usb" , 0xa000 , 0x1000 , true},
123+ {"tunable_LN0_RX_SHM_USB_DFLT" , "apple,tunable-lane0-usb" , 0xb000 , 0x1000 , true},
124+ {"tunable_LN0_TX_TOP_USB_DFLT" , "apple,tunable-lane0-usb" , 0xc000 , 0x1000 , true},
125+ {"tunable_LN0_TX_SHM_USB_DFLT" , "apple,tunable-lane0-usb" , 0xd000 , 0x1000 , true},
126+ {"tunable_LN0_RX_TOP_CIO_DFLT" , "apple,tunable-lane0-cio" , 0x9000 , 0x1000 , true},
127+ {"tunable_LN0_RX_EQ_CIO_EQA" , "apple,tunable-lane0-cio" , 0xa000 , 0x1000 , true},
128+ {"tunable_LN0_RX_SHM_CIO_DFLT" , "apple,tunable-lane0-cio" , 0xb000 , 0x1000 , true},
129+ {"tunable_LN0_TX_TOP_CIO_DFLT" , "apple,tunable-lane0-cio" , 0xc000 , 0x1000 , true},
130+ {"tunable_LN0_TX_SHM_CIO_DFLT" , "apple,tunable-lane0-cio" , 0xd000 , 0x1000 , true},
131+
132+ {"tunable_LN1_RX_TOP_USB_DFLT" , "apple,tunable-lane1-usb" , 0x10000 , 0x1000 , true},
133+ //{"tunable_LN1_RX_TOP_USB_EQA", "apple,tunable-lane1-usb", 0x0, 0x1000, true}, // TODO: offset?
134+ {"tunable_LN1_RX_EQ_USB_EQA" , "apple,tunable-lane1-usb" , 0x11000 , 0x1000 , true},
135+ {"tunable_LN1_RX_SHM_USB_DFLT" , "apple,tunable-lane1-usb" , 0x12000 , 0x1000 , true},
136+ {"tunable_LN1_TX_TOP_USB_DFLT" , "apple,tunable-lane1-usb" , 0x13000 , 0x1000 , true},
137+ {"tunable_LN1_TX_SHM_USB_DFLT" , "apple,tunable-lane1-usb" , 0x14000 , 0x1000 , true},
138+ {"tunable_LN1_RX_TOP_CIO_DFLT" , "apple,tunable-lane1-cio" , 0x10000 , 0x1000 , true},
139+ {"tunable_LN1_RX_EQ_CIO_EQA" , "apple,tunable-lane1-cio" , 0x11000 , 0x1000 , true},
140+ {"tunable_LN1_RX_SHM_CIO_DFLT" , "apple,tunable-lane1-cio" , 0x12000 , 0x1000 , true},
141+ {"tunable_LN1_TX_TOP_CIO_DFLT" , "apple,tunable-lane1-cio" , 0x13000 , 0x1000 , true},
142+ {"tunable_LN1_TX_SHM_CIO_DFLT" , "apple,tunable-lane1-cio" , 0x14000 , 0x1000 , true},
143+ };
144+
103145static const struct atc_fuse_info atc_fuses_t8103_port0 [] = {
104146 {0x23d2bc434 , 9 , 6 , CIO3PLL_DCO_NCTRL , CIO3PLL_DCO_COARSEBIN_EFUSE0 },
105147 {0x23d2bc434 , 15 , 6 , CIO3PLL_DCO_NCTRL , CIO3PLL_DCO_COARSEBIN_EFUSE1 },
@@ -235,6 +277,7 @@ static const struct atc_fuse_info atc_fuses_t8112_port1[] = {
235277// Order "atc-phy" compatibles in reverse chronologically order to deal with mutliple compatible
236278// strings in ADT atc-phy nodes.
237279static const struct atc_fuse_hw atc_fuses [] = {
280+ {"atc-phy,t8122" , -1 , NULL , 0 },
238281 {"atc-phy,t6020" , -1 , NULL , 0 },
239282 {"atc-phy,t8112" , 0 , atc_fuses_t8112_port0 , ARRAY_SIZE (atc_fuses_t8112_port0 )},
240283 {"atc-phy,t8112" , 1 , atc_fuses_t8112_port1 , ARRAY_SIZE (atc_fuses_t8112_port1 )},
@@ -374,6 +417,8 @@ static int dt_append_atc_tunable(void *dt, int adt_node, int fdt_node,
374417static void dt_copy_atc_tunables (void * dt , const char * adt_path , const char * dt_alias , int port )
375418{
376419 int ret ;
420+ const struct adt_tunable_info * tunables ;
421+ size_t tunable_count ;
377422
378423 int adt_node = adt_path_offset (adt , adt_path );
379424 if (adt_node < 0 )
@@ -398,8 +443,16 @@ static void dt_copy_atc_tunables(void *dt, const char *adt_path, const char *dt_
398443 goto cleanup ;
399444 }
400445
401- for (size_t i = 0 ; i < sizeof (atc_tunables ) / sizeof (* atc_tunables ); ++ i ) {
402- ret = dt_append_atc_tunable (dt , adt_node , fdt_node , & atc_tunables [i ]);
446+ if (adt_is_compatible_at (adt , adt_node , "atc-phy,t8122" , 0 )) {
447+ tunables = & atc_tunables_t8122 [0 ];
448+ tunable_count = sizeof (atc_tunables_t8122 ) / sizeof (* atc_tunables_t8122 );
449+ } else {
450+ tunables = & atc_tunables [0 ];
451+ tunable_count = sizeof (atc_tunables ) / sizeof (* atc_tunables );
452+ }
453+
454+ for (size_t i = 0 ; i < tunable_count ; ++ i ) {
455+ ret = dt_append_atc_tunable (dt , adt_node , fdt_node , & tunables [i ]);
403456 if (ret )
404457 goto cleanup ;
405458 }
0 commit comments