mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 06:38:29 +04:00
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 <jelonek.jonas@gmail.com> Link: https://github.com/openwrt/openwrt/pull/21184 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
1 parent
5334b41b00
commit
7899dfa6ef
1 file changed
+13
-11
@@ -2676,6 +2676,17 @@ static sds_config sds_config_10p3125g_cmu_type1[] = {
|
|||||||
{ 0x2F, 0x0F, 0xA470 }, { 0x2F, 0x10, 0x8000 }, { 0x2F, 0x11, 0x037B }
|
{ 0x2F, 0x0F, 0xA470 }, { 0x2F, 0x10, 0x8000 }, { 0x2F, 0x11, 0x037B }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int rtpcs_931x_sds_config_fiber_1g(struct rtpcs_serdes *sds)
|
||||||
|
{
|
||||||
|
rtpcs_sds_write_bits(sds, 0x43, 0x12, 15, 14, 0x0);
|
||||||
|
|
||||||
|
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 0x1);
|
||||||
|
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 0x1);
|
||||||
|
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0x0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
|
static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
|
||||||
enum rtpcs_sds_mode hw_mode, int chiptype)
|
enum rtpcs_sds_mode hw_mode, int chiptype)
|
||||||
{
|
{
|
||||||
@@ -2686,11 +2697,7 @@ static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RTPCS_SDS_MODE_1000BASEX:
|
case RTPCS_SDS_MODE_1000BASEX:
|
||||||
rtpcs_sds_write_bits(sds, 0x43, 0x13, 15, 14, 0);
|
rtpcs_931x_sds_config_fiber_1g(sds);
|
||||||
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 1);
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 1);
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RTPCS_SDS_MODE_2500BASEX:
|
case RTPCS_SDS_MODE_2500BASEX:
|
||||||
@@ -2701,12 +2708,7 @@ static int rtpcs_931x_sds_config_mode(struct rtpcs_serdes *sds,
|
|||||||
/* configure 10GR fiber mode=1 */
|
/* configure 10GR fiber mode=1 */
|
||||||
rtpcs_sds_write_bits(sds, 0x1f, 0xb, 1, 1, 1);
|
rtpcs_sds_write_bits(sds, 0x1f, 0xb, 1, 1, 1);
|
||||||
|
|
||||||
/* init fiber_1g */
|
rtpcs_931x_sds_config_fiber_1g(sds);
|
||||||
rtpcs_sds_write_bits(sds, 0x43, 0x13, 15, 14, 0);
|
|
||||||
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 12, 12, 1);
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 6, 6, 1);
|
|
||||||
rtpcs_sds_write_bits(sds, 0x42, 0x0, 13, 13, 0);
|
|
||||||
|
|
||||||
/* init auto */
|
/* init auto */
|
||||||
rtpcs_sds_write_bits(sds, 0x1f, 13, 15, 0, 0x109e);
|
rtpcs_sds_write_bits(sds, 0x1f, 13, 15, 0, 0x109e);
|
||||||
|
|||||||
Reference in new issue
Block a user