[PATCH V3 2/4 net-next?] net: dsa: b53: prefer CPU port 8 for Northstar devices
Rafał Miłecki <[email protected]>
| Newsgroups | org.kernel.vger.netdev,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-devicetree |
|---|---|
| Message-ID | <[email protected]> |
From: Rafał Miłecki <[email protected]> It allows using all switch features in opposite to ports 5 and 7. Signed-off-by: Rafał Miłecki <[email protected]> --- I think this can be net-next but I was asked to send a complete patchset Can you pick those 2 patches to different trees? drivers/net/dsa/b53/b53_common.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c index 5fd8362d0430..052812d2faa9 100644 --- a/drivers/net/dsa/b53/b53_common.c +++ b/drivers/net/dsa/b53/b53_common.c @@ -766,6 +766,32 @@ void b53_disable_port(struct dsa_switch *ds, int port) } EXPORT_SYMBOL(b53_disable_port); +static struct dsa_port *b53_preferred_default_local_cpu_port(struct dsa_switch *ds) +{ + struct b53_device *dev = ds->priv; + struct dsa_port *cpu_dp; + + /* + * Northstar SoCs devices have 3 Ethernet controllers and 3 CPU ports: + * 5 (IMP1), 7, 8 (IMP0). This design was meant for dual IMP setups when + * WAN traffic goes to port 5 and LAN traffic goes to port 8. + * + * While all 3 ports support Broadcom header, ports 5 and 7 have their + * limitations. Features that relay on trapping to CPU (e.g. EAP, STP) + * won't work when using those as CPU ones. + * + * Prefer CPU port 8 if available. + */ + if (is5301x(dev)) { + cpu_dp = dsa_to_port(ds, B53_CPU_PORT); + + if (dsa_port_is_cpu(cpu_dp)) + return cpu_dp; + } + + return NULL; +} + void b53_brcm_hdr_setup(struct dsa_switch *ds, int port) { struct b53_device *dev = ds->priv; @@ -2724,6 +2750,7 @@ static const struct dsa_switch_ops b53_switch_ops = { .port_setup = b53_setup_port, .port_enable = b53_enable_port, .port_disable = b53_disable_port, + .preferred_default_local_cpu_port = b53_preferred_default_local_cpu_port, .support_eee = b53_support_eee, .set_mac_eee = b53_set_mac_eee, .set_ageing_time = b53_set_ageing_time, -- 2.51.0