net: stmmac: modified pcs mode support for RGMII

snps databook noted that physical coding sublayer (PCS) interface
that can be used when the MAC is configured for the TBI, RTBI, or
SGMII PHY interface. we have RGMII and SGMII in a SoC and it also
has the PCS block. it needs stmmac_init_phy and stmmac_mdio_register
function for initializing phy when it used RGMII interface.

Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dejin Zheng 2020-01-15 23:53:23 +08:00 committed by David S. Miller
parent b3f7e3f23a
commit a47b9e15c3
1 changed files with 6 additions and 11 deletions

View File

@ -388,9 +388,8 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
/* Using PCS we cannot dial with the phy registers at this stage /* Using PCS we cannot dial with the phy registers at this stage
* so we do not support extra feature like EEE. * so we do not support extra feature like EEE.
*/ */
if ((priv->hw->pcs == STMMAC_PCS_RGMII) || if (priv->hw->pcs == STMMAC_PCS_TBI ||
(priv->hw->pcs == STMMAC_PCS_TBI) || priv->hw->pcs == STMMAC_PCS_RTBI)
(priv->hw->pcs == STMMAC_PCS_RTBI))
return false; return false;
/* Check if MAC core supports the EEE feature. */ /* Check if MAC core supports the EEE feature. */
@ -2687,8 +2686,7 @@ static int stmmac_open(struct net_device *dev)
u32 chan; u32 chan;
int ret; int ret;
if (priv->hw->pcs != STMMAC_PCS_RGMII && if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI) {
ret = stmmac_init_phy(dev); ret = stmmac_init_phy(dev);
if (ret) { if (ret) {
@ -4876,8 +4874,7 @@ int stmmac_dvr_probe(struct device *device,
stmmac_check_pcs_mode(priv); stmmac_check_pcs_mode(priv);
if (priv->hw->pcs != STMMAC_PCS_RGMII && if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI) { priv->hw->pcs != STMMAC_PCS_RTBI) {
/* MDIO bus Registration */ /* MDIO bus Registration */
ret = stmmac_mdio_register(ndev); ret = stmmac_mdio_register(ndev);
@ -4911,8 +4908,7 @@ int stmmac_dvr_probe(struct device *device,
error_netdev_register: error_netdev_register:
phylink_destroy(priv->phylink); phylink_destroy(priv->phylink);
error_phy_setup: error_phy_setup:
if (priv->hw->pcs != STMMAC_PCS_RGMII && if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI) priv->hw->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev); stmmac_mdio_unregister(ndev);
error_mdio_register: error_mdio_register:
@ -4957,8 +4953,7 @@ int stmmac_dvr_remove(struct device *dev)
reset_control_assert(priv->plat->stmmac_rst); reset_control_assert(priv->plat->stmmac_rst);
clk_disable_unprepare(priv->plat->pclk); clk_disable_unprepare(priv->plat->pclk);
clk_disable_unprepare(priv->plat->stmmac_clk); clk_disable_unprepare(priv->plat->stmmac_clk);
if (priv->hw->pcs != STMMAC_PCS_RGMII && if (priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_TBI &&
priv->hw->pcs != STMMAC_PCS_RTBI) priv->hw->pcs != STMMAC_PCS_RTBI)
stmmac_mdio_unregister(ndev); stmmac_mdio_unregister(ndev);
destroy_workqueue(priv->wq); destroy_workqueue(priv->wq);