Thread (4 messages) 4 messages, 3 authors, 2014-03-28

RE: [PATCH] phy/at8031: enable at8031 to work on interrupt mode

From: qiang.zhao@freescale.com <hidden>
Date: 2014-03-28 07:51:34
Also in: linuxppc-dev, lkml

On Thursday, March 27, 2014 7:53 PM, Sergei Shtylyov wrote:
-----Original Message-----
From: Sergei Shtylyov [mailto:sergei.shtylyov@cogentembedded.com]
Sent: Thursday, March 27, 2014 7:53 PM
To: Zhao Qiang-B45475; linuxppc-dev@lists.ozlabs.org;
netdev@vger.kernel.org; Wood Scott-B07421
Cc: linux-kernel@vger.kernel.org; davem@davemloft.net;
mugunthanvnm@ti.com; zonque@gmail.com; helmut.schaa@googlemail.com; Xie
Xiaobo-R63061
Subject: Re: [PATCH] phy/at8031: enable at8031 to work on interrupt mode

Hello.

On 27-03-2014 10:18, Zhao Qiang wrote:
quoted
The at8031 can work on polling mode and interrupt mode.
Add ack_interrupt and config intr funcs to enable interrupt mode for
it.
quoted
Signed-off-by: Zhao Qiang <redacted>
---
  drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++++++++
  1 file changed, 30 insertions(+)
quoted
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index
bc71947..d034ef5 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
[...]
quoted
@@ -191,6 +194,31 @@ static int at803x_config_init(struct phy_device
*phydev)
quoted
  	return 0;
  }

+static int at803x_ack_interrupt(struct phy_device *phydev) {
+	int err;
+
+	err = phy_read(phydev, AT803X_INSR);
    Could make this an initializer...
Thank you very much. However I have no idea about "make this an initializer".
quoted
+
+	return (err < 0) ? err : 0;
+}
+
+static int at803x_config_intr(struct phy_device *phydev) {
+	int err;
+	int value;
+
+	value = phy_read(phydev, AT803X_INER);
+
+	if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
+		err = phy_write(phydev, AT803X_INER,
+				(value | AT803X_INER_INIT));
    Inner parens not needed.
quoted
+	else
+		err = phy_write(phydev, AT803X_INER, value);
    Why are you not clearing the bits here? Why write back what has been
read at all?

WBR, Sergei
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help