Skip to content

Commit c870f16

Browse files
jonasjelonekrobimarko
authored andcommitted
realtek: pcs: move polarity into SerDes struct
As a first real usage of the new SerDes struct, move the polarity configuration there. It was previously located in the global rtpcs_ctrl struct as an array, indexed by SerDes id. Because this is per-SerDes information, the new SerDes struct is the correct place to live in. Signed-off-by: Jonas Jelonek <[email protected]> Link: openwrt/openwrt#21146 Signed-off-by: Robert Marko <[email protected]> (cherry picked from commit 56a71f3)
1 parent 4d86ac6 commit c870f16

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ struct rtpcs_serdes {
135135
struct rtpcs_ctrl *ctrl;
136136
u8 id;
137137
enum rtpcs_sds_mode mode;
138+
139+
bool rx_pol_inv;
140+
bool tx_pol_inv;
138141
};
139142

140143
struct rtpcs_ctrl {
@@ -144,8 +147,6 @@ struct rtpcs_ctrl {
144147
const struct rtpcs_config *cfg;
145148
struct rtpcs_serdes serdes[RTPCS_SDS_CNT];
146149
struct rtpcs_link *link[RTPCS_PORT_CNT];
147-
bool rx_pol_inv[RTPCS_SDS_CNT];
148-
bool tx_pol_inv[RTPCS_SDS_CNT];
149150
struct mutex lock;
150151
};
151152

@@ -2242,8 +2243,7 @@ static int rtpcs_930x_setup_serdes(struct rtpcs_serdes *sds,
22422243
pr_info("%s: Configuring RTL9300 SERDES %d\n", __func__, sds->id);
22432244

22442245
/* Set SDS polarity */
2245-
rtpcs_930x_sds_set_polarity(sds, sds->ctrl->tx_pol_inv[sds->id],
2246-
sds->ctrl->rx_pol_inv[sds->id]);
2246+
rtpcs_930x_sds_set_polarity(sds, sds->tx_pol_inv, sds->rx_pol_inv);
22472247

22482248
/* Enable SDS in desired mode */
22492249
rtpcs_930x_sds_mode_set(sds, phy_mode);
@@ -2831,8 +2831,7 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_serdes *sds,
28312831
}
28322832
}
28332833

2834-
rtpcs_931x_sds_set_polarity(sds, ctrl->tx_pol_inv[sds_id],
2835-
ctrl->rx_pol_inv[sds_id]);
2834+
rtpcs_931x_sds_set_polarity(sds, sds->tx_pol_inv, sds->rx_pol_inv);
28362835

28372836
val = ori & ~BIT(sds_id);
28382837
regmap_write(ctrl->map, RTL931X_PS_SERDES_OFF_MODE_CTRL_ADDR, val);
@@ -3090,8 +3089,9 @@ static int rtpcs_probe(struct platform_device *pdev)
30903089
if (sds_id >= ctrl->cfg->serdes_count)
30913090
return -EINVAL;
30923091

3093-
ctrl->rx_pol_inv[sds_id] = of_property_read_bool(child, "realtek,pnswap-rx");
3094-
ctrl->tx_pol_inv[sds_id] = of_property_read_bool(child, "realtek,pnswap-tx");
3092+
sds = &ctrl->serdes[sds_id];
3093+
sds->rx_pol_inv = of_property_read_bool(child, "realtek,pnswap-rx");
3094+
sds->tx_pol_inv = of_property_read_bool(child, "realtek,pnswap-tx");
30953095
}
30963096

30973097
if (ctrl->cfg->init_serdes_common) {

0 commit comments

Comments
 (0)