@@ -565,6 +565,60 @@ void sja1105_frame_memory_partitioning(struct sja1105_private *priv)
565565 vl_fwd_params -> partspc [0 ] = SJA1105_VL_FRAME_MEMORY ;
566566}
567567
568+ /* SJA1110 TDMACONFIGIDX values:
569+ *
570+ * | 100 Mbps ports | 1Gbps ports | 2.5Gbps ports | Disabled ports
571+ * -----+----------------+---------------+---------------+---------------
572+ * 0 | 0, [5:10] | [1:2] | [3:4] | retag
573+ * 1 |0, [5:10], retag| [1:2] | [3:4] | -
574+ * 2 | 0, [5:10] | [1:3], retag | 4 | -
575+ * 3 | 0, [5:10] |[1:2], 4, retag| 3 | -
576+ * 4 | 0, 2, [5:10] | 1, retag | [3:4] | -
577+ * 5 | 0, 1, [5:10] | 2, retag | [3:4] | -
578+ * 14 | 0, [5:10] | [1:4], retag | - | -
579+ * 15 | [5:10] | [0:4], retag | - | -
580+ */
581+ static void sja1110_select_tdmaconfigidx (struct sja1105_private * priv )
582+ {
583+ struct sja1105_general_params_entry * general_params ;
584+ struct sja1105_table * table ;
585+ bool port_1_is_base_tx ;
586+ bool port_3_is_2500 ;
587+ bool port_4_is_2500 ;
588+ u64 tdmaconfigidx ;
589+
590+ if (priv -> info -> device_id != SJA1110_DEVICE_ID )
591+ return ;
592+
593+ table = & priv -> static_config .tables [BLK_IDX_GENERAL_PARAMS ];
594+ general_params = table -> entries ;
595+
596+ /* All the settings below are "as opposed to SGMII", which is the
597+ * other pinmuxing option.
598+ */
599+ port_1_is_base_tx = priv -> phy_mode [1 ] == PHY_INTERFACE_MODE_INTERNAL ;
600+ port_3_is_2500 = priv -> phy_mode [3 ] == PHY_INTERFACE_MODE_2500BASEX ;
601+ port_4_is_2500 = priv -> phy_mode [4 ] == PHY_INTERFACE_MODE_2500BASEX ;
602+
603+ if (port_1_is_base_tx )
604+ /* Retagging port will operate at 1 Gbps */
605+ tdmaconfigidx = 5 ;
606+ else if (port_3_is_2500 && port_4_is_2500 )
607+ /* Retagging port will operate at 100 Mbps */
608+ tdmaconfigidx = 1 ;
609+ else if (port_3_is_2500 )
610+ /* Retagging port will operate at 1 Gbps */
611+ tdmaconfigidx = 3 ;
612+ else if (port_4_is_2500 )
613+ /* Retagging port will operate at 1 Gbps */
614+ tdmaconfigidx = 2 ;
615+ else
616+ /* Retagging port will operate at 1 Gbps */
617+ tdmaconfigidx = 14 ;
618+
619+ general_params -> tdmaconfigidx = tdmaconfigidx ;
620+ }
621+
568622static int sja1105_init_general_params (struct sja1105_private * priv )
569623{
570624 struct sja1105_general_params_entry default_general_params = {
@@ -640,6 +694,8 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
640694 ((struct sja1105_general_params_entry * )table -> entries )[0 ] =
641695 default_general_params ;
642696
697+ sja1110_select_tdmaconfigidx (priv );
698+
643699 return 0 ;
644700}
645701
0 commit comments