mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ioana Ciornei <ciorneiioana@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Ioana Ciornei <ioana.ciornei@nxp.com>,
	Maxim Kochetkov <fido_max@inbox.ru>,
	Baruch Siach <baruch@tkos.co.il>,
	Robert Hancock <robert.hancock@calian.com>
Subject: [PATCH net-next 05/18] net: phy: marvell: implement generic .handle_interrupt() callback
Date: Thu, 12 Nov 2020 17:55:00 +0200	[thread overview]
Message-ID: <20201112155513.411604-6-ciorneiioana@gmail.com> (raw)
In-Reply-To: <20201112155513.411604-1-ciorneiioana@gmail.com>

From: Ioana Ciornei <ioana.ciornei@nxp.com>

In an attempt to actually support shared IRQs in phylib, we now move the
responsibility of triggering the phylib state machine or just returning
IRQ_NONE, based on the IRQ status register, to the PHY driver. Having
3 different IRQ handling callbacks (.handle_interrupt(),
.did_interrupt() and .ack_interrupt() ) is confusing so let the PHY
driver implement directly an IRQ handler like any other device driver.
Make this driver follow the new convention.

Cc: Maxim Kochetkov <fido_max@inbox.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Robert Hancock <robert.hancock@calian.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/phy/marvell.c | 57 ++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 21 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 2563526bf4a6..bb843b960436 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -327,6 +327,24 @@ static int marvell_config_intr(struct phy_device *phydev)
 	return err;
 }
 
+static irqreturn_t marvell_handle_interrupt(struct phy_device *phydev)
+{
+	int irq_status;
+
+	irq_status = phy_read(phydev, MII_M1011_IEVENT);
+	if (irq_status < 0) {
+		phy_error(phydev);
+		return IRQ_NONE;
+	}
+
+	if (!(irq_status & MII_M1011_IMASK_INIT))
+		return IRQ_NONE;
+
+	phy_trigger_machine(phydev);
+
+	return IRQ_HANDLED;
+}
+
 static int marvell_set_polarity(struct phy_device *phydev, int polarity)
 {
 	int reg;
@@ -1659,18 +1677,6 @@ static int marvell_aneg_done(struct phy_device *phydev)
 	return (retval < 0) ? retval : (retval & MII_M1011_PHY_STATUS_RESOLVED);
 }
 
-static int m88e1121_did_interrupt(struct phy_device *phydev)
-{
-	int imask;
-
-	imask = phy_read(phydev, MII_M1011_IEVENT);
-
-	if (imask & MII_M1011_IMASK_INIT)
-		return 1;
-
-	return 0;
-}
-
 static void m88e1318_get_wol(struct phy_device *phydev,
 			     struct ethtool_wolinfo *wol)
 {
@@ -2699,6 +2705,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_aneg = m88e1101_config_aneg,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2717,6 +2724,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_aneg = marvell_config_aneg,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2738,6 +2746,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2759,6 +2768,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2779,6 +2789,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_aneg = m88e1118_config_aneg,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2798,7 +2809,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2820,7 +2831,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.get_wol = m88e1318_get_wol,
 		.set_wol = m88e1318_set_wol,
 		.resume = genphy_resume,
@@ -2842,6 +2853,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = genphy_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2862,6 +2874,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_aneg = m88e1118_config_aneg,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2880,6 +2893,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_aneg = marvell_config_aneg,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2897,6 +2911,7 @@ static struct phy_driver marvell_drivers[] = {
 		.config_init = m88e1116r_config_init,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2919,7 +2934,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.get_wol = m88e1318_get_wol,
 		.set_wol = m88e1318_set_wol,
 		.resume = marvell_resume,
@@ -2948,7 +2963,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2974,7 +2989,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -2999,7 +3014,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -3020,7 +3035,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -3045,7 +3060,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
@@ -3067,7 +3082,7 @@ static struct phy_driver marvell_drivers[] = {
 		.read_status = marvell_read_status,
 		.ack_interrupt = marvell_ack_interrupt,
 		.config_intr = marvell_config_intr,
-		.did_interrupt = m88e1121_did_interrupt,
+		.handle_interrupt = marvell_handle_interrupt,
 		.resume = genphy_resume,
 		.suspend = genphy_suspend,
 		.read_page = marvell_read_page,
-- 
2.28.0


  parent reply	other threads:[~2020-11-12 16:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12 15:54 [PATCH net-next 00/18] net: phy: add support for shared interrupts (part 2) Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 01/18] net: phy: vitesse: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 02/18] net: phy: vitesse: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 03/18] net: phy: microchip: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:54 ` [PATCH net-next 04/18] net: phy: microchip: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` Ioana Ciornei [this message]
2020-11-12 15:55 ` [PATCH net-next 06/18] net: phy: marvell: " Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 07/18] net: phy: lxt: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 08/18] net: phy: lxt: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 09/18] net: phy: nxp-tja11xx: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 10/18] net: phy: nxp-tja11xx: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 11/18] net: phy: amd: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 12/18] net: phy: amd: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 13/18] net: phy: smsc: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 14/18] net: phy: smsc: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 15/18] net: phy: ste10Xp: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 16/18] net: phy: ste10Xp: remove the use of .ack_interrupt() Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 17/18] net: phy: adin: implement generic .handle_interrupt() callback Ioana Ciornei
2020-11-12 15:55 ` [PATCH net-next 18/18] net: phy: adin: remove the use of the .ack_interrupt() Ioana Ciornei
2020-11-13  2:19 ` [PATCH net-next 00/18] net: phy: add support for shared interrupts (part 2) Jakub Kicinski
2020-11-13  8:17   ` Ioana Ciornei
2020-11-13 19:54     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112155513.411604-6-ciorneiioana@gmail.com \
    --to=ciorneiioana@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=baruch@tkos.co.il \
    --cc=f.fainelli@gmail.com \
    --cc=fido_max@inbox.ru \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=robert.hancock@calian.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®