Skip to content

Commit 7899dfa

Browse files
jonasjelonekhauke
authored andcommitted
realtek: pcs: rtl931x: separate and reuse 1000base-x config
Move the configuration of 1000Base-X mode into its own function. This way, redundant code can be replaced by a single function call. Signed-off-by: Jonas Jelonek <[email protected]> Link: openwrt/openwrt#21184 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 5334b41 commit 7899dfa

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

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

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,17 @@ static sds_config sds_config_10p3125g_cmu_type1[] = {
26762676
{ 0x2F, 0x0F, 0xA470 }, { 0x2F, 0x10, 0x8000 }, { 0x2F, 0x11, 0x037B }
26772677
};
26782678

2679+
static int rtpcs_931x_sds_config_fiber_1g(struct rtpcs_serdes *sds)
2680+
{
2681+
rtpcs_sds_write_bits(sds, 0x43, 0x12, 15, 14, 0x0);
2682+
2683+
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 0x1);
2684+
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 0x1);
2685+
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0x0);
2686+
2687+
return 0;
2688+
}
2689+
26792690
static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
26802691
enum rtpcs_sds_mode hw_mode, int chiptype)
26812692
{
@@ -2686,11 +2697,7 @@ static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
26862697
break;
26872698

26882699
case RTPCS_SDS_MODE_1000BASEX:
2689-
rtpcs_sds_write_bits(sds, 0x43, 0x13, 15, 14, 0);
2690-
2691-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 1);
2692-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 1);
2693-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0);
2700+
rtpcs_931x_sds_config_fiber_1g(sds);
26942701
break;
26952702

26962703
case RTPCS_SDS_MODE_2500BASEX:
@@ -2701,12 +2708,7 @@ static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
27012708
/* configure 10GR fiber mode=1 */
27022709
rtpcs_sds_write_bits(sds, 0x1f, 0xb, 1, 1, 1);
27032710

2704-
/* init fiber_1g */
2705-
rtpcs_sds_write_bits(sds, 0x43, 0x13, 15, 14, 0);
2706-
2707-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 1);
2708-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 1);
2709-
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0);
2711+
rtpcs_931x_sds_config_fiber_1g(sds);
27102712

27112713
/* init auto */
27122714
rtpcs_sds_write_bits(sds, 0x1f, 13, 15, 0, 0x109e);

0 commit comments

Comments
 (0)