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

net: ravb: Move PTP initialization in the driver's ndo_open API for ccc_gac platorms

The initialization sequence for PTP is the same for platforms with ccc_gac
and gptp (according to "Figure 50.71 Flow of gPTP Initialization (Normal,
Common to All Modes)" of the R-Car Series, 3rd generation hardware
manual and "Figure 37A.53 Flow of gPTP Initialization (Normal, Common to
All Modes)" of the RZ/G Series hardware manual).

As some IP variants switch to reset mode (and thus the registers content is
lost) when setting clocks (due to module standby functionality) to be able
to implement runtime PM, move the PTP initialization to the driver's
ndo_open API.

This commit prepares the code for the addition of runtime PM.
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 cd1fb46e
...@@ -1876,7 +1876,7 @@ static int ravb_open(struct net_device *ndev) ...@@ -1876,7 +1876,7 @@ static int ravb_open(struct net_device *ndev)
ravb_set_gti(ndev); ravb_set_gti(ndev);
/* Initialise PTP Clock driver */ /* Initialise PTP Clock driver */
if (info->gptp) if (info->gptp || info->ccc_gac)
ravb_ptp_init(ndev, priv->pdev); ravb_ptp_init(ndev, priv->pdev);
/* PHY control start */ /* PHY control start */
...@@ -1890,7 +1890,7 @@ static int ravb_open(struct net_device *ndev) ...@@ -1890,7 +1890,7 @@ static int ravb_open(struct net_device *ndev)
out_ptp_stop: out_ptp_stop:
/* Stop PTP Clock driver */ /* Stop PTP Clock driver */
if (info->gptp) if (info->gptp || info->ccc_gac)
ravb_ptp_stop(ndev); ravb_ptp_stop(ndev);
ravb_stop_dma(ndev); ravb_stop_dma(ndev);
out_napi_off: out_napi_off:
...@@ -2200,7 +2200,7 @@ static int ravb_close(struct net_device *ndev) ...@@ -2200,7 +2200,7 @@ static int ravb_close(struct net_device *ndev)
ravb_write(ndev, 0, TIC); ravb_write(ndev, 0, TIC);
/* Stop PTP Clock driver */ /* Stop PTP Clock driver */
if (info->gptp) if (info->gptp || info->ccc_gac)
ravb_ptp_stop(ndev); ravb_ptp_stop(ndev);
/* Set the config mode to stop the AVB-DMAC's processes */ /* Set the config mode to stop the AVB-DMAC's processes */
...@@ -2813,10 +2813,6 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2813,10 +2813,6 @@ static int ravb_probe(struct platform_device *pdev)
/* Initialise HW timestamp list */ /* Initialise HW timestamp list */
INIT_LIST_HEAD(&priv->ts_skb_list); INIT_LIST_HEAD(&priv->ts_skb_list);
/* Initialise PTP Clock driver */
if (info->ccc_gac)
ravb_ptp_init(ndev, pdev);
/* Debug message level */ /* Debug message level */
priv->msg_enable = RAVB_DEF_MSG_ENABLE; priv->msg_enable = RAVB_DEF_MSG_ENABLE;
...@@ -2861,10 +2857,6 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2861,10 +2857,6 @@ static int ravb_probe(struct platform_device *pdev)
out_dma_free: out_dma_free:
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
priv->desc_bat_dma); priv->desc_bat_dma);
/* Stop PTP Clock driver */
if (info->ccc_gac)
ravb_ptp_stop(ndev);
out_rpm_put: out_rpm_put:
pm_runtime_put(&pdev->dev); pm_runtime_put(&pdev->dev);
out_rpm_disable: out_rpm_disable:
...@@ -2890,10 +2882,6 @@ static void ravb_remove(struct platform_device *pdev) ...@@ -2890,10 +2882,6 @@ static void ravb_remove(struct platform_device *pdev)
ravb_mdio_release(priv); ravb_mdio_release(priv);
/* Stop PTP Clock driver */
if (info->ccc_gac)
ravb_ptp_stop(ndev);
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat, dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
priv->desc_bat_dma); priv->desc_bat_dma);
......
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