All of lore.kernel.org
 help / color / mirror / Atom feed
From: Haojian Zhuang <haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 3/9] ARM: mmp: support DT in irq
Date: Wed, 2 May 2012 13:40:31 +0800	[thread overview]
Message-ID: <CAN1soZz5b0bc10isc6syxM7WzKfvVqc-HzotW6Auqv1A1mnC9A@mail.gmail.com> (raw)
In-Reply-To: <20120427190620.D3C313E0B4D@localhost>

On Sat, Apr 28, 2012 at 3:06 AM, Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
> On Fri, 27 Apr 2012 16:39:11 +0800, Haojian Zhuang <haojian.zhuang@gmail.com> wrote:
>> Append new interrupt driver that could support both pxa168 and mmp2
>> silicon. And this driver supports device tree.
>>
>> Since CONFIG_SPARSE_IRQ is enabled in arch-mmp, irq driver should
>> handle reserved NR_IRQS_LEGACY in irq domain.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>>  arch/arm/mach-mmp/Makefile                   |    2 +-
>>  arch/arm/mach-mmp/include/mach/entry-macro.S |    9 +
>>  arch/arm/mach-mmp/irq.c                      |  287 ++++++++++++++++++++++++++
>
> It shouldn't be necessary to create an entirely new irq controller
> driver that duplicates the functionality of irq-mmp2.c and
> irq-pxa168.c.  Instead, the existing drivers should be refactored to
> work with both DT and non-DT user.
>
New irq controller driver handles both pxa168 and mmp2. The register definition
is different. And some mux interrupt controllers are in mmp2. There
are different
interrupt numbers in each mux interrupt controller.

Directly merging these two drivers are a bit difficult. But I can make
use of DTS file
to record register address and interrupt numbers.

>> diff --git a/arch/arm/mach-mmp/include/mach/entry-macro.S b/arch/arm/mach-mmp/include/mach/entry-macro.S
>> index 9cff9e7..6b9d925 100644
>> --- a/arch/arm/mach-mmp/include/mach/entry-macro.S
>> +++ b/arch/arm/mach-mmp/include/mach/entry-macro.S
>> @@ -6,13 +6,19 @@
>>   * published by the Free Software Foundation.
>>   */
>>
>> +#include <asm/irq.h>
>>  #include <mach/regs-icu.h>
>>
>>       .macro  get_irqnr_preamble, base, tmp
>>       mrc     p15, 0, \tmp, c0, c0, 0         @ CPUID
>>       and     \tmp, \tmp, #0xff00
>>       cmp     \tmp, #0x5800
>> +#ifdef CONFIG_OF
>> +     ldr     \base, =mmp_icu_base
>> +     ldr     \base, [\base, #0]
>> +#else
>>       ldr     \base, =ICU_VIRT_BASE
>> +#endif
>>       addne   \base, \base, #0x10c            @ PJ1 AP INT SEL register
>>       addeq   \base, \base, #0x104            @ PJ4 IRQ SEL register
>>       .endm
>> @@ -20,5 +26,8 @@
>>       .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
>>       ldr     \tmp, [\base, #0]
>>       and     \irqnr, \tmp, #0x3f
>> +#ifdef CONFIG_OF
>> +     add     \irqnr, \irqnr, #NR_IRQS_LEGACY
>> +#endif
>
> What do these do?  Does turning on CONFIG_OF break booting with atags?
> If so then this will need to be reworked.  CONFIG_OF must not disable
> non-devicetree usage.
>
> g.

I use two CONFIG_OF in this file. The first one is used to record
register base address
of interrupt controller. In legacy code, the register address is
hardcoding. Do you mean
that I should remove this CONFIG_OF?

The second CONFIG_OF is used to do a rebase of interrupt number. Since
SPARSE IRQ
is enabled, NR_IRQS_LEGACY (16) is defined already. I have two
choices. Either I extended
to define ".nr_irqs" in machine script for internal interrupts, or I
reserve NR_IRQS_LEGACY and
allocate new irqs for internal interrupts. I choose the second
solution. Do you mean that I have to
use the first solution?

WARNING: multiple messages have this Message-ID (diff)
From: haojian.zhuang@gmail.com (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/9] ARM: mmp: support DT in irq
Date: Wed, 2 May 2012 13:40:31 +0800	[thread overview]
Message-ID: <CAN1soZz5b0bc10isc6syxM7WzKfvVqc-HzotW6Auqv1A1mnC9A@mail.gmail.com> (raw)
In-Reply-To: <20120427190620.D3C313E0B4D@localhost>

On Sat, Apr 28, 2012 at 3:06 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Fri, 27 Apr 2012 16:39:11 +0800, Haojian Zhuang <haojian.zhuang@gmail.com> wrote:
>> Append new interrupt driver that could support both pxa168 and mmp2
>> silicon. And this driver supports device tree.
>>
>> Since CONFIG_SPARSE_IRQ is enabled in arch-mmp, irq driver should
>> handle reserved NR_IRQS_LEGACY in irq domain.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
>> ---
>> ?arch/arm/mach-mmp/Makefile ? ? ? ? ? ? ? ? ? | ? ?2 +-
>> ?arch/arm/mach-mmp/include/mach/entry-macro.S | ? ?9 +
>> ?arch/arm/mach-mmp/irq.c ? ? ? ? ? ? ? ? ? ? ?| ?287 ++++++++++++++++++++++++++
>
> It shouldn't be necessary to create an entirely new irq controller
> driver that duplicates the functionality of irq-mmp2.c and
> irq-pxa168.c. ?Instead, the existing drivers should be refactored to
> work with both DT and non-DT user.
>
New irq controller driver handles both pxa168 and mmp2. The register definition
is different. And some mux interrupt controllers are in mmp2. There
are different
interrupt numbers in each mux interrupt controller.

Directly merging these two drivers are a bit difficult. But I can make
use of DTS file
to record register address and interrupt numbers.

>> diff --git a/arch/arm/mach-mmp/include/mach/entry-macro.S b/arch/arm/mach-mmp/include/mach/entry-macro.S
>> index 9cff9e7..6b9d925 100644
>> --- a/arch/arm/mach-mmp/include/mach/entry-macro.S
>> +++ b/arch/arm/mach-mmp/include/mach/entry-macro.S
>> @@ -6,13 +6,19 @@
>> ? * published by the Free Software Foundation.
>> ? */
>>
>> +#include <asm/irq.h>
>> ?#include <mach/regs-icu.h>
>>
>> ? ? ? .macro ?get_irqnr_preamble, base, tmp
>> ? ? ? mrc ? ? p15, 0, \tmp, c0, c0, 0 ? ? ? ? @ CPUID
>> ? ? ? and ? ? \tmp, \tmp, #0xff00
>> ? ? ? cmp ? ? \tmp, #0x5800
>> +#ifdef CONFIG_OF
>> + ? ? ldr ? ? \base, =mmp_icu_base
>> + ? ? ldr ? ? \base, [\base, #0]
>> +#else
>> ? ? ? ldr ? ? \base, =ICU_VIRT_BASE
>> +#endif
>> ? ? ? addne ? \base, \base, #0x10c ? ? ? ? ? ?@ PJ1 AP INT SEL register
>> ? ? ? addeq ? \base, \base, #0x104 ? ? ? ? ? ?@ PJ4 IRQ SEL register
>> ? ? ? .endm
>> @@ -20,5 +26,8 @@
>> ? ? ? .macro ?get_irqnr_and_base, irqnr, irqstat, base, tmp
>> ? ? ? ldr ? ? \tmp, [\base, #0]
>> ? ? ? and ? ? \irqnr, \tmp, #0x3f
>> +#ifdef CONFIG_OF
>> + ? ? add ? ? \irqnr, \irqnr, #NR_IRQS_LEGACY
>> +#endif
>
> What do these do? ?Does turning on CONFIG_OF break booting with atags?
> If so then this will need to be reworked. ?CONFIG_OF must not disable
> non-devicetree usage.
>
> g.

I use two CONFIG_OF in this file. The first one is used to record
register base address
of interrupt controller. In legacy code, the register address is
hardcoding. Do you mean
that I should remove this CONFIG_OF?

The second CONFIG_OF is used to do a rebase of interrupt number. Since
SPARSE IRQ
is enabled, NR_IRQS_LEGACY (16) is defined already. I have two
choices. Either I extended
to define ".nr_irqs" in machine script for internal interrupts, or I
reserve NR_IRQS_LEGACY and
allocate new irqs for internal interrupts. I choose the second
solution. Do you mean that I have to
use the first solution?

  reply	other threads:[~2012-05-02  5:40 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  8:39 [PATCH 0/9] add more devicetree support in arch-mmp Haojian Zhuang
2012-04-27  8:39 ` Haojian Zhuang
     [not found] ` <1335515957-1798-1-git-send-email-haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-27  8:39   ` [PATCH 1/9] ARM: mmp: fix build issue on mmp with device tree Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
     [not found]     ` <1335515957-1798-2-git-send-email-haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-27 20:15       ` Arnd Bergmann
2012-04-27 20:15         ` Arnd Bergmann
     [not found]         ` <201204272015.49611.arnd-r2nGTMty4D4@public.gmane.org>
2012-04-28  3:11           ` Haojian Zhuang
2012-04-28  3:11             ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 2/9] ARM: mmp: distinguish mmp and mmp2 in Kconfig Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
     [not found]     ` <1335515957-1798-3-git-send-email-haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-27 20:14       ` Arnd Bergmann
2012-04-27 20:14         ` Arnd Bergmann
     [not found]         ` <201204272014.49443.arnd-r2nGTMty4D4@public.gmane.org>
2012-05-02  5:53           ` Haojian Zhuang
2012-05-02  5:53             ` Haojian Zhuang
     [not found]             ` <CAN1soZy=OdS=GUc93mgJ0bXTLJSX3+=WuWT=0yLDxkgjjG=wgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-02 12:58               ` Arnd Bergmann
2012-05-02 12:58                 ` Arnd Bergmann
2012-04-27  8:39   ` [PATCH 3/9] ARM: mmp: support DT in irq Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
     [not found]     ` <1335515957-1798-4-git-send-email-haojian.zhuang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-04-27 19:06       ` Grant Likely
2012-04-27 19:06         ` Grant Likely
2012-05-02  5:40         ` Haojian Zhuang [this message]
2012-05-02  5:40           ` Haojian Zhuang
     [not found]           ` <CAN1soZz5b0bc10isc6syxM7WzKfvVqc-HzotW6Auqv1A1mnC9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-02 12:51             ` Arnd Bergmann
2012-05-02 12:51               ` Arnd Bergmann
     [not found]               ` <201205021251.16967.arnd-r2nGTMty4D4@public.gmane.org>
2012-05-04  3:41                 ` Haojian Zhuang
2012-05-04  3:41                   ` Haojian Zhuang
     [not found]                   ` <CAN1soZwE7MoifmxtPS8f_x6CrK-dF97=vPMTMStg=VW1wsoLrA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-04 12:56                     ` Arnd Bergmann
2012-05-04 12:56                       ` Arnd Bergmann
2012-05-30 19:38       ` Chris Ball
2012-05-30 19:38         ` Chris Ball
2012-05-31  3:07         ` Haojian Zhuang
2012-05-31  3:07           ` Haojian Zhuang
     [not found]           ` <CAN1soZz2=NcadK1kD6d9t92G6Xdfn=TPGP5_ngwX_fGj+QhOVA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-31  3:23             ` Chris Ball
2012-05-31  3:23               ` Chris Ball
2012-05-31 21:11             ` Chris Ball
2012-05-31 21:11               ` Chris Ball
2012-04-27  8:39   ` [PATCH 4/9] ARM: mmp: support DT in timer Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 5/9] gpio: pxa: parse gpio from DTS file Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 6/9] ARM: mmp: support mmp2 with device tree Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 7/9] ARM: mmp: support pxa910 " Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 8/9] ARM: dts: refresh dts file for arch mmp Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang
2012-04-27  8:39   ` [PATCH 9/9] Documentation: update docs for mmp dt Haojian Zhuang
2012-04-27  8:39     ` Haojian Zhuang

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=CAN1soZz5b0bc10isc6syxM7WzKfvVqc-HzotW6Auqv1A1mnC9A@mail.gmail.com \
    --to=haojian.zhuang-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=eric.y.miao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.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 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.