netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Fleming <afleming@gmail.com>
To: Anatolij Gustschin <agust@denx.de>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] phylib: add support for shared PHY interrupts
Date: Tue, 17 Feb 2009 18:47:34 -0600	[thread overview]
Message-ID: <2acbd3e40902171647i327e3a85m25bf7d9bcd8be987@mail.gmail.com> (raw)
In-Reply-To: <1234817631-7981-2-git-send-email-agust@denx.de>

On Mon, Feb 16, 2009 at 2:53 PM, Anatolij Gustschin <agust@denx.de> wrote:
> Marvell 88E1121R PHY device can be hardware-configured
> to use shared interrupt pin for both PHY ports. This
> patch adds support for shared PHY interrupts to the PHY
> framework to enable support for such PHY configurations.

Well, technically the phylib already supports shared interrupts (all
of my systems have only one interrupt for all of the PHYs).  This
patch adds support for some PHYs which can report which device caused
the interrupt.

>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  drivers/net/phy/phy.c        |   13 +++++++++++++
>  drivers/net/phy/phy_device.c |    2 ++
>  include/linux/phy.h          |    4 ++++
>  3 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index df4e625..93d387e 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -657,9 +657,17 @@ EXPORT_SYMBOL(phy_stop_interrupts);
>  static void phy_change(struct work_struct *work)
>  {
>        int err;
> +       int src;
>        struct phy_device *phydev =
>                container_of(work, struct phy_device, phy_queue);
>
> +       if (phydev->drv->flags & PHY_INTERRUPTS_SHARED
> +           && phydev->drv->interrupt_src) {
> +               src = phydev->drv->interrupt_src(phydev);
> +               if ((src == -1) || (src != phydev->addr))
> +                       goto ignore;
> +       }
> +


I don't agree with this approach to the problem.  First, it would
appear that phydev->drv->interrupt_src is redundant with
PHY_INTERRUPTS_SHARED.  So we probably don't need to add that bit.
Next, the result of interrupt_src isn't being used to do anything but
determine whether *this* PHY originated the interrupt.  So a minor
improvement would be to have a function ->did_interrupt(), which
returns 1 if the PHY generated an interrupt, and 0 otherwise.

For solving this problem, I'd prefer a solution that didn't appear to
be so closely tied to the specific hardware you are using.  The
->did_interrupt() method would allow any PHY with interrupts to report
whether it believes it created the interrupt.  It seems to me that
this is just creating more overhead, though.  There may be a way to
consolidate the various interrupt-related functions, and create a new
set which allows for this sort of "early-out".

Another possibility to consider is some way that each "global" device
could only read this register once per interrupt, and report that
status through the phy_device struct(s).  Maybe we need some sort of
container for multi-PHY devices?


Andy

  parent reply	other threads:[~2009-02-18  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 20:53 [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip Anatolij Gustschin
2009-02-16 20:53 ` [PATCH 2/3] phylib: add support for shared PHY interrupts Anatolij Gustschin
2009-02-16 20:53   ` [PATCH 3/3] phylib: shared interrupts support for Marvell 88E1121R PHY Anatolij Gustschin
2009-02-18  1:12     ` Andy Fleming
2009-02-18  0:47   ` Andy Fleming [this message]
2009-02-27  6:39 ` [PATCH 1/3] phylib: Basic support for the M88E1121R Marvell chip David Miller

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=2acbd3e40902171647i327e3a85m25bf7d9bcd8be987@mail.gmail.com \
    --to=afleming@gmail.com \
    --cc=agust@denx.de \
    --cc=netdev@vger.kernel.org \
    /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 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).