* [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25
@ 2007-11-21 6:06 Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 1/8] ibm_newemac: Fix possible lockup on close Benjamin Herrenschmidt
` (8 more replies)
0 siblings, 9 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
Here are the patches I have pending for EMAC. With some non-released
patches from Hugh Blemings, I get a taishan (440GX) booting now,
in addition to Ebony (440GP) and various 405GP boards.
This is 2.6.25 material except for patch #1 which has already been
posted separately and is candidate for 2.6.24 (and possibly stable)
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/8] ibm_newemac: Fix possible lockup on close
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 15:41 ` Christoph Hellwig
2007-11-21 6:06 ` [PATCH 2/8] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support Benjamin Herrenschmidt
` (7 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
It's a bad idea to call flush_scheduled_work from within a
netdev->stop because the linkwatch will occasionally take the
rtnl lock from a workqueue context, and thus that can deadlock.
This reworks things a bit in that area to avoid the problem.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/net/ibm_newemac/core.c | 31 ++++++++++++++++++++-----------
drivers/net/ibm_newemac/core.h | 1 +
2 files changed, 21 insertions(+), 11 deletions(-)
Index: linux-work/drivers/net/ibm_newemac/core.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:42:50.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:51.000000000 +1100
@@ -642,9 +642,11 @@ static void emac_reset_work(struct work_
DBG(dev, "reset_work" NL);
mutex_lock(&dev->link_lock);
- emac_netif_stop(dev);
- emac_full_tx_reset(dev);
- emac_netif_start(dev);
+ if (dev->opened) {
+ emac_netif_stop(dev);
+ emac_full_tx_reset(dev);
+ emac_netif_start(dev);
+ }
mutex_unlock(&dev->link_lock);
}
@@ -1063,10 +1065,9 @@ static int emac_open(struct net_device *
dev->rx_sg_skb = NULL;
mutex_lock(&dev->link_lock);
+ dev->opened = 1;
- /* XXX Start PHY polling now. Shouldn't wr do like sungem instead and
- * always poll the PHY even when the iface is down ? That would allow
- * things like laptop-net to work. --BenH
+ /* Start PHY polling now.
*/
if (dev->phy.address >= 0) {
int link_poll_interval;
@@ -1145,9 +1146,11 @@ static void emac_link_timer(struct work_
int link_poll_interval;
mutex_lock(&dev->link_lock);
-
DBG2(dev, "link timer" NL);
+ if (!dev->opened)
+ goto bail;
+
if (dev->phy.def->ops->poll_link(&dev->phy)) {
if (!netif_carrier_ok(dev->ndev)) {
/* Get new link parameters */
@@ -1170,13 +1173,14 @@ static void emac_link_timer(struct work_
link_poll_interval = PHY_POLL_LINK_OFF;
}
schedule_delayed_work(&dev->link_work, link_poll_interval);
-
+ bail:
mutex_unlock(&dev->link_lock);
}
static void emac_force_link_update(struct emac_instance *dev)
{
netif_carrier_off(dev->ndev);
+ smp_rmb();
if (dev->link_polling) {
cancel_rearming_delayed_work(&dev->link_work);
if (dev->link_polling)
@@ -1191,11 +1195,14 @@ static int emac_close(struct net_device
DBG(dev, "close" NL);
- if (dev->phy.address >= 0)
+ if (dev->phy.address >= 0) {
+ dev->link_polling = 0;
cancel_rearming_delayed_work(&dev->link_work);
-
+ }
+ mutex_lock(&dev->link_lock);
emac_netif_stop(dev);
- flush_scheduled_work();
+ dev->opened = 0;
+ mutex_unlock(&dev->link_lock);
emac_rx_disable(dev);
emac_tx_disable(dev);
@@ -2756,6 +2763,8 @@ static int __devexit emac_remove(struct
unregister_netdev(dev->ndev);
+ flush_scheduled_work();
+
if (emac_has_feature(dev, EMAC_FTR_HAS_TAH))
tah_detach(dev->tah_dev, dev->tah_port);
if (emac_has_feature(dev, EMAC_FTR_HAS_RGMII))
Index: linux-work/drivers/net/ibm_newemac/core.h
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.h 2007-11-20 14:42:50.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.h 2007-11-20 14:46:51.000000000 +1100
@@ -258,6 +258,7 @@ struct emac_instance {
int stop_timeout; /* in us */
int no_mcast;
int mcast_pending;
+ int opened;
struct work_struct reset_work;
spinlock_t lock;
};
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/8] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 1/8] ibm_newemac: Fix possible lockup on close Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 3/8] ibm_newemac: Add ET1011c " Benjamin Herrenschmidt
` (6 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
From: Stefan Roese <sr@denx.de>
This patch adds BCM5248 and Marvell 88E1111 PHY support to NEW EMAC driver.
These PHY chips are used on PowerPC 440EPx boards.
The PHY code is based on the previous work by Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
--- linux.orig/drivers/net/ibm_newemac/phy.c 2007-06-15 21:45:18.000000000 +0400
+++ linux/drivers/net/ibm_newemac/phy.c 2007-06-15 20:45:15.000000000 +0400
@@ -306,8 +306,47 @@
.ops = &cis8201_phy_ops
};
+static struct mii_phy_def bcm5248_phy_def = {
+
+ .phy_id = 0x0143bc00,
+ .phy_id_mask = 0x0ffffff0,
+ .name = "BCM5248 10/100 SMII Ethernet",
+ .ops = &generic_phy_ops
+};
+
+static int m88e1111_init(struct mii_phy *phy)
+{
+ printk("%s: Marvell 88E1111 Ethernet\n", __FUNCTION__);
+ phy_write(phy, 0x14, 0x0ce3);
+ phy_write(phy, 0x18, 0x4101);
+ phy_write(phy, 0x09, 0x0e00);
+ phy_write(phy, 0x04, 0x01e1);
+ phy_write(phy, 0x00, 0x9140);
+ phy_write(phy, 0x00, 0x1140);
+
+ return 0;
+}
+
+static struct mii_phy_ops m88e1111_phy_ops = {
+ .init = m88e1111_init,
+ .setup_aneg = genmii_setup_aneg,
+ .setup_forced = genmii_setup_forced,
+ .poll_link = genmii_poll_link,
+ .read_link = genmii_read_link
+};
+
+static struct mii_phy_def m88e1111_phy_def = {
+
+ .phy_id = 0x01410CC0,
+ .phy_id_mask = 0x0ffffff0,
+ .name = "Marvell 88E1111 Ethernet",
+ .ops = &m88e1111_phy_ops,
+};
+
static struct mii_phy_def *mii_phy_table[] = {
&cis8201_phy_def,
+ &bcm5248_phy_def,
+ &m88e1111_phy_def,
&genmii_phy_def,
NULL
};
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 3/8] ibm_newemac: Add ET1011c PHY support
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 1/8] ibm_newemac: Fix possible lockup on close Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 2/8] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 4/8] ibm_newemac: Fix ZMII refcounting bug Benjamin Herrenschmidt
` (5 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
From: Stefan Roese <sr@denx.de>
This adds support for the Agere ET1011c PHY as found on the AMCC Taishan
board.
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/net/ibm_newemac/phy.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
Index: linux-work/drivers/net/ibm_newemac/phy.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/phy.c 2007-11-08 18:54:12.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/phy.c 2007-11-08 18:54:13.000000000 +1100
@@ -327,6 +327,42 @@ static int m88e1111_init(struct mii_phy
return 0;
}
+static int et1011c_init(struct mii_phy *phy)
+{
+ u16 reg_short;
+
+ reg_short = (u16)(phy_read(phy,0x16));
+ reg_short &= ~(0x7);
+ reg_short |= 0x6; /* RGMII Trace Delay*/
+ phy_write(phy, 0x16, reg_short);
+
+ reg_short = (u16)(phy_read(phy, 0x17));
+ reg_short &= ~(0x40);
+ phy_write(phy, 0x17, reg_short);
+
+ phy_write(phy,0x1c,0x74f0);
+ return 0;
+}
+
+static struct mii_phy_ops et1011c_phy_ops = {
+ .init = et1011c_init,
+ .setup_aneg = genmii_setup_aneg,
+ .setup_forced = genmii_setup_forced,
+ .poll_link = genmii_poll_link,
+ .read_link = genmii_read_link
+};
+
+static struct mii_phy_def et1011c_phy_def = {
+ .phy_id = 0x0282f000,
+ .phy_id_mask = 0x0fffff00,
+ .name = "ET1011C Gigabit Ethernet",
+ .ops = &et1011c_phy_ops
+};
+
+
+
+
+
static struct mii_phy_ops m88e1111_phy_ops = {
.init = m88e1111_init,
.setup_aneg = genmii_setup_aneg,
@@ -344,6 +380,7 @@ static struct mii_phy_def m88e1111_phy_d
};
static struct mii_phy_def *mii_phy_table[] = {
+ &et1011c_phy_def,
&cis8201_phy_def,
&bcm5248_phy_def,
&m88e1111_phy_def,
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 4/8] ibm_newemac: Fix ZMII refcounting bug
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (2 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 3/8] ibm_newemac: Add ET1011c " Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 5/8] ibm_newemac: Workaround reset timeout when no link Benjamin Herrenschmidt
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
When using ZMII for MDIO only (such as 440GX with RGMII for data and ZMII for
MDIO), the ZMII code would fail to properly refcount, thus triggering a
BUG_ON().
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
---
drivers/net/ibm_newemac/zmii.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: linux-work/drivers/net/ibm_newemac/zmii.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/zmii.c 2007-11-08 15:45:32.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/zmii.c 2007-11-08 15:46:21.000000000 +1100
@@ -83,12 +83,14 @@ int __devinit zmii_attach(struct of_devi
ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode);
- if (!zmii_valid_mode(*mode))
+ if (!zmii_valid_mode(*mode)) {
/* Probably an EMAC connected to RGMII,
* but it still may need ZMII for MDIO so
* we don't fail here.
*/
+ dev->users++;
return 0;
+ }
mutex_lock(&dev->lock);
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 5/8] ibm_newemac: Workaround reset timeout when no link
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (3 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 4/8] ibm_newemac: Fix ZMII refcounting bug Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 6/8] ibm_newemac: Cleanup/Fix RGMII MDIO support detection Benjamin Herrenschmidt
` (3 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
With some PHYs, when the link goes away, the EMAC reset fails due
to the loss of the RX clock I believe.
The old EMAC driver worked around that using some internal chip-specific
clock force bits that are different on various 44x implementations.
This is an attempt at doing it differently, by avoiding the reset when
there is no link, but forcing loopback mode instead. It seems to work
on my Taishan 440GX based board so far.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
---
drivers/net/ibm_newemac/core.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
Index: linux-work/drivers/net/ibm_newemac/core.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:51.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:58.000000000 +1100
@@ -464,26 +464,34 @@ static int emac_configure(struct emac_in
{
struct emac_regs __iomem *p = dev->emacp;
struct net_device *ndev = dev->ndev;
- int tx_size, rx_size;
+ int tx_size, rx_size, link = netif_carrier_ok(dev->ndev);
u32 r, mr1 = 0;
DBG(dev, "configure" NL);
- if (emac_reset(dev) < 0)
+ if (!link) {
+ out_be32(&p->mr1, in_be32(&p->mr1)
+ | EMAC_MR1_FDE | EMAC_MR1_ILE);
+ udelay(100);
+ } else if (emac_reset(dev) < 0)
return -ETIMEDOUT;
if (emac_has_feature(dev, EMAC_FTR_HAS_TAH))
tah_reset(dev->tah_dev);
- DBG(dev, " duplex = %d, pause = %d, asym_pause = %d\n",
- dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause);
+ DBG(dev, " link = %d duplex = %d, pause = %d, asym_pause = %d\n",
+ link, dev->phy.duplex, dev->phy.pause, dev->phy.asym_pause);
/* Default fifo sizes */
tx_size = dev->tx_fifo_size;
rx_size = dev->rx_fifo_size;
+ /* No link, force loopback */
+ if (!link)
+ mr1 = EMAC_MR1_FDE | EMAC_MR1_ILE;
+
/* Check for full duplex */
- if (dev->phy.duplex == DUPLEX_FULL)
+ else if (dev->phy.duplex == DUPLEX_FULL)
mr1 |= EMAC_MR1_FDE | EMAC_MR1_MWSW_001;
/* Adjust fifo sizes, mr1 and timeouts based on link speed */
@@ -1165,9 +1173,9 @@ static void emac_link_timer(struct work_
link_poll_interval = PHY_POLL_LINK_ON;
} else {
if (netif_carrier_ok(dev->ndev)) {
- emac_reinitialize(dev);
netif_carrier_off(dev->ndev);
netif_tx_disable(dev->ndev);
+ emac_reinitialize(dev);
emac_print_link_status(dev);
}
link_poll_interval = PHY_POLL_LINK_OFF;
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 6/8] ibm_newemac: Cleanup/Fix RGMII MDIO support detection
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (4 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 5/8] ibm_newemac: Workaround reset timeout when no link Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware Benjamin Herrenschmidt
` (2 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
More than just "AXON" version of EMAC RGMII supports MDIO, so replace
the current test with a generic property in the device-tree that
indicates such support.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
---
arch/powerpc/boot/dts/sequoia.dts | 1 +
drivers/net/ibm_newemac/rgmii.c | 20 +++++++++++---------
drivers/net/ibm_newemac/rgmii.h | 5 +++--
3 files changed, 15 insertions(+), 11 deletions(-)
Index: linux-work/drivers/net/ibm_newemac/rgmii.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/rgmii.c 2007-11-12 10:55:54.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/rgmii.c 2007-11-12 10:56:56.000000000 +1100
@@ -140,7 +140,7 @@ void rgmii_get_mdio(struct of_device *of
RGMII_DBG2(dev, "get_mdio(%d)" NL, input);
- if (dev->type != RGMII_AXON)
+ if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO))
return;
mutex_lock(&dev->lock);
@@ -161,7 +161,7 @@ void rgmii_put_mdio(struct of_device *of
RGMII_DBG2(dev, "put_mdio(%d)" NL, input);
- if (dev->type != RGMII_AXON)
+ if (!(dev->flags & EMAC_RGMII_FLAG_HAS_MDIO))
return;
fer = in_be32(&p->fer);
@@ -250,11 +250,13 @@ static int __devinit rgmii_probe(struct
goto err_free;
}
- /* Check for RGMII type */
+ /* Check for RGMII flags */
+ if (of_get_property(ofdev->node, "has-mdio", NULL))
+ dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
+
+ /* CAB lacks the right properties, fix this up */
if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
- dev->type = RGMII_AXON;
- else
- dev->type = RGMII_STANDARD;
+ dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
DBG2(dev, " Boot FER = 0x%08x, SSR = 0x%08x\n",
in_be32(&dev->base->fer), in_be32(&dev->base->ssr));
@@ -263,9 +265,9 @@ static int __devinit rgmii_probe(struct
out_be32(&dev->base->fer, 0);
printk(KERN_INFO
- "RGMII %s %s initialized\n",
- dev->type == RGMII_STANDARD ? "standard" : "axon",
- ofdev->node->full_name);
+ "RGMII %s initialized with%s MDIO support\n",
+ ofdev->node->full_name,
+ (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out");
wmb();
dev_set_drvdata(&ofdev->dev, dev);
Index: linux-work/drivers/net/ibm_newemac/rgmii.h
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/rgmii.h 2007-11-12 10:55:54.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/rgmii.h 2007-11-12 10:56:56.000000000 +1100
@@ -35,8 +35,9 @@ struct rgmii_regs {
struct rgmii_instance {
struct rgmii_regs __iomem *base;
- /* Type of RGMII bridge */
- int type;
+ /* RGMII bridge flags */
+ int flags;
+#define EMAC_RGMII_FLAG_HAS_MDIO 0x00000001
/* Only one EMAC whacks us at a time */
struct mutex lock;
Index: linux-work/arch/powerpc/boot/dts/sequoia.dts
===================================================================
--- linux-work.orig/arch/powerpc/boot/dts/sequoia.dts 2007-11-12 10:58:38.000000000 +1100
+++ linux-work/arch/powerpc/boot/dts/sequoia.dts 2007-11-12 10:58:47.000000000 +1100
@@ -245,6 +245,7 @@
device_type = "rgmii-interface";
compatible = "ibm,rgmii-440epx", "ibm,rgmii";
reg = <ef601000 8>;
+ has-mdio;
};
EMAC0: ethernet@ef600e00 {
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 7/8] ibm_newemac: Cleanup/fix support for STACR register variants
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (6 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-24 1:43 ` [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Jeff Garzik
8 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
There are a few variants of the STACR register that affect more than
just the "AXON" version of EMAC. Replace the current test of various
chip models with tests for generic properties in the device-tree.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
---
arch/powerpc/boot/dts/sequoia.dts | 4 ++++
drivers/net/ibm_newemac/core.c | 23 +++++++++++++----------
drivers/net/ibm_newemac/core.h | 6 +++---
3 files changed, 20 insertions(+), 13 deletions(-)
Index: linux-work/arch/powerpc/boot/dts/sequoia.dts
===================================================================
--- linux-work.orig/arch/powerpc/boot/dts/sequoia.dts 2007-11-20 14:47:01.000000000 +1100
+++ linux-work/arch/powerpc/boot/dts/sequoia.dts 2007-11-20 14:47:02.000000000 +1100
@@ -274,6 +274,8 @@
zmii-channel = <0>;
rgmii-device = <&RGMII0>;
rgmii-channel = <0>;
+ has-inverted-stacr-oc;
+ has-new-stacr-staopc;
};
EMAC1: ethernet@ef600f00 {
@@ -302,6 +304,8 @@
zmii-channel = <1>;
rgmii-device = <&RGMII0>;
rgmii-channel = <1>;
+ has-inverted-stacr-oc;
+ has-new-stacr-staopc;
};
};
};
Index: linux-work/drivers/net/ibm_newemac/core.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:46:58.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:02.000000000 +1100
@@ -711,7 +711,7 @@ static int __emac_mdio_read(struct emac_
r = EMAC_STACR_BASE(dev->opb_bus_freq);
if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT))
r |= EMAC_STACR_OC;
- if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR))
+ if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR))
r |= EMACX_STACR_STAC_READ;
else
r |= EMAC_STACR_STAC_READ;
@@ -783,7 +783,7 @@ static void __emac_mdio_write(struct ema
r = EMAC_STACR_BASE(dev->opb_bus_freq);
if (emac_has_feature(dev, EMAC_FTR_STACR_OC_INVERT))
r |= EMAC_STACR_OC;
- if (emac_has_feature(dev, EMAC_FTR_HAS_AXON_STACR))
+ if (emac_has_feature(dev, EMAC_FTR_HAS_NEW_STACR))
r |= EMACX_STACR_STAC_WRITE;
else
r |= EMAC_STACR_STAC_WRITE;
@@ -2480,16 +2480,19 @@ static int __devinit emac_init_config(st
/* Check EMAC version */
if (of_device_is_compatible(np, "ibm,emac4"))
dev->features |= EMAC_FTR_EMAC4;
- if (of_device_is_compatible(np, "ibm,emac-axon")
- || of_device_is_compatible(np, "ibm,emac-440epx"))
- dev->features |= EMAC_FTR_HAS_AXON_STACR
- | EMAC_FTR_STACR_OC_INVERT;
- if (of_device_is_compatible(np, "ibm,emac-440spe"))
+
+ /* Fixup some feature bits based on the device tree */
+ if (of_get_property(np, "has-inverted-stacr-oc", NULL))
dev->features |= EMAC_FTR_STACR_OC_INVERT;
+ if (of_get_property(np, "has-new-stacr-staopc", NULL))
+ dev->features |= EMAC_FTR_HAS_NEW_STACR;
- /* Fixup some feature bits based on the device tree and verify
- * we have support for them compiled in
- */
+ /* CAB lacks the appropriate properties */
+ if (of_device_is_compatible(np, "ibm,emac-axon"))
+ dev->features |= EMAC_FTR_HAS_NEW_STACR |
+ EMAC_FTR_STACR_OC_INVERT;
+
+ /* Enable TAH/ZMII/RGMII features as found */
if (dev->tah_ph != 0) {
#ifdef CONFIG_IBM_NEW_EMAC_TAH
dev->features |= EMAC_FTR_HAS_TAH;
Index: linux-work/drivers/net/ibm_newemac/core.h
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.h 2007-11-20 14:46:51.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.h 2007-11-20 14:47:02.000000000 +1100
@@ -293,9 +293,9 @@ struct emac_instance {
*/
#define EMAC_FTR_HAS_RGMII 0x00000020
/*
- * Set if we have axon-type STACR
+ * Set if we have new type STACR with STAOPC
*/
-#define EMAC_FTR_HAS_AXON_STACR 0x00000040
+#define EMAC_FTR_HAS_NEW_STACR 0x00000040
/* Right now, we don't quite handle the always/possible masks on the
@@ -307,7 +307,7 @@ enum {
EMAC_FTRS_POSSIBLE =
#ifdef CONFIG_IBM_NEW_EMAC_EMAC4
- EMAC_FTR_EMAC4 | EMAC_FTR_HAS_AXON_STACR |
+ EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR |
EMAC_FTR_STACR_OC_INVERT |
#endif
#ifdef CONFIG_IBM_NEW_EMAC_TAH
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (5 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 6/8] ibm_newemac: Cleanup/Fix RGMII MDIO support detection Benjamin Herrenschmidt
@ 2007-11-21 6:06 ` Benjamin Herrenschmidt
2007-11-21 7:13 ` Stefan Roese
2007-11-21 6:06 ` [PATCH 7/8] ibm_newemac: Cleanup/fix support for STACR register variants Benjamin Herrenschmidt
2007-11-24 1:43 ` [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Jeff Garzik
8 siblings, 1 reply; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 6:06 UTC (permalink / raw)
To: jgarzik; +Cc: netdev, linuxppc-dev
From: Hugh Blemings <hugh@blemings.org>
Depending on how the 44x processors are wired, some EMAC cells
might not be useable (and not connected to a PHY). However, some
device-trees may choose to still expose them (since their registers
are present in the MMIO space) but with an "unused" property in them.
Signed-off-by: Hugh Blemings <hugh@blemings.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/net/ibm_newemac/core.c | 4 ++++
1 file changed, 4 insertions(+)
Index: linux-work/drivers/net/ibm_newemac/core.c
===================================================================
--- linux-work.orig/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:02.000000000 +1100
+++ linux-work/drivers/net/ibm_newemac/core.c 2007-11-20 14:47:05.000000000 +1100
@@ -2550,6 +2550,10 @@ static int __devinit emac_probe(struct o
struct device_node **blist = NULL;
int err, i;
+ /* Skip unused/unwired EMACS */
+ if (of_get_property(np, "unused", NULL))
+ return -ENODEV;
+
/* Find ourselves in the bootlist if we are there */
for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++)
if (emac_boot_list[i] == np)
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware
2007-11-21 6:06 ` [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware Benjamin Herrenschmidt
@ 2007-11-21 7:13 ` Stefan Roese
2007-11-21 7:28 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 15+ messages in thread
From: Stefan Roese @ 2007-11-21 7:13 UTC (permalink / raw)
To: linuxppc-dev; +Cc: jgarzik, netdev
On Wednesday 21 November 2007, Benjamin Herrenschmidt wrote:
> From: Hugh Blemings <hugh@blemings.org>
>
> Depending on how the 44x processors are wired, some EMAC cells
> might not be useable (and not connected to a PHY). However, some
> device-trees may choose to still expose them (since their registers
> are present in the MMIO space) but with an "unused" property in them.
>
> Signed-off-by: Hugh Blemings <hugh@blemings.org>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Stefan Roese <sr@denx.de>
Best regards,
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware
2007-11-21 7:13 ` Stefan Roese
@ 2007-11-21 7:28 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 7:28 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev, jgarzik, netdev
On Wed, 2007-11-21 at 08:13 +0100, Stefan Roese wrote:
> On Wednesday 21 November 2007, Benjamin Herrenschmidt wrote:
> > From: Hugh Blemings <hugh@blemings.org>
> >
> > Depending on how the 44x processors are wired, some EMAC cells
> > might not be useable (and not connected to a PHY). However, some
> > device-trees may choose to still expose them (since their registers
> > are present in the MMIO space) but with an "unused" property in them.
> >
> > Signed-off-by: Hugh Blemings <hugh@blemings.org>
> > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> Acked-by: Stefan Roese <sr@denx.de>
I noticed that I forgot to add your Ack's to the patches. I'll do so
before I ask Paul to pull them.
Thanks !
Ben.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/8] ibm_newemac: Fix possible lockup on close
2007-11-21 6:06 ` [PATCH 1/8] ibm_newemac: Fix possible lockup on close Benjamin Herrenschmidt
@ 2007-11-21 15:41 ` Christoph Hellwig
2007-11-21 15:43 ` Josh Boyer
2007-11-21 19:53 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 15+ messages in thread
From: Christoph Hellwig @ 2007-11-21 15:41 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: netdev, jgarzik, linuxppc-dev
On Wed, Nov 21, 2007 at 05:06:39PM +1100, Benjamin Herrenschmidt wrote:
> It's a bad idea to call flush_scheduled_work from within a
> netdev->stop because the linkwatch will occasionally take the
> rtnl lock from a workqueue context, and thus that can deadlock.
>
> This reworks things a bit in that area to avoid the problem.
So from the name of the driver you want to keep the previous emac
driver around. Is there a good reason for that?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/8] ibm_newemac: Fix possible lockup on close
2007-11-21 15:41 ` Christoph Hellwig
@ 2007-11-21 15:43 ` Josh Boyer
2007-11-21 19:53 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 15+ messages in thread
From: Josh Boyer @ 2007-11-21 15:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linuxppc-dev, jgarzik, netdev
On Wed, 21 Nov 2007 16:41:23 +0100
Christoph Hellwig <hch@lst.de> wrote:
> On Wed, Nov 21, 2007 at 05:06:39PM +1100, Benjamin Herrenschmidt wrote:
> > It's a bad idea to call flush_scheduled_work from within a
> > netdev->stop because the linkwatch will occasionally take the
> > rtnl lock from a workqueue context, and thus that can deadlock.
> >
> > This reworks things a bit in that area to avoid the problem.
>
> So from the name of the driver you want to keep the previous emac
> driver around. Is there a good reason for that?
It's being kept around until arch/ppc dies. Then things should get
renamed.
josh
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/8] ibm_newemac: Fix possible lockup on close
2007-11-21 15:41 ` Christoph Hellwig
2007-11-21 15:43 ` Josh Boyer
@ 2007-11-21 19:53 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 15+ messages in thread
From: Benjamin Herrenschmidt @ 2007-11-21 19:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: netdev, jgarzik, linuxppc-dev
On Wed, 2007-11-21 at 16:41 +0100, Christoph Hellwig wrote:
> On Wed, Nov 21, 2007 at 05:06:39PM +1100, Benjamin Herrenschmidt wrote:
> > It's a bad idea to call flush_scheduled_work from within a
> > netdev->stop because the linkwatch will occasionally take the
> > rtnl lock from a workqueue context, and thus that can deadlock.
> >
> > This reworks things a bit in that area to avoid the problem.
>
> So from the name of the driver you want to keep the previous emac
> driver around. Is there a good reason for that?
Until arch/ppc is gone... the previous driver works with arch/ppc the
new one with arch/powerpc.
If we kill arch/ppc in .25, then we'll remove the old driver and rename
the new one. If not, that will wait til .26
I'm hard at work porting as much of 4xx over I can to get to the point
where we -can- kill arch/ppc but I'm not done yet.
Cheers,
Ben.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
` (7 preceding siblings ...)
2007-11-21 6:06 ` [PATCH 7/8] ibm_newemac: Cleanup/fix support for STACR register variants Benjamin Herrenschmidt
@ 2007-11-24 1:43 ` Jeff Garzik
8 siblings, 0 replies; 15+ messages in thread
From: Jeff Garzik @ 2007-11-24 1:43 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: netdev, linuxppc-dev
Benjamin Herrenschmidt wrote:
> Here are the patches I have pending for EMAC. With some non-released
> patches from Hugh Blemings, I get a taishan (440GX) booting now,
> in addition to Ebony (440GP) and various 405GP boards.
>
> This is 2.6.25 material except for patch #1 which has already been
> posted separately and is candidate for 2.6.24 (and possibly stable)
dropping (waiting for resend), as requested
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2007-11-24 1:43 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 6:06 [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 1/8] ibm_newemac: Fix possible lockup on close Benjamin Herrenschmidt
2007-11-21 15:41 ` Christoph Hellwig
2007-11-21 15:43 ` Josh Boyer
2007-11-21 19:53 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 2/8] ibm_newemac: Add BCM5248 and Marvell 88E1111 PHY support Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 3/8] ibm_newemac: Add ET1011c " Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 4/8] ibm_newemac: Fix ZMII refcounting bug Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 5/8] ibm_newemac: Workaround reset timeout when no link Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 6/8] ibm_newemac: Cleanup/Fix RGMII MDIO support detection Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 8/8] ibm_newemac: Skip EMACs that are marked unused by the firmware Benjamin Herrenschmidt
2007-11-21 7:13 ` Stefan Roese
2007-11-21 7:28 ` Benjamin Herrenschmidt
2007-11-21 6:06 ` [PATCH 7/8] ibm_newemac: Cleanup/fix support for STACR register variants Benjamin Herrenschmidt
2007-11-24 1:43 ` [PATCH 0/8] ibm_newemac: Candidate patches for 2.6.25 Jeff Garzik
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).