All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dale Farnsworth" <dale@farnsworth.org>
To: nd@bplan-gmbh.de, linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH 1/2] Add MPC52xx Interrupt controller support for ARCH=powerpc
Date: 30 Oct 2006 17:47:24 -0000	[thread overview]
Message-ID: <20061030174724.7155.qmail@farnsworth.org> (raw)
In-Reply-To: <200610292310.k9TNAHXZ013852@post.webmailer.de>

In article <200610292310.k9TNAHXZ013852@post.webmailer.de> Nicolas wrote:
> This patch add MPC52xx Interrupt controller for ARCH=powerpc.
> 
> It includes the main code in arch/powerpc/sysdev/ ad well as an header file in
> include/asm-powerpc.
> 
> Signed-off-by: Nicolas DET <nd@bplan-gmbh.de>

Wow, the source code size sure ballooned in this revision.

I'd like to see us go the other direction, with something like the
following (untested code).

-Dale Farnsworth

(BTW, I sent a patch containing these changes to Nicolas last week.)

-----------------------

static inline void io_be_setbit(u32 __iomem *addr, int bitno)
{
	out_be32(addr, in_be32(addr) | 1 << bitno);
}

static inline void io_be_clrbit(u32 __iomem *addr, int bitno)
{
	out_be32(addr, in_be32(addr) & ~(1 << bitno));
}

static void mpc52xx_ic_mask(unsigned int virq)
{
	u32 val;
	int irq;
	int l1irq;
	int l2irq;

	irq = irq_map[virq].hwirq;
	l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET;
	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;

	pr_debug("%s: irq=%x. l1=%d, l2=%d\n", __func__, irq, l1irq, l2irq);

	switch (l1irq) {
	case MPC52xx_IRQ_L1_CRIT:
	case MPC52xx_IRQ_L1_MAIN:
		if (l2irq <= 3)
			io_be_clrbit(&intr->ctrl, 11 - l2irq);
		else
			io_be_setbit(&intr->main_mask, 16 - l2irq);
		break;

	case MPC52xx_IRQ_L1_PERP:
		io_be_setbit(&intr->per_mask, 31 - l2irq);
		break;

	case MPC52xx_IRQ_L1_SDMA:
		io_be_setbit(&sdma->IntMask, l2irq);
		break;
	}
}

static void mpc52xx_ic_unmask(unsigned int virq)
{
	u32 val;
	int irq;
	int l1irq;
	int l2irq;

	irq = irq_map[virq].hwirq;
	l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET;
	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;

	pr_debug("%s: irq=%x. l1=%d, l2=%d\n", __func__, irq, l1irq, l2irq);

	switch (l1irq) {
	case MPC52xx_IRQ_L1_CRIT:
	case MPC52xx_IRQ_L1_MAIN:
		if (l2irq <= 3)
			io_be_setbit(&intr->ctrl, 11 - l2irq);
		else
			io_be_clrbit(&intr->main, 16 - l2irq);
		break;

	case MPC52xx_IRQ_L1_PERP:
		io_be_setbit(&intr->per_mask, 31 - l2irq);
		break;

	case MPC52xx_IRQ_L1_SDMA:
		io_be_clrbit(&sdma->IntMask, l2irq);
		break;
	}
}

static void mpc52xx_ic_ack(unsigned int virq)
{
	u32 val;
	int irq;
	int l1irq;
	int l2irq;

	irq = irq_map[virq].hwirq;
	l1irq = (irq & MPC52xx_IRQ_L1_MASK) >> MPC52xx_IRQ_L1_OFFSET;
	l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;

	pr_debug("%s: irq=%x. l1=%d, l2=%d\n", __func__, irq, l1irq, l2irq);

	switch (l1irq) {
	case MPC52xx_IRQ_L1_CRIT:
	case MPC52xx_IRQ_L1_MAIN:
		if (l2irq <= 3)
			io_be_setbit(&intr->ctrl, 27 - l2irq);
		break;

	case MPC52xx_IRQ_L1_PERP:
		io_be_clrbit(&intr->per_mask, 31 - l2irq);
		break;

	case MPC52xx_IRQ_L1_SDMA:
		out_be32(&sdma->IntPend, 1 << l2irq);
		break;
	}
}

  parent reply	other threads:[~2006-10-30 17:47 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-29 23:10 [PATCH 1/2] Add MPC52xx Interrupt controller support for ARCH=powerpc Nicolas DET
2006-10-30 17:37 ` Dale Farnsworth
2006-10-30 17:47 ` Dale Farnsworth [this message]
2006-10-30 23:18   ` Sylvain Munaut
2006-10-31  7:10   ` Nicolas DET
2006-10-30 22:25 ` Kumar Gala
2006-10-30 22:31   ` Benjamin Herrenschmidt
2006-10-30 23:15   ` Sylvain Munaut
2006-10-31  1:11     ` Kumar Gala
2006-10-31  6:59       ` Sylvain Munaut
2006-10-31  7:05         ` Benjamin Herrenschmidt
2006-10-31  7:14   ` Nicolas DET
2006-10-31  7:38     ` Benjamin Herrenschmidt
2006-10-31  8:25       ` Nicolas DET
2006-10-31  8:42         ` Benjamin Herrenschmidt
2006-10-31  9:08           ` Nicolas DET
2006-10-31 20:04             ` Nicolas DET
2006-10-31 21:59               ` Benjamin Herrenschmidt
2006-10-31 22:08                 ` Grant Likely
2006-10-31 22:11                   ` Benjamin Herrenschmidt
2006-10-31 23:08                     ` Grant Likely
2006-11-01  1:06                       ` Benjamin Herrenschmidt
2006-11-01  9:24                 ` Nicolas DET
2006-11-01 20:56                   ` Benjamin Herrenschmidt
2006-10-31 14:34           ` Kumar Gala
2006-10-31 16:24     ` Grant Likely
2006-10-31  4:27 ` Benjamin Herrenschmidt
2006-10-31  7:09   ` Nicolas DET
2006-10-31  7:21     ` Benjamin Herrenschmidt
2006-10-31  7:49       ` Nicolas DET
2006-10-31  7:58         ` Benjamin Herrenschmidt
2006-10-31  8:28           ` Nicolas DET
2006-10-31  8:44             ` Benjamin Herrenschmidt
2006-10-31  9:04               ` Nicolas DET
2006-10-31  9:07                 ` Benjamin Herrenschmidt
2006-10-31  9:46                   ` Nicolas DET
2006-10-31 20:29                     ` Benjamin Herrenschmidt

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=20061030174724.7155.qmail@farnsworth.org \
    --to=dale@farnsworth.org \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=nd@bplan-gmbh.de \
    /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.