qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] hw/9118.c: Implement active-low interrupt support
Date: Mon, 13 Jun 2011 22:41:57 +0100	[thread overview]
Message-ID: <BANLkTikry_8g1xoz3aC-Up2oGLfa=6_gGg@mail.gmail.com> (raw)
In-Reply-To: <1306427651-3547-1-git-send-email-peter.maydell@linaro.org>

Ping?

On 26 May 2011 17:34, Peter Maydell <peter.maydell@linaro.org> wrote:
> The 9118 ethernet controller interrupt line is active low unless
> the IRQ config register is programmed to set both the IRQ_POL
> (polarity: active-high) and IRQ_TYPE (type: push-pull) bits:
> implement support for inverting the irq output in other configurations.
> This also requires that we support setting the bits in the first
> place, and that we correctly preserve them across software reset.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> The motivation for this patch is actually an omap3 platform (overo)
> which uses the active-low configuration; the platforms in QEMU
> mainline which use it (vexpress and realview) both configure the
> chip to active-high, which is why this bug hasn't come to light
> before. I've tested that (a) my overo platform works with the
> change and (b) it doesn't regress vexpress.
>
>  hw/lan9118.c |   12 +++++++++---
>  1 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/hw/lan9118.c b/hw/lan9118.c
> index 4c42fe9..3f3c05d 100644
> --- a/hw/lan9118.c
> +++ b/hw/lan9118.c
> @@ -228,6 +228,12 @@ static void lan9118_update(lan9118_state *s)
>     if ((s->irq_cfg & IRQ_EN) == 0) {
>         level = 0;
>     }
> +    if ((s->irq_cfg & (IRQ_TYPE | IRQ_POL)) != (IRQ_TYPE | IRQ_POL)) {
> +        /* Interrupt is active low unless we're configured as
> +         * active-high polarity, push-pull type.
> +         */
> +        level = !level;
> +    }
>     qemu_set_irq(s->irq, level);
>  }
>
> @@ -294,8 +300,7 @@ static void phy_reset(lan9118_state *s)
>  static void lan9118_reset(DeviceState *d)
>  {
>     lan9118_state *s = FROM_SYSBUS(lan9118_state, sysbus_from_qdev(d));
> -
> -    s->irq_cfg &= ~(IRQ_TYPE | IRQ_POL);
> +    s->irq_cfg &= (IRQ_TYPE | IRQ_POL);
>     s->int_sts = 0;
>     s->int_en = 0;
>     s->fifo_int = 0x48000000;
> @@ -904,7 +909,8 @@ static void lan9118_writel(void *opaque, target_phys_addr_t offset,
>     switch (offset) {
>     case CSR_IRQ_CFG:
>         /* TODO: Implement interrupt deassertion intervals.  */
> -        s->irq_cfg = (s->irq_cfg & IRQ_INT) | (val & IRQ_EN);
> +        val &= (IRQ_EN | IRQ_POL | IRQ_TYPE);
> +        s->irq_cfg = (s->irq_cfg & IRQ_INT) | val;
>         break;
>     case CSR_INT_STS:
>         s->int_sts &= ~val;
> --
> 1.7.1

  reply	other threads:[~2011-06-13 21:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 16:34 [Qemu-devel] [PATCH] hw/9118.c: Implement active-low interrupt support Peter Maydell
2011-06-13 21:41 ` Peter Maydell [this message]
2011-06-16  2:21 ` andrzej zaborowski

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='BANLkTikry_8g1xoz3aC-Up2oGLfa=6_gGg@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=patches@linaro.org \
    --cc=qemu-devel@nongnu.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).