mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Milo Kim <milo.kim@ti.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: <tglx@linutronix.de>, <jason@lakedaemon.net>,
	<marc.zyngier@arm.com>, <alexandre.belloni@free-electrons.com>,
	<ludovic.desroches@atmel.com>, <nicolas.ferre@atmel.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 06/19] irqchip: atmel-aic: introduce register data structure
Date: Wed, 6 Jan 2016 17:30:13 +0900	[thread overview]
Message-ID: <568CD095.7010203@ti.com> (raw)
In-Reply-To: <20160104095309.4a613aab@bbrezillon>

On 01/04/2016 05:53 PM, Boris Brezillon wrote:
> On Mon, 4 Jan 2016 13:28:30 +0900
> Milo Kim <milo.kim@ti.com> wrote:
>
>> Structure, 'aic_reg_offset' describes for device specific register offset.
>> Each offset is used for IRQ chip operation. AIC and AIC5 have different
>> register values, but the structure can be shared.
>>
>> Please note that this is not complete patch, it's a preceding step for
>> making unified AIC driver.
>>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Jason Cooper <jason@lakedaemon.net>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> Cc: Boris BREZILLON <boris.brezillon@free-electrons.com>
>> Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
>> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Milo Kim <milo.kim@ti.com>
>> ---
>>   drivers/irqchip/irq-atmel-aic-common.c | 91 ++++++++++++++++++++++++++++++++++
>>   1 file changed, 91 insertions(+)
>>
>> diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c
>> index 5effd52..f840165 100644
>> --- a/drivers/irqchip/irq-atmel-aic-common.c
>> +++ b/drivers/irqchip/irq-atmel-aic-common.c
>> @@ -24,6 +24,32 @@
>>
>>   #include "irq-atmel-aic-common.h"
>>
>> +#define AT91_AIC_SMR_BASE		0
>> +#define AT91_AIC_SVR_BASE		0x80
>> +#define AT91_AIC_IVR			0x100
>> +#define AT91_AIC_ISR			0x108
>> +#define AT91_AIC_IECR			0x120
>> +#define AT91_AIC_IDCR			0x124
>> +#define AT91_AIC_ICCR			0x128
>> +#define AT91_AIC_ISCR			0x12c
>> +#define AT91_AIC_EOICR			0x130
>> +#define AT91_AIC_SPU			0x134
>> +#define AT91_AIC_DCR			0x138
>> +#define AT91_INVALID_OFFSET		(-1)
>> +
>> +#define AT91_AIC5_SSR			0x0
>> +#define AT91_AIC5_SMR			0x4
>> +#define AT91_AIC5_SVR			0x8
>> +#define AT91_AIC5_IVR			0x10
>> +#define AT91_AIC5_ISR			0x18
>> +#define AT91_AIC5_EOICR			0x38
>> +#define AT91_AIC5_SPU			0x3c
>> +#define AT91_AIC5_IECR			0x40
>> +#define AT91_AIC5_IDCR			0x44
>> +#define AT91_AIC5_ICCR			0x48
>> +#define AT91_AIC5_ISCR			0x4c
>> +#define AT91_AIC5_DCR			0x6c
>> +
>>   #define AT91_AIC_PRIOR			GENMASK(2, 0)
>>   #define AT91_AIC_IRQ_MIN_PRIORITY	0
>>   #define AT91_AIC_IRQ_MAX_PRIORITY	7
>> @@ -38,6 +64,71 @@ struct aic_chip_data {
>>   	u32 ext_irqs;
>>   };
>>
>> +/**
>> + * struct aic_reg_offset
>> + *
>> + * @eoi:	End of interrupt command register
>> + * @smr:	Source mode register
>> + * @ssr:	Source select register
>> + * @iscr:	Interrupt set command register
>> + * @idcr:	Interrupt disable command register
>> + * @iccr:	Interrupt clear command register
>> + * @iecr:	Interrupt enable command register
>> + * @spu:	Spurious interrupt vector register
>> + * @dcr:	Debug control register
>> + * @svr:	Source vector register
>> + * @ivr:	Interrupt vector register
>> + * @isr:	Interrupt status register
>> + *
>> + * Each value means register offset.
>> + */
>> +struct aic_reg_offset {
>> +	int eoi;
>> +	int smr;
>> +	int ssr;
>> +	int iscr;
>> +	int idcr;
>> +	int iccr;
>> +	int iecr;
>> +	int spu;
>> +	int dcr;
>> +	int svr;
>> +	int ivr;
>> +	int isr;
>> +};
>> +
>> +static const struct aic_reg_offset aic_regs = {
>> +	.eoi	= AT91_AIC_EOICR,
>> +	.smr	= AT91_AIC_SMR_BASE,
>> +	.ssr	= AT91_INVALID_OFFSET,	/* No SSR exists */
>> +	.iscr	= AT91_AIC_ISCR,
>> +	.idcr	= AT91_AIC_IDCR,
>> +	.iccr	= AT91_AIC_ICCR,
>> +	.iecr	= AT91_AIC_IECR,
>> +	.spu	= AT91_AIC_SPU,
>> +	.dcr	= AT91_AIC_DCR,
>> +	.svr	= AT91_AIC_SVR_BASE,
>> +	.ivr	= AT91_AIC_IVR,
>> +	.isr	= AT91_AIC_ISR,
>> +};
>> +
>> +static const struct aic_reg_offset aic5_regs = {
>> +	.eoi	= AT91_AIC5_EOICR,
>> +	.smr	= AT91_AIC5_SMR,
>> +	.ssr	= AT91_AIC5_SSR,
>> +	.iscr	= AT91_AIC5_ISCR,
>> +	.idcr	= AT91_AIC5_IDCR,
>> +	.iccr	= AT91_AIC5_ICCR,
>> +	.iecr	= AT91_AIC5_IECR,
>> +	.spu	= AT91_AIC5_SPU,
>> +	.dcr	= AT91_AIC5_DCR,
>> +	.svr	= AT91_AIC5_SVR,
>> +	.ivr	= AT91_AIC5_IVR,
>> +	.isr	= AT91_AIC5_ISR,
>> +};
>> +
>> +static const struct aic_reg_offset *aic_reg_data;
>> +
>
> Can we avoid adding this global variable: this information can probably
> be added to the aic_chip_data struct.

Chip private data, 'aic_chip_data' is allocated per each chip. If we 
move aic_reg_data into aic_chip_data, then this data will be allocated 
in each IRQ chip data as well. Then, AIC5 will allocate several register 
data. (nchips >= 2 in AIC5)

         aic = kcalloc(nchips, sizeof(*aic), GFP_KERNEL);
         if (!aic) {
                 ret = -ENOMEM;
                 goto err_iounmap;
         }

No need to use multiple register data.

Best regards,
Milo

  reply	other threads:[~2016-01-06  8:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04  4:28 [PATCH 00/19] irqchip: atmel-aic: make unified AIC driver Milo Kim
2016-01-04  4:28 ` [PATCH 01/19] irqchip: atmel-aic: fix wrong bit operation for IRQ priority Milo Kim
2016-01-04  8:11   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 02/19] irqchip: atmel-aic: clean up RTC interrupt code Milo Kim
2016-01-04  8:16   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 03/19] irqchip: atmel-aic: clean up RTT " Milo Kim
2016-01-04  8:17   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 04/19] irqchip: atmel-aic: replace magic numbers with named constant Milo Kim
2016-01-04  8:29   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 05/19] irqchip: atmel-aic: use simple constant to get number of interrupts per chip Milo Kim
2016-01-04  8:33   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 06/19] irqchip: atmel-aic: introduce register data structure Milo Kim
2016-01-04  8:53   ` Boris Brezillon
2016-01-06  8:30     ` Milo Kim [this message]
2016-01-04  4:28 ` [PATCH 07/19] irqchip: atmel-aic: make common IRQ domain translate function Milo Kim
2016-01-04  4:28 ` [PATCH 08/19] irqchip: atmel-aic: add common mask and unmask functions Milo Kim
2016-01-04  8:48   ` Boris Brezillon
2016-01-04  4:28 ` [PATCH 09/19] irqchip: atmel-aic: add common retrigger function Milo Kim
2016-01-04  4:28 ` [PATCH 10/19] irqchip: atmel-aic: add common set_type function Milo Kim
2016-01-04  4:28 ` [PATCH 11/19] irqchip: atmel-aic: add common PM IRQ chip operation Milo Kim
2016-01-04  4:28 ` [PATCH 12/19] irqchip: atmel-aic: use EOI register data in aic_reg_data Milo Kim
2016-01-04  4:28 ` [PATCH 13/19] irqchip: atmel-aic: clean up irq_chip_generic Milo Kim
2016-01-04  4:28 ` [PATCH 14/19] irqchip: atmel-aic: add common HW init function Milo Kim
2016-01-04  4:28 ` [PATCH 15/19] irqchip: atmel-aic: add common interrupt handler Milo Kim
2016-01-04  4:28 ` [PATCH 16/19] irqchip: atmel-aic: get total number of IRQs from device node Milo Kim
2016-01-04  4:28 ` [PATCH 17/19] irqchip: atmel-aic: use unified IRQ chip initialization function Milo Kim
2016-01-04  4:28 ` [PATCH 18/19] irqchip: atmel-aic: use unified AIC driver Milo Kim
2016-01-04  4:28 ` [PATCH 19/19] irqchip: atmel-aic: rename AIC driver and fix Kconfig Milo Kim
2016-01-04  9:02 ` [PATCH 00/19] irqchip: atmel-aic: make unified AIC driver Boris Brezillon
2016-01-04  9:37   ` Nicolas Ferre
2016-01-06  7:55     ` Milo Kim
2016-01-06  7:48   ` Milo Kim
2016-01-06  9:07     ` Boris Brezillon
2016-01-06 14:49       ` Jason Cooper
2016-01-07  7:48       ` Milo Kim

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=568CD095.7010203@ti.com \
    --to=milo.kim@ti.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludovic.desroches@atmel.com \
    --cc=marc.zyngier@arm.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=tglx@linutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome