Skip to content

Commit afb8a87

Browse files
jonasjelonekhauke
authored andcommitted
realtek: pcs: rtl930x: add standalone 5G QSGMII setup
Add everything that's needed to setup QSGMII mode on the 5G SerDes. This includes patch sequences, additions to symbol error reset and read, and allowing this mode during SerDes setup. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Link: openwrt/openwrt#21930 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent 956cf4a commit afb8a87

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
*/
8484
#define RTPCS_930X_SDS_MODE_SGMII 0x02
8585
#define RTPCS_930X_SDS_MODE_1000BASEX 0x04
86+
#define RTPCS_930X_SDS_MODE_QSGMII 0x06
8687
#define RTPCS_930X_SDS_MODE_USXGMII 0x0d
8788
#define RTPCS_930X_SDS_MODE_XSGMII 0x10
8889
#define RTPCS_930X_SDS_MODE_2500BASEX 0x16
@@ -1462,6 +1463,8 @@ static int rtpcs_930x_sds_get_hw_mode_val(enum rtpcs_sds_mode hw_mode)
14621463
return RTPCS_930X_SDS_MODE_2500BASEX;
14631464
case RTPCS_SDS_MODE_10GBASER:
14641465
return RTPCS_930X_SDS_MODE_10GBASER;
1466+
case RTPCS_SDS_MODE_QSGMII:
1467+
return RTPCS_930X_SDS_MODE_QSGMII;
14651468
case RTPCS_SDS_MODE_XSGMII:
14661469
return RTPCS_930X_SDS_MODE_XSGMII;
14671470
case RTPCS_SDS_MODE_USXGMII_10GSXGMII:
@@ -1621,6 +1624,8 @@ static void rtpcs_930x_sds_tx_config(struct rtpcs_serdes *sds,
16211624
post_en = 0;
16221625
page = 0x2f;
16231626
break;
1627+
case RTPCS_SDS_MODE_QSGMII:
1628+
return;
16241629
default:
16251630
pr_err("%s: unsupported SerDes hw mode\n", __func__);
16261631
return;
@@ -2473,6 +2478,7 @@ static u32 rtpcs_930x_sds_sym_err_get(struct rtpcs_serdes *sds,
24732478
u32 v = 0;
24742479

24752480
switch (hw_mode) {
2481+
case RTPCS_SDS_MODE_QSGMII:
24762482
case RTPCS_SDS_MODE_XSGMII:
24772483
v = rtpcs_sds_read_bits(sds, 0x1, 0x1, 15, 8) << 16;
24782484
v |= rtpcs_sds_read_bits(sds, 0x1, 0x0, 15, 0);
@@ -2810,6 +2816,13 @@ static const struct rtpcs_sds_config rtpcs_930x_sds_cfg_usxgmii_sx_odd[] =
28102816
{0x06, 0x03, 0xc45c},
28112817
};
28122818

2819+
static const struct rtpcs_sds_config rtpcs_930x_sds_cfg_5g_qsgmii[] =
2820+
{
2821+
{0x00, 0x0E, 0x3053},
2822+
{0x21, 0x00, 0x3C91},{0x21, 0x02, 0xB602},{0x21, 0x07, 0xFA66},{0x21, 0x0A, 0xDF40},
2823+
{0x2A, 0x02, 0x35A1},{0x2A, 0x03, 0x6960},
2824+
};
2825+
28132826
static void rtpcs_930x_sds_usxgmii_config(struct rtpcs_serdes *sds, int nway_en,
28142827
u32 opcode, u32 am_period,
28152828
u32 all_am_markers, u32 an_table,
@@ -2870,6 +2883,12 @@ static void rtpcs_930x_sds_patch(struct rtpcs_serdes *sds,
28702883
}
28712884
break;
28722885

2886+
case RTPCS_SDS_MODE_QSGMII:
2887+
/* only QSGMII on 5G SerDes (0 + 1) for now */
2888+
config = rtpcs_930x_sds_cfg_5g_qsgmii;
2889+
count = ARRAY_SIZE(rtpcs_930x_sds_cfg_5g_qsgmii);
2890+
break;
2891+
28732892
case RTPCS_SDS_MODE_XSGMII:
28742893
if (is_even_sds) {
28752894
config = rtpcs_930x_sds_cfg_xsgmii_even;
@@ -2949,6 +2968,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
29492968
case RTPCS_SDS_MODE_10GBASER:
29502969
case RTPCS_SDS_MODE_USXGMII_10GSXGMII:
29512970
case RTPCS_SDS_MODE_USXGMII_10GQXGMII:
2971+
case RTPCS_SDS_MODE_QSGMII:
29522972
case RTPCS_SDS_MODE_XSGMII:
29532973
break;
29542974
default:
@@ -2984,6 +3004,9 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
29843004
/* Enable Fiber RX */
29853005
rtpcs_sds_write_bits(sds, 0x20, 2, 12, 12, 0);
29863006

3007+
if (hw_mode == RTPCS_SDS_MODE_QSGMII)
3008+
goto skip_cali;
3009+
29873010
/* Calibrate SerDes receiver in loopback mode */
29883011
rtpcs_930x_sds_10g_idle(sds);
29893012
do {
@@ -2994,6 +3017,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
29943017
if (calib_tries >= 3)
29953018
pr_warn("%s: SerDes RX calibration failed\n", __func__);
29963019

3020+
skip_cali:
29973021
/* Leave loopback mode */
29983022
rtpcs_930x_sds_tx_config(sds, hw_mode);
29993023

0 commit comments

Comments
 (0)