net: mscc: ocelot: move NPI port configuration to DSA
Remove the ocelot_configure_cpu() function, which was in fact bringing up 2 ports: the CPU port module, which both switchdev and DSA have, and the NPI port, which only DSA has. The (non-Ethernet) CPU port module is at a fixed index in the analyzer, whereas the NPI port is selected through the "ethernet" property in the device tree. Therefore, the function to set up an NPI port is DSA-specific, so we move it there, simplifying the ocelot switch library a little bit. Cc: Horatiu Vultur <horatiu.vultur@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: UNGLinuxDriver <UNGLinuxDriver@microchip.com> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
435be28b07
commit
2d44b097bb
@@ -439,6 +439,8 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
|
||||
ocelot->vcap_is2_actions= felix->info->vcap_is2_actions;
|
||||
ocelot->vcap = felix->info->vcap;
|
||||
ocelot->ops = felix->info->ops;
|
||||
ocelot->inj_prefix = OCELOT_TAG_PREFIX_NONE;
|
||||
ocelot->xtr_prefix = OCELOT_TAG_PREFIX_LONG;
|
||||
|
||||
port_phy_modes = kcalloc(num_phys_ports, sizeof(phy_interface_t),
|
||||
GFP_KERNEL);
|
||||
@@ -538,6 +540,28 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The CPU port module is connected to the Node Processor Interface (NPI). This
|
||||
* is the mode through which frames can be injected from and extracted to an
|
||||
* external CPU, over Ethernet.
|
||||
*/
|
||||
static void felix_npi_port_init(struct ocelot *ocelot, int port)
|
||||
{
|
||||
ocelot->npi = port;
|
||||
|
||||
ocelot_write(ocelot, QSYS_EXT_CPU_CFG_EXT_CPUQ_MSK_M |
|
||||
QSYS_EXT_CPU_CFG_EXT_CPU_PORT(port),
|
||||
QSYS_EXT_CPU_CFG);
|
||||
|
||||
/* NPI port Injection/Extraction configuration */
|
||||
ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_XTR_HDR,
|
||||
ocelot->xtr_prefix);
|
||||
ocelot_fields_write(ocelot, port, SYS_PORT_MODE_INCL_INJ_HDR,
|
||||
ocelot->inj_prefix);
|
||||
|
||||
/* Disable transmission of pause frames */
|
||||
ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0);
|
||||
}
|
||||
|
||||
/* Hardware initialization done here so that we can allocate structures with
|
||||
* devm without fear of dsa_register_switch returning -EPROBE_DEFER and causing
|
||||
* us to allocate structures twice (leak memory) and map PCI memory twice
|
||||
@@ -570,11 +594,8 @@ static int felix_setup(struct dsa_switch *ds)
|
||||
for (port = 0; port < ds->num_ports; port++) {
|
||||
ocelot_init_port(ocelot, port);
|
||||
|
||||
/* Bring up the CPU port module and configure the NPI port */
|
||||
if (dsa_is_cpu_port(ds, port))
|
||||
ocelot_configure_cpu(ocelot, port,
|
||||
OCELOT_TAG_PREFIX_NONE,
|
||||
OCELOT_TAG_PREFIX_LONG);
|
||||
felix_npi_port_init(ocelot, port);
|
||||
|
||||
/* Set the default QoS Classification based on PCP and DEI
|
||||
* bits of vlan tag.
|
||||
|
||||
Reference in New Issue
Block a user