Skip to contentSkip to conversation

DM9000 patches

DISCUSSION Ben Dooks 5 participants 11 messages Apr 28, 2008 – May 13, 2008

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
Quoted 7 lines · Ben Dooks

I would like to find out the state of the DM9000 patches which where submitted. Is it possible for these to be queued either into the network driver tree, or into -mm?

The messages are:

http://marc.info/?l=linux-netdev&m=120818415110509&w=2

this is in the queue

Quoted 2 lines

http://marc.info/?l=linux-netdev&m=120851343125997&w=2
http://marc.info/?l=linux-netdev&m=120851419927097&w=2

these two are not. It sounded like your comments may have impacted your ack, and also, when there are multiple patches in the air from multiple people, it's generally up to the maintainer to sort them all out and send them in a batch.

Lastly, a CC to me would be quite helpful. I tend to scan subject lines on netdev rather than read every message, and sometimes patches can get missed.

Jeff

#3 lore raw
Quoted 5 lines · Jeff Garzik
Quoted 4 lines · Ben Dooks

I would like to find out the state of the DM9000 patches which where submitted. Is it possible for these to be queued either into the network driver tree, or into -mm?

Quoted 7 lines
Quoted 5 lines

The messages are:

http://marc.info/?l=linux-netdev&m=120818415110509&w=2
http://marc.info/?l=linux-netdev&m=120851343125997&w=2
http://marc.info/?l=linux-netdev&m=120851419927097&w=2

if there is anything missing upstream, please resend...

As a just in case, as I can't see that any of these have made it upstream, I'll repost the three patches that I would like to see applied.

author
#4 lore raw

DM9000: Add __devinit and __devexit attributes to probe and remove

In reply to Jeff Garzik

From: Enrico Scholz <[email protected]>

There were missing __dev* annotations for the dm9000_probe() and dm9000_drv_remove() functions.

---
 drivers/net/dm9000.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/dm9000.c +3 -3
index e668b37..7bc16d2 100644
@@ -503,7 +503,7 @@ dm9000_release_board(struct platform_device *pdev, struct board_info *db)
 /*
  * Search DM9000 board, allocate space and register it
  */
-static int
+static int __devinit
 dm9000_probe(struct platform_device *pdev)
 {
 	struct dm9000_plat_data *pdata = pdev->dev.platform_data;
@@ -1376,7 +1376,7 @@ dm9000_drv_resume(struct platform_device *dev)
 	return 0;
 }
 
-static int
+static int __devexit
 dm9000_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
@@ -1397,7 +1397,7 @@ static struct platform_driver dm9000_driver = {
 		.owner	 = THIS_MODULE,
 	},
 	.probe   = dm9000_probe,
-	.remove  = dm9000_drv_remove,
+	.remove  = __devexit_p(dm9000_drv_remove),
 	.suspend = dm9000_drv_suspend,
 	.resume  = dm9000_drv_resume,
 };
Signature · 6 lines
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#6 lore raw

DM9000: Update and fix driver debugging messages

In reply to Jeff Garzik

From: Enrico Scholz <[email protected]>

There was a missing newline in a dev_dbg() message. Values read from/written into PHY registers might be for interest too, so I added new dbg messages there.

---
 drivers/net/dm9000.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/net/dm9000.c +4 -1
index 7bc16d2..e4af7a9 100644
@@ -525,7 +525,7 @@ dm9000_probe(struct platform_device *pdev)
 
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 
-	dev_dbg(&pdev->dev, "dm9000_probe()");
+	dev_dbg(&pdev->dev, "dm9000_probe()\n");
 
 	/* setup board info structure */
 	db = (struct board_info *) ndev->priv;
@@ -1292,6 +1292,8 @@ dm9000_phy_read(struct net_device *dev, int phy_reg_unused, int reg)
 	spin_unlock_irqrestore(&db->lock,flags);
 
 	mutex_unlock(&db->addr_lock);
+
+	dm9000_dbg(db, 5, "phy_read[%02x] -> %04x\n", reg, ret);
 	return ret;
 }
 
@@ -1305,6 +1307,7 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
 	unsigned long flags;
 	unsigned long reg_save;
 
+	dm9000_dbg(db, 5, "phy_write[%02x] = %04x\n", reg, value);
 	mutex_lock(&db->addr_lock);
 
 	spin_lock_irqsave(&db->lock,flags);
author
#7 lore raw

DM9000: Use delayed work to update MII PHY state

In reply to Jeff Garzik

Periodically check the MII PHY status to ensure that the network layer's link status is updated and the user informed of any changes.

drivers/net/dm9000.c +26 -0
Index: linux-2.6.25-rc9-quilt2/drivers/net/dm9000.c
===================================================================
@@ -117,6 +117,9 @@ typedef struct board_info {
 
 	struct mutex	 addr_lock;	/* phy and eeprom access lock */
 
+	struct delayed_work phy_poll;
+	struct net_device  *ndev;
+
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_i
 	}
 }
 
+static void dm9000_schedule_poll(board_info_t *db)
+{
+	schedule_delayed_work(&db->phy_poll, HZ * 2);
+}
 
 /* Our watchdog timed out. Called by the networking layer */
 static void dm9000_timeout(struct net_device *dev)
@@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_e
  	.set_eeprom		= dm9000_set_eeprom,
 };
 
+static void
+dm9000_poll_work(struct work_struct *w)
+{
+	struct delayed_work *dw = container_of(w, struct delayed_work, work);
+	board_info_t *db = container_of(dw, board_info_t, phy_poll);
+
+	mii_check_media(&db->mii, netif_msg_link(db), 0);
+	
+	if (netif_running(db->ndev))
+		dm9000_schedule_poll(db);
+}
 
 /* dm9000_release_board
  *
@@ -532,10 +550,14 @@ dm9000_probe(struct platform_device *pde
 	memset(db, 0, sizeof (*db));
 
 	db->dev = &pdev->dev;
+	db->ndev = ndev;
 
 	spin_lock_init(&db->lock);
 	mutex_init(&db->addr_lock);
 
+	INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
+
+
 	if (pdev->num_resources < 2) {
 		ret = -ENODEV;
 		goto out;
@@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev)
 
 	mii_check_media(&db->mii, netif_msg_link(db), 1);
 	netif_start_queue(dev);
+	
+	dm9000_schedule_poll(db);
 
 	return 0;
 }
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
+	cancel_delayed_work(&db->phy_poll);
+
 	netif_stop_queue(ndev);
 	netif_carrier_off(ndev);
 
#8 lore raw

Re: DM9000: Use delayed work to update MII PHY state

drivers/net/dm9000.c dm9000_stop(struct net_device *ndev) · line 906

Quoted 5 lines · On Thu, 8 May 2008 11:36:42 +0100 Ben Dooks <[email protected]> wrote:
drivers/net/dm9000.c +1 -0
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
+	cancel_delayed_work(&db->phy_poll);

I think this should be cancel_delayed_work_sync().

#9 lore raw

Re: DM9000: Use delayed work to update MII PHY state

In reply to Ben Dooks
Quoted 74 lines · On Thu, 8 May 2008 11:36:42 +0100 Ben Dooks <[email protected]> wrote:

Periodically check the MII PHY status to ensure that the network layer's link status is updated and the user informed of any changes.

Index: linux-2.6.25-rc9-quilt2/drivers/net/dm9000.c
===================================================================

drivers/net/dm9000.c +24 -0
@@ -117,6 +117,9 @@ typedef struct board_info {
 
 	struct mutex	 addr_lock;	/* phy and eeprom access lock */
 
+	struct delayed_work phy_poll;
+	struct net_device  *ndev;
+
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_i
 	}
 }
 
+static void dm9000_schedule_poll(board_info_t *db)
+{
+	schedule_delayed_work(&db->phy_poll, HZ * 2);
+}
 
 /* Our watchdog timed out. Called by the networking layer */
 static void dm9000_timeout(struct net_device *dev)
@@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_e
  	.set_eeprom		= dm9000_set_eeprom,
 };
 
+static void
+dm9000_poll_work(struct work_struct *w)
+{
+	struct delayed_work *dw = container_of(w, struct delayed_work, work);
+	board_info_t *db = container_of(dw, board_info_t, phy_poll);
+
+	mii_check_media(&db->mii, netif_msg_link(db), 0);
+	
+	if (netif_running(db->ndev))
+		dm9000_schedule_poll(db);
+}
 
 /* dm9000_release_board
  *
@@ -532,10 +550,14 @@ dm9000_probe(struct platform_device *pde
 	memset(db, 0, sizeof (*db));
 
 	db->dev = &pdev->dev;
+	db->ndev = ndev;
 
 	spin_lock_init(&db->lock);
 	mutex_init(&db->addr_lock);
 
+	INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
+
+
 	if (pdev->num_resources < 2) {
 		ret = -ENODEV;
 		goto out;
@@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev)
 
 	mii_check_media(&db->mii, netif_msg_link(db), 1);
 	netif_start_queue(dev);
+	
+	dm9000_schedule_poll(db);
 
 	return 0;
 }

drivers/net/dm9000.c dm9000_stop(struct net_device *ndev) · line 910

Quoted 8 lines
drivers/net/dm9000.c +2 -0
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
+	cancel_delayed_work(&db->phy_poll);
+
 	netif_stop_queue(ndev);
 	netif_carrier_off(ndev);
 

The above patch breaks dm9000-restore-mii-physical-polling-timer.patch, below.

Perhaps they both fix the same thing?

From: Michael Abbott <[email protected]>

In commit fcfa81aa3e8d885356139122fcb281487b983468 the timer for polling the MII physical layer was removed because of conflicts with newly added mutexes. Unfortunately a side effect of this change is that the corresponding ethernet layer is permanently reported as down: there is no other way to read the link status.

This commit restores the timer, but uses the default work queue for polling.

Cc Daniel Mack <[email protected]>
Cc Russell King <[email protected]>
Cc Jeff Garzik <[email protected]>
Cc Ben Dooks <[email protected]>

---

 drivers/net/dm9000.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/net/dm9000.c renamed from drivers/net/dm9000.c~dm9000-restore-mii-physical-polling-timer +21 -0
diff -puN drivers/net/dm9000.c~dm9000-restore-mii-physical-polling-timer drivers/net/dm9000.c
@@ -43,6 +43,7 @@
 /* Board/System/Debug information/definition ---------------- */
 
 #define DM9000_PHY		0x40	/* PHY address 0x01 */
+#define DM9000_TIMER_WUT	(HZ*2)	/* timer wakeup time : 2 second */
 
 #define CARDNAME "dm9000"
 #define PFX CARDNAME ": "
@@ -117,6 +118,8 @@ typedef struct board_info {
 
 	struct mutex	 addr_lock;	/* phy and eeprom access lock */
 
+	struct delayed_work timer;	/* Interface status timer. */
+
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -144,6 +147,7 @@ static int dm9000_start_xmit(struct sk_b
 static int dm9000_stop(struct net_device *);
 static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
 
+static void dm9000_timer(struct work_struct * work);
 static void dm9000_init_dm9000(struct net_device *);
 
 static irqreturn_t dm9000_interrupt(int, void *);
@@ -762,6 +766,10 @@ dm9000_open(struct net_device *dev)
 	mii_check_media(&db->mii, netif_msg_link(db), 1);
 	netif_start_queue(dev);
 
+	/* Start the media status timer running. */
+	INIT_DELAYED_WORK(&db->timer, dm9000_timer);
+	schedule_delayed_work(&db->timer, DM9000_TIMER_WUT);
+
 	return 0;
 }
 
@@ -876,6 +884,9 @@ dm9000_stop(struct net_device *ndev)
 {
 	board_info_t *db = (board_info_t *) ndev->priv;
 
+	/* Delete the timer and make sure it's not running right now! */
+	cancel_delayed_work_sync(&db->timer);
+
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
@@ -965,6 +976,16 @@ dm9000_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+
+/* Two second timer to poll the media status -- the DM9000 doesn't provide a
+ * status interrupt, so this has to be polled. */
+static void dm9000_timer(struct work_struct * work)
+{
+	board_info_t *db = container_of(work, board_info_t, timer);
+	mii_check_media(&db->mii, netif_msg_link(db), 0);
+	schedule_delayed_work(&db->timer, DM9000_TIMER_WUT);
+}
+
 struct dm9000_rxhdr {
 	u8	RxPktReady;
 	u8	RxStatus;

_

#10 lore raw

Re: DM9000: Use delayed work to update MII PHY state

Quoted 80 lines · Andrew Morton
Quoted 77 lines · On Thu, 8 May 2008 11:36:42 +0100 Ben Dooks <[email protected]> wrote:

Periodically check the MII PHY status to ensure that the network layer's link status is updated and the user informed of any changes.

Index: linux-2.6.25-rc9-quilt2/drivers/net/dm9000.c
===================================================================

drivers/net/dm9000.c +24 -0
@@ -117,6 +117,9 @@ typedef struct board_info {
 
 	struct mutex	 addr_lock;	/* phy and eeprom access lock */
 
+	struct delayed_work phy_poll;
+	struct net_device  *ndev;
+
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -297,6 +300,10 @@ static void dm9000_set_io(struct board_i
 	}
 }
 
+static void dm9000_schedule_poll(board_info_t *db)
+{
+	schedule_delayed_work(&db->phy_poll, HZ * 2);
+}
 
 /* Our watchdog timed out. Called by the networking layer */
 static void dm9000_timeout(struct net_device *dev)
@@ -465,6 +472,17 @@ static const struct ethtool_ops dm9000_e
  	.set_eeprom		= dm9000_set_eeprom,
 };
 
+static void
+dm9000_poll_work(struct work_struct *w)
+{
+	struct delayed_work *dw = container_of(w, struct delayed_work, work);
+	board_info_t *db = container_of(dw, board_info_t, phy_poll);
+
+	mii_check_media(&db->mii, netif_msg_link(db), 0);
+	
+	if (netif_running(db->ndev))
+		dm9000_schedule_poll(db);
+}
 
 /* dm9000_release_board
  *
@@ -532,10 +550,14 @@ dm9000_probe(struct platform_device *pde
 	memset(db, 0, sizeof (*db));
 
 	db->dev = &pdev->dev;
+	db->ndev = ndev;
 
 	spin_lock_init(&db->lock);
 	mutex_init(&db->addr_lock);
 
+	INIT_DELAYED_WORK(&db->phy_poll, dm9000_poll_work);
+
+
 	if (pdev->num_resources < 2) {
 		ret = -ENODEV;
 		goto out;
@@ -761,6 +783,8 @@ dm9000_open(struct net_device *dev)
 
 	mii_check_media(&db->mii, netif_msg_link(db), 1);
 	netif_start_queue(dev);
+	
+	dm9000_schedule_poll(db);
 
 	return 0;
 }
@@ -879,6 +903,8 @@ dm9000_stop(struct net_device *ndev)
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
Quoted 8 lines

drivers/net/dm9000.c dm9000_stop(struct net_device *ndev) · line 910

Quoted 5 lines
drivers/net/dm9000.c +2 -0
+	cancel_delayed_work(&db->phy_poll);
+
 	netif_stop_queue(ndev);
 	netif_carrier_off(ndev);
 

The above patch breaks dm9000-restore-mii-physical-polling-timer.patch, below.

Yes, I belive I submitted this first to the netdev list.

Quoted 95 lines

Perhaps they both fix the same thing?

From: Michael Abbott <[email protected]>

In commit fcfa81aa3e8d885356139122fcb281487b983468 the timer for polling the MII physical layer was removed because of conflicts with newly added mutexes. Unfortunately a side effect of this change is that the corresponding ethernet layer is permanently reported as down: there is no other way to read the link status.

This commit restores the timer, but uses the default work queue for polling.

Cc Daniel Mack <[email protected]>
Cc Russell King <[email protected]>
Cc Jeff Garzik <[email protected]>
Cc Ben Dooks <[email protected]>

---

 drivers/net/dm9000.c |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff -puN drivers/net/dm9000.c~dm9000-restore-mii-physical-polling-timer drivers/net/dm9000.c

drivers/net/dm9000.c renamed from drivers/net/dm9000.c~dm9000-restore-mii-physical-polling-timer +21 -0
@@ -43,6 +43,7 @@
 /* Board/System/Debug information/definition ---------------- */
 
 #define DM9000_PHY		0x40	/* PHY address 0x01 */
+#define DM9000_TIMER_WUT	(HZ*2)	/* timer wakeup time : 2 second */
 
 #define CARDNAME "dm9000"
 #define PFX CARDNAME ": "
@@ -117,6 +118,8 @@ typedef struct board_info {
 
 	struct mutex	 addr_lock;	/* phy and eeprom access lock */
 
+	struct delayed_work timer;	/* Interface status timer. */
+
 	spinlock_t lock;
 
 	struct mii_if_info mii;
@@ -144,6 +147,7 @@ static int dm9000_start_xmit(struct sk_b
 static int dm9000_stop(struct net_device *);
 static int dm9000_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
 
+static void dm9000_timer(struct work_struct * work);
 static void dm9000_init_dm9000(struct net_device *);
 
 static irqreturn_t dm9000_interrupt(int, void *);
@@ -762,6 +766,10 @@ dm9000_open(struct net_device *dev)
 	mii_check_media(&db->mii, netif_msg_link(db), 1);
 	netif_start_queue(dev);
 
+	/* Start the media status timer running. */
+	INIT_DELAYED_WORK(&db->timer, dm9000_timer);
+	schedule_delayed_work(&db->timer, DM9000_TIMER_WUT);
+
 	return 0;
 }
 
@@ -876,6 +884,9 @@ dm9000_stop(struct net_device *ndev)
 {
 	board_info_t *db = (board_info_t *) ndev->priv;
 
+	/* Delete the timer and make sure it's not running right now! */
+	cancel_delayed_work_sync(&db->timer);
+
 	if (netif_msg_ifdown(db))
 		dev_dbg(db->dev, "shutting down %s\n", ndev->name);
 
@@ -965,6 +976,16 @@ dm9000_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+
+/* Two second timer to poll the media status -- the DM9000 doesn't provide a
+ * status interrupt, so this has to be polled. */
+static void dm9000_timer(struct work_struct * work)
+{
+	board_info_t *db = container_of(work, board_info_t, timer);
+	mii_check_media(&db->mii, netif_msg_link(db), 0);
+	schedule_delayed_work(&db->timer, DM9000_TIMER_WUT);
+}
+
 struct dm9000_rxhdr {
 	u8	RxPktReady;
 	u8	RxStatus;

_

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'