* [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip
@ 2009-04-07 12:01 Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 2/3] phylib: Allow early-out in phy_change Anatolij Gustschin
2009-04-13 21:51 ` [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2009-04-07 12:01 UTC (permalink / raw)
To: netdev; +Cc: afleming, Sergei Poselenov, Yuri Tikhonov
From: Sergei Poselenov <sposelenov@emcraft.com>
Add support for the Marvell M88E1121R Dual GigE PHY
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/net/phy/marvell.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index eb6411c..e9f436b 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -69,6 +69,11 @@
#define MII_M1111_COPPER 0
#define MII_M1111_FIBER 1
+#define MII_88E1121_PHY_LED_CTRL 16
+#define MII_88E1121_PHY_LED_PAGE 3
+#define MII_88E1121_PHY_LED_DEF 0x0030
+#define MII_88E1121_PHY_PAGE 22
+
#define MII_M1011_PHY_STATUS 0x11
#define MII_M1011_PHY_STATUS_1000 0x8000
#define MII_M1011_PHY_STATUS_100 0x4000
@@ -154,6 +159,30 @@ static int marvell_config_aneg(struct phy_device *phydev)
return err;
}
+static int m88e1121_config_aneg(struct phy_device *phydev)
+{
+ int err, temp;
+
+ err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+ if (err < 0)
+ return err;
+
+ err = phy_write(phydev, MII_M1011_PHY_SCR,
+ MII_M1011_PHY_SCR_AUTO_CROSS);
+ if (err < 0)
+ return err;
+
+ temp = phy_read(phydev, MII_88E1121_PHY_PAGE);
+
+ phy_write(phydev, MII_88E1121_PHY_PAGE, MII_88E1121_PHY_LED_PAGE);
+ phy_write(phydev, MII_88E1121_PHY_LED_CTRL, MII_88E1121_PHY_LED_DEF);
+ phy_write(phydev, MII_88E1121_PHY_PAGE, temp);
+
+ err = genphy_config_aneg(phydev);
+
+ return err;
+}
+
static int m88e1111_config_init(struct phy_device *phydev)
{
int err;
@@ -482,6 +511,18 @@ static struct phy_driver marvell_drivers[] = {
.driver = {.owner = THIS_MODULE,},
},
{
+ .phy_id = 0x01410cb0,
+ .phy_id_mask = 0xfffffff0,
+ .name = "Marvell 88E1121R",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .config_aneg = &m88e1121_config_aneg,
+ .read_status = &marvell_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .driver = { .owner = THIS_MODULE },
+ },
+ {
.phy_id = 0x01410cd0,
.phy_id_mask = 0xfffffff0,
.name = "Marvell 88E1145",
--
1.5.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] phylib: Allow early-out in phy_change
2009-04-07 12:01 [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip Anatolij Gustschin
@ 2009-04-07 12:01 ` Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver Anatolij Gustschin
2009-04-13 21:52 ` [PATCH 2/3] phylib: Allow early-out in phy_change David Miller
2009-04-13 21:51 ` [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip David Miller
1 sibling, 2 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2009-04-07 12:01 UTC (permalink / raw)
To: netdev; +Cc: afleming
Marvell 88E1121R Dual PHY device can be hardware-configured
to use shared interrupt pin for both PHY ports. For such
PHY configurations using shared PHY interrupt phy_interrupt()
handler will also schedule a work for PHY port which didn't
cause an interrupt.
This patch adds a possibility for PHY drivers to provide
did_interrupt() function which reports if the PHY (or a PHY
port in a multi-PHY device) generated an interrupt. This
function is called in phy_change() as phy_change() shouldn't
proceed if it is invoked for a PHY which didn't cause an
interrupt. So check for interrupt originator in phy_change()
to allow early-out.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/net/phy/phy.c | 9 +++++++++
include/linux/phy.h | 6 ++++++
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 3ff1f42..e3b8932 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -655,6 +655,10 @@ static void phy_change(struct work_struct *work)
struct phy_device *phydev =
container_of(work, struct phy_device, phy_queue);
+ if (phydev->drv->did_interrupt &&
+ !phydev->drv->did_interrupt(phydev))
+ goto ignore;
+
err = phy_disable_interrupts(phydev);
if (err)
@@ -681,6 +685,11 @@ static void phy_change(struct work_struct *work)
return;
+ignore:
+ atomic_dec(&phydev->irq_disable);
+ enable_irq(phydev->irq);
+ return;
+
irq_enable_err:
disable_irq(phydev->irq);
atomic_inc(&phydev->irq_disable);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 32cf14a..c871065 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -388,6 +388,12 @@ struct phy_driver {
/* Enables or disables interrupts */
int (*config_intr)(struct phy_device *phydev);
+ /*
+ * Checks if the PHY generated an interrupt.
+ * For multy-PHY devices with shared PHY interrupt pin
+ */
+ int (*did_interrupt)(struct phy_device *phydev);
+
/* Clears up any memory if needed */
void (*remove)(struct phy_device *phydev);
--
1.5.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver
2009-04-07 12:01 ` [PATCH 2/3] phylib: Allow early-out in phy_change Anatolij Gustschin
@ 2009-04-07 12:01 ` Anatolij Gustschin
2009-04-13 21:51 ` David Miller
2009-04-13 21:52 ` [PATCH 2/3] phylib: Allow early-out in phy_change David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2009-04-07 12:01 UTC (permalink / raw)
To: netdev; +Cc: afleming
Add did_interrupt() function to check if a PHY port
really caused an interrupt. This is needed in the case
of shared PHY interrupt pin configuration to stop
interrupt event processing for PHY ports which didn't
cause an interrupt.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/net/phy/marvell.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index e9f436b..7a3ec9d 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -458,6 +458,18 @@ static int marvell_read_status(struct phy_device *phydev)
return 0;
}
+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 struct phy_driver marvell_drivers[] = {
{
.phy_id = 0x01410c60,
@@ -520,6 +532,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,
.driver = { .owner = THIS_MODULE },
},
{
--
1.5.6.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip
2009-04-07 12:01 [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 2/3] phylib: Allow early-out in phy_change Anatolij Gustschin
@ 2009-04-13 21:51 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2009-04-13 21:51 UTC (permalink / raw)
To: agust; +Cc: netdev, afleming, sposelenov, yur
From: Anatolij Gustschin <agust@denx.de>
Date: Tue, 7 Apr 2009 14:01:41 +0200
> From: Sergei Poselenov <sposelenov@emcraft.com>
>
> Add support for the Marvell M88E1121R Dual GigE PHY
>
> Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
> Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver
2009-04-07 12:01 ` [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver Anatolij Gustschin
@ 2009-04-13 21:51 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2009-04-13 21:51 UTC (permalink / raw)
To: agust; +Cc: netdev, afleming
From: Anatolij Gustschin <agust@denx.de>
Date: Tue, 7 Apr 2009 14:01:43 +0200
> Add did_interrupt() function to check if a PHY port
> really caused an interrupt. This is needed in the case
> of shared PHY interrupt pin configuration to stop
> interrupt event processing for PHY ports which didn't
> cause an interrupt.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] phylib: Allow early-out in phy_change
2009-04-07 12:01 ` [PATCH 2/3] phylib: Allow early-out in phy_change Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver Anatolij Gustschin
@ 2009-04-13 21:52 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2009-04-13 21:52 UTC (permalink / raw)
To: agust; +Cc: netdev, afleming
From: Anatolij Gustschin <agust@denx.de>
Date: Tue, 7 Apr 2009 14:01:42 +0200
> Marvell 88E1121R Dual PHY device can be hardware-configured
> to use shared interrupt pin for both PHY ports. For such
> PHY configurations using shared PHY interrupt phy_interrupt()
> handler will also schedule a work for PHY port which didn't
> cause an interrupt.
>
> This patch adds a possibility for PHY drivers to provide
> did_interrupt() function which reports if the PHY (or a PHY
> port in a multi-PHY device) generated an interrupt. This
> function is called in phy_change() as phy_change() shouldn't
> proceed if it is invoked for a PHY which didn't cause an
> interrupt. So check for interrupt originator in phy_change()
> to allow early-out.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
Applied.
> + * For multy-PHY devices with shared PHY interrupt pin
^^^^^
I fixed that typo when commiting this change.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-04-13 21:52 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-07 12:01 [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 2/3] phylib: Allow early-out in phy_change Anatolij Gustschin
2009-04-07 12:01 ` [PATCH 3/3] phylib: Add interrupt source check function to M88E1121R driver Anatolij Gustschin
2009-04-13 21:51 ` David Miller
2009-04-13 21:52 ` [PATCH 2/3] phylib: Allow early-out in phy_change David Miller
2009-04-13 21:51 ` [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).