Commit e95273fe authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Paolo Abeni

net: ravb: Simplify ravb_resume()

Remove explicit calls to functions that are called by ravb_open(). There is
no need to have them doubled now that the ravb_open() already contains
what is needed for the interface configuration. Along with it,
configurations needed by PTP were moved to ravb_wol_restore(). With this,
code in ravb_resume() becomes simpler.
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent b07bc55c
...@@ -2939,6 +2939,20 @@ static int ravb_wol_restore(struct net_device *ndev) ...@@ -2939,6 +2939,20 @@ static int ravb_wol_restore(struct net_device *ndev)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
const struct ravb_hw_info *info = priv->info; const struct ravb_hw_info *info = priv->info;
int error;
/* Set reset mode to rearm the WoL logic. */
error = ravb_set_opmode(ndev, CCC_OPC_RESET);
if (error)
return error;
/* Set AVB config mode. */
error = ravb_set_config_mode(ndev);
if (error)
return error;
if (priv->info->ccc_gac)
ravb_ptp_init(ndev, priv->pdev);
if (info->nc_queues) if (info->nc_queues)
napi_enable(&priv->napi[RAVB_NC]); napi_enable(&priv->napi[RAVB_NC]);
...@@ -2978,53 +2992,29 @@ static int ravb_resume(struct device *dev) ...@@ -2978,53 +2992,29 @@ static int ravb_resume(struct device *dev)
{ {
struct net_device *ndev = dev_get_drvdata(dev); struct net_device *ndev = dev_get_drvdata(dev);
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
const struct ravb_hw_info *info = priv->info;
int ret; int ret;
ret = reset_control_deassert(priv->rstc); ret = reset_control_deassert(priv->rstc);
if (ret) if (ret)
return ret; return ret;
/* If WoL is enabled set reset mode to rearm the WoL logic */ if (!netif_running(ndev))
return 0;
/* If WoL is enabled restore the interface. */
if (priv->wol_enabled) { if (priv->wol_enabled) {
ret = ravb_set_opmode(ndev, CCC_OPC_RESET); ret = ravb_wol_restore(ndev);
if (ret) if (ret)
return ret; return ret;
} }
/* All register have been reset to default values. /* Reopening the interface will restore the device to the working state. */
* Restore all registers which where setup at probe time and ret = ravb_open(ndev);
* reopen device if it was running before system suspended. if (ret < 0)
*/
/* Set AVB config mode */
ret = ravb_set_config_mode(ndev);
if (ret)
return ret; return ret;
ravb_set_gti(ndev); ravb_set_rx_mode(ndev);
netif_device_attach(ndev);
if (info->internal_delay)
ravb_set_delay_mode(ndev);
/* Restore descriptor base address table */
ravb_write(ndev, priv->desc_bat_dma, DBAT);
if (priv->info->ccc_gac)
ravb_ptp_init(ndev, priv->pdev);
if (netif_running(ndev)) {
if (priv->wol_enabled) {
ret = ravb_wol_restore(ndev);
if (ret)
return ret;
}
ret = ravb_open(ndev);
if (ret < 0)
return ret;
ravb_set_rx_mode(ndev);
netif_device_attach(ndev);
}
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment