linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] mmp2: add handling on PMIC IRQ
Date: Tue, 2 Feb 2010 16:14:40 -0800	[thread overview]
Message-ID: <f17812d71002021614n4d9838dh1e2ad6e6be2843c5@mail.gmail.com> (raw)
In-Reply-To: <771cded01001262208p2da963dbhf51a245606741bfc@mail.gmail.com>

On Tue, Jan 26, 2010 at 10:08 PM, Haojian Zhuang
<haojian.zhuang@gmail.com> wrote:
> From 43f04d3f0ab95721b5fd6b9590990ffa1b1eef1d Mon Sep 17 00:00:00 2001
> From: Haojian Zhuang <haojian.zhuang@marvell.com>
> Date: Wed, 27 Jan 2010 08:49:12 -0500
> Subject: [PATCH] mmp2: add handling on PMIC IRQ
>
> Since PMIC INT pin is a special pin of CPU, the status of PMIC INT pin needs
> to be cleared after PMIC IRQ occured. Now append the clear operation in
> irq chip handler.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> ?arch/arm/mach-mmp/irq-mmp2.c | ? ?7 +++++++
> ?1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/irq-mmp2.c b/arch/arm/mach-mmp/irq-mmp2.c
> index 41b29f6..761abe3 100644
> --- a/arch/arm/mach-mmp/irq-mmp2.c
> +++ b/arch/arm/mach-mmp/irq-mmp2.c
> @@ -62,7 +62,9 @@ static void _name_##_unmask_irq(unsigned int irq) ? ? ? ? ? ? ? ? ? ? \
> ?static void _name_##_irq_demux(unsigned int irq, struct irq_desc *desc) ? ? ? ?\
> ?{ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ?unsigned long status, mask, n; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? unsigned long mfpr_pmic, data; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ?mask = __raw_readl(prefix##_MASK); ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> + ? ? ? mfpr_pmic = APB_VIRT_BASE + 0x1e000 + 0x2c4; ? ? ? ? ? ? ? ? ? ?\
> ? ? ? ?while (1) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ?status = __raw_readl(prefix##_STATUS) & ~mask; ? ? ? ? ?\
> ? ? ? ? ? ? ? ?if (status == 0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?\
> @@ -70,6 +72,11 @@ static void _name_##_irq_demux(unsigned int irq,
> struct irq_desc *desc) ?\
> ? ? ? ? ? ? ? ?n = find_first_bit(&status, BITS_PER_LONG); ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ?while (n < BITS_PER_LONG) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ? ? ? ? ?generic_handle_irq(irq_base + n); ? ? ? ? ? ? ? \
> + ? ? ? ? ? ? ? ? ? ? ? if ((irq_base + n) == IRQ_MMP2_PMIC) { ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? data = __raw_readl(mfpr_pmic); ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? __raw_writel(data | (1 << 6), mfpr_pmic); \
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? __raw_writel(data, mfpr_pmic); ? ? ? ? ?\
> + ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ? ? ? ? ? ? ? ? ?n = find_next_bit(&status, BITS_PER_LONG, n+1); \
> ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
> ? ? ? ?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \

I don't think this is probably the right way to go. There could be two
improvements:

1. move mfpr register manipulation into a dedicated function, e.g.
    mmp2_clear_pmic_int() within mmp2.c

2. invent a pmic_mask_ack_irq() to replace the default one at
   run-time, so to save the time that every 2nd level interrupt
   handling has to go through the if (.... == IRQ_MMP2_PMIC) thing,
   provided it does look like an ack operation to me.

  reply	other threads:[~2010-02-03  0:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-27  6:08 [PATCH 1/1] mmp2: add handling on PMIC IRQ Haojian Zhuang
2010-02-03  0:14 ` Eric Miao [this message]
2010-02-03  6:31   ` Haojian Zhuang
2010-02-03  7:21     ` Haojian Zhuang
2010-02-03  7:42       ` Eric Miao

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=f17812d71002021614n4d9838dh1e2ad6e6be2843c5@mail.gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.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).