mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-03-14 23:09:45 +01:00
realtek: dsa,pcs: rtl931x: let PCS driver setup SerDes
Remove SerDes initialization/configuration calls from the DSA driver in 'rtl931x_phylink_mac_config' and let our PCS driver setup the SerDes now that the driver is able to do that. pcs_config of the PCS driver is automatically called by phylink, thus there's no need to call it on our own. Note that in rtl931x_phylink_mac_config the MAC is enabled before pcs_config is called. While this seems to work, it isn't good and needs to be fixed. Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com> Link: https://github.com/openwrt/openwrt/pull/20369 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
8bdc3d1b56
commit
4a5de35dba
2 changed files with 2 additions and 43 deletions
|
|
@ -692,52 +692,11 @@ static void rtl931x_phylink_mac_config(struct dsa_switch *ds, int port,
|
||||||
{
|
{
|
||||||
struct rtl838x_switch_priv *priv = ds->priv;
|
struct rtl838x_switch_priv *priv = ds->priv;
|
||||||
int sds_num;
|
int sds_num;
|
||||||
u32 reg, band;
|
u32 reg;
|
||||||
|
|
||||||
sds_num = priv->ports[port].sds_num;
|
sds_num = priv->ports[port].sds_num;
|
||||||
pr_info("%s: speed %d sds_num %d\n", __func__, state->speed, sds_num);
|
pr_info("%s: speed %d sds_num %d\n", __func__, state->speed, sds_num);
|
||||||
|
|
||||||
switch (state->interface) {
|
|
||||||
case PHY_INTERFACE_MODE_1000BASEX:
|
|
||||||
band = rtl931x_sds_cmu_band_get(sds_num, PHY_INTERFACE_MODE_1000BASEX);
|
|
||||||
rtl931x_sds_init(sds_num, PHY_INTERFACE_MODE_1000BASEX);
|
|
||||||
break;
|
|
||||||
case PHY_INTERFACE_MODE_XGMII:
|
|
||||||
band = rtl931x_sds_cmu_band_get(sds_num, PHY_INTERFACE_MODE_XGMII);
|
|
||||||
rtl931x_sds_init(sds_num, PHY_INTERFACE_MODE_XGMII);
|
|
||||||
break;
|
|
||||||
case PHY_INTERFACE_MODE_10GBASER:
|
|
||||||
case PHY_INTERFACE_MODE_10GKR:
|
|
||||||
band = rtl931x_sds_cmu_band_get(sds_num, PHY_INTERFACE_MODE_10GBASER);
|
|
||||||
rtl931x_sds_init(sds_num, PHY_INTERFACE_MODE_10GBASER);
|
|
||||||
break;
|
|
||||||
case PHY_INTERFACE_MODE_USXGMII:
|
|
||||||
/*
|
|
||||||
* TODO: USXGMII is currently the swiss army knife to declare 10G
|
|
||||||
* multi port PHYs. Real devices use other modes instead. Especially
|
|
||||||
*
|
|
||||||
* - RTL8224 is driven in 10G_QXGMII
|
|
||||||
* - RTL8218D/E are driven in (Realtek proprietary) XSGMII (10G SGMII)
|
|
||||||
*
|
|
||||||
* For now disable all USXGMII SerDes handling and rely on U-Boot setup.
|
|
||||||
*/
|
|
||||||
break;
|
|
||||||
case PHY_INTERFACE_MODE_SGMII:
|
|
||||||
pr_info("%s setting mode PHY_INTERFACE_MODE_SGMII\n", __func__);
|
|
||||||
band = rtl931x_sds_cmu_band_get(sds_num, PHY_INTERFACE_MODE_SGMII);
|
|
||||||
rtl931x_sds_init(sds_num, PHY_INTERFACE_MODE_SGMII);
|
|
||||||
band = rtl931x_sds_cmu_band_set(sds_num, true, 62, PHY_INTERFACE_MODE_SGMII);
|
|
||||||
break;
|
|
||||||
case PHY_INTERFACE_MODE_QSGMII:
|
|
||||||
band = rtl931x_sds_cmu_band_get(sds_num, PHY_INTERFACE_MODE_QSGMII);
|
|
||||||
rtl931x_sds_init(sds_num, PHY_INTERFACE_MODE_QSGMII);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
pr_err("%s: unknown serdes mode: %s\n",
|
|
||||||
__func__, phy_modes(state->interface));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reg = sw_r32(priv->r->mac_force_mode_ctrl(port));
|
reg = sw_r32(priv->r->mac_force_mode_ctrl(port));
|
||||||
pr_info("%s reading FORCE_MODE_CTRL: %08x\n", __func__, reg);
|
pr_info("%s reading FORCE_MODE_CTRL: %08x\n", __func__, reg);
|
||||||
|
|
||||||
|
|
@ -755,7 +714,6 @@ static void rtl931x_phylink_mac_config(struct dsa_switch *ds, int port,
|
||||||
reg |= RTL931X_DUPLEX_MODE;
|
reg |= RTL931X_DUPLEX_MODE;
|
||||||
|
|
||||||
sw_w32(reg, priv->r->mac_force_mode_ctrl(port));
|
sw_w32(reg, priv->r->mac_force_mode_ctrl(port));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rtl93xx_phylink_mac_config(struct dsa_switch *ds, int port,
|
static void rtl93xx_phylink_mac_config(struct dsa_switch *ds, int port,
|
||||||
|
|
|
||||||
|
|
@ -1069,6 +1069,7 @@ static const struct rtpcs_config rtpcs_931x_cfg = {
|
||||||
.mac_tx_pause_sts = RTPCS_931X_MAC_TX_PAUSE_STS,
|
.mac_tx_pause_sts = RTPCS_931X_MAC_TX_PAUSE_STS,
|
||||||
.pcs_ops = &rtpcs_931x_pcs_ops,
|
.pcs_ops = &rtpcs_931x_pcs_ops,
|
||||||
.set_autoneg = rtpcs_93xx_set_autoneg,
|
.set_autoneg = rtpcs_93xx_set_autoneg,
|
||||||
|
.setup_serdes = rtpcs_931x_setup_serdes,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id rtpcs_of_match[] = {
|
static const struct of_device_id rtpcs_of_match[] = {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue