linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/11] ARM: imx: Add support of interrupt controller ICOLL
Date: Mon, 15 Nov 2010 17:33:46 +0100	[thread overview]
Message-ID: <20101115163346.GJ8942@pengutronix.de> (raw)
In-Reply-To: <1289831795-4373-3-git-send-email-shawn.guo@freescale.com>

On Mon, Nov 15, 2010 at 10:36:26PM +0800, Shawn Guo wrote:
> MX28 uses Interrupt Collector (ICOLL) as the interrupt
> controller. So ICOLL becomes the third interrupt controller
> for MXC besides AVIC and TZIC.
> 
> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
> ---
>  arch/arm/plat-mxc/icoll.c                    |   79 ++++++++++++++++++++++++++
>  arch/arm/plat-mxc/include/mach/entry-macro.S |   22 ++++++-
>  2 files changed, 97 insertions(+), 4 deletions(-)
>  create mode 100644 arch/arm/plat-mxc/icoll.c
> 
> diff --git a/arch/arm/plat-mxc/icoll.c b/arch/arm/plat-mxc/icoll.c
> new file mode 100644
> index 0000000..e9a9e42
> --- /dev/null
> +++ b/arch/arm/plat-mxc/icoll.c
> @@ -0,0 +1,79 @@
> +/*
> + * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/irq.h>
> +
> +#include <mach/hardware.h>
> +#include <mach/common.h>
> +
> +#define HW_ICOLL_VECTOR				0x0000
> +#define HW_ICOLL_LEVELACK			0x0010
> +#define HW_ICOLL_CTRL				0x0020
> +#define HW_ICOLL_INTERRUPTn_SET(n)		(0x0124 + (n) * 0x10)
> +#define HW_ICOLL_INTERRUPTn_CLR(n)		(0x0128 + (n) * 0x10)
> +#define BM_ICOLL_INTERRUPTn_ENABLE		0x00000004
> +#define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0	0x1
> +
> +void __iomem *icoll_base;
> +
> +static void icoll_ack_irq(unsigned int irq)
> +{
> +	__raw_writel(0, icoll_base + HW_ICOLL_VECTOR);
> +
> +	/* ACK current interrupt (level 0) */
> +	__raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0,
> +			icoll_base + HW_ICOLL_LEVELACK);
> +}
> +
> +static void icoll_mask_irq(unsigned int irq)
> +{
> +	__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
> +			icoll_base + HW_ICOLL_INTERRUPTn_CLR(irq));
> +}
> +
> +static void icoll_unmask_irq(unsigned int irq)
> +{
> +	__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
> +			icoll_base + HW_ICOLL_INTERRUPTn_SET(irq));
> +}
> +
> +static struct irq_chip mxc_icoll_chip = {
> +	.ack = icoll_ack_irq,
> +	.mask = icoll_mask_irq,
> +	.unmask = icoll_unmask_irq,
> +};
> +
> +void __init icoll_init_irq(void __iomem *irqbase)
> +{
> +	int i;
> +
> +	icoll_base = irqbase;
> +	mxc_irq_base = irqbase;
> +	mxc_irq_controller_type = MXC_IRQ_TYPE_ICOLL;
> +
> +	/* Reset icoll */
> +	mxc_reset_block(irqbase + HW_ICOLL_CTRL);
mxc_reset_block is only defined in patch 3, so you must not use it in
patch 2.

> +
> +	for (i = 0; i < MXC_INTERNAL_IRQS; i++) {
> +		set_irq_chip(i, &mxc_icoll_chip);
> +		set_irq_handler(i, handle_level_irq);
> +		set_irq_flags(i, IRQF_VALID);
> +	}
> +}
> diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
> index a7dd008..a66e804 100644
> --- a/arch/arm/plat-mxc/include/mach/entry-macro.S
> +++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
> @@ -1,6 +1,6 @@
>  /*
>   *  Copyright (C) 2007 Lennert Buytenhek <buytenh@wantstofly.org>
> - *  Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
> + *  Copyright 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
>   */
>  
>  /*
> @@ -73,25 +73,39 @@
>  #endif
>  	.endm
>  
> +	.macro	icoll_get_irqnr_and_base, irqnr, irqstat, base, tmp
> +	ldr \irqnr, [\base, #0x70]
> +	cmp \irqnr, #0x7F
> +	moveqs \irqnr, #0
> +	.endm
> +
>  	.macro get_irqnr_and_base, irqnr, irqstat, base, tmp
> -#if defined CONFIG_MXC_TZIC && defined CONFIG_MXC_AVIC
> +#if defined CONFIG_MXC_TZIC && defined CONFIG_MXC_AVIC && defined CONFIG_MXC_ICOLL
>  	ldr	\tmp, =mxc_irq_controller_type
>  	ldr	\tmp, [\tmp]
>  	cmp	\tmp, #MXC_IRQ_TYPE_AVIC
>  	beq	3001f
> +	cmp	\tmp, #MXC_IRQ_TYPE_ICOLL
> +	beq	3002f
>  
>  	tzic_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
> -	b	3002f
> +	b	3003f
>  3001:
>  	avic_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
> +	b	3003f
>  3002:
> +	icoll_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
> +	b	3003f
> +3003:
>  
>  #elif defined CONFIG_MXC_TZIC
>  	tzic_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
>  #elif defined CONFIG_MXC_AVIC
>  	avic_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
> +#elif defined CONFIG_MXC_ICOLL
> +	icoll_get_irqnr_and_base \irqnr, \irqstat, \base, \tmp
>  #else
> -#error no tzic and no avic?
> +#error none of tzic, avic, icoll?
>  #endif
>  	.endm
I wonder if it's sensible to integrate mx28 (and mx23) support into
mach-imx/plat-mxc.  They seem to better fit into mach-stmp378x?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2010-11-15 16:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-15 14:36 [RFC][PATCH 00/11] ARM: imx: Add initial i.MX28 support Shawn Guo
2010-11-15 14:36 ` [PATCH 01/11] ARM: imx: Add basic definitions for i.MX28 Shawn Guo
2010-11-15 16:25   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 02/11] ARM: imx: Add support of interrupt controller ICOLL Shawn Guo
2010-11-15 16:33   ` Uwe Kleine-König [this message]
2010-11-15 14:36 ` [PATCH 03/11] ARM: imx: Add reset routine for i.MX28 Shawn Guo
2010-11-15 16:36   ` Uwe Kleine-König
2010-11-17 11:17     ` Shawn Guo
2010-11-17 13:44       ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 04/11] ARM: imx: Add timer support " Shawn Guo
2010-11-15 16:40   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 05/11] ARM: imx: Add GPIO " Shawn Guo
2010-11-15 16:43   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 06/11] ARM: imx: Add IOMUX " Shawn Guo
2010-11-15 16:46   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 07/11] ARM: imx: Add support of uncompress print " Shawn Guo
2010-11-15 16:47   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 08/11] ARM: imx: Add clock support " Shawn Guo
2010-11-15 14:36 ` [PATCH 09/11] ARM: imx: Add memory map " Shawn Guo
2010-11-15 14:36 ` [PATCH 10/11] ARM: imx: Add initial support of machine mx28evk Shawn Guo
2010-11-15 16:54   ` Uwe Kleine-König
2010-11-15 14:36 ` [PATCH 11/11] ARM: imx: Add i.MX28 support into Kconfig and Makefile Shawn Guo
2010-11-15 17:01   ` Uwe Kleine-König
2010-11-16 10:15 ` [RFC][PATCH 00/11] ARM: imx: Add initial i.MX28 support Sascha Hauer
2010-11-16 12:42   ` Shawn Guo
2010-11-16 17:24     ` Uwe Kleine-König
2010-11-17  1:28       ` Shawn Guo
2010-11-17  6:06         ` Uwe Kleine-König

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=20101115163346.GJ8942@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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).