RGMII delays for SJA1105 DSA driver
Vladimir Oltean
maintainercover RGMII delays for SJA1105 DSA driver
This patchset configures the Tunable Delay Lines of the SJA1105 P/Q/R/S switches. These add a programmable phase offset on the RGMII RX and TX clock signals and get used by the driver for fixed-link interfaces that use the rgmii-id, rgmii-txid or rgmii-rxid phy-modes.
Tested on a board where RGMII delays were already set up, by adding MAC-side delays on the RGMII interface towards a BCM5464R PHY and noticing that the MAC now reports SFD, preamble, FCS etc. errors.
Conflicts trivially in drivers/net/dsa/sja1105/sja1105_spi.c with
https://patchwork.ozlabs.org/project/netdev/list/?series=112614&state=*
which must be applied first.
Vladimir Oltean (2):
net: dsa: sja1105: Remove duplicate rgmii_pad_mii_tx from regs
net: dsa: sja1105: Add RGMII delay support for P/Q/R/S chips
drivers/net/dsa/sja1105/sja1105.h | 3 +- drivers/net/dsa/sja1105/sja1105_clocking.c | 100 ++++++++++++++++++++- drivers/net/dsa/sja1105/sja1105_spi.c | 11 ++- 3 files changed, 106 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1
Vladimir Oltean
maintainerPATCH 1/2 net: dsa: sja1105: Remove duplicate rgmii_pad_mii_tx from regs
The pad_mii_tx registers point to the same memory region but were unused. So convert to using these for RGMII I/O cell configuration, as they bear a shorter name.
--- drivers/net/dsa/sja1105/sja1105.h | 2 +- drivers/net/dsa/sja1105/sja1105_clocking.c | 2 +- drivers/net/dsa/sja1105/sja1105_spi.c | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-)
drivers/net/dsa/sja1105/sja1105.h +1 -1
@@ -35,8 +35,8 @@ struct sja1105_regs {u64 ptptsclk;u64 ptpegr_ts[SJA1105_NUM_PORTS ];u64 pad_mii_tx[SJA1105_NUM_PORTS ]; +u64 pad_mii_id[SJA1105_NUM_PORTS ];u64 cgu_idiv[SJA1105_NUM_PORTS ]; -u64 rgmii_pad_mii_tx[SJA1105_NUM_PORTS ];u64 mii_tx_clk[SJA1105_NUM_PORTS ];u64 mii_rx_clk[SJA1105_NUM_PORTS ];u64 mii_ext_tx_clk[SJA1105_NUM_PORTS ];
drivers/net/dsa/sja1105/sja1105_clocking.c +1 -1
@@ -373,7 +373,7 @@ static int sja1105_rgmii_cfg_pad_tx_config(struct sja1105_private *priv,sja1105_cfg_pad_mii_tx_packing (packed_buf, &pad_mii_tx,PACK );return sja1105_spi_send_packed_buf (priv,SPI_WRITE , - regs->rgmii_pad_mii_tx[port], + regs->pad_mii_tx[port], packed_buf,SJA1105_SIZE_CGU_CMD ); }
drivers/net/dsa/sja1105/sja1105_spi.c +2 -4
@@ -500,11 +500,10 @@ static struct sja1105_regs sja1105et_regs = { .port_control = 0x11, .config = 0x020000, .rgu = 0x100440, + /* UM10944.pdf, Table 86, ACU Register overview */ .pad_mii_tx = {0x100800, 0x100802, 0x100804, 0x100806, 0x100808}, .rmii_pll1 = 0x10000A, .cgu_idiv = {0x10000B, 0x10000C, 0x10000D, 0x10000E, 0x10000F}, -/* UM10944.pdf, Table 86, ACU Register overview */ - .rgmii_pad_mii_tx = {0x100800, 0x100802, 0x100804, 0x100806, 0x100808}, .mac = {0x200, 0x202, 0x204, 0x206, 0x208}, .mac_hl1 = {0x400, 0x410, 0x420, 0x430, 0x440}, .mac_hl2 = {0x600, 0x610, 0x620, 0x630, 0x640},
@@ -530,11 +529,10 @@ static struct sja1105_regs sja1105pqrs_regs = { .port_control = 0x12, .config = 0x020000, .rgu = 0x100440, + /* UM10944.pdf, Table 86, ACU Register overview */ .pad_mii_tx = {0x100800, 0x100802, 0x100804, 0x100806, 0x100808}, .rmii_pll1 = 0x10000A, .cgu_idiv = {0x10000B, 0x10000C, 0x10000D, 0x10000E, 0x10000F}, -/* UM10944.pdf, Table 86, ACU Register overview */ - .rgmii_pad_mii_tx = {0x100800, 0x100802, 0x100804, 0x100806, 0x100808}, .mac = {0x200, 0x202, 0x204, 0x206, 0x208}, .mac_hl1 = {0x400, 0x410, 0x420, 0x430, 0x440}, .mac_hl2 = {0x600, 0x610, 0x620, 0x630, 0x640},
Signature · 1 line
2.17.1
Vladimir Oltean
maintainerPATCH 2/2 net: dsa: sja1105: Add RGMII delay support for P/Q/R/S chips
In reply to Vladimir OlteanAs per the DT phy-mode specification, RGMII delays are applied by the MAC when there is no PHY present on the link.
--- drivers/net/dsa/sja1105/sja1105.h | 1 + drivers/net/dsa/sja1105/sja1105_clocking.c | 98 +++++++++++++++++++++- drivers/net/dsa/sja1105/sja1105_spi.c | 5 ++ 3 files changed, 102 insertions(+), 2 deletions(-)
drivers/net/dsa/sja1105/sja1105.h +1 -0
@@ -168,6 +168,7 @@ typedef enum {SJA1105_SPEED_AUTO =0 , } sja1105_speed_t; +int sja1105pqrs_setup_rgmii_delay (const void *ctx,int port);int sja1105_clocking_setup_port (struct sja1105_private *priv,int port);int sja1105_clocking_setup (struct sja1105_private *priv);
drivers/net/dsa/sja1105/sja1105_clocking.c +96 -2
122 lines not on this page · raw message
drivers/net/dsa/sja1105/sja1105_spi.c +5 -0
@@ -531,6 +531,7 @@ static struct sja1105_regs sja1105pqrs_regs = { .rgu = 0x100440, /* UM10944.pdf, Table 86, ACU Register overview */ .pad_mii_tx = {0x100800, 0x100802, 0x100804, 0x100806, 0x100808}, + .pad_mii_id = {0x100810, 0x100811, 0x100812, 0x100813, 0x100814}, .rmii_pll1 = 0x10000A, .cgu_idiv = {0x10000B, 0x10000C, 0x10000D, 0x10000E, 0x10000F}, .mac = {0x200, 0x202, 0x204, 0x206, 0x208},
@@ -587,6 +588,7 @@ struct sja1105_info sja1105p_info = { .dyn_ops = sja1105pqrs_dyn_ops, .ptp_ts_bits = 32, .ptpegr_ts_bytes = 8, + .setup_rgmii_delay = sja1105pqrs_setup_rgmii_delay, .reset_cmd = sja1105pqrs_reset_cmd, .fdb_add_cmd = sja1105pqrs_fdb_add, .fdb_del_cmd = sja1105pqrs_fdb_del,
@@ -601,6 +603,7 @@ struct sja1105_info sja1105q_info = { .dyn_ops = sja1105pqrs_dyn_ops, .ptp_ts_bits = 32, .ptpegr_ts_bytes = 8, + .setup_rgmii_delay = sja1105pqrs_setup_rgmii_delay, .reset_cmd = sja1105pqrs_reset_cmd, .fdb_add_cmd = sja1105pqrs_fdb_add, .fdb_del_cmd = sja1105pqrs_fdb_del,
@@ -615,6 +618,7 @@ struct sja1105_info sja1105r_info = { .dyn_ops = sja1105pqrs_dyn_ops, .ptp_ts_bits = 32, .ptpegr_ts_bytes = 8, + .setup_rgmii_delay = sja1105pqrs_setup_rgmii_delay, .reset_cmd = sja1105pqrs_reset_cmd, .fdb_add_cmd = sja1105pqrs_fdb_add, .fdb_del_cmd = sja1105pqrs_fdb_del,
@@ -630,6 +634,7 @@ struct sja1105_info sja1105s_info = { .regs = &sja1105pqrs_regs, .ptp_ts_bits = 32, .ptpegr_ts_bytes = 8, + .setup_rgmii_delay = sja1105pqrs_setup_rgmii_delay, .reset_cmd = sja1105pqrs_reset_cmd, .fdb_add_cmd = sja1105pqrs_fdb_add, .fdb_del_cmd = sja1105pqrs_fdb_del,
Signature · 1 line
2.17.1
Re: [PATCH net-next 2/2] net: dsa: sja1105: Add RGMII delay support for P/Q/R/S chips
Quoted 4 lines · Vladimir Oltean
As per the DT phy-mode specification, RGMII delays are applied by the MAC when there is no PHY present on the link.
Signed-off-by Vladimir Oltean <[email protected]>
Andrew
David Miller
maintainerFrom: Vladimir Oltean <[email protected]>
Date: Sat, 8 Jun 2019 19:12:26 +0300
Quoted 5 lines
This patchset configures the Tunable Delay Lines of the SJA1105 P/Q/R/S switches. These add a programmable phase offset on the RGMII RX and TX clock signals and get used by the driver for fixed-link interfaces that use the rgmii-id, rgmii-txid or rgmii-rxid phy-modes.
Quoted 7 lines
Tested on a board where RGMII delays were already set up, by adding MAC-side delays on the RGMII interface towards a BCM5464R PHY and noticing that the MAC now reports SFD, preamble, FCS etc. errors.
Conflicts trivially in
drivers/net/dsa/sja1105/sja1105_spi.cwith
https://patchwork.ozlabs.org/project/netdev/list/?series=112614&state=*
which must be applied first.
Series applied, thanks.