Skip to content

Commit d337c55

Browse files
mdegevinodkoul
authored andcommitted
phy: renesas: r8a779f0-ether-serdes: add USXGMII mode
The initial driver implementation was limited to SGMII and 1GBit/s. The new mode allows speeds up to 2.5GBit/s on R-Car S4-8 SOCs. Signed-off-by: Michael Dege <michael.dege@renesas.com> Link: https://lore.kernel.org/r/20250703-renesas-serdes-update-v4-1-1db5629cac2b@renesas.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent f0c6d77 commit d337c55

File tree

1 file changed

+57
-12
lines changed

1 file changed

+57
-12
lines changed

drivers/phy/renesas/r8a779f0-ether-serdes.c

Lines changed: 57 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Renesas Ethernet SERDES device driver
33
*
4-
* Copyright (C) 2022 Renesas Electronics Corporation
4+
* Copyright (C) 2022-2025 Renesas Electronics Corporation
55
*/
66

77
#include <linux/delay.h>
@@ -92,17 +92,18 @@ r8a779f0_eth_serdes_common_setting(struct r8a779f0_eth_serdes_channel *channel)
9292
{
9393
struct r8a779f0_eth_serdes_drv_data *dd = channel->dd;
9494

95-
switch (channel->phy_interface) {
96-
case PHY_INTERFACE_MODE_SGMII:
97-
r8a779f0_eth_serdes_write32(dd->addr, 0x0244, 0x180, 0x0097);
98-
r8a779f0_eth_serdes_write32(dd->addr, 0x01d0, 0x180, 0x0060);
99-
r8a779f0_eth_serdes_write32(dd->addr, 0x01d8, 0x180, 0x2200);
100-
r8a779f0_eth_serdes_write32(dd->addr, 0x01d4, 0x180, 0x0000);
101-
r8a779f0_eth_serdes_write32(dd->addr, 0x01e0, 0x180, 0x003d);
102-
return 0;
103-
default:
104-
return -EOPNOTSUPP;
105-
}
95+
/* Set combination mode */
96+
r8a779f0_eth_serdes_write32(dd->addr, 0x0244, 0x180, 0x00d7);
97+
r8a779f0_eth_serdes_write32(dd->addr, 0x01cc, 0x180, 0xc200);
98+
r8a779f0_eth_serdes_write32(dd->addr, 0x01c4, 0x180, 0x0042);
99+
r8a779f0_eth_serdes_write32(dd->addr, 0x01c8, 0x180, 0x0000);
100+
r8a779f0_eth_serdes_write32(dd->addr, 0x01dc, 0x180, 0x002f);
101+
r8a779f0_eth_serdes_write32(dd->addr, 0x01d0, 0x180, 0x0060);
102+
r8a779f0_eth_serdes_write32(dd->addr, 0x01d8, 0x180, 0x2200);
103+
r8a779f0_eth_serdes_write32(dd->addr, 0x01d4, 0x180, 0x0000);
104+
r8a779f0_eth_serdes_write32(dd->addr, 0x01e0, 0x180, 0x003d);
105+
106+
return 0;
106107
}
107108

108109
static int
@@ -155,6 +156,42 @@ r8a779f0_eth_serdes_chan_setting(struct r8a779f0_eth_serdes_channel *channel)
155156
r8a779f0_eth_serdes_write32(channel->addr, 0x0028, 0x1f80, 0x07a1);
156157
r8a779f0_eth_serdes_write32(channel->addr, 0x0000, 0x1f80, 0x0208);
157158
break;
159+
160+
case PHY_INTERFACE_MODE_USXGMII:
161+
r8a779f0_eth_serdes_write32(channel->addr, 0x001c, 0x300, 0x0000);
162+
r8a779f0_eth_serdes_write32(channel->addr, 0x0014, 0x380, 0x0050);
163+
r8a779f0_eth_serdes_write32(channel->addr, 0x0000, 0x380, 0x2200);
164+
r8a779f0_eth_serdes_write32(channel->addr, 0x001c, 0x380, 0x0400);
165+
r8a779f0_eth_serdes_write32(channel->addr, 0x01c0, 0x180, 0x0001);
166+
r8a779f0_eth_serdes_write32(channel->addr, 0x0248, 0x180, 0x056a);
167+
r8a779f0_eth_serdes_write32(channel->addr, 0x0258, 0x180, 0x0015);
168+
r8a779f0_eth_serdes_write32(channel->addr, 0x0144, 0x180, 0x1100);
169+
r8a779f0_eth_serdes_write32(channel->addr, 0x01a0, 0x180, 0x0001);
170+
r8a779f0_eth_serdes_write32(channel->addr, 0x00d0, 0x180, 0x0001);
171+
r8a779f0_eth_serdes_write32(channel->addr, 0x0150, 0x180, 0x0001);
172+
r8a779f0_eth_serdes_write32(channel->addr, 0x00c8, 0x180, 0x0300);
173+
r8a779f0_eth_serdes_write32(channel->addr, 0x0148, 0x180, 0x0300);
174+
r8a779f0_eth_serdes_write32(channel->addr, 0x0174, 0x180, 0x0000);
175+
r8a779f0_eth_serdes_write32(channel->addr, 0x0160, 0x180, 0x0004);
176+
r8a779f0_eth_serdes_write32(channel->addr, 0x01ac, 0x180, 0x0000);
177+
r8a779f0_eth_serdes_write32(channel->addr, 0x00c4, 0x180, 0x0310);
178+
r8a779f0_eth_serdes_write32(channel->addr, 0x00c8, 0x180, 0x0301);
179+
ret = r8a779f0_eth_serdes_reg_wait(channel, 0x00c8, 0x180, BIT(0), 0);
180+
if (ret)
181+
return ret;
182+
r8a779f0_eth_serdes_write32(channel->addr, 0x0148, 0x180, 0x0301);
183+
ret = r8a779f0_eth_serdes_reg_wait(channel, 0x0148, 0x180, BIT(0), 0);
184+
if (ret)
185+
return ret;
186+
r8a779f0_eth_serdes_write32(channel->addr, 0x00c4, 0x180, 0x1310);
187+
r8a779f0_eth_serdes_write32(channel->addr, 0x00d8, 0x180, 0x1800);
188+
r8a779f0_eth_serdes_write32(channel->addr, 0x00dc, 0x180, 0x0000);
189+
r8a779f0_eth_serdes_write32(channel->addr, 0x0000, 0x380, 0x2300);
190+
ret = r8a779f0_eth_serdes_reg_wait(channel, 0x0000, 0x380, BIT(8), 0);
191+
if (ret)
192+
return ret;
193+
break;
194+
158195
default:
159196
return -EOPNOTSUPP;
160197
}
@@ -179,6 +216,14 @@ r8a779f0_eth_serdes_chan_speed(struct r8a779f0_eth_serdes_channel *channel)
179216
return ret;
180217
r8a779f0_eth_serdes_write32(channel->addr, 0x0008, 0x1f80, 0x0000);
181218
break;
219+
case PHY_INTERFACE_MODE_USXGMII:
220+
r8a779f0_eth_serdes_write32(channel->addr, 0x0000, 0x1f00, 0x0120);
221+
usleep_range(10, 20);
222+
r8a779f0_eth_serdes_write32(channel->addr, 0x0000, 0x380, 0x2600);
223+
ret = r8a779f0_eth_serdes_reg_wait(channel, 0x0000, 0x380, BIT(10), 0);
224+
if (ret)
225+
return ret;
226+
break;
182227
default:
183228
return -EOPNOTSUPP;
184229
}

0 commit comments

Comments
 (0)