Skip to content

Commit 006983e

Browse files
triha2workkuba-moo
authored andcommitted
net: dsa: microchip: Setup fiber ports for KSZ8463
The fiber ports in KSZ8463 cannot be detected internally, so it requires specifying that condition in the device tree. Like the one used in Micrel PHY the port link can only be read and there is no write to the PHY. The driver programs registers to operate fiber ports correctly. Signed-off-by: Tristram Ha <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5bcdb13 commit 006983e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

drivers/net/dsa/microchip/ksz8.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,7 @@ void ksz8_config_cpu_port(struct dsa_switch *ds)
17141714
const u32 *masks;
17151715
const u16 *regs;
17161716
u8 remote;
1717+
u8 fiber_ports = 0;
17171718
int i;
17181719

17191720
masks = dev->info->masks;
@@ -1744,6 +1745,21 @@ void ksz8_config_cpu_port(struct dsa_switch *ds)
17441745
else
17451746
ksz_port_cfg(dev, i, regs[P_STP_CTRL],
17461747
PORT_FORCE_FLOW_CTRL, false);
1748+
if (p->fiber)
1749+
fiber_ports |= (1 << i);
1750+
}
1751+
if (ksz_is_ksz8463(dev)) {
1752+
/* Setup fiber ports. */
1753+
if (fiber_ports) {
1754+
fiber_ports &= 3;
1755+
regmap_update_bits(ksz_regmap_16(dev),
1756+
KSZ8463_REG_CFG_CTRL,
1757+
fiber_ports << PORT_COPPER_MODE_S,
1758+
0);
1759+
regmap_update_bits(ksz_regmap_16(dev),
1760+
KSZ8463_REG_DSP_CTRL_6,
1761+
COPPER_RECEIVE_ADJUSTMENT, 0);
1762+
}
17471763
}
17481764
}
17491765

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5439,6 +5439,9 @@ int ksz_switch_register(struct ksz_device *dev)
54395439
&dev->ports[port_num].interface);
54405440

54415441
ksz_parse_rgmii_delay(dev, port_num, port);
5442+
dev->ports[port_num].fiber =
5443+
of_property_read_bool(port,
5444+
"micrel,fiber-mode");
54425445
}
54435446
of_node_put(ports);
54445447
}

0 commit comments

Comments
 (0)