Skip to contentSkip to conversation

Add PHY IRQ support to the 'sh_eth' driver

PATCH In review Sergei Shtylyov 2 participants 5 messages Dec 19, 2013 – Dec 20, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Add PHY IRQ support to the 'sh_eth' driver

Hello.

This patchset adds support for passing PHY's IRQ to the 'sh_eth' driver from
the platform code and removes now useless code that hinders the PHY IRQ handing by philib.

[1/2] sh_eth: add PHY IRQ to platform data
[2/2] sh_eth: do not reset PHY needlessly

WBR, Sergei

#1 lore raw

PATCH 1/2 sh_eth: add PHY IRQ to platform data

Allow the platform code to pass PHY's IRQ to the driver. Print this IRQ along with the other PHY datails in sh_eth_phy_init().

---
 drivers/net/ethernet/renesas/sh_eth.c |    6 ++++--
 include/linux/sh_eth.h                |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +4 -2
Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
@@ -1685,8 +1685,8 @@ static int sh_eth_phy_init(struct net_de
 		return PTR_ERR(phydev);
 	}
 
-	dev_info(&ndev->dev, "attached phy %i to driver %s\n",
-		phydev->addr, phydev->drv->name);
+	dev_info(&ndev->dev, "attached PHY %d (IRQ %d) to driver %s\n",
+		 phydev->addr, phydev->irq, phydev->drv->name);
 
 	mdp->phydev = phydev;
 
@@ -2544,6 +2544,8 @@ static int sh_mdio_init(struct net_devic
 
 	for (i = 0; i < PHY_MAX_ADDR; i++)
 		mdp->mii_bus->irq[i] = PHY_POLL;
+	if (pd->phy_irq > 0)
+		mdp->mii_bus->irq[pd->phy] = pd->phy_irq;
 
 	/* register mdio bus */
 	ret = mdiobus_register(mdp->mii_bus);
include/linux/sh_eth.h +1 -0
Index: net-next/include/linux/sh_eth.h
===================================================================
@@ -8,6 +8,7 @@ enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_END
 
 struct sh_eth_plat_data {
 	int phy;
+	int phy_irq;
 	int edmac_endian;
 	phy_interface_t phy_interface;
 	void (*set_mdio_gate)(void *addr);
#2 lore raw

PATCH 2/2 sh_eth: do not reset PHY needlessly

In reply to Sergei Shtylyov

There's no need anymore to call phy_init_hw() to reset/resume the PHY from the driver, as the call chain in phylib already has reached it, and so reset/resumed the PHY (even resuming it twice). This duplicate reset is not only needless, it e.g. clears the PHY's interrupt enables just setup by phylib and so prevents the expected IRQs from the PHY.

---
 drivers/net/ethernet/renesas/sh_eth.c |    5 -----
 1 file changed, 5 deletions(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c =================================--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c +++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -1703,11 +1703,6 @@ static int sh_eth_phy_start(struct net_d
if (ret)
return ret;

- /* reset phy - this also wakes it from PDOWN */
- ret = phy_init_hw(mdp->phydev);
- if (ret)
- return ret;
-
phy_start(mdp->phydev);

return 0;

#3 lore raw
In reply to Sergei Shtylyov
Quoted 3 lines · Sergei Shtylyov

This patchset adds support for passing PHY's IRQ to the 'sh_eth' driver from
the platform code and removes now useless code that hinders the PHY IRQ handing by philib.

Ugh, forgot to mention it's against DaveM's 'net-next.git' repo.

Quoted 2 lines

[1/2] sh_eth: add PHY IRQ to platform data
[2/2] sh_eth: do not reset PHY needlessly

WBR, Sergei

maintainer
#4 lore raw

From: Sergei Shtylyov <[email protected]>
Date: Fri, 20 Dec 2013 01:43:16 +0300

Quoted 9 lines · Sergei Shtylyov
Quoted 6 lines

This patchset adds support for passing PHY's IRQ to the 'sh_eth' driver from
the platform code and removes now useless code that hinders the PHY IRQ handing
by philib.

Ugh, forgot to mention it's against DaveM's 'net-next.git' repo.

No need, series applied, thanks.