Skip to content

Commit ceec8bc

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: sja1105: make sure the retagging port is enabled for SJA1110
The SJA1110 has an extra configuration in the General Parameters Table through which the user can select the buffer reservation config. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3e77e59 commit ceec8bc

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
568622
static 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

drivers/net/dsa/sja1105/sja1105_static_config.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ size_t sja1110_general_params_entry_packing(void *buf, void *entry_ptr,
211211
sja1105_packing(buf, &entry->egrmirrpcp, 113, 111, size, op);
212212
sja1105_packing(buf, &entry->egrmirrdei, 110, 110, size, op);
213213
sja1105_packing(buf, &entry->replay_port, 109, 106, size, op);
214+
sja1105_packing(buf, &entry->tdmaconfigidx, 70, 67, size, op);
214215
sja1105_packing(buf, &entry->tte_en, 16, 16, size, op);
215216
return size;
216217
}

drivers/net/dsa/sja1105/sja1105_static_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ struct sja1105_general_params_entry {
216216
u64 replay_port;
217217
/* SJA1110 only */
218218
u64 tte_en;
219+
u64 tdmaconfigidx;
219220
};
220221

221222
struct sja1105_schedule_entry_points_entry {

0 commit comments

Comments
 (0)