2017-04-19 14:30:16

by Alexander Kochetkov

[permalink] [raw]
Subject: [PATCH] net: arc_emac: switch to phy_start()/phy_stop()

The patch replace phy_start_aneg() with phy_start(). phy_start() call
phy_start_aneg() as a part of startup sequence and allow recover from
error (PHY_HALTED) state.

Also added call phy_stop() to arc_emac_remove() to stop PHY state machine
when MAC is down.

Signed-off-by: Alexander Kochetkov <[email protected]>
---
drivers/net/ethernet/arc/emac_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index abc9f2a..188676d 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -434,7 +434,7 @@ static int arc_emac_open(struct net_device *ndev)
/* Enable EMAC */
arc_reg_or(priv, R_CTRL, EN_MASK);

- phy_start_aneg(ndev->phydev);
+ phy_start(ndev->phydev);

netif_start_queue(ndev);

@@ -556,6 +556,8 @@ static int arc_emac_stop(struct net_device *ndev)
napi_disable(&priv->napi);
netif_stop_queue(ndev);

+ phy_stop(ndev->phydev);
+
/* Disable interrupts */
arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);

--
1.7.9.5


2017-04-19 18:22:32

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH] net: arc_emac: switch to phy_start()/phy_stop()

On 04/19/2017 05:29 PM, Alexander Kochetkov wrote:

> The patch replace phy_start_aneg() with phy_start(). phy_start() call

Replaces.

> phy_start_aneg() as a part of startup sequence and allow recover from
> error (PHY_HALTED) state.
>
> Also added call phy_stop() to arc_emac_remove() to stop PHY state machine

To arc_emac_stop() maybe?

> when MAC is down.

> Signed-off-by: Alexander Kochetkov <[email protected]>
> ---
> drivers/net/ethernet/arc/emac_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
> index abc9f2a..188676d 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
[...]
> @@ -556,6 +556,8 @@ static int arc_emac_stop(struct net_device *ndev)
> napi_disable(&priv->napi);
> netif_stop_queue(ndev);
>
> + phy_stop(ndev->phydev);
> +
> /* Disable interrupts */
> arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
>

MBR, Sergei

2017-04-19 21:08:56

by Florian Fainelli

[permalink] [raw]
Subject: Re: [PATCH] net: arc_emac: switch to phy_start()/phy_stop()

On 04/19/2017 07:29 AM, Alexander Kochetkov wrote:
> The patch replace phy_start_aneg() with phy_start(). phy_start() call
> phy_start_aneg() as a part of startup sequence and allow recover from
> error (PHY_HALTED) state.
>
> Also added call phy_stop() to arc_emac_remove() to stop PHY state machine
> when MAC is down.

This looks fine. If you wanted to go further, you could move the
phy_connect(), phy_disconnect() calls down to the arc_emac_open()
respectively arc_emac_stop() as this would also allow the PHY device to
be fully suspended when the interface is unused.

>
> Signed-off-by: Alexander Kochetkov <[email protected]>
> ---
> drivers/net/ethernet/arc/emac_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
> index abc9f2a..188676d 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
> @@ -434,7 +434,7 @@ static int arc_emac_open(struct net_device *ndev)
> /* Enable EMAC */
> arc_reg_or(priv, R_CTRL, EN_MASK);
>
> - phy_start_aneg(ndev->phydev);
> + phy_start(ndev->phydev);
>
> netif_start_queue(ndev);
>
> @@ -556,6 +556,8 @@ static int arc_emac_stop(struct net_device *ndev)
> napi_disable(&priv->napi);
> netif_stop_queue(ndev);
>
> + phy_stop(ndev->phydev);
> +
> /* Disable interrupts */
> arc_reg_clr(priv, R_ENABLE, RXINT_MASK | TXINT_MASK | ERR_MASK);
>
>


--
Florian

2017-04-19 21:19:20

by Alexander Kochetkov

[permalink] [raw]
Subject: Re: [PATCH] net: arc_emac: switch to phy_start()/phy_stop()


> 20 апр. 2017 г., в 0:08, Florian Fainelli <[email protected]> написал(а):
>
> This looks fine. If you wanted to go further, you could move the
> phy_connect(), phy_disconnect() calls down to the arc_emac_open()
> respectively arc_emac_stop() as this would also allow the PHY device to
> be fully suspended when the interface is unused.


I’ve checked patch phy_connect() is called from arc_emac_open() and
phy_disconnect() is called from arc_emac_stop().

So, I’ve made mistake in the commit message.

Thank you for review.

>
> 19 апр. 2017 г., в 21:22, Sergei Shtylyov <[email protected]> написал(а):
>
> On 04/19/2017 05:29 PM, Alexander Kochetkov wrote:
>
>> The patch replace phy_start_aneg() with phy_start(). phy_start() call
>
> Replaces.
>
>> phy_start_aneg() as a part of startup sequence and allow recover from
>> error (PHY_HALTED) state.
>>
>> Also added call phy_stop() to arc_emac_remove() to stop PHY state machine
>
> To arc_emac_stop() maybe?
>

Sergei, thanks for spell and gramma checking.

Regards,
Alexander.