From: Ben Dooks <ben-linux@fluff.org>
To: Michael Abbott <michael@araneidae.co.uk>
Cc: linux-net@vger.kernel.org, Ben Dooks <ben-linux@fluff.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] DM9000: Restore MII physical polling timer.
Date: Mon, 28 Apr 2008 16:14:11 +0100 [thread overview]
Message-ID: <20080428151411.GF16284@fluff.org.uk> (raw)
In-Reply-To: <20080424095217.P51356@saturn.araneidae.co.uk>
On Thu, Apr 24, 2008 at 10:12:59AM +0000, Michael Abbott wrote:
> From: Michael Abbott <michael.abbott@diamond.ac.uk>
>
> DM9000: Restore MII physical polling timer.
>
> 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.
I've already submitted a similar patch to netdev@vger.kernel.org
> Signed-off-by: Michael Abbott <michael.abbott@diamond.ac.uk>
> ---
> drivers/net/dm9000.c | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> This patch is against 2.6.25, and has been tested with the Colibri PXA270
> board (patch follows separately).
>
> diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> index d63cc93..9ad9499 100644
> --- a/drivers/net/dm9000.c
> +++ b/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_buff *, struct net_device *);
> 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;
> --
> 1.5.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Ben (ben@fluff.org, http://www.fluff.org/)
'a smiley only costs 4 bytes'
next prev parent reply other threads:[~2008-04-28 15:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 10:12 [PATCH] DM9000: Restore MII physical polling timer Michael Abbott
2008-04-28 15:14 ` Ben Dooks [this message]
2008-05-02 7:23 ` Michael Abbott
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=20080428151411.GF16284@fluff.org.uk \
--to=ben-linux@fluff.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
--cc=michael@araneidae.co.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.