* Git pull request: mach/vmalloc.h removal, and ioremap optimizations
From: Nicolas Pitre @ 2011-09-29 18:42 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4E84B80D.2020605@gmail.com>
On Thu, 29 Sep 2011, Rob Herring wrote:
> On 09/29/2011 12:37 PM, Russell King - ARM Linux wrote:
> > My guess would be:
> >
> > }, {
> > .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE),
> > .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE),
> > .length = SZ_4K * 9,
> > .type = MT_DEVICE
> > },
> > #ifdef CONFIG_MACH_VERSATILE_AB
> > {
> > .virtual = IO_ADDRESS(VERSATILE_GPIO0_BASE),
> > .pfn = __phys_to_pfn(VERSATILE_GPIO0_BASE),
> > .length = SZ_4K,
> > .type = MT_DEVICE
> >
> > #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */
> > #define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */
> >
> > I don't see why GPIO0 is explicitly listed here.
>
> It works for PB and AB with that removed. Here's a patch:
[...]
Thanks for testing and the patch. I've inserted it in my patch series
and pushed the result out.
Nicolas
^ permalink raw reply
* [PATCH 1/5] ARM: pxa: remove redundant macro on GPIO
From: Michał Mirosław @ 2011-09-29 18:44 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-1-git-send-email-haojian.zhuang@marvell.com>
2011/9/29 Haojian Zhuang <haojian.zhuang@marvell.com>:
[...]
> ? ? ? ?if (type & IRQ_TYPE_EDGE_RISING)
> - ? ? ? ? ? ? ? GRER0 |= GPIO_bit(gpio);
> + ? ? ? ? ? ? ? GRER(gpio) |= GPIO_bit(gpio);
[...]
This looks wrong. There are more occurrences like this. Can you
explain if this is correct?
Best Regards,
Micha? Miros?aw
^ permalink raw reply
* [PATCH v2 0/7] Add a generic struct clk
From: Mark Brown @ 2011-09-29 18:54 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1316730422-20027-1-git-send-email-mturquette@ti.com>
On Thu, Sep 22, 2011 at 03:26:55PM -0700, Mike Turquette wrote:
> more thought. I also dropped Mark's change to append a device's name to
> a clk name since device tree might solve this neatly. Again more
> discussion around that would be good.
Some of that was for debugfs type stuff - if we end up providing
information about the clocks via a diagnostic interface being able to
distinguish between things in a textual fashion would be handy (and I'd
guess the struct device may also be needed by any OF bindings to get at
the bindings?).
^ permalink raw reply
* [PATCH v5 3/3] arm/tegra: device tree support for ventana board
From: Peter De Schrijver @ 2011-09-29 18:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <74CDBE0F657A3D45AFBB94109FB122FF173A2C6717@HQMAIL01.nvidia.com>
On Thu, Sep 29, 2011 at 07:04:15PM +0200, Stephen Warren wrote:
> Peter De Schrijver wrote at Wednesday, September 28, 2011 4:30 PM:
> ...
> > diff --git a/arch/arm/mach-tegra/board-dt.c b/arch/arm/mach-tegra/board-dt.c
> ...
> > @@ -80,9 +80,19 @@ static struct of_device_id tegra_dt_gic_match[] __initdata = {
> > {}
> > };
> >
> > +static struct {
> > + char *machine;
> > + void (*init)(void);
> > +} pinmux_configs[] = {
> > + { "nvidia,harmony", harmony_pinmux_init() },
> > + { "nvidia,seaboard", seaboard_pinmux_init() },
> > + { "nvidia,ventana", ventana_pinmux_init() },
> > +};
>
> Do you want the brackets after the function names there? Locally, they
> cause the following syntax errors during compilation:
>
> arch/arm/mach-tegra/board-dt.c:85: error: initializer element is not constant
> arch/arm/mach-tegra/board-dt.c:85: error: (near initialization for 'pinmux_configs[0].init')
> arch/arm/mach-tegra/board-dt.c:86: error: initializer element is not constant
> arch/arm/mach-tegra/board-dt.c:86: error: (near initialization for 'pinmux_configs[1].init')
> arch/arm/mach-tegra/board-dt.c:87: error: initializer element is not constant
> arch/arm/mach-tegra/board-dt.c:87: error: (near initialization for 'pinmux_configs[2].init')
>
> (using gcc version 4.4.3 (gcc-4.4.3_cos_gg_51096))
It compiled fine here using gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50).
I will change it next week when I'm back at the office.
Cheers,
Peter.
^ permalink raw reply
* [PATCH 7/8] OMAP4: clock: Add CPU local timer clock node.
From: Paul Walmsley @ 2011-09-29 19:12 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1315459327-3285-8-git-send-email-santosh.shilimkar@ti.com>
Hi Santosh,
On Thu, 8 Sep 2011, Santosh Shilimkar wrote:
> Local timer clock is sourced from the CPU clock and hence changes
> along with CPU clock. These per CPU local timers are used as
> clock-events, so they need to be reconfigured on CPU frequency
> change as part of CPUfreq governor.
>
> Newly introduced clockevents_reconfigure() needs to know the
> twd clock-rate. Provide a clock-node to make clk_get_rate() work
> for TWD.
>
> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: Paul Walmsley <paul@pwsan.com>
> Cc: Kevin Hilman <khilman@ti.com>
This clock looks like the ARM Cortex-A9 MPCore PERIPHCLK, correct? From
ARM Cortex-A9 MPCore Technical Reference Manual (DDI 0407G) Section 5.1
"Clocks"?
Assuming that is so, I've modified this patch appropriately, and added
support to the autogeneration script to generate this clock node.
Care to take a quick look at it to make sure it's okay?
- Paul
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
Date: Thu, 8 Sep 2011 10:52:06 +0530
Subject: [PATCH] ARM: OMAP4: clock: Add CPU local timer clock node.
Local timer clock is sourced from the CPU clock and hence changes
along with CPU clock. These per CPU local timers are used as
clock-events, so they need to be reconfigured on CPU frequency
change as part of CPUfreq governor.
Newly introduced clockevents_reconfigure() needs to know the
twd clock-rate. Provide a clock-node to make clk_get_rate() work
for TWD.
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Kevin Hilman <khilman@ti.com>
[paul at pwsan.com: renamed clock node to 'mpu_periphclk' to indicate that this
is the Cortex-A9 MPCore subsystem clock PERIPHCLK (DDI 0407G); moved
clock and clkdev entries to match the autogenerated script output]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap2/clock44xx_data.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 4873c00..9684233 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -1195,6 +1195,14 @@ static struct clk l4_wkup_clk_mux_ck = {
.recalc = &omap2_clksel_recalc,
};
+static struct clk mpu_periphclk = {
+ .name = "mpu_periphclk",
+ .parent = &dpll_mpu_ck,
+ .ops = &clkops_null,
+ .fixed_div = 2,
+ .recalc = &omap_fixed_divisor_recalc,
+};
+
static const struct clksel_rate div2_2to1_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_4430 },
{ .div = 2, .val = 0, .flags = RATE_IN_4430 },
@@ -3189,6 +3197,7 @@ static struct omap_clk omap44xx_clks[] = {
CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
+ CLK(NULL, "smp_twd", &mpu_periphclk, CK_443X),
CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
--
1.7.6.3
^ permalink raw reply related
* YCbCr 422 on s3c2440
From: Guennadi Liakhovetski @ 2011-09-29 19:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <loom.20110929T160147-550@post.gmane.org>
Forwarding to the suitable list, although, I don't think s3c24xx SoCs are
currently supported by V4L.
Thanks
Guennadi
On Thu, 29 Sep 2011, GIGIN JOSE wrote:
> Hi,
>
> I am working on s3c2440 ARM linux platform. I am connecting
> an image sensor device to the camera controller of the s3c2440
> ARM processor. The image sensor outputs YCbCr 4:2:2 output.
> Can I pass the output of this format to the preview path of
> the camera controller to get proper image ?
>
> The image sensor also outputs RGB565 format, which I can
> comfortably view using the preview path. But I would like
> to get the YCbCr 4:2:2 format from the image sensor device.
>
> Is this possible with the preview path ? Any other register
> settings are required for YCbCr 4:2:2 mode on the preview
> path, other than that done for the RGB565 format. ?
>
> Thank You
> GIGIN
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply
* [patch] ARM: smpboot: Enable interrupts after marking CPU online/active
From: Thomas Gleixner @ 2011-09-29 20:12 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <009101cc7e7b$1ebece00$5c3c6a00$%kim@samsung.com>
On Thu, 29 Sep 2011, Kukjin Kim wrote:
> Russell King - ARM Linux wrote:
> But as Amit said, current EXYNOS4 SoCs which are using SPI for local timers
> has problem that the irq_set_affinity() method is called in
> percpu_timer_setup() before CPU1 becomes online with the commit
> 5dfc54e087c15f823ee9b6541d2f0f314e69cbed ("ARM: GIC: avoid routing
> interrupts to offline CPUs"). So I will check again.
Why is a per cpu interrupt having an irq_set_affinity() function at all?
Thanks,
tglx
^ permalink raw reply
* Git pull request: mach/vmalloc.h removal, and ioremap optimizations
From: Rob Herring @ 2011-09-29 20:26 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1109291439110.9106@xanadu.home>
On 09/29/2011 01:42 PM, Nicolas Pitre wrote:
> On Thu, 29 Sep 2011, Rob Herring wrote:
>
>> On 09/29/2011 12:37 PM, Russell King - ARM Linux wrote:
>>> My guess would be:
>>>
>>> }, {
>>> .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE),
>>> .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE),
>>> .length = SZ_4K * 9,
>>> .type = MT_DEVICE
>>> },
>>> #ifdef CONFIG_MACH_VERSATILE_AB
>>> {
>>> .virtual = IO_ADDRESS(VERSATILE_GPIO0_BASE),
>>> .pfn = __phys_to_pfn(VERSATILE_GPIO0_BASE),
>>> .length = SZ_4K,
>>> .type = MT_DEVICE
>>>
>>> #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */
>>> #define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */
>>>
>>> I don't see why GPIO0 is explicitly listed here.
>>
>> It works for PB and AB with that removed. Here's a patch:
> [...]
>
> Thanks for testing and the patch. I've inserted it in my patch series
> and pushed the result out.
So it was really Realview PBX I wanted to test my GIC changes on. Well,
turns out it's got a similar problem, too.
However, the fix for it should perhaps be a bit different. The problem
is that the virtual address of REALVIEW_PBX_TILE_GIC_CPU_BASE is not
aligned. Then 0x100 + 4KB length overlaps into the DIST_BASE. So do we
fix it in the platform or should the core code mask out the lower bits
of the virt addr before doing any size calculations?
Rob
^ permalink raw reply
* [PATCH v3 2/2] OMAP: omap_device: Add a method to build an omap_device from a DT node
From: Kevin Hilman @ 2011-09-29 20:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20110929173006.GG6800@ponder.secretlab.ca>
Grant Likely <grant.likely@secretlab.ca> writes:
> On Wed, Sep 28, 2011 at 10:47:32AM -0700, Kevin Hilman wrote:
>> "Cousson, Benoit" <b-cousson@ti.com> writes:
>>
>> > Hi Grant, Kevin,
>> >
>> > Should I go ahead with this version and repost the series with that
>> > third patch?
>>
>> Fine with me.
>>
>> Grant let me know if you prefer if I merge it (with your ack) with the
>> rest of the series or if you want to take it to avoid conflicts.
>
> I'm happy with the way things have gone. Go ahead and add my Ack and
> merge it through your tree. I'd like to avoid the conflicts.
Thanks, I think keeping this series together will be smoothest.
Adding your ack, and queuing for v3.2 (branch: for_3.2/omap_device-2)
Kevin
^ permalink raw reply
* [PATCH v3 2/3] ARM: OMAP: TI814X: Add cpu type macros and detection support
From: Paul Walmsley @ 2011-09-29 20:46 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317258560-30408-1-git-send-email-hemantp@ti.com>
Hello Hemant,
a few comments:
On Thu, 29 Sep 2011, Hemant Pedanekar wrote:
> This patch adds cpu type, macros for identification of TI814X device.
>
> Note that following update to common OMAP data structures is made:
>
> cpu_mask and RATE_IN_XXX flags have crossed 8 bit hence struct
> clksel_rate.flags, struct prcm_config.flags and cpu_mask are changed to u16 from
> u8.
>
> Signed-off-by: Hemant Pedanekar <hemantp@ti.com>
Also, the opp2xxx.h change looks spurious, is that really needed?
Could you please split the clock-related changes into a separate patch?
Then this patch would just be the id.c and cpu.h changes.
Other than that, the patch looks okay to me.
- Paul
^ permalink raw reply
* Git pull request: mach/vmalloc.h removal, and ioremap optimizations
From: Nicolas Pitre @ 2011-09-29 20:47 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4E84D47F.7030007@gmail.com>
On Thu, 29 Sep 2011, Rob Herring wrote:
> On 09/29/2011 01:42 PM, Nicolas Pitre wrote:
> > On Thu, 29 Sep 2011, Rob Herring wrote:
> >
> >> On 09/29/2011 12:37 PM, Russell King - ARM Linux wrote:
> >>> My guess would be:
> >>>
> >>> }, {
> >>> .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE),
> >>> .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE),
> >>> .length = SZ_4K * 9,
> >>> .type = MT_DEVICE
> >>> },
> >>> #ifdef CONFIG_MACH_VERSATILE_AB
> >>> {
> >>> .virtual = IO_ADDRESS(VERSATILE_GPIO0_BASE),
> >>> .pfn = __phys_to_pfn(VERSATILE_GPIO0_BASE),
> >>> .length = SZ_4K,
> >>> .type = MT_DEVICE
> >>>
> >>> #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */
> >>> #define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */
> >>>
> >>> I don't see why GPIO0 is explicitly listed here.
> >>
> >> It works for PB and AB with that removed. Here's a patch:
> > [...]
> >
> > Thanks for testing and the patch. I've inserted it in my patch series
> > and pushed the result out.
>
> So it was really Realview PBX I wanted to test my GIC changes on. Well,
> turns out it's got a similar problem, too.
>
> However, the fix for it should perhaps be a bit different. The problem
> is that the virtual address of REALVIEW_PBX_TILE_GIC_CPU_BASE is not
> aligned. Then 0x100 + 4KB length overlaps into the DIST_BASE. So do we
> fix it in the platform or should the core code mask out the lower bits
> of the virt addr before doing any size calculations?
Please fix it in the platform static declaration. No need to put
run time code for something that can be fixed in the source.
Nicolas
^ permalink raw reply
* [PATCH 1/2] ARM: gic: add irq_domain support
From: Rob Herring @ 2011-09-29 21:02 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20110929171540.GC6800@ponder.secretlab.ca>
On 09/29/2011 12:15 PM, Grant Likely wrote:
> On Wed, Sep 28, 2011 at 10:53:55PM -0500, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> Convert the gic interrupt controller to use irq domains in preparation
>> for device-tree binding and MULTI_IRQ. This allows for translation between
>> GIC interrupt IDs and Linux irq numbers.
>>
>> The meaning of irq_offset has changed. It now is just the number of skipped
>> GIC interrupt IDs for the controller. It will be 16 for primary GIC and 32
>> for secondary GICs.
>
> [...]
>
>> /*
>> @@ -81,7 +82,7 @@ static inline unsigned int gic_irq(struct irq_data *d)
>> */
>> static void gic_mask_irq(struct irq_data *d)
>> {
>> - u32 mask = 1 << (d->irq % 32);
>> + u32 mask = 1 << (gic_irq(d) % 32);
>
> This can probably change simply to d->hwirq if irq_offset is
> eliminated as I describe below.
>
>> void __init gic_init(unsigned int gic_nr, unsigned int irq_start,
>> void __iomem *dist_base, void __iomem *cpu_base)
>> {
>> struct gic_chip_data *gic;
>> + struct irq_domain *domain;
>> + int gic_irqs;
>>
>> BUG_ON(gic_nr >= MAX_GIC_NR);
>>
>> gic = &gic_data[gic_nr];
>> + domain = &gic->domain;
>> gic->dist_base = dist_base;
>> gic->cpu_base = cpu_base;
>> - gic->irq_offset = (irq_start - 1) & ~31;
>>
>> - if (gic_nr == 0)
>> + /*
>> + * For primary GICs, skip over SGIs.
>> + * For secondary GICs, skip over PPIs, too.
>> + */
>> + if (gic_nr == 0) {
>> gic_cpu_base_addr = cpu_base;
>> + gic->irq_offset = 16;
>> + irq_start = (irq_start & ~31) + 16;
>
> With the switch to irq_domain, there should no longer be any need for
> a ~31 mask on the irq_start number. Yes, you'll want to make sure
> that it doesn't allocate below irq 16, but the driver should
> completely use the irq_domain to manage the mapping from linux-irq
> number to hwirq number. The ~31 mask appears to have been an
> optimization to quickly calculate hwirq number from the linux one, but
> that value is now found in irq_data->hwirq.
I started out exactly this way removing irq_offset. The problem is the
core irq domain code assumes that hwirq starts at 0, but for the gic it
starts at 16 or 32.
It could be fixed in the domain core, but that would effectively mean
moving irq_offset into the core.
The masking here is mainly to not break exynos. Everyone else passes in
a value of 16-31 which I could just hardcode to 16. So when exynos gets
all the interrupts converted over to domains, this can be removed. I
looked at it briefly and it doesn't look trivial.
>
> irq_offset could almost be dropped entirely outside of probe because
> it no longer matters. Instead, populate the to_irq() hook so that the
> hwirq value gets set correctly from the outset.
>
> It would be better in general to have a consistent view of what the
> hwirq number means regardless of if it is a root GIC.
Agreed.
Rob
^ permalink raw reply
* Git pull request: mach/vmalloc.h removal, and ioremap optimizations
From: Rob Herring @ 2011-09-29 21:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <alpine.LFD.2.02.1109291645570.9106@xanadu.home>
On 09/29/2011 03:47 PM, Nicolas Pitre wrote:
> On Thu, 29 Sep 2011, Rob Herring wrote:
>
>> On 09/29/2011 01:42 PM, Nicolas Pitre wrote:
>>> On Thu, 29 Sep 2011, Rob Herring wrote:
>>>
>>>> On 09/29/2011 12:37 PM, Russell King - ARM Linux wrote:
>>>>> My guess would be:
>>>>>
>>>>> }, {
>>>>> .virtual = IO_ADDRESS(VERSATILE_SCTL_BASE),
>>>>> .pfn = __phys_to_pfn(VERSATILE_SCTL_BASE),
>>>>> .length = SZ_4K * 9,
>>>>> .type = MT_DEVICE
>>>>> },
>>>>> #ifdef CONFIG_MACH_VERSATILE_AB
>>>>> {
>>>>> .virtual = IO_ADDRESS(VERSATILE_GPIO0_BASE),
>>>>> .pfn = __phys_to_pfn(VERSATILE_GPIO0_BASE),
>>>>> .length = SZ_4K,
>>>>> .type = MT_DEVICE
>>>>>
>>>>> #define VERSATILE_SCTL_BASE 0x101E0000 /* System controller */
>>>>> #define VERSATILE_GPIO0_BASE 0x101E4000 /* GPIO port 0 */
>>>>>
>>>>> I don't see why GPIO0 is explicitly listed here.
>>>>
>>>> It works for PB and AB with that removed. Here's a patch:
>>> [...]
>>>
>>> Thanks for testing and the patch. I've inserted it in my patch series
>>> and pushed the result out.
>>
>> So it was really Realview PBX I wanted to test my GIC changes on. Well,
>> turns out it's got a similar problem, too.
>>
>> However, the fix for it should perhaps be a bit different. The problem
>> is that the virtual address of REALVIEW_PBX_TILE_GIC_CPU_BASE is not
>> aligned. Then 0x100 + 4KB length overlaps into the DIST_BASE. So do we
>> fix it in the platform or should the core code mask out the lower bits
>> of the virt addr before doing any size calculations?
>
> Please fix it in the platform static declaration. No need to put
> run time code for something that can be fixed in the source.
>
Except that 2 out of 2 machines I've tried are broken. Anyway, patch is
coming.
Rob
^ permalink raw reply
* [PATCH] ARM: realview: fix map_desc alignment
From: Rob Herring @ 2011-09-29 21:22 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4E84E0CA.2050905@gmail.com>
From: Rob Herring <rob.herring@calxeda.com>
REALVIEW_PBX_TILE_GIC_CPU_BASE is not 4KB aligned which causes an
overlapping mapping. Use REALVIEW_PBX_TILE_SCU_BASE instead which is
aligned.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
arch/arm/mach-realview/realview_pbx.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 363b0ab..5930a33 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -98,8 +98,8 @@ static struct map_desc realview_pbx_io_desc[] __initdata = {
static struct map_desc realview_local_io_desc[] __initdata = {
{
- .virtual = IO_ADDRESS(REALVIEW_PBX_TILE_GIC_CPU_BASE),
- .pfn = __phys_to_pfn(REALVIEW_PBX_TILE_GIC_CPU_BASE),
+ .virtual = IO_ADDRESS(REALVIEW_PBX_TILE_SCU_BASE),
+ .pfn = __phys_to_pfn(REALVIEW_PBX_TILE_SCU_BASE),
.length = SZ_4K,
.type = MT_DEVICE,
}, {
--
1.7.5.4
^ permalink raw reply related
* [PATCH 7/8] OMAP4: clock: Add CPU local timer clock node.
From: Linus Walleij @ 2011-09-29 21:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1315459327-3285-8-git-send-email-santosh.shilimkar@ti.com>
2011/9/8 Santosh Shilimkar <santosh.shilimkar@ti.com>:
> Local timer clock is sourced from the CPU clock and hence changes
> along with CPU clock. These per CPU local timers are used as
> clock-events, so they need to be reconfigured on CPU frequency
> change as part of CPUfreq governor.
This requires patch 6956/2 right?
http://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=6956/2
Can I add your Tested-by: to the patch as well?
Yours,
Linus Walleij
^ permalink raw reply
* [PATCH 1/5] ARM: pxa: remove redundant macro on GPIO
From: Linus Walleij @ 2011-09-29 21:35 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-1-git-send-email-haojian.zhuang@marvell.com>
Hey, these patches are mor thorough than what I did, making deeper changes
in the driver.
Notify me when you have put the patches into Russells patch tracker
so I can remove my similar patches from the tracker.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
For all.
Thanks!
Linus Walleij
^ permalink raw reply
* [PATCH 1/5] ARM: pxa: remove redundant macro on GPIO
From: Grant Likely @ 2011-09-29 22:02 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-1-git-send-email-haojian.zhuang@marvell.com>
On Thu, Sep 29, 2011 at 11:19:02PM +0800, Haojian Zhuang wrote:
> Both GPLRx and GPLR(x) are provided. GPLRx means register GPLR0/1/...
> GPLR(x) means register GPLR0/1/... and x ranges from 0 to the maximum
> bit number.
>
> Remove GPLRx since it's redundant.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> arch/arm/mach-pxa/corgi_pm.c | 5 ++-
> arch/arm/mach-pxa/include/mach/gpio.h | 60 ++++----------------------------
> arch/arm/mach-pxa/irq.c | 17 +++++----
> arch/arm/mach-pxa/spitz_pm.c | 3 +-
> 4 files changed, 22 insertions(+), 63 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
> index 2903477..1a7a4c0 100644
> --- a/arch/arm/mach-pxa/corgi_pm.c
> +++ b/arch/arm/mach-pxa/corgi_pm.c
> @@ -90,7 +90,7 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
> {
> int is_resume = 0;
>
> - dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
> + dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR(0), PEDR);
>
> if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
> if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
> @@ -124,7 +124,8 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
>
> static unsigned long corgi_charger_wakeup(void)
> {
> - return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
> + return ~GPLR(CORGI_GPIO_AC_IN) & ( GPIO_bit(CORGI_GPIO_AC_IN)
> + | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
> }
>
> unsigned long corgipm_read_devdata(int type)
> diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
> index c463950..1b77c11 100644
> --- a/arch/arm/mach-pxa/include/mach/gpio.h
> +++ b/arch/arm/mach-pxa/include/mach/gpio.h
> @@ -33,69 +33,25 @@
> #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> #define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
>
> -/* GPIO Pin Level Registers */
> -#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
> -#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
> -#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
> -#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
> -
> -/* GPIO Pin Direction Registers */
> -#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
> -#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
> -#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
> -#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
> -
> -/* GPIO Pin Output Set Registers */
> -#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
> -#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
> -#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
> -#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
> -
> -/* GPIO Pin Output Clear Registers */
> -#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
> -#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
> -#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
> -#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
> -
> -/* GPIO Rising Edge Detect Registers */
> -#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
> -#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
> -#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
> -#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
> -
> -/* GPIO Falling Edge Detect Registers */
> -#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
> -#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
> -#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
> -#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
> -
> -/* GPIO Edge Detect Status Registers */
> -#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
> -#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
> -#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
> -#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
> -
> -/* GPIO Alternate Function Select Registers */
> -#define GAFR0_L GPIO_REG(0x0054)
> -#define GAFR0_U GPIO_REG(0x0058)
> -#define GAFR1_L GPIO_REG(0x005C)
> -#define GAFR1_U GPIO_REG(0x0060)
> -#define GAFR2_L GPIO_REG(0x0064)
> -#define GAFR2_U GPIO_REG(0x0068)
> -#define GAFR3_L GPIO_REG(0x006C)
> -#define GAFR3_U GPIO_REG(0x0070)
> -
> /* More handy macros. The argument is a literal GPIO number. */
>
> #define GPIO_bit(x) (1 << ((x) & 0x1f))
>
> +/* GPIO Pin Level Registers */
> #define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
> +/* GPIO Pin Direction Registers */
> #define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
> +/* GPIO Pin Output Set Registers */
> #define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
> +/* GPIO Pin Output Clear Registers */
> #define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
> +/* GPIO Rising Edge Detect Registers */
> #define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
> +/* GPIO Falling Edge Detect Registers */
> #define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
> +/* GPIO Edge Detect Status Registers */
> #define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
> +/* GPIO Alternate Function Select Registers */
> #define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
>
>
> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
> index dafb4bf..b569e70 100644
> --- a/arch/arm/mach-pxa/irq.c
> +++ b/arch/arm/mach-pxa/irq.c
> @@ -103,21 +103,22 @@ static int pxa_set_low_gpio_type(struct irq_data *d, unsigned int type)
> }
>
> if (type & IRQ_TYPE_EDGE_RISING)
> - GRER0 |= GPIO_bit(gpio);
> + GRER(gpio) |= GPIO_bit(gpio);
> else
> - GRER0 &= ~GPIO_bit(gpio);
> + GRER(gpio) &= ~GPIO_bit(gpio);
>
> if (type & IRQ_TYPE_EDGE_FALLING)
> - GFER0 |= GPIO_bit(gpio);
> + GFER(gpio) |= GPIO_bit(gpio);
> else
> - GFER0 &= ~GPIO_bit(gpio);
> + GFER(gpio) &= ~GPIO_bit(gpio);
>
> return 0;
> }
>
> static void pxa_ack_low_gpio(struct irq_data *d)
> {
> - GEDR0 = (1 << (d->irq - IRQ_GPIO0));
> + int gpio = d->irq - IRQ_GPIO0;
> + GEDR(gpio) = 1 << gpio;
> }
>
> static struct irq_chip pxa_low_gpio_chip = {
> @@ -163,9 +164,9 @@ static void __init pxa_init_low_gpio_irq(set_wake_t fn)
> int irq;
>
> /* clear edge detection on GPIO 0 and 1 */
> - GFER0 &= ~0x3;
> - GRER0 &= ~0x3;
> - GEDR0 = 0x3;
> + GFER(0) &= ~0x3;
> + GRER(0) &= ~0x3;
> + GEDR(0) = 0x3;
>
> for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
> irq_set_chip_and_handler(irq, &pxa_low_gpio_chip,
> diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
> index 094279a..d5295b7 100644
> --- a/arch/arm/mach-pxa/spitz_pm.c
> +++ b/arch/arm/mach-pxa/spitz_pm.c
> @@ -169,7 +169,8 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
>
> static unsigned long spitz_charger_wakeup(void)
> {
> - return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
> + return (~GPLR(SPITZ_GPIO_KEY_INT) & GPIO_bit(SPITZ_GPIO_KEY_INT))
> + | (GPLR(SPITZ_GPIO_SYNC) & GPIO_bit(SPITZ_GPIO_SYNC));
> }
>
> unsigned long spitzpm_read_devdata(int type)
> --
> 1.7.2.5
>
^ permalink raw reply
* [PATCH 3/5] ARM: pxa: rename gpio_to_irq and irq_to_gpio
From: Grant Likely @ 2011-09-29 22:03 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-3-git-send-email-haojian.zhuang@marvell.com>
On Thu, Sep 29, 2011 at 11:19:04PM +0800, Haojian Zhuang wrote:
> Rename gpio_to_irq() to pxa_gpio_to_irq(), and rename irq_to_gpio() to
> pxa_irq_to_gpio(). This rename operations is used to avoid naming
> confliction while gpio driver is moved into drivers/gpio/ directory.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> arch/arm/mach-mmp/aspenite.c | 4 +-
> arch/arm/mach-mmp/flint.c | 4 +-
> arch/arm/mach-mmp/include/mach/gpio.h | 4 +-
> arch/arm/mach-mmp/tavorevb.c | 4 +-
> arch/arm/mach-mmp/teton_bga.c | 2 +-
> arch/arm/mach-pxa/capc7117.c | 12 ++++----
> arch/arm/mach-pxa/cm-x270.c | 2 +-
> arch/arm/mach-pxa/cm-x2xx-pci.c | 4 +-
> arch/arm/mach-pxa/colibri-pxa270.c | 6 ++--
> arch/arm/mach-pxa/colibri-pxa300.c | 4 +-
> arch/arm/mach-pxa/colibri-pxa320.c | 4 +-
> arch/arm/mach-pxa/corgi.c | 2 +-
> arch/arm/mach-pxa/em-x270.c | 6 ++--
> arch/arm/mach-pxa/hx4700.c | 18 +++++++-------
> arch/arm/mach-pxa/icontrol.c | 8 +++---
> arch/arm/mach-pxa/include/mach/csb726.h | 4 +-
> arch/arm/mach-pxa/include/mach/gpio.h | 4 +-
> arch/arm/mach-pxa/littleton.c | 2 +-
> arch/arm/mach-pxa/magician.c | 8 +++---
> arch/arm/mach-pxa/mioa701.c | 12 ++++----
> arch/arm/mach-pxa/mxm8x10.c | 4 +-
> arch/arm/mach-pxa/poodle.c | 2 +-
> arch/arm/mach-pxa/pxa25x.c | 2 +-
> arch/arm/mach-pxa/pxa27x.c | 2 +-
> arch/arm/mach-pxa/raumfeld.c | 14 +++++-----
> arch/arm/mach-pxa/saar.c | 6 ++--
> arch/arm/mach-pxa/saarb.c | 2 +-
> arch/arm/mach-pxa/spitz.c | 2 +-
> arch/arm/mach-pxa/stargate2.c | 4 +-
> arch/arm/mach-pxa/tavorevb.c | 4 +-
> arch/arm/mach-pxa/tavorevb3.c | 2 +-
> arch/arm/mach-pxa/tosa.c | 4 +-
> arch/arm/mach-pxa/viper.c | 16 ++++++------
> arch/arm/mach-pxa/vpac270.c | 4 +-
> arch/arm/mach-pxa/z2.c | 2 +-
> arch/arm/mach-pxa/zeus.c | 40 +++++++++++++++++-------------
> arch/arm/mach-pxa/zylonite.c | 4 +-
> arch/arm/plat-pxa/gpio.c | 13 +++++----
> 38 files changed, 124 insertions(+), 117 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
> index 2b3b0c6..6b19812 100644
> --- a/arch/arm/mach-mmp/aspenite.c
> +++ b/arch/arm/mach-mmp/aspenite.c
> @@ -119,8 +119,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(27),
> - .end = gpio_to_irq(27),
> + .start = pxa_gpio_to_irq(27),
> + .end = pxa_gpio_to_irq(27),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
> index c4fd806..f466a2c 100644
> --- a/arch/arm/mach-mmp/flint.c
> +++ b/arch/arm/mach-mmp/flint.c
> @@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(155),
> - .end = gpio_to_irq(155),
> + .start = pxa_gpio_to_irq(155),
> + .end = pxa_gpio_to_irq(155),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
> index 7bfb827..5ed6977 100644
> --- a/arch/arm/mach-mmp/include/mach/gpio.h
> +++ b/arch/arm/mach-mmp/include/mach/gpio.h
> @@ -13,8 +13,8 @@
> #define NR_BUILTIN_GPIO IRQ_GPIO_NUM
>
> #define gpio_to_bank(gpio) ((gpio) >> 5)
> -#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> -#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
> +#define pxa_gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> +#define pxa_irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
>
>
> #define __gpio_is_inverted(gpio) (0)
> diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
> index 143e52e..c5e1529 100644
> --- a/arch/arm/mach-mmp/tavorevb.c
> +++ b/arch/arm/mach-mmp/tavorevb.c
> @@ -70,8 +70,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(80),
> - .end = gpio_to_irq(80),
> + .start = pxa_gpio_to_irq(80),
> + .end = pxa_gpio_to_irq(80),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
> index bbe4727..79bbbc2 100644
> --- a/arch/arm/mach-mmp/teton_bga.c
> +++ b/arch/arm/mach-mmp/teton_bga.c
> @@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
> static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
> {
> I2C_BOARD_INFO("ds1337", 0x68),
> - .irq = gpio_to_irq(RTC_INT_GPIO)
> + .irq = pxa_gpio_to_irq(RTC_INT_GPIO)
> },
> };
>
> diff --git a/arch/arm/mach-pxa/capc7117.c b/arch/arm/mach-pxa/capc7117.c
> index 4efc16d..6046eac 100644
> --- a/arch/arm/mach-pxa/capc7117.c
> +++ b/arch/arm/mach-pxa/capc7117.c
> @@ -50,8 +50,8 @@ static struct resource capc7117_ide_resources[] = {
> .flags = IORESOURCE_MEM
> },
> [2] = {
> - .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
> - .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO76)),
> .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING
> }
> };
> @@ -80,7 +80,7 @@ static void __init capc7117_ide_init(void)
> static struct plat_serial8250_port ti16c752_platform_data[] = {
> [0] = {
> .mapbase = 0x14000000,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO78)),
> .irqflags = IRQF_TRIGGER_RISING,
> .flags = TI16C752_FLAGS,
> .iotype = UPIO_MEM,
> @@ -89,7 +89,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
> },
> [1] = {
> .mapbase = 0x14000040,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO79)),
> .irqflags = IRQF_TRIGGER_RISING,
> .flags = TI16C752_FLAGS,
> .iotype = UPIO_MEM,
> @@ -98,7 +98,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
> },
> [2] = {
> .mapbase = 0x14000080,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO80)),
> .irqflags = IRQF_TRIGGER_RISING,
> .flags = TI16C752_FLAGS,
> .iotype = UPIO_MEM,
> @@ -107,7 +107,7 @@ static struct plat_serial8250_port ti16c752_platform_data[] = {
> },
> [3] = {
> .mapbase = 0x140000c0,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO81)),
> .irqflags = IRQF_TRIGGER_RISING,
> .flags = TI16C752_FLAGS,
> .iotype = UPIO_MEM,
> diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
> index 13518a7..885e91a 100644
> --- a/arch/arm/mach-pxa/cm-x270.c
> +++ b/arch/arm/mach-pxa/cm-x270.c
> @@ -380,7 +380,7 @@ static struct spi_board_info cm_x270_spi_devices[] __initdata = {
> .modalias = "libertas_spi",
> .max_speed_hz = 13000000,
> .bus_num = 2,
> - .irq = gpio_to_irq(95),
> + .irq = pxa_gpio_to_irq(95),
> .chip_select = 0,
> .controller_data = &cm_x270_libertas_chip,
> .platform_data = &cm_x270_libertas_pdata,
> diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
> index 6bf479d..9583517 100644
> --- a/arch/arm/mach-pxa/cm-x2xx-pci.c
> +++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
> @@ -43,9 +43,9 @@ void __cmx2xx_pci_init_irq(int irq_gpio)
>
> cmx2xx_it8152_irq_gpio = irq_gpio;
>
> - irq_set_irq_type(gpio_to_irq(irq_gpio), IRQ_TYPE_EDGE_RISING);
> + irq_set_irq_type(pxa_gpio_to_irq(irq_gpio), IRQ_TYPE_EDGE_RISING);
>
> - irq_set_chained_handler(gpio_to_irq(irq_gpio),
> + irq_set_chained_handler(pxa_gpio_to_irq(irq_gpio),
> cmx2xx_it8152_irq_demux);
> }
>
> diff --git a/arch/arm/mach-pxa/colibri-pxa270.c b/arch/arm/mach-pxa/colibri-pxa270.c
> index 7db6646..74dbfa6 100644
> --- a/arch/arm/mach-pxa/colibri-pxa270.c
> +++ b/arch/arm/mach-pxa/colibri-pxa270.c
> @@ -217,8 +217,8 @@ static struct resource colibri_pxa270_dm9000_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> {
> - .start = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
> - .end = gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
> + .start = pxa_gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
> + .end = pxa_gpio_to_irq(GPIO114_COLIBRI_PXA270_ETH_IRQ),
> .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
> },
> };
> @@ -248,7 +248,7 @@ static pxa2xx_audio_ops_t colibri_pxa270_ac97_pdata = {
> };
>
> static struct ucb1400_pdata colibri_pxa270_ucb1400_pdata = {
> - .irq = gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
> + .irq = pxa_gpio_to_irq(GPIO113_COLIBRI_PXA270_TS_IRQ),
> };
>
> static struct platform_device colibri_pxa270_ucb1400_device = {
> diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c
> index c825e8b..3d428eb 100644
> --- a/arch/arm/mach-pxa/colibri-pxa300.c
> +++ b/arch/arm/mach-pxa/colibri-pxa300.c
> @@ -78,8 +78,8 @@ static struct resource colibri_asix_resource[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> - .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> + .start = pxa_gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> + .end = pxa_gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
> }
> };
> diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c
> index 692e1ff..817c6cb 100644
> --- a/arch/arm/mach-pxa/colibri-pxa320.c
> +++ b/arch/arm/mach-pxa/colibri-pxa320.c
> @@ -115,8 +115,8 @@ static struct resource colibri_asix_resource[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> - .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> + .start = pxa_gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> + .end = pxa_gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
> .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
> }
> };
> diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
> index fcc04dd..88cacd8 100644
> --- a/arch/arm/mach-pxa/corgi.c
> +++ b/arch/arm/mach-pxa/corgi.c
> @@ -531,7 +531,7 @@ static struct spi_board_info corgi_spi_devices[] = {
> .chip_select = 0,
> .platform_data = &corgi_ads7846_info,
> .controller_data= &corgi_ads7846_chip,
> - .irq = gpio_to_irq(CORGI_GPIO_TP_INT),
> + .irq = pxa_gpio_to_irq(CORGI_GPIO_TP_INT),
> }, {
> .modalias = "corgi-lcd",
> .max_speed_hz = 50000,
> diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
> index 94acc0b..a802c2c 100644
> --- a/arch/arm/mach-pxa/em-x270.c
> +++ b/arch/arm/mach-pxa/em-x270.c
> @@ -558,7 +558,7 @@ static int em_x270_mci_init(struct device *dev,
> return PTR_ERR(em_x270_sdio_ldo);
> }
>
> - err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
> + err = request_irq(pxa_gpio_to_irq(mmc_cd), em_x270_detect_int,
> IRQF_DISABLED | IRQF_TRIGGER_RISING |
> IRQF_TRIGGER_FALLING,
> "MMC card detect", data);
> @@ -588,7 +588,7 @@ static int em_x270_mci_init(struct device *dev,
> return 0;
>
> err_gpio_wp:
> - free_irq(gpio_to_irq(mmc_cd), data);
> + free_irq(pxa_gpio_to_irq(mmc_cd), data);
> err_irq:
> regulator_put(em_x270_sdio_ldo);
>
> @@ -611,7 +611,7 @@ static void em_x270_mci_setpower(struct device *dev, unsigned int vdd)
>
> static void em_x270_mci_exit(struct device *dev, void *data)
> {
> - free_irq(gpio_to_irq(mmc_cd), data);
> + free_irq(pxa_gpio_to_irq(mmc_cd), data);
> regulator_put(em_x270_sdio_ldo);
>
> if (machine_is_em_x270())
> diff --git a/arch/arm/mach-pxa/hx4700.c b/arch/arm/mach-pxa/hx4700.c
> index 6f6368e..03b5ced 100644
> --- a/arch/arm/mach-pxa/hx4700.c
> +++ b/arch/arm/mach-pxa/hx4700.c
> @@ -252,8 +252,8 @@ static struct resource asic3_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
> - .end = gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
> + .start = pxa_gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
> + .end = pxa_gpio_to_irq(GPIO12_HX4700_ASIC3_IRQ),
> .flags = IORESOURCE_IRQ,
> },
> /* SD part */
> @@ -263,8 +263,8 @@ static struct resource asic3_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [3] = {
> - .start = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
> - .end = gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
> + .start = pxa_gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
> + .end = pxa_gpio_to_irq(GPIO66_HX4700_ASIC3_nSDIO_IRQ),
> .flags = IORESOURCE_IRQ,
> },
> };
> @@ -587,7 +587,7 @@ static struct spi_board_info tsc2046_board_info[] __initdata = {
> .modalias = "ads7846",
> .bus_num = 2,
> .max_speed_hz = 2600000, /* 100 kHz sample rate */
> - .irq = gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ),
> + .irq = pxa_gpio_to_irq(GPIO58_HX4700_TSC2046_nPENIRQ),
> .platform_data = &tsc2046_info,
> .controller_data = &tsc2046_chip,
> },
> @@ -635,15 +635,15 @@ static struct resource power_supply_resources[] = {
> .name = "ac",
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
> IORESOURCE_IRQ_LOWEDGE,
> - .start = gpio_to_irq(GPIOD9_nAC_IN),
> - .end = gpio_to_irq(GPIOD9_nAC_IN),
> + .start = pxa_gpio_to_irq(GPIOD9_nAC_IN),
> + .end = pxa_gpio_to_irq(GPIOD9_nAC_IN),
> },
> [1] = {
> .name = "usb",
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
> IORESOURCE_IRQ_LOWEDGE,
> - .start = gpio_to_irq(GPIOD14_nUSBC_DETECT),
> - .end = gpio_to_irq(GPIOD14_nUSBC_DETECT),
> + .start = pxa_gpio_to_irq(GPIOD14_nUSBC_DETECT),
> + .end = pxa_gpio_to_irq(GPIOD14_nUSBC_DETECT),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/icontrol.c b/arch/arm/mach-pxa/icontrol.c
> index f78d5db..c15d095 100644
> --- a/arch/arm/mach-pxa/icontrol.c
> +++ b/arch/arm/mach-pxa/icontrol.c
> @@ -86,7 +86,7 @@ static struct spi_board_info mcp251x_board_info[] = {
> .chip_select = 0,
> .platform_data = &mcp251x_info,
> .controller_data = &mcp251x_chip_info1,
> - .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ1)
> + .irq = pxa_gpio_to_irq(ICONTROL_MCP251x_nIRQ1)
> },
> {
> .modalias = "mcp2515",
> @@ -95,7 +95,7 @@ static struct spi_board_info mcp251x_board_info[] = {
> .chip_select = 1,
> .platform_data = &mcp251x_info,
> .controller_data = &mcp251x_chip_info2,
> - .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ2)
> + .irq = pxa_gpio_to_irq(ICONTROL_MCP251x_nIRQ2)
> },
> {
> .modalias = "mcp2515",
> @@ -104,7 +104,7 @@ static struct spi_board_info mcp251x_board_info[] = {
> .chip_select = 0,
> .platform_data = &mcp251x_info,
> .controller_data = &mcp251x_chip_info3,
> - .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ3)
> + .irq = pxa_gpio_to_irq(ICONTROL_MCP251x_nIRQ3)
> },
> {
> .modalias = "mcp2515",
> @@ -113,7 +113,7 @@ static struct spi_board_info mcp251x_board_info[] = {
> .chip_select = 1,
> .platform_data = &mcp251x_info,
> .controller_data = &mcp251x_chip_info4,
> - .irq = gpio_to_irq(ICONTROL_MCP251x_nIRQ4)
> + .irq = pxa_gpio_to_irq(ICONTROL_MCP251x_nIRQ4)
> }
> };
>
> diff --git a/arch/arm/mach-pxa/include/mach/csb726.h b/arch/arm/mach-pxa/include/mach/csb726.h
> index 747ab1a..ba17e0f 100644
> --- a/arch/arm/mach-pxa/include/mach/csb726.h
> +++ b/arch/arm/mach-pxa/include/mach/csb726.h
> @@ -19,8 +19,8 @@
> #define CSB726_FLASH_SIZE (64 * 1024 * 1024)
> #define CSB726_FLASH_uMON (8 * 1024 * 1024)
>
> -#define CSB726_IRQ_LAN gpio_to_irq(CSB726_GPIO_IRQ_LAN)
> -#define CSB726_IRQ_SM501 gpio_to_irq(CSB726_GPIO_IRQ_SM501)
> +#define CSB726_IRQ_LAN pxa_gpio_to_irq(CSB726_GPIO_IRQ_LAN)
> +#define CSB726_IRQ_SM501 pxa_gpio_to_irq(CSB726_GPIO_IRQ_SM501)
>
> #endif
>
> diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
> index 1b77c11..45ac8e6 100644
> --- a/arch/arm/mach-pxa/include/mach/gpio.h
> +++ b/arch/arm/mach-pxa/include/mach/gpio.h
> @@ -58,9 +58,9 @@
> #define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
>
> #define gpio_to_bank(gpio) ((gpio) >> 5)
> -#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
> +#define pxa_gpio_to_irq(gpio) IRQ_GPIO(gpio)
>
> -static inline int irq_to_gpio(unsigned int irq)
> +static inline int pxa_irq_to_gpio(unsigned int irq)
> {
> int gpio;
>
> diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
> index 7b324ec..0296e1d 100644
> --- a/arch/arm/mach-pxa/littleton.c
> +++ b/arch/arm/mach-pxa/littleton.c
> @@ -396,7 +396,7 @@ static struct i2c_board_info littleton_i2c_info[] = {
> .type = "da9034",
> .addr = 0x34,
> .platform_data = &littleton_da9034_info,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
> },
> [1] = {
> .type = "max7320",
> diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c
> index 4b796c3..e58f9e1 100644
> --- a/arch/arm/mach-pxa/magician.c
> +++ b/arch/arm/mach-pxa/magician.c
> @@ -184,8 +184,8 @@ static struct resource egpio_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
> - .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
> + .start = pxa_gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
> + .end = pxa_gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ),
> .flags = IORESOURCE_IRQ,
> },
> };
> @@ -468,8 +468,8 @@ static struct resource pasic3_resources[] = {
> },
> /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
> [1] = {
> - .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
> - .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
> + .start = pxa_gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
> + .end = pxa_gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
> index b938fc2..967ab8d 100644
> --- a/arch/arm/mach-pxa/mioa701.c
> +++ b/arch/arm/mach-pxa/mioa701.c
> @@ -314,7 +314,7 @@ static int __init gsm_init(void)
> rc = gpio_request_array(ARRAY_AND_SIZE(gsm_gpios));
> if (rc)
> goto err_gpio;
> - rc = request_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), gsm_on_irq,
> + rc = request_irq(pxa_gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), gsm_on_irq,
> IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> "GSM XS200 Power Irq", NULL);
> if (rc)
> @@ -333,7 +333,7 @@ err_gpio:
>
> static void gsm_exit(void)
> {
> - free_irq(gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), NULL);
> + free_irq(pxa_gpio_to_irq(GPIO25_GSM_MOD_ON_STATE), NULL);
> gpio_free_array(ARRAY_AND_SIZE(gsm_gpios));
> }
>
> @@ -541,15 +541,15 @@ static struct pda_power_pdata power_pdata = {
> static struct resource power_resources[] = {
> [0] = {
> .name = "ac",
> - .start = gpio_to_irq(GPIO96_AC_DETECT),
> - .end = gpio_to_irq(GPIO96_AC_DETECT),
> + .start = pxa_gpio_to_irq(GPIO96_AC_DETECT),
> + .end = pxa_gpio_to_irq(GPIO96_AC_DETECT),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
> IORESOURCE_IRQ_LOWEDGE,
> },
> [1] = {
> .name = "usb",
> - .start = gpio_to_irq(GPIO13_nUSB_DETECT),
> - .end = gpio_to_irq(GPIO13_nUSB_DETECT),
> + .start = pxa_gpio_to_irq(GPIO13_nUSB_DETECT),
> + .end = pxa_gpio_to_irq(GPIO13_nUSB_DETECT),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
> IORESOURCE_IRQ_LOWEDGE,
> },
> diff --git a/arch/arm/mach-pxa/mxm8x10.c b/arch/arm/mach-pxa/mxm8x10.c
> index 90928d6..ef9901c 100644
> --- a/arch/arm/mach-pxa/mxm8x10.c
> +++ b/arch/arm/mach-pxa/mxm8x10.c
> @@ -417,8 +417,8 @@ static struct resource dm9k_resources[] = {
> .flags = IORESOURCE_MEM
> },
> [2] = {
> - .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
> - .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO9)),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
> }
> };
> diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
> index 79a94fe..469dcd6 100644
> --- a/arch/arm/mach-pxa/poodle.c
> +++ b/arch/arm/mach-pxa/poodle.c
> @@ -212,7 +212,7 @@ static struct spi_board_info poodle_spi_devices[] = {
> .bus_num = 1,
> .platform_data = &poodle_ads7846_info,
> .controller_data= &poodle_ads7846_chip,
> - .irq = gpio_to_irq(POODLE_GPIO_TP_INT),
> + .irq = pxa_gpio_to_irq(POODLE_GPIO_TP_INT),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
> index 6bb3fa5..2ae1739 100644
> --- a/arch/arm/mach-pxa/pxa25x.c
> +++ b/arch/arm/mach-pxa/pxa25x.c
> @@ -286,7 +286,7 @@ static inline void pxa25x_init_pm(void) {}
>
> static int pxa25x_set_wake(struct irq_data *d, unsigned int on)
> {
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> uint32_t mask = 0;
>
> if (gpio >= 0 && gpio < 85)
> diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
> index d2cdcd6..03d0728 100644
> --- a/arch/arm/mach-pxa/pxa27x.c
> +++ b/arch/arm/mach-pxa/pxa27x.c
> @@ -354,7 +354,7 @@ static inline void pxa27x_init_pm(void) {}
> */
> static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
> {
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> uint32_t mask;
>
> if (gpio >= 0 && gpio < 128)
> diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
> index f0c05f4..ad07ea6 100644
> --- a/arch/arm/mach-pxa/raumfeld.c
> +++ b/arch/arm/mach-pxa/raumfeld.c
> @@ -292,8 +292,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> {
> - .start = gpio_to_irq(GPIO_ETH_IRQ),
> - .end = gpio_to_irq(GPIO_ETH_IRQ),
> + .start = pxa_gpio_to_irq(GPIO_ETH_IRQ),
> + .end = pxa_gpio_to_irq(GPIO_ETH_IRQ),
> .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
> }
> };
> @@ -672,7 +672,7 @@ static struct lis3lv02d_platform_data lis3_pdata = {
> .chip_select = 1, \
> .controller_data = (void *) GPIO_ACCEL_CS, \
> .platform_data = &lis3_pdata, \
> - .irq = gpio_to_irq(GPIO_ACCEL_IRQ), \
> + .irq = pxa_gpio_to_irq(GPIO_ACCEL_IRQ), \
> }
>
> #define SPI_DAC7512 \
> @@ -824,10 +824,10 @@ static void __init raumfeld_power_init(void)
> else
> gpio_direction_output(GPIO_CHARGE_USB_SUSP, 0);
>
> - power_supply_resources[0].start = gpio_to_irq(GPIO_CHARGE_DC_OK);
> - power_supply_resources[0].end = gpio_to_irq(GPIO_CHARGE_DC_OK);
> + power_supply_resources[0].start = pxa_gpio_to_irq(GPIO_CHARGE_DC_OK);
> + power_supply_resources[0].end = pxa_gpio_to_irq(GPIO_CHARGE_DC_OK);
>
> - ret = request_irq(gpio_to_irq(GPIO_CHARGE_DONE),
> + ret = request_irq(pxa_gpio_to_irq(GPIO_CHARGE_DONE),
> &charge_done_irq, IORESOURCE_IRQ_LOWEDGE,
> "charge_done", NULL);
>
> @@ -956,7 +956,7 @@ static struct eeti_ts_platform_data eeti_ts_pdata = {
> static struct i2c_board_info raumfeld_controller_i2c_board_info __initdata = {
> .type = "eeti_ts",
> .addr = 0x0a,
> - .irq = gpio_to_irq(GPIO_TOUCH_IRQ),
> + .irq = pxa_gpio_to_irq(GPIO_TOUCH_IRQ),
> .platform_data = &eeti_ts_pdata,
> };
>
> diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
> index fc2c1e0..7345799e 100644
> --- a/arch/arm/mach-pxa/saar.c
> +++ b/arch/arm/mach-pxa/saar.c
> @@ -96,8 +96,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
> - .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO97)),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> @@ -502,7 +502,7 @@ static struct i2c_board_info saar_i2c_info[] = {
> .type = "da9034",
> .addr = 0x34,
> .platform_data = &saar_da9034_info,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
> index 87070a8..eb9edd9 100644
> --- a/arch/arm/mach-pxa/saarb.c
> +++ b/arch/arm/mach-pxa/saarb.c
> @@ -90,7 +90,7 @@ static struct i2c_board_info saarb_i2c_info[] = {
> .type = "88PM860x",
> .addr = 0x34,
> .platform_data = &saarb_pm8607_info,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
> index 29dc9e7..d0caa9f 100644
> --- a/arch/arm/mach-pxa/spitz.c
> +++ b/arch/arm/mach-pxa/spitz.c
> @@ -552,7 +552,7 @@ static struct spi_board_info spitz_spi_devices[] = {
> .chip_select = 0,
> .platform_data = &spitz_ads7846_info,
> .controller_data = &spitz_ads7846_chip,
> - .irq = gpio_to_irq(SPITZ_GPIO_TP_INT),
> + .irq = pxa_gpio_to_irq(SPITZ_GPIO_TP_INT),
> }, {
> .modalias = "corgi-lcd",
> .max_speed_hz = 50000,
> diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
> index 4c9a48b..8752dc0 100644
> --- a/arch/arm/mach-pxa/stargate2.c
> +++ b/arch/arm/mach-pxa/stargate2.c
> @@ -546,7 +546,7 @@ static struct i2c_board_info __initdata imote2_pwr_i2c_board_info[] = {
> .type = "da9030",
> .addr = 0x49,
> .platform_data = &imote2_da9030_pdata,
> - .irq = gpio_to_irq(1),
> + .irq = pxa_gpio_to_irq(1),
> },
> };
>
> @@ -913,7 +913,7 @@ static struct i2c_board_info __initdata stargate2_pwr_i2c_board_info[] = {
> .type = "da9030",
> .addr = 0x49,
> .platform_data = &stargate2_da9030_pdata,
> - .irq = gpio_to_irq(1),
> + .irq = pxa_gpio_to_irq(1),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/tavorevb.c b/arch/arm/mach-pxa/tavorevb.c
> index ad47bb9..7b444e3 100644
> --- a/arch/arm/mach-pxa/tavorevb.c
> +++ b/arch/arm/mach-pxa/tavorevb.c
> @@ -85,8 +85,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
> - .end = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO47)),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-pxa/tavorevb3.c b/arch/arm/mach-pxa/tavorevb3.c
> index fd56916..817c9d1 100644
> --- a/arch/arm/mach-pxa/tavorevb3.c
> +++ b/arch/arm/mach-pxa/tavorevb3.c
> @@ -101,7 +101,7 @@ static struct i2c_board_info evb3_i2c_info[] = {
> .type = "88PM860x",
> .addr = 0x34,
> .platform_data = &evb3_pm8607_info,
> - .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> + .irq = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO83)),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
> index 9f69a26..ac1e4da 100644
> --- a/arch/arm/mach-pxa/tosa.c
> +++ b/arch/arm/mach-pxa/tosa.c
> @@ -404,8 +404,8 @@ static struct pda_power_pdata tosa_power_data = {
> static struct resource tosa_power_resource[] = {
> {
> .name = "ac",
> - .start = gpio_to_irq(TOSA_GPIO_AC_IN),
> - .end = gpio_to_irq(TOSA_GPIO_AC_IN),
> + .start = pxa_gpio_to_irq(TOSA_GPIO_AC_IN),
> + .end = pxa_gpio_to_irq(TOSA_GPIO_AC_IN),
> .flags = IORESOURCE_IRQ |
> IORESOURCE_IRQ_HIGHEDGE |
> IORESOURCE_IRQ_LOWEDGE,
> diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
> index 242ddae..6c63069 100644
> --- a/arch/arm/mach-pxa/viper.c
> +++ b/arch/arm/mach-pxa/viper.c
> @@ -315,9 +315,9 @@ static void __init viper_init_irq(void)
> set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE);
> }
>
> - irq_set_chained_handler(gpio_to_irq(VIPER_CPLD_GPIO),
> + irq_set_chained_handler(pxa_gpio_to_irq(VIPER_CPLD_GPIO),
> viper_irq_handler);
> - irq_set_irq_type(gpio_to_irq(VIPER_CPLD_GPIO), IRQ_TYPE_EDGE_BOTH);
> + irq_set_irq_type(pxa_gpio_to_irq(VIPER_CPLD_GPIO), IRQ_TYPE_EDGE_BOTH);
> }
>
> /* Flat Panel */
> @@ -422,8 +422,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = gpio_to_irq(VIPER_ETH_GPIO),
> - .end = gpio_to_irq(VIPER_ETH_GPIO),
> + .start = pxa_gpio_to_irq(VIPER_ETH_GPIO),
> + .end = pxa_gpio_to_irq(VIPER_ETH_GPIO),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> },
> [2] = {
> @@ -546,7 +546,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> /* External UARTs */
> {
> .mapbase = VIPER_UARTA_PHYS,
> - .irq = gpio_to_irq(VIPER_UARTA_GPIO),
> + .irq = pxa_gpio_to_irq(VIPER_UARTA_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 1843200,
> .regshift = 1,
> @@ -556,7 +556,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> },
> {
> .mapbase = VIPER_UARTB_PHYS,
> - .irq = gpio_to_irq(VIPER_UARTB_GPIO),
> + .irq = pxa_gpio_to_irq(VIPER_UARTB_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 1843200,
> .regshift = 1,
> @@ -596,8 +596,8 @@ static struct resource isp116x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [2] = {
> - .start = gpio_to_irq(VIPER_USB_GPIO),
> - .end = gpio_to_irq(VIPER_USB_GPIO),
> + .start = pxa_gpio_to_irq(VIPER_USB_GPIO),
> + .end = pxa_gpio_to_irq(VIPER_USB_GPIO),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> },
> };
> diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
> index a7539a6..261f258 100644
> --- a/arch/arm/mach-pxa/vpac270.c
> +++ b/arch/arm/mach-pxa/vpac270.c
> @@ -610,8 +610,8 @@ static struct resource vpac270_ide_resources[] = {
> .flags = IORESOURCE_DMA
> },
> [3] = { /* IDE IRQ pin */
> - .start = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
> - .end = gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
> + .start = pxa_gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
> + .end = pxa_gpio_to_irq(GPIO36_VPAC270_IDE_IRQ),
> .flags = IORESOURCE_IRQ
> }
> };
> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
> index 65fed37..4b18474 100644
> --- a/arch/arm/mach-pxa/z2.c
> +++ b/arch/arm/mach-pxa/z2.c
> @@ -573,7 +573,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
> .modalias = "libertas_spi",
> .platform_data = &z2_lbs_pdata,
> .controller_data = &z2_lbs_chip_info,
> - .irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ),
> + .irq = pxa_gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ),
> .max_speed_hz = 13000000,
> .bus_num = 1,
> .chip_select = 0,
> diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
> index c424e7d..dd30cd0 100644
> --- a/arch/arm/mach-pxa/zeus.c
> +++ b/arch/arm/mach-pxa/zeus.c
> @@ -136,12 +136,16 @@ static void __init zeus_init_irq(void)
>
> /* Peripheral IRQs. It would be nice to move those inside driver
> configuration, but it is not supported at the moment. */
> - irq_set_irq_type(gpio_to_irq(ZEUS_AC97_GPIO), IRQ_TYPE_EDGE_RISING);
> - irq_set_irq_type(gpio_to_irq(ZEUS_WAKEUP_GPIO), IRQ_TYPE_EDGE_RISING);
> - irq_set_irq_type(gpio_to_irq(ZEUS_PTT_GPIO), IRQ_TYPE_EDGE_RISING);
> - irq_set_irq_type(gpio_to_irq(ZEUS_EXTGPIO_GPIO),
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_AC97_GPIO),
> + IRQ_TYPE_EDGE_RISING);
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_WAKEUP_GPIO),
> + IRQ_TYPE_EDGE_RISING);
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_PTT_GPIO),
> + IRQ_TYPE_EDGE_RISING);
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_EXTGPIO_GPIO),
> + IRQ_TYPE_EDGE_FALLING);
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_CAN_GPIO),
> IRQ_TYPE_EDGE_FALLING);
> - irq_set_irq_type(gpio_to_irq(ZEUS_CAN_GPIO), IRQ_TYPE_EDGE_FALLING);
>
> /* Setup ISA IRQs */
> for (level = 0; level < ARRAY_SIZE(zeus_isa_irqs); level++) {
> @@ -151,8 +155,10 @@ static void __init zeus_init_irq(void)
> set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE);
> }
>
> - irq_set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING);
> - irq_set_chained_handler(gpio_to_irq(ZEUS_ISA_GPIO), zeus_irq_handler);
> + irq_set_irq_type(pxa_gpio_to_irq(ZEUS_ISA_GPIO),
> + IRQ_TYPE_EDGE_RISING);
> + irq_set_chained_handler(pxa_gpio_to_irq(ZEUS_ISA_GPIO),
> + zeus_irq_handler);
> }
>
>
> @@ -233,7 +239,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
> { /* COM1 */
> .mapbase = 0x10000000,
> - .irq = gpio_to_irq(ZEUS_UARTA_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_UARTA_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 14745600,
> .regshift = 1,
> @@ -242,7 +248,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> },
> { /* COM2 */
> .mapbase = 0x10800000,
> - .irq = gpio_to_irq(ZEUS_UARTB_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_UARTB_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 14745600,
> .regshift = 1,
> @@ -251,7 +257,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> },
> { /* COM3 */
> .mapbase = 0x11000000,
> - .irq = gpio_to_irq(ZEUS_UARTC_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_UARTC_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 14745600,
> .regshift = 1,
> @@ -260,7 +266,7 @@ static struct plat_serial8250_port serial_platform_data[] = {
> },
> { /* COM4 */
> .mapbase = 0x11800000,
> - .irq = gpio_to_irq(ZEUS_UARTD_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_UARTD_GPIO),
> .irqflags = IRQF_TRIGGER_RISING,
> .uartclk = 14745600,
> .regshift = 1,
> @@ -321,8 +327,8 @@ static struct resource zeus_dm9k0_resource[] = {
> .flags = IORESOURCE_MEM
> },
> [2] = {
> - .start = gpio_to_irq(ZEUS_ETH0_GPIO),
> - .end = gpio_to_irq(ZEUS_ETH0_GPIO),
> + .start = pxa_gpio_to_irq(ZEUS_ETH0_GPIO),
> + .end = pxa_gpio_to_irq(ZEUS_ETH0_GPIO),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
> },
> };
> @@ -339,8 +345,8 @@ static struct resource zeus_dm9k1_resource[] = {
> .flags = IORESOURCE_MEM,
> },
> [2] = {
> - .start = gpio_to_irq(ZEUS_ETH1_GPIO),
> - .end = gpio_to_irq(ZEUS_ETH1_GPIO),
> + .start = pxa_gpio_to_irq(ZEUS_ETH1_GPIO),
> + .end = pxa_gpio_to_irq(ZEUS_ETH1_GPIO),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
> },
> };
> @@ -423,7 +429,7 @@ static struct spi_board_info zeus_spi_board_info[] = {
> [0] = {
> .modalias = "mcp2515",
> .platform_data = &zeus_mcp2515_pdata,
> - .irq = gpio_to_irq(ZEUS_CAN_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_CAN_GPIO),
> .max_speed_hz = 1*1000*1000,
> .bus_num = 3,
> .mode = SPI_MODE_0,
> @@ -753,7 +759,7 @@ static struct i2c_board_info __initdata zeus_i2c_devices[] = {
> {
> I2C_BOARD_INFO("pca9535", 0x20),
> .platform_data = &zeus_pca953x_pdata[2],
> - .irq = gpio_to_irq(ZEUS_EXTGPIO_GPIO),
> + .irq = pxa_gpio_to_irq(ZEUS_EXTGPIO_GPIO),
> },
> { I2C_BOARD_INFO("lm75a", 0x48) },
> { I2C_BOARD_INFO("24c01", 0x50) },
> diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c
> index 6c39c33..28343e0 100644
> --- a/arch/arm/mach-pxa/zylonite.c
> +++ b/arch/arm/mach-pxa/zylonite.c
> @@ -408,8 +408,8 @@ static void __init zylonite_init(void)
> * Note: We depend that the bootloader set
> * the correct value to MSC register for SMC91x.
> */
> - smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq);
> - smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
> + smc91x_resources[1].start = pxa_gpio_to_irq(gpio_eth_irq);
> + smc91x_resources[1].end = pxa_gpio_to_irq(gpio_eth_irq);
> platform_device_register(&smc91x_device);
>
> pxa_set_ac97_info(NULL);
> diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
> index cd6d210..5ab42f8 100644
> --- a/arch/arm/plat-pxa/gpio.c
> +++ b/arch/arm/plat-pxa/gpio.c
> @@ -156,7 +156,7 @@ static inline void update_edge_detect(struct pxa_gpio_chip *c)
> static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
> {
> struct pxa_gpio_chip *c;
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> unsigned long gpdr, mask = GPIO_bit(gpio);
>
> c = gpio_to_pxachip(gpio);
> @@ -218,7 +218,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
> while (n < BITS_PER_LONG) {
> loop = 1;
>
> - generic_handle_irq(gpio_to_irq(gpio_base + n));
> + generic_handle_irq(pxa_gpio_to_irq(gpio_base + n));
> n = find_next_bit(&gedr, BITS_PER_LONG, n + 1);
> }
> }
> @@ -227,7 +227,7 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
>
> static void pxa_ack_muxed_gpio(struct irq_data *d)
> {
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
>
> __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
> @@ -235,7 +235,7 @@ static void pxa_ack_muxed_gpio(struct irq_data *d)
>
> static void pxa_mask_muxed_gpio(struct irq_data *d)
> {
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> uint32_t grer, gfer;
>
> @@ -249,7 +249,7 @@ static void pxa_mask_muxed_gpio(struct irq_data *d)
>
> static void pxa_unmask_muxed_gpio(struct irq_data *d)
> {
> - int gpio = irq_to_gpio(d->irq);
> + int gpio = pxa_irq_to_gpio(d->irq);
> struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
>
> c->irq_mask |= GPIO_bit(gpio);
> @@ -282,7 +282,8 @@ void __init pxa_init_gpio(int mux_irq, int start, int end,
> __raw_writel(~0,c->regbase + GEDR_OFFSET);
> }
>
> - for (irq = gpio_to_irq(start); irq <= gpio_to_irq(end); irq++) {
> + for (irq = pxa_gpio_to_irq(start); irq <= pxa_gpio_to_irq(end);
> + irq++) {
> irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> handle_edge_irq);
> set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> --
> 1.7.2.5
>
^ permalink raw reply
* [PATCH 4/5] ARM: pxa: use chained irq for GPIO0 and GPIO1
From: Grant Likely @ 2011-09-29 22:08 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-4-git-send-email-haojian.zhuang@marvell.com>
On Thu, Sep 29, 2011 at 11:19:05PM +0800, Haojian Zhuang wrote:
> Change interrupt of GPIO0 and GPIO1 to chained interrupt. So irq chip of
> gpio could be removed from irq.c. So pxa_gpio_to_irq() could be
> simplified.
>
> Since IRQ_GPIO() is similar to pxa_gpio_to_irq(), remove IRQ_GPIO().
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
On brief review, looks okay to me.
g.
> ---
> arch/arm/mach-mmp/include/mach/gpio.h | 3 -
> arch/arm/mach-mmp/include/mach/irqs.h | 3 +-
> arch/arm/mach-mmp/ttc_dkb.c | 2 +-
> arch/arm/mach-pxa/am200epd.c | 4 +-
> arch/arm/mach-pxa/am300epd.c | 4 +-
> arch/arm/mach-pxa/balloon3.c | 2 +-
> arch/arm/mach-pxa/cm-x270.c | 2 +-
> arch/arm/mach-pxa/cm-x2xx.c | 4 +-
> arch/arm/mach-pxa/cm-x300.c | 6 +-
> arch/arm/mach-pxa/em-x270.c | 6 +-
> arch/arm/mach-pxa/eseries.c | 4 +-
> arch/arm/mach-pxa/idp.c | 4 +-
> arch/arm/mach-pxa/include/mach/balloon3.h | 6 +-
> arch/arm/mach-pxa/include/mach/corgi.h | 24 ++++----
> arch/arm/mach-pxa/include/mach/gpio.h | 15 -----
> arch/arm/mach-pxa/include/mach/gumstix.h | 20 ++++----
> arch/arm/mach-pxa/include/mach/idp.h | 14 +++---
> arch/arm/mach-pxa/include/mach/irqs.h | 4 +-
> arch/arm/mach-pxa/include/mach/palmld.h | 8 ++--
> arch/arm/mach-pxa/include/mach/palmt5.h | 8 ++--
> arch/arm/mach-pxa/include/mach/palmtc.h | 4 +-
> arch/arm/mach-pxa/include/mach/palmtx.h | 8 ++--
> arch/arm/mach-pxa/include/mach/pcm027.h | 8 ++--
> arch/arm/mach-pxa/include/mach/pcm990_baseboard.h | 14 +++---
> arch/arm/mach-pxa/include/mach/poodle.h | 24 ++++----
> arch/arm/mach-pxa/include/mach/spitz.h | 34 ++++++------
> arch/arm/mach-pxa/include/mach/tosa.h | 46 ++++++++--------
> arch/arm/mach-pxa/include/mach/trizeps4.h | 16 +++---
> arch/arm/mach-pxa/irq.c | 61 ---------------------
> arch/arm/mach-pxa/littleton.c | 4 +-
> arch/arm/mach-pxa/lpd270.c | 4 +-
> arch/arm/mach-pxa/lubbock.c | 4 +-
> arch/arm/mach-pxa/mainstone.c | 4 +-
> arch/arm/mach-pxa/poodle.c | 4 +-
> arch/arm/mach-pxa/sharpsl_pm.c | 24 ++++----
> arch/arm/mach-pxa/stargate2.c | 22 ++++----
> arch/arm/mach-pxa/vpac270.c | 6 +-
> arch/arm/mach-pxa/zylonite_pxa300.c | 4 +-
> arch/arm/plat-pxa/gpio.c | 14 +++++
> 39 files changed, 192 insertions(+), 256 deletions(-)
>
> diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
> index 5ed6977..89d499e 100644
> --- a/arch/arm/mach-mmp/include/mach/gpio.h
> +++ b/arch/arm/mach-mmp/include/mach/gpio.h
> @@ -13,9 +13,6 @@
> #define NR_BUILTIN_GPIO IRQ_GPIO_NUM
>
> #define gpio_to_bank(gpio) ((gpio) >> 5)
> -#define pxa_gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> -#define pxa_irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
> -
>
> #define __gpio_is_inverted(gpio) (0)
> #define __gpio_is_occupied(gpio) (0)
> diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
> index a09d328..2971a00 100644
> --- a/arch/arm/mach-mmp/include/mach/irqs.h
> +++ b/arch/arm/mach-mmp/include/mach/irqs.h
> @@ -220,7 +220,8 @@
>
> #define IRQ_GPIO_START 128
> #define IRQ_GPIO_NUM 192
> -#define IRQ_GPIO(x) (IRQ_GPIO_START + (x))
> +#define pxa_gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> +#define pxa_irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
>
> #define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
>
> diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> index 176515a..a420b07 100644
> --- a/arch/arm/mach-mmp/ttc_dkb.c
> +++ b/arch/arm/mach-mmp/ttc_dkb.c
> @@ -136,7 +136,7 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
> {
> .type = "max7312",
> .addr = 0x23,
> - .irq = IRQ_GPIO(80),
> + .irq = pxa_gpio_to_irq(80),
> .platform_data = &max7312_data,
> },
> };
> diff --git a/arch/arm/mach-pxa/am200epd.c b/arch/arm/mach-pxa/am200epd.c
> index 4cb069f..e69da52 100644
> --- a/arch/arm/mach-pxa/am200epd.c
> +++ b/arch/arm/mach-pxa/am200epd.c
> @@ -138,7 +138,7 @@ static void am200_cleanup(struct metronomefb_par *par)
> {
> int i;
>
> - free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
> + free_irq(pxa_gpio_to_irq(RDY_GPIO_PIN), par);
>
> for (i = 0; i < ARRAY_SIZE(gpios); i++)
> gpio_free(gpios[i]);
> @@ -292,7 +292,7 @@ static int am200_setup_irq(struct fb_info *info)
> {
> int ret;
>
> - ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am200_handle_irq,
> + ret = request_irq(pxa_gpio_to_irq(RDY_GPIO_PIN), am200_handle_irq,
> IRQF_DISABLED|IRQF_TRIGGER_FALLING,
> "AM200", info->par);
> if (ret)
> diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
> index fa8bad2..aba8193 100644
> --- a/arch/arm/mach-pxa/am300epd.c
> +++ b/arch/arm/mach-pxa/am300epd.c
> @@ -176,7 +176,7 @@ static void am300_cleanup(struct broadsheetfb_par *par)
> {
> int i;
>
> - free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
> + free_irq(pxa_gpio_to_irq(RDY_GPIO_PIN), par);
>
> for (i = 0; i < ARRAY_SIZE(gpios); i++)
> gpio_free(gpios[i]);
> @@ -240,7 +240,7 @@ static int am300_setup_irq(struct fb_info *info)
> int ret;
> struct broadsheetfb_par *par = info->par;
>
> - ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq,
> + ret = request_irq(pxa_gpio_to_irq(RDY_GPIO_PIN), am300_handle_irq,
> IRQF_DISABLED|IRQF_TRIGGER_RISING,
> "AM300", par);
> if (ret)
> diff --git a/arch/arm/mach-pxa/balloon3.c b/arch/arm/mach-pxa/balloon3.c
> index 7765d67..f992ace 100644
> --- a/arch/arm/mach-pxa/balloon3.c
> +++ b/arch/arm/mach-pxa/balloon3.c
> @@ -179,7 +179,7 @@ static unsigned long balloon3_ac97_pin_config[] __initdata = {
> };
>
> static struct ucb1400_pdata vpac270_ucb1400_pdata = {
> - .irq = IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ),
> + .irq = pxa_gpio_to_irq(BALLOON3_GPIO_CODEC_IRQ),
> };
>
>
> diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
> index 885e91a..7065df5 100644
> --- a/arch/arm/mach-pxa/cm-x270.c
> +++ b/arch/arm/mach-pxa/cm-x270.c
> @@ -33,7 +33,7 @@
> /* GPIO IRQ usage */
> #define GPIO83_MMC_IRQ (83)
>
> -#define CMX270_MMC_IRQ IRQ_GPIO(GPIO83_MMC_IRQ)
> +#define CMX270_MMC_IRQ pxa_gpio_to_irq(GPIO83_MMC_IRQ)
>
> /* MMC power enable */
> #define GPIO105_MMC_POWER (105)
> diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
> index 349896c..ed2689a 100644
> --- a/arch/arm/mach-pxa/cm-x2xx.c
> +++ b/arch/arm/mach-pxa/cm-x2xx.c
> @@ -58,8 +58,8 @@ extern void cmx270_init(void);
> #define CMX255_GPIO_IT8152_IRQ (0)
> #define CMX270_GPIO_IT8152_IRQ (22)
>
> -#define CMX255_ETHIRQ IRQ_GPIO(GPIO22_ETHIRQ)
> -#define CMX270_ETHIRQ IRQ_GPIO(GPIO10_ETHIRQ)
> +#define CMX255_ETHIRQ pxa_gpio_to_irq(GPIO22_ETHIRQ)
> +#define CMX270_ETHIRQ pxa_gpio_to_irq(GPIO10_ETHIRQ)
>
> #if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
> static struct resource cmx255_dm9000_resource[] = {
> diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
> index 0f00e01..934c29a 100644
> --- a/arch/arm/mach-pxa/cm-x300.c
> +++ b/arch/arm/mach-pxa/cm-x300.c
> @@ -64,7 +64,7 @@
> #define GPIO82_MMC_IRQ (82)
> #define GPIO85_MMC_WP (85)
>
> -#define CM_X300_MMC_IRQ IRQ_GPIO(GPIO82_MMC_IRQ)
> +#define CM_X300_MMC_IRQ pxa_gpio_to_irq(GPIO82_MMC_IRQ)
>
> #define GPIO95_RTC_CS (95)
> #define GPIO96_RTC_WR (96)
> @@ -229,8 +229,8 @@ static struct resource dm9000_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [2] = {
> - .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
> - .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO99)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO99)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO99)),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
> index a802c2c..3c08f2f 100644
> --- a/arch/arm/mach-pxa/em-x270.c
> +++ b/arch/arm/mach-pxa/em-x270.c
> @@ -70,7 +70,7 @@
> /* common GPIOs */
> #define GPIO11_NAND_CS (11)
> #define GPIO41_ETHIRQ (41)
> -#define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ)
> +#define EM_X270_ETHIRQ pxa_gpio_to_irq(GPIO41_ETHIRQ)
> #define GPIO115_WLAN_PWEN (115)
> #define GPIO19_WLAN_STRAP (19)
> #define GPIO9_USB_VBUS_EN (9)
> @@ -805,7 +805,7 @@ static struct spi_board_info em_x270_spi_devices[] __initdata = {
> .modalias = "libertas_spi",
> .max_speed_hz = 13000000,
> .bus_num = 2,
> - .irq = IRQ_GPIO(116),
> + .irq = pxa_gpio_to_irq(116),
> .chip_select = 0,
> .controller_data = &em_x270_libertas_chip,
> .platform_data = &em_x270_libertas_pdata,
> @@ -1203,7 +1203,7 @@ static struct da903x_platform_data em_x270_da9030_info = {
>
> static struct i2c_board_info em_x270_i2c_pmic_info = {
> I2C_BOARD_INFO("da9030", 0x49),
> - .irq = IRQ_GPIO(0),
> + .irq = pxa_gpio_to_irq(0),
> .platform_data = &em_x270_da9030_info,
> };
>
> diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
> index e823c54..fc26443 100644
> --- a/arch/arm/mach-pxa/eseries.c
> +++ b/arch/arm/mach-pxa/eseries.c
> @@ -120,8 +120,8 @@ struct resource eseries_tmio_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
> - .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ),
> + .start = pxa_gpio_to_irq(GPIO_ESERIES_TMIO_IRQ),
> + .end = pxa_gpio_to_irq(GPIO_ESERIES_TMIO_IRQ),
> .flags = IORESOURCE_IRQ,
> },
> };
> diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
> index ddf20e5..f2e210f 100644
> --- a/arch/arm/mach-pxa/idp.c
> +++ b/arch/arm/mach-pxa/idp.c
> @@ -75,8 +75,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = IRQ_GPIO(4),
> - .end = IRQ_GPIO(4),
> + .start = pxa_gpio_to_irq(4),
> + .end = pxa_gpio_to_irq(4),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-pxa/include/mach/balloon3.h b/arch/arm/mach-pxa/include/mach/balloon3.h
> index 7074e76..6844342 100644
> --- a/arch/arm/mach-pxa/include/mach/balloon3.h
> +++ b/arch/arm/mach-pxa/include/mach/balloon3.h
> @@ -172,9 +172,9 @@ enum balloon3_features {
> /* Balloon3 Interrupts */
> #define BALLOON3_IRQ(x) (IRQ_BOARD_START + (x))
>
> -#define BALLOON3_AUX_NIRQ IRQ_GPIO(BALLOON3_GPIO_AUX_NIRQ)
> -#define BALLOON3_CODEC_IRQ IRQ_GPIO(BALLOON3_GPIO_CODEC_IRQ)
> -#define BALLOON3_S0_CD_IRQ IRQ_GPIO(BALLOON3_GPIO_S0_CD)
> +#define BALLOON3_AUX_NIRQ pxa_gpio_to_irq(BALLOON3_GPIO_AUX_NIRQ)
> +#define BALLOON3_CODEC_IRQ pxa_gpio_to_irq(BALLOON3_GPIO_CODEC_IRQ)
> +#define BALLOON3_S0_CD_IRQ pxa_gpio_to_irq(BALLOON3_GPIO_S0_CD)
>
> #define BALLOON3_NR_IRQS (IRQ_BOARD_START + 16)
>
> diff --git a/arch/arm/mach-pxa/include/mach/corgi.h b/arch/arm/mach-pxa/include/mach/corgi.h
> index 5dfd119..baf4aff 100644
> --- a/arch/arm/mach-pxa/include/mach/corgi.h
> +++ b/arch/arm/mach-pxa/include/mach/corgi.h
> @@ -66,18 +66,18 @@
> /*
> * Corgi Interrupts
> */
> -#define CORGI_IRQ_GPIO_KEY_INT IRQ_GPIO(0)
> -#define CORGI_IRQ_GPIO_AC_IN IRQ_GPIO(1)
> -#define CORGI_IRQ_GPIO_WAKEUP IRQ_GPIO(3)
> -#define CORGI_IRQ_GPIO_AK_INT IRQ_GPIO(4)
> -#define CORGI_IRQ_GPIO_TP_INT IRQ_GPIO(5)
> -#define CORGI_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9)
> -#define CORGI_IRQ_GPIO_nSD_INT IRQ_GPIO(10)
> -#define CORGI_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(11)
> -#define CORGI_IRQ_GPIO_CF_CD IRQ_GPIO(14)
> -#define CORGI_IRQ_GPIO_CHRG_FULL IRQ_GPIO(16) /* Battery fully charged */
> -#define CORGI_IRQ_GPIO_CF_IRQ IRQ_GPIO(17)
> -#define CORGI_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(58+(a)) /* Keyboard Sense lines */
> +#define CORGI_IRQ_GPIO_KEY_INT pxa_gpio_to_irq(0)
> +#define CORGI_IRQ_GPIO_AC_IN pxa_gpio_to_irq(1)
> +#define CORGI_IRQ_GPIO_WAKEUP pxa_gpio_to_irq(3)
> +#define CORGI_IRQ_GPIO_AK_INT pxa_gpio_to_irq(4)
> +#define CORGI_IRQ_GPIO_TP_INT pxa_gpio_to_irq(5)
> +#define CORGI_IRQ_GPIO_nSD_DETECT pxa_gpio_to_irq(9)
> +#define CORGI_IRQ_GPIO_nSD_INT pxa_gpio_to_irq(10)
> +#define CORGI_IRQ_GPIO_MAIN_BAT_LOW pxa_gpio_to_irq(11)
> +#define CORGI_IRQ_GPIO_CF_CD pxa_gpio_to_irq(14)
> +#define CORGI_IRQ_GPIO_CHRG_FULL pxa_gpio_to_irq(16) /* Battery fully charged */
> +#define CORGI_IRQ_GPIO_CF_IRQ pxa_gpio_to_irq(17)
> +#define CORGI_IRQ_GPIO_KEY_SENSE(a) pxa_gpio_to_irq(58+(a)) /* Keyboard Sense lines */
>
>
> /*
> diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
> index 45ac8e6..d58efb5 100644
> --- a/arch/arm/mach-pxa/include/mach/gpio.h
> +++ b/arch/arm/mach-pxa/include/mach/gpio.h
> @@ -58,21 +58,6 @@
> #define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
>
> #define gpio_to_bank(gpio) ((gpio) >> 5)
> -#define pxa_gpio_to_irq(gpio) IRQ_GPIO(gpio)
> -
> -static inline int pxa_irq_to_gpio(unsigned int irq)
> -{
> - int gpio;
> -
> - if (irq == IRQ_GPIO0 || irq == IRQ_GPIO1)
> - return irq - IRQ_GPIO0;
> -
> - gpio = irq - PXA_GPIO_IRQ_BASE;
> - if (gpio >= 2 && gpio < NR_BUILTIN_GPIO)
> - return gpio;
> -
> - return -1;
> -}
>
> #ifdef CONFIG_CPU_PXA26x
> /* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
> diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
> index 9b89868..c52d751 100644
> --- a/arch/arm/mach-pxa/include/mach/gumstix.h
> +++ b/arch/arm/mach-pxa/include/mach/gumstix.h
> @@ -24,7 +24,7 @@ has detected a cable insertion; driven low otherwise. */
> #define GPIO_GUMSTIX_USB_GPIOx 41
>
> /* usb state change */
> -#define GUMSTIX_USB_INTR_IRQ IRQ_GPIO(GPIO_GUMSTIX_USB_GPIOn)
> +#define GUMSTIX_USB_INTR_IRQ pxa_gpio_to_irq(GPIO_GUMSTIX_USB_GPIOn)
>
> #define GPIO_GUMSTIX_USB_GPIOn_MD (GPIO_GUMSTIX_USB_GPIOn | GPIO_IN)
> #define GPIO_GUMSTIX_USB_GPIOx_CON_MD (GPIO_GUMSTIX_USB_GPIOx | GPIO_OUT)
> @@ -35,7 +35,7 @@ has detected a cable insertion; driven low otherwise. */
> */
> #define GUMSTIX_GPIO_nSD_WP 22 /* SD Write Protect */
> #define GUMSTIX_GPIO_nSD_DETECT 11 /* MMC/SD Card Detect */
> -#define GUMSTIX_IRQ_GPIO_nSD_DETECT IRQ_GPIO(GUMSTIX_GPIO_nSD_DETECT)
> +#define GUMSTIX_IRQ_GPIO_nSD_DETECT pxa_gpio_to_irq(GUMSTIX_GPIO_nSD_DETECT)
>
> /*
> * SMC Ethernet definitions
> @@ -49,10 +49,10 @@ has detected a cable insertion; driven low otherwise. */
>
> #define GPIO_GUMSTIX_ETH0 36
> #define GPIO_GUMSTIX_ETH0_MD (GPIO_GUMSTIX_ETH0 | GPIO_IN)
> -#define GUMSTIX_ETH0_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH0)
> +#define GUMSTIX_ETH0_IRQ pxa_gpio_to_irq(GPIO_GUMSTIX_ETH0)
> #define GPIO_GUMSTIX_ETH1 27
> #define GPIO_GUMSTIX_ETH1_MD (GPIO_GUMSTIX_ETH1 | GPIO_IN)
> -#define GUMSTIX_ETH1_IRQ IRQ_GPIO(GPIO_GUMSTIX_ETH1)
> +#define GUMSTIX_ETH1_IRQ pxa_gpio_to_irq(GPIO_GUMSTIX_ETH1)
>
>
> /* CF reset line */
> @@ -63,18 +63,18 @@ has detected a cable insertion; driven low otherwise. */
> #define GPIO4_nSTSCHG GPIO4_nBVD1
> #define GPIO11_nCD 11
> #define GPIO26_PRDY_nBSY 26
> -#define GUMSTIX_S0_nSTSCHG_IRQ IRQ_GPIO(GPIO4_nSTSCHG)
> -#define GUMSTIX_S0_nCD_IRQ IRQ_GPIO(GPIO11_nCD)
> -#define GUMSTIX_S0_PRDY_nBSY_IRQ IRQ_GPIO(GPIO26_PRDY_nBSY)
> +#define GUMSTIX_S0_nSTSCHG_IRQ pxa_gpio_to_irq(GPIO4_nSTSCHG)
> +#define GUMSTIX_S0_nCD_IRQ pxa_gpio_to_irq(GPIO11_nCD)
> +#define GUMSTIX_S0_PRDY_nBSY_IRQ pxa_gpio_to_irq(GPIO26_PRDY_nBSY)
>
> /* CF slot 1 */
> #define GPIO18_nBVD1 18
> #define GPIO18_nSTSCHG GPIO18_nBVD1
> #define GPIO36_nCD 36
> #define GPIO27_PRDY_nBSY 27
> -#define GUMSTIX_S1_nSTSCHG_IRQ IRQ_GPIO(GPIO18_nSTSCHG)
> -#define GUMSTIX_S1_nCD_IRQ IRQ_GPIO(GPIO36_nCD)
> -#define GUMSTIX_S1_PRDY_nBSY_IRQ IRQ_GPIO(GPIO27_PRDY_nBSY)
> +#define GUMSTIX_S1_nSTSCHG_IRQ pxa_gpio_to_irq(GPIO18_nSTSCHG)
> +#define GUMSTIX_S1_nCD_IRQ pxa_gpio_to_irq(GPIO36_nCD)
> +#define GUMSTIX_S1_PRDY_nBSY_IRQ pxa_gpio_to_irq(GPIO27_PRDY_nBSY)
>
> /* CF GPIO line modes */
> #define GPIO4_nSTSCHG_MD (GPIO4_nSTSCHG | GPIO_IN)
> diff --git a/arch/arm/mach-pxa/include/mach/idp.h b/arch/arm/mach-pxa/include/mach/idp.h
> index 5eff96f..ce3655c 100644
> --- a/arch/arm/mach-pxa/include/mach/idp.h
> +++ b/arch/arm/mach-pxa/include/mach/idp.h
> @@ -135,24 +135,24 @@
>
> /* A listing of interrupts used by external hardware devices */
>
> -#define TOUCH_PANEL_IRQ IRQ_GPIO(5)
> -#define IDE_IRQ IRQ_GPIO(21)
> +#define TOUCH_PANEL_IRQ pxa_gpio_to_irq(5)
> +#define IDE_IRQ pxa_gpio_to_irq(21)
>
> #define TOUCH_PANEL_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
>
> -#define ETHERNET_IRQ IRQ_GPIO(4)
> +#define ETHERNET_IRQ pxa_gpio_to_irq(4)
> #define ETHERNET_IRQ_EDGE IRQ_TYPE_EDGE_RISING
>
> #define IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
>
> -#define PCMCIA_S0_CD_VALID IRQ_GPIO(7)
> +#define PCMCIA_S0_CD_VALID pxa_gpio_to_irq(7)
> #define PCMCIA_S0_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
>
> -#define PCMCIA_S1_CD_VALID IRQ_GPIO(8)
> +#define PCMCIA_S1_CD_VALID pxa_gpio_to_irq(8)
> #define PCMCIA_S1_CD_VALID_EDGE IRQ_TYPE_EDGE_BOTH
>
> -#define PCMCIA_S0_RDYINT IRQ_GPIO(19)
> -#define PCMCIA_S1_RDYINT IRQ_GPIO(22)
> +#define PCMCIA_S0_RDYINT pxa_gpio_to_irq(19)
> +#define PCMCIA_S1_RDYINT pxa_gpio_to_irq(22)
>
>
> /*
> diff --git a/arch/arm/mach-pxa/include/mach/irqs.h b/arch/arm/mach-pxa/include/mach/irqs.h
> index 7cc5a78..9e0f1b7d 100644
> --- a/arch/arm/mach-pxa/include/mach/irqs.h
> +++ b/arch/arm/mach-pxa/include/mach/irqs.h
> @@ -90,8 +90,8 @@
> #define PXA_GPIO_IRQ_BASE PXA_IRQ(96)
> #define PXA_GPIO_IRQ_NUM (192)
>
> -#define GPIO_2_x_TO_IRQ(x) (PXA_GPIO_IRQ_BASE + (x))
> -#define IRQ_GPIO(x) (((x) < 2) ? (IRQ_GPIO0 + (x)) : GPIO_2_x_TO_IRQ(x))
> +#define pxa_gpio_to_irq(gpio) (PXA_GPIO_IRQ_BASE + (gpio))
> +#define pxa_irq_to_gpio(irq) ((irq) - PXA_GPIO_IRQ_BASE)
>
> /*
> * The following interrupts are for board specific purposes. Since
> diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h
> index ae536e8..8ed3103 100644
> --- a/arch/arm/mach-pxa/include/mach/palmld.h
> +++ b/arch/arm/mach-pxa/include/mach/palmld.h
> @@ -68,10 +68,10 @@
> /* 20, 53 and 86 are usb related too */
>
> /* INTERRUPTS */
> -#define IRQ_GPIO_PALMLD_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMLD_GPIO_RESET)
> -#define IRQ_GPIO_PALMLD_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMLD_SD_DETECT_N)
> -#define IRQ_GPIO_PALMLD_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMLD_WM9712_IRQ)
> -#define IRQ_GPIO_PALMLD_IDE_IRQ IRQ_GPIO(GPIO_NR_PALMLD_IDE_IRQ)
> +#define IRQ_GPIO_PALMLD_GPIO_RESET pxa_gpio_to_irq(GPIO_NR_PALMLD_GPIO_RESET)
> +#define IRQ_GPIO_PALMLD_SD_DETECT_N pxa_gpio_to_irq(GPIO_NR_PALMLD_SD_DETECT_N)
> +#define IRQ_GPIO_PALMLD_WM9712_IRQ pxa_gpio_to_irq(GPIO_NR_PALMLD_WM9712_IRQ)
> +#define IRQ_GPIO_PALMLD_IDE_IRQ pxa_gpio_to_irq(GPIO_NR_PALMLD_IDE_IRQ)
>
>
> /** HERE ARE INIT VALUES **/
> diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h
> index 6baf746..649776c 100644
> --- a/arch/arm/mach-pxa/include/mach/palmt5.h
> +++ b/arch/arm/mach-pxa/include/mach/palmt5.h
> @@ -48,10 +48,10 @@
> #define GPIO_NR_PALMT5_BT_RESET 83
>
> /* INTERRUPTS */
> -#define IRQ_GPIO_PALMT5_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMT5_SD_DETECT_N)
> -#define IRQ_GPIO_PALMT5_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMT5_WM9712_IRQ)
> -#define IRQ_GPIO_PALMT5_USB_DETECT IRQ_GPIO(GPIO_NR_PALMT5_USB_DETECT)
> -#define IRQ_GPIO_PALMT5_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMT5_GPIO_RESET)
> +#define IRQ_GPIO_PALMT5_SD_DETECT_N pxa_gpio_to_irq(GPIO_NR_PALMT5_SD_DETECT_N)
> +#define IRQ_GPIO_PALMT5_WM9712_IRQ pxa_gpio_to_irq(GPIO_NR_PALMT5_WM9712_IRQ)
> +#define IRQ_GPIO_PALMT5_USB_DETECT pxa_gpio_to_irq(GPIO_NR_PALMT5_USB_DETECT)
> +#define IRQ_GPIO_PALMT5_GPIO_RESET pxa_gpio_to_irq(GPIO_NR_PALMT5_GPIO_RESET)
>
> /** HERE ARE INIT VALUES **/
>
> diff --git a/arch/arm/mach-pxa/include/mach/palmtc.h b/arch/arm/mach-pxa/include/mach/palmtc.h
> index 3f9dd3f..6db872b 100644
> --- a/arch/arm/mach-pxa/include/mach/palmtc.h
> +++ b/arch/arm/mach-pxa/include/mach/palmtc.h
> @@ -52,8 +52,8 @@
> #define GPIO_NR_PALMTC_IR_DISABLE 45
>
> /* IRQs */
> -#define IRQ_GPIO_PALMTC_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTC_SD_DETECT_N)
> -#define IRQ_GPIO_PALMTC_WLAN_READY IRQ_GPIO(GPIO_NR_PALMTC_WLAN_READY)
> +#define IRQ_GPIO_PALMTC_SD_DETECT_N pxa_gpio_to_irq(GPIO_NR_PALMTC_SD_DETECT_N)
> +#define IRQ_GPIO_PALMTC_WLAN_READY pxa_gpio_to_irq(GPIO_NR_PALMTC_WLAN_READY)
>
> /* UCB1400 GPIOs */
> #define GPIO_NR_PALMTC_POWER_DETECT (0x80 | 0x00)
> diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h
> index 10abc4f..e8643ec 100644
> --- a/arch/arm/mach-pxa/include/mach/palmtx.h
> +++ b/arch/arm/mach-pxa/include/mach/palmtx.h
> @@ -62,10 +62,10 @@
> #define GPIO_NR_PALMTX_NAND_BUFFER_DIR 79
>
> /* INTERRUPTS */
> -#define IRQ_GPIO_PALMTX_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTX_SD_DETECT_N)
> -#define IRQ_GPIO_PALMTX_WM9712_IRQ IRQ_GPIO(GPIO_NR_PALMTX_WM9712_IRQ)
> -#define IRQ_GPIO_PALMTX_USB_DETECT IRQ_GPIO(GPIO_NR_PALMTX_USB_DETECT)
> -#define IRQ_GPIO_PALMTX_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMTX_GPIO_RESET)
> +#define IRQ_GPIO_PALMTX_SD_DETECT_N pxa_gpio_to_irq(GPIO_NR_PALMTX_SD_DETECT_N)
> +#define IRQ_GPIO_PALMTX_WM9712_IRQ pxa_gpio_to_irq(GPIO_NR_PALMTX_WM9712_IRQ)
> +#define IRQ_GPIO_PALMTX_USB_DETECT pxa_gpio_to_irq(GPIO_NR_PALMTX_USB_DETECT)
> +#define IRQ_GPIO_PALMTX_GPIO_RESET pxa_gpio_to_irq(GPIO_NR_PALMTX_GPIO_RESET)
>
> /** HERE ARE INIT VALUES **/
>
> diff --git a/arch/arm/mach-pxa/include/mach/pcm027.h b/arch/arm/mach-pxa/include/mach/pcm027.h
> index 4bac588..b9d8903 100644
> --- a/arch/arm/mach-pxa/include/mach/pcm027.h
> +++ b/arch/arm/mach-pxa/include/mach/pcm027.h
> @@ -34,7 +34,7 @@
>
> /* I2C RTC */
> #define PCM027_RTC_IRQ_GPIO 0
> -#define PCM027_RTC_IRQ IRQ_GPIO(PCM027_RTC_IRQ_GPIO)
> +#define PCM027_RTC_IRQ pxa_gpio_to_irq(PCM027_RTC_IRQ_GPIO)
> #define PCM027_RTC_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
> #define ADR_PCM027_RTC 0x51 /* I2C address */
>
> @@ -43,21 +43,21 @@
>
> /* Ethernet chip (SMSC91C111) */
> #define PCM027_ETH_IRQ_GPIO 52
> -#define PCM027_ETH_IRQ IRQ_GPIO(PCM027_ETH_IRQ_GPIO)
> +#define PCM027_ETH_IRQ pxa_gpio_to_irq(PCM027_ETH_IRQ_GPIO)
> #define PCM027_ETH_IRQ_EDGE IRQ_TYPE_EDGE_RISING
> #define PCM027_ETH_PHYS PXA_CS5_PHYS
> #define PCM027_ETH_SIZE (1*1024*1024)
>
> /* CAN controller SJA1000 (unsupported yet) */
> #define PCM027_CAN_IRQ_GPIO 114
> -#define PCM027_CAN_IRQ IRQ_GPIO(PCM027_CAN_IRQ_GPIO)
> +#define PCM027_CAN_IRQ pxa_gpio_to_irq(PCM027_CAN_IRQ_GPIO)
> #define PCM027_CAN_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
> #define PCM027_CAN_PHYS 0x22000000
> #define PCM027_CAN_SIZE 0x100
>
> /* SPI GPIO expander (unsupported yet) */
> #define PCM027_EGPIO_IRQ_GPIO 27
> -#define PCM027_EGPIO_IRQ IRQ_GPIO(PCM027_EGPIO_IRQ_GPIO)
> +#define PCM027_EGPIO_IRQ pxa_gpio_to_irq(PCM027_EGPIO_IRQ_GPIO)
> #define PCM027_EGPIO_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
> #define PCM027_EGPIO_CS 24
> /*
> diff --git a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
> index 8a4383b..3b3c94e 100644
> --- a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
> +++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h
> @@ -28,14 +28,14 @@
>
> /* CPLD's interrupt controller is connected to PCM-027 GPIO 9 */
> #define PCM990_CTRL_INT_IRQ_GPIO 9
> -#define PCM990_CTRL_INT_IRQ IRQ_GPIO(PCM990_CTRL_INT_IRQ_GPIO)
> +#define PCM990_CTRL_INT_IRQ pxa_gpio_to_irq(PCM990_CTRL_INT_IRQ_GPIO)
> #define PCM990_CTRL_INT_IRQ_EDGE IRQ_TYPE_EDGE_RISING
> #define PCM990_CTRL_PHYS PXA_CS1_PHYS /* 16-Bit */
> #define PCM990_CTRL_BASE 0xea000000
> #define PCM990_CTRL_SIZE (1*1024*1024)
>
> #define PCM990_CTRL_PWR_IRQ_GPIO 14
> -#define PCM990_CTRL_PWR_IRQ IRQ_GPIO(PCM990_CTRL_PWR_IRQ_GPIO)
> +#define PCM990_CTRL_PWR_IRQ pxa_gpio_to_irq(PCM990_CTRL_PWR_IRQ_GPIO)
> #define PCM990_CTRL_PWR_IRQ_EDGE IRQ_TYPE_EDGE_RISING
>
> /* visible CPLD (U7) registers */
> @@ -132,7 +132,7 @@
> * IDE
> */
> #define PCM990_IDE_IRQ_GPIO 13
> -#define PCM990_IDE_IRQ IRQ_GPIO(PCM990_IDE_IRQ_GPIO)
> +#define PCM990_IDE_IRQ pxa_gpio_to_irq(PCM990_IDE_IRQ_GPIO)
> #define PCM990_IDE_IRQ_EDGE IRQ_TYPE_EDGE_RISING
> #define PCM990_IDE_PLD_PHYS 0x20000000 /* 16 bit wide */
> #define PCM990_IDE_PLD_BASE 0xee000000
> @@ -188,11 +188,11 @@
> * Compact Flash
> */
> #define PCM990_CF_IRQ_GPIO 11
> -#define PCM990_CF_IRQ IRQ_GPIO(PCM990_CF_IRQ_GPIO)
> +#define PCM990_CF_IRQ pxa_gpio_to_irq(PCM990_CF_IRQ_GPIO)
> #define PCM990_CF_IRQ_EDGE IRQ_TYPE_EDGE_RISING
>
> #define PCM990_CF_CD_GPIO 12
> -#define PCM990_CF_CD IRQ_GPIO(PCM990_CF_CD_GPIO)
> +#define PCM990_CF_CD pxa_gpio_to_irq(PCM990_CF_CD_GPIO)
> #define PCM990_CF_CD_EDGE IRQ_TYPE_EDGE_RISING
>
> #define PCM990_CF_PLD_PHYS 0x30000000 /* 16 bit wide */
> @@ -258,14 +258,14 @@
> * Wolfson AC97 Touch
> */
> #define PCM990_AC97_IRQ_GPIO 10
> -#define PCM990_AC97_IRQ IRQ_GPIO(PCM990_AC97_IRQ_GPIO)
> +#define PCM990_AC97_IRQ pxa_gpio_to_irq(PCM990_AC97_IRQ_GPIO)
> #define PCM990_AC97_IRQ_EDGE IRQ_TYPE_EDGE_RISING
>
> /*
> * MMC phyCORE
> */
> #define PCM990_MMC0_IRQ_GPIO 9
> -#define PCM990_MMC0_IRQ IRQ_GPIO(PCM990_MMC0_IRQ_GPIO)
> +#define PCM990_MMC0_IRQ pxa_gpio_to_irq(PCM990_MMC0_IRQ_GPIO)
> #define PCM990_MMC0_IRQ_EDGE IRQ_TYPE_EDGE_FALLING
>
> /*
> diff --git a/arch/arm/mach-pxa/include/mach/poodle.h b/arch/arm/mach-pxa/include/mach/poodle.h
> index 83d1cfd..58717fd 100644
> --- a/arch/arm/mach-pxa/include/mach/poodle.h
> +++ b/arch/arm/mach-pxa/include/mach/poodle.h
> @@ -47,18 +47,18 @@
> #define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */
>
> /* PXA GPIOs */
> -#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0)
> -#define POODLE_IRQ_GPIO_AC_IN IRQ_GPIO(1)
> -#define POODLE_IRQ_GPIO_HP_IN IRQ_GPIO(4)
> -#define POODLE_IRQ_GPIO_CO IRQ_GPIO(16)
> -#define POODLE_IRQ_GPIO_TP_INT IRQ_GPIO(5)
> -#define POODLE_IRQ_GPIO_WAKEUP IRQ_GPIO(11)
> -#define POODLE_IRQ_GPIO_GA_INT IRQ_GPIO(10)
> -#define POODLE_IRQ_GPIO_CF_IRQ IRQ_GPIO(17)
> -#define POODLE_IRQ_GPIO_CF_CD IRQ_GPIO(14)
> -#define POODLE_IRQ_GPIO_nSD_INT IRQ_GPIO(8)
> -#define POODLE_IRQ_GPIO_nSD_DETECT IRQ_GPIO(9)
> -#define POODLE_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(13)
> +#define POODLE_IRQ_GPIO_ON_KEY pxa_gpio_to_irq(0)
> +#define POODLE_IRQ_GPIO_AC_IN pxa_gpio_to_irq(1)
> +#define POODLE_IRQ_GPIO_HP_IN pxa_gpio_to_irq(4)
> +#define POODLE_IRQ_GPIO_CO pxa_gpio_to_irq(16)
> +#define POODLE_IRQ_GPIO_TP_INT pxa_gpio_to_irq(5)
> +#define POODLE_IRQ_GPIO_WAKEUP pxa_gpio_to_irq(11)
> +#define POODLE_IRQ_GPIO_GA_INT pxa_gpio_to_irq(10)
> +#define POODLE_IRQ_GPIO_CF_IRQ pxa_gpio_to_irq(17)
> +#define POODLE_IRQ_GPIO_CF_CD pxa_gpio_to_irq(14)
> +#define POODLE_IRQ_GPIO_nSD_INT pxa_gpio_to_irq(8)
> +#define POODLE_IRQ_GPIO_nSD_DETECT pxa_gpio_to_irq(9)
> +#define POODLE_IRQ_GPIO_MAIN_BAT_LOW pxa_gpio_to_irq(13)
>
> /* SCOOP GPIOs */
> #define POODLE_SCOOP_CHARGE_ON SCOOP_GPCR_PA11
> diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
> index 685749a..9023719 100644
> --- a/arch/arm/mach-pxa/include/mach/spitz.h
> +++ b/arch/arm/mach-pxa/include/mach/spitz.h
> @@ -164,23 +164,23 @@
>
> /* Spitz IRQ Definitions */
>
> -#define SPITZ_IRQ_GPIO_KEY_INT IRQ_GPIO(SPITZ_GPIO_KEY_INT)
> -#define SPITZ_IRQ_GPIO_AC_IN IRQ_GPIO(SPITZ_GPIO_AC_IN)
> -#define SPITZ_IRQ_GPIO_AK_INT IRQ_GPIO(SPITZ_GPIO_AK_INT)
> -#define SPITZ_IRQ_GPIO_HP_IN IRQ_GPIO(SPITZ_GPIO_HP_IN)
> -#define SPITZ_IRQ_GPIO_TP_INT IRQ_GPIO(SPITZ_GPIO_TP_INT)
> -#define SPITZ_IRQ_GPIO_SYNC IRQ_GPIO(SPITZ_GPIO_SYNC)
> -#define SPITZ_IRQ_GPIO_ON_KEY IRQ_GPIO(SPITZ_GPIO_ON_KEY)
> -#define SPITZ_IRQ_GPIO_SWA IRQ_GPIO(SPITZ_GPIO_SWA)
> -#define SPITZ_IRQ_GPIO_SWB IRQ_GPIO(SPITZ_GPIO_SWB)
> -#define SPITZ_IRQ_GPIO_BAT_COVER IRQ_GPIO(SPITZ_GPIO_BAT_COVER)
> -#define SPITZ_IRQ_GPIO_FATAL_BAT IRQ_GPIO(SPITZ_GPIO_FATAL_BAT)
> -#define SPITZ_IRQ_GPIO_CO IRQ_GPIO(SPITZ_GPIO_CO)
> -#define SPITZ_IRQ_GPIO_CF_IRQ IRQ_GPIO(SPITZ_GPIO_CF_IRQ)
> -#define SPITZ_IRQ_GPIO_CF_CD IRQ_GPIO(SPITZ_GPIO_CF_CD)
> -#define SPITZ_IRQ_GPIO_CF2_IRQ IRQ_GPIO(SPITZ_GPIO_CF2_IRQ)
> -#define SPITZ_IRQ_GPIO_nSD_INT IRQ_GPIO(SPITZ_GPIO_nSD_INT)
> -#define SPITZ_IRQ_GPIO_nSD_DETECT IRQ_GPIO(SPITZ_GPIO_nSD_DETECT)
> +#define SPITZ_IRQ_GPIO_KEY_INT pxa_gpio_to_irq(SPITZ_GPIO_KEY_INT)
> +#define SPITZ_IRQ_GPIO_AC_IN pxa_gpio_to_irq(SPITZ_GPIO_AC_IN)
> +#define SPITZ_IRQ_GPIO_AK_INT pxa_gpio_to_irq(SPITZ_GPIO_AK_INT)
> +#define SPITZ_IRQ_GPIO_HP_IN pxa_gpio_to_irq(SPITZ_GPIO_HP_IN)
> +#define SPITZ_IRQ_GPIO_TP_INT pxa_gpio_to_irq(SPITZ_GPIO_TP_INT)
> +#define SPITZ_IRQ_GPIO_SYNC pxa_gpio_to_irq(SPITZ_GPIO_SYNC)
> +#define SPITZ_IRQ_GPIO_ON_KEY pxa_gpio_to_irq(SPITZ_GPIO_ON_KEY)
> +#define SPITZ_IRQ_GPIO_SWA pxa_gpio_to_irq(SPITZ_GPIO_SWA)
> +#define SPITZ_IRQ_GPIO_SWB pxa_gpio_to_irq(SPITZ_GPIO_SWB)
> +#define SPITZ_IRQ_GPIO_BAT_COVER pxa_gpio_to_irq(SPITZ_GPIO_BAT_COVER)
> +#define SPITZ_IRQ_GPIO_FATAL_BAT pxa_gpio_to_irq(SPITZ_GPIO_FATAL_BAT)
> +#define SPITZ_IRQ_GPIO_CO pxa_gpio_to_irq(SPITZ_GPIO_CO)
> +#define SPITZ_IRQ_GPIO_CF_IRQ pxa_gpio_to_irq(SPITZ_GPIO_CF_IRQ)
> +#define SPITZ_IRQ_GPIO_CF_CD pxa_gpio_to_irq(SPITZ_GPIO_CF_CD)
> +#define SPITZ_IRQ_GPIO_CF2_IRQ pxa_gpio_to_irq(SPITZ_GPIO_CF2_IRQ)
> +#define SPITZ_IRQ_GPIO_nSD_INT pxa_gpio_to_irq(SPITZ_GPIO_nSD_INT)
> +#define SPITZ_IRQ_GPIO_nSD_DETECT pxa_gpio_to_irq(SPITZ_GPIO_nSD_DETECT)
>
> /*
> * Shared data structures
> diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h
> index 1272c4b..046460e 100644
> --- a/arch/arm/mach-pxa/include/mach/tosa.h
> +++ b/arch/arm/mach-pxa/include/mach/tosa.h
> @@ -141,30 +141,30 @@
> /*
> * Interrupts
> */
> -#define TOSA_IRQ_GPIO_WAKEUP IRQ_GPIO(TOSA_GPIO_WAKEUP)
> -#define TOSA_IRQ_GPIO_AC_IN IRQ_GPIO(TOSA_GPIO_AC_IN)
> -#define TOSA_IRQ_GPIO_RECORD_BTN IRQ_GPIO(TOSA_GPIO_RECORD_BTN)
> -#define TOSA_IRQ_GPIO_SYNC IRQ_GPIO(TOSA_GPIO_SYNC)
> -#define TOSA_IRQ_GPIO_USB_IN IRQ_GPIO(TOSA_GPIO_USB_IN)
> -#define TOSA_IRQ_GPIO_JACKET_DETECT IRQ_GPIO(TOSA_GPIO_JACKET_DETECT)
> -#define TOSA_IRQ_GPIO_nSD_INT IRQ_GPIO(TOSA_GPIO_nSD_INT)
> -#define TOSA_IRQ_GPIO_nSD_DETECT IRQ_GPIO(TOSA_GPIO_nSD_DETECT)
> -#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG)
> -#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD)
> -#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG)
> -#define TOSA_IRQ_GPIO_TC6393XB_INT IRQ_GPIO(TOSA_GPIO_TC6393XB_INT)
> -#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW)
> -#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN)
> -#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ)
> -#define TOSA_IRQ_GPIO_ON_KEY IRQ_GPIO(TOSA_GPIO_ON_KEY)
> -#define TOSA_IRQ_GPIO_VGA_LINE IRQ_GPIO(TOSA_GPIO_VGA_LINE)
> -#define TOSA_IRQ_GPIO_TP_INT IRQ_GPIO(TOSA_GPIO_TP_INT)
> -#define TOSA_IRQ_GPIO_JC_CF_IRQ IRQ_GPIO(TOSA_GPIO_JC_CF_IRQ)
> -#define TOSA_IRQ_GPIO_BAT_LOCKED IRQ_GPIO(TOSA_GPIO_BAT_LOCKED)
> -#define TOSA_IRQ_GPIO_BAT1_LOW IRQ_GPIO(TOSA_GPIO_BAT1_LOW)
> -#define TOSA_IRQ_GPIO_KEY_SENSE(a) IRQ_GPIO(69+(a))
> -
> -#define TOSA_IRQ_GPIO_MAIN_BAT_LOW IRQ_GPIO(TOSA_GPIO_MAIN_BAT_LOW)
> +#define TOSA_IRQ_GPIO_WAKEUP pxa_gpio_to_irq(TOSA_GPIO_WAKEUP)
> +#define TOSA_IRQ_GPIO_AC_IN pxa_gpio_to_irq(TOSA_GPIO_AC_IN)
> +#define TOSA_IRQ_GPIO_RECORD_BTN pxa_gpio_to_irq(TOSA_GPIO_RECORD_BTN)
> +#define TOSA_IRQ_GPIO_SYNC pxa_gpio_to_irq(TOSA_GPIO_SYNC)
> +#define TOSA_IRQ_GPIO_USB_IN pxa_gpio_to_irq(TOSA_GPIO_USB_IN)
> +#define TOSA_IRQ_GPIO_JACKET_DETECT pxa_gpio_to_irq(TOSA_GPIO_JACKET_DETECT)
> +#define TOSA_IRQ_GPIO_nSD_INT pxa_gpio_to_irq(TOSA_GPIO_nSD_INT)
> +#define TOSA_IRQ_GPIO_nSD_DETECT pxa_gpio_to_irq(TOSA_GPIO_nSD_DETECT)
> +#define TOSA_IRQ_GPIO_BAT1_CRG pxa_gpio_to_irq(TOSA_GPIO_BAT1_CRG)
> +#define TOSA_IRQ_GPIO_CF_CD pxa_gpio_to_irq(TOSA_GPIO_CF_CD)
> +#define TOSA_IRQ_GPIO_BAT0_CRG pxa_gpio_to_irq(TOSA_GPIO_BAT0_CRG)
> +#define TOSA_IRQ_GPIO_TC6393XB_INT pxa_gpio_to_irq(TOSA_GPIO_TC6393XB_INT)
> +#define TOSA_IRQ_GPIO_BAT0_LOW pxa_gpio_to_irq(TOSA_GPIO_BAT0_LOW)
> +#define TOSA_IRQ_GPIO_EAR_IN pxa_gpio_to_irq(TOSA_GPIO_EAR_IN)
> +#define TOSA_IRQ_GPIO_CF_IRQ pxa_gpio_to_irq(TOSA_GPIO_CF_IRQ)
> +#define TOSA_IRQ_GPIO_ON_KEY pxa_gpio_to_irq(TOSA_GPIO_ON_KEY)
> +#define TOSA_IRQ_GPIO_VGA_LINE pxa_gpio_to_irq(TOSA_GPIO_VGA_LINE)
> +#define TOSA_IRQ_GPIO_TP_INT pxa_gpio_to_irq(TOSA_GPIO_TP_INT)
> +#define TOSA_IRQ_GPIO_JC_CF_IRQ pxa_gpio_to_irq(TOSA_GPIO_JC_CF_IRQ)
> +#define TOSA_IRQ_GPIO_BAT_LOCKED pxa_gpio_to_irq(TOSA_GPIO_BAT_LOCKED)
> +#define TOSA_IRQ_GPIO_BAT1_LOW pxa_gpio_to_irq(TOSA_GPIO_BAT1_LOW)
> +#define TOSA_IRQ_GPIO_KEY_SENSE(a) pxa_gpio_to_irq(69+(a))
> +
> +#define TOSA_IRQ_GPIO_MAIN_BAT_LOW pxa_gpio_to_irq(TOSA_GPIO_MAIN_BAT_LOW)
>
> #define TOSA_KEY_SYNC KEY_102ND /* ??? */
>
> diff --git a/arch/arm/mach-pxa/include/mach/trizeps4.h b/arch/arm/mach-pxa/include/mach/trizeps4.h
> index 903e1a2..19f8559 100644
> --- a/arch/arm/mach-pxa/include/mach/trizeps4.h
> +++ b/arch/arm/mach-pxa/include/mach/trizeps4.h
> @@ -43,30 +43,30 @@
>
> /* Ethernet Controller Davicom DM9000 */
> #define GPIO_DM9000 101
> -#define TRIZEPS4_ETH_IRQ IRQ_GPIO(GPIO_DM9000)
> +#define TRIZEPS4_ETH_IRQ pxa_gpio_to_irq(GPIO_DM9000)
>
> /* UCB1400 audio / TS-controller */
> #define GPIO_UCB1400 1
> -#define TRIZEPS4_UCB1400_IRQ IRQ_GPIO(GPIO_UCB1400)
> +#define TRIZEPS4_UCB1400_IRQ pxa_gpio_to_irq(GPIO_UCB1400)
>
> /* PCMCIA socket Compact Flash */
> #define GPIO_PCD 11 /* PCMCIA Card Detect */
> -#define TRIZEPS4_CD_IRQ IRQ_GPIO(GPIO_PCD)
> +#define TRIZEPS4_CD_IRQ pxa_gpio_to_irq(GPIO_PCD)
> #define GPIO_PRDY 13 /* READY / nINT */
> -#define TRIZEPS4_READY_NINT IRQ_GPIO(GPIO_PRDY)
> +#define TRIZEPS4_READY_NINT pxa_gpio_to_irq(GPIO_PRDY)
>
> /* MMC socket */
> #define GPIO_MMC_DET 12
> -#define TRIZEPS4_MMC_IRQ IRQ_GPIO(GPIO_MMC_DET)
> +#define TRIZEPS4_MMC_IRQ pxa_gpio_to_irq(GPIO_MMC_DET)
>
> /* DOC NAND chip */
> #define GPIO_DOC_LOCK 94
> #define GPIO_DOC_IRQ 93
> -#define TRIZEPS4_DOC_IRQ IRQ_GPIO(GPIO_DOC_IRQ)
> +#define TRIZEPS4_DOC_IRQ pxa_gpio_to_irq(GPIO_DOC_IRQ)
>
> /* SPI interface */
> #define GPIO_SPI 53
> -#define TRIZEPS4_SPI_IRQ IRQ_GPIO(GPIO_SPI)
> +#define TRIZEPS4_SPI_IRQ pxa_gpio_to_irq(GPIO_SPI)
>
> /* LEDS using tx2 / rx2 */
> #define GPIO_SYS_BUSY_LED 46
> @@ -74,7 +74,7 @@
>
> /* Off-module PIC on ConXS board */
> #define GPIO_PIC 0
> -#define TRIZEPS4_PIC_IRQ IRQ_GPIO(GPIO_PIC)
> +#define TRIZEPS4_PIC_IRQ pxa_gpio_to_irq(GPIO_PIC)
>
> #ifdef CONFIG_MACH_TRIZEPS_CONXS
> /* for CONXS base board define these registers */
> diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
> index a8e1aa1..26ad6cd 100644
> --- a/arch/arm/mach-pxa/irq.c
> +++ b/arch/arm/mach-pxa/irq.c
> @@ -11,7 +11,6 @@
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation.
> */
> -#include <linux/gpio.h>
> #include <linux/init.h>
> #include <linux/module.h>
> #include <linux/interrupt.h>
> @@ -90,45 +89,6 @@ static struct irq_chip pxa_internal_irq_chip = {
> .irq_unmask = pxa_unmask_irq,
> };
>
> -/*
> - * GPIO IRQs for GPIO 0 and 1
> - */
> -static int pxa_set_low_gpio_type(struct irq_data *d, unsigned int type)
> -{
> - int gpio = d->irq - IRQ_GPIO0;
> -
> - if (__gpio_is_occupied(gpio)) {
> - pr_err("%s failed: GPIO is configured\n", __func__);
> - return -EINVAL;
> - }
> -
> - if (type & IRQ_TYPE_EDGE_RISING)
> - GRER(gpio) |= GPIO_bit(gpio);
> - else
> - GRER(gpio) &= ~GPIO_bit(gpio);
> -
> - if (type & IRQ_TYPE_EDGE_FALLING)
> - GFER(gpio) |= GPIO_bit(gpio);
> - else
> - GFER(gpio) &= ~GPIO_bit(gpio);
> -
> - return 0;
> -}
> -
> -static void pxa_ack_low_gpio(struct irq_data *d)
> -{
> - int gpio = d->irq - IRQ_GPIO0;
> - GEDR(gpio) = 1 << gpio;
> -}
> -
> -static struct irq_chip pxa_low_gpio_chip = {
> - .name = "GPIO-l",
> - .irq_ack = pxa_ack_low_gpio,
> - .irq_mask = pxa_mask_irq,
> - .irq_unmask = pxa_unmask_irq,
> - .irq_set_type = pxa_set_low_gpio_type,
> -};
> -
> asmlinkage void __exception_irq_entry icip_handle_irq(struct pt_regs *regs)
> {
> uint32_t icip, icmr, mask;
> @@ -159,26 +119,6 @@ asmlinkage void __exception_irq_entry ichp_handle_irq(struct pt_regs *regs)
> } while (1);
> }
>
> -static void __init pxa_init_low_gpio_irq(int (*fn)(struct irq_data *,
> - unsigned int))
> -{
> - int irq;
> -
> - /* clear edge detection on GPIO 0 and 1 */
> - GFER(0) &= ~0x3;
> - GRER(0) &= ~0x3;
> - GEDR(0) = 0x3;
> -
> - for (irq = IRQ_GPIO0; irq <= IRQ_GPIO1; irq++) {
> - irq_set_chip_and_handler(irq, &pxa_low_gpio_chip,
> - handle_edge_irq);
> - irq_set_chip_data(irq, irq_base(0));
> - set_irq_flags(irq, IRQF_VALID);
> - }
> -
> - pxa_low_gpio_chip.irq_set_wake = fn;
> -}
> -
> void __init pxa_init_irq(int irq_nr, int (*fn)(struct irq_data *, unsigned int))
> {
> int irq, i, n;
> @@ -209,7 +149,6 @@ void __init pxa_init_irq(int irq_nr, int (*fn)(struct irq_data *, unsigned int))
> __raw_writel(1, irq_base(0) + ICCR);
>
> pxa_internal_irq_chip.irq_set_wake = fn;
> - pxa_init_low_gpio_irq(fn);
> }
>
> #ifdef CONFIG_PM
> diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
> index 0296e1d..4cf259b 100644
> --- a/arch/arm/mach-pxa/littleton.c
> +++ b/arch/arm/mach-pxa/littleton.c
> @@ -124,8 +124,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
> - .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
> + .start = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO90)),
> + .end = pxa_gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO90)),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
> }
> };
> diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
> index 64540d9..b5e0968 100644
> --- a/arch/arm/mach-pxa/lpd270.c
> +++ b/arch/arm/mach-pxa/lpd270.c
> @@ -152,8 +152,8 @@ static void __init lpd270_init_irq(void)
> handle_level_irq);
> set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> }
> - irq_set_chained_handler(IRQ_GPIO(0), lpd270_irq_handler);
> - irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
> + irq_set_chained_handler(pxa_gpio_to_irq(0), lpd270_irq_handler);
> + irq_set_irq_type(pxa_gpio_to_irq(0), IRQ_TYPE_EDGE_FALLING);
> }
>
>
> diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
> index c48ce6d..b33c633 100644
> --- a/arch/arm/mach-pxa/lubbock.c
> +++ b/arch/arm/mach-pxa/lubbock.c
> @@ -170,8 +170,8 @@ static void __init lubbock_init_irq(void)
> set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> }
>
> - irq_set_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
> - irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
> + irq_set_chained_handler(pxa_gpio_to_irq(0), lubbock_irq_handler);
> + irq_set_irq_type(pxa_gpio_to_irq(0), IRQ_TYPE_EDGE_FALLING);
> }
>
> #ifdef CONFIG_PM
> diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
> index 0567d39..cd3917a 100644
> --- a/arch/arm/mach-pxa/mainstone.c
> +++ b/arch/arm/mach-pxa/mainstone.c
> @@ -178,8 +178,8 @@ static void __init mainstone_init_irq(void)
> MST_INTMSKENA = 0;
> MST_INTSETCLR = 0;
>
> - irq_set_chained_handler(IRQ_GPIO(0), mainstone_irq_handler);
> - irq_set_irq_type(IRQ_GPIO(0), IRQ_TYPE_EDGE_FALLING);
> + irq_set_chained_handler(pxa_gpio_to_irq(0), mainstone_irq_handler);
> + irq_set_irq_type(pxa_gpio_to_irq(0), IRQ_TYPE_EDGE_FALLING);
> }
>
> #ifdef CONFIG_PM
> diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
> index 469dcd6..a577826 100644
> --- a/arch/arm/mach-pxa/poodle.c
> +++ b/arch/arm/mach-pxa/poodle.c
> @@ -166,8 +166,8 @@ static struct resource locomo_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = IRQ_GPIO(10),
> - .end = IRQ_GPIO(10),
> + .start = pxa_gpio_to_irq(10),
> + .end = pxa_gpio_to_irq(10),
> .flags = IORESOURCE_IRQ,
> },
> };
> diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
> index 785880f..7fa6f84 100644
> --- a/arch/arm/mach-pxa/sharpsl_pm.c
> +++ b/arch/arm/mach-pxa/sharpsl_pm.c
> @@ -907,24 +907,24 @@ static int __devinit sharpsl_pm_probe(struct platform_device *pdev)
> gpio_direction_input(sharpsl_pm.machinfo->gpio_batlock);
>
> /* Register interrupt handlers */
> - if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
> - dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin));
> + if (request_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "AC Input Detect", sharpsl_ac_isr)) {
> + dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_acin));
> }
>
> - if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
> - dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock));
> + if (request_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Battery Cover", sharpsl_fatal_isr)) {
> + dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock));
> }
>
> if (sharpsl_pm.machinfo->gpio_fatal) {
> - if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
> - dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal));
> + if (request_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr, IRQF_DISABLED | IRQF_TRIGGER_FALLING, "Fatal Battery", sharpsl_fatal_isr)) {
> + dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal));
> }
> }
>
> if (sharpsl_pm.machinfo->batfull_irq) {
> /* Register interrupt handler. */
> - if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
> - dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull));
> + if (request_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, IRQF_DISABLED | IRQF_TRIGGER_RISING, "CO", sharpsl_chrg_full_isr)) {
> + dev_err(sharpsl_pm.dev, "Could not get irq %d.\n", pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull));
> }
> }
>
> @@ -953,14 +953,14 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
>
> led_trigger_unregister_simple(sharpsl_charge_led_trigger);
>
> - free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
> - free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
> + free_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
> + free_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
>
> if (sharpsl_pm.machinfo->gpio_fatal)
> - free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr);
> + free_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr);
>
> if (sharpsl_pm.machinfo->batfull_irq)
> - free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
> + free_irq(pxa_gpio_to_irq(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
>
> gpio_free(sharpsl_pm.machinfo->gpio_batlock);
> gpio_free(sharpsl_pm.machinfo->gpio_batfull);
> diff --git a/arch/arm/mach-pxa/stargate2.c b/arch/arm/mach-pxa/stargate2.c
> index 8752dc0..6f23f7a 100644
> --- a/arch/arm/mach-pxa/stargate2.c
> +++ b/arch/arm/mach-pxa/stargate2.c
> @@ -376,7 +376,7 @@ static struct spi_board_info spi_board_info[] __initdata = {
> .bus_num = 1,
> .chip_select = 0,
> .controller_data = &staccel_chip_info,
> - .irq = IRQ_GPIO(96),
> + .irq = pxa_gpio_to_irq(96),
> }, {
> .modalias = "cc2420",
> .max_speed_hz = 6500000,
> @@ -560,18 +560,18 @@ static struct i2c_board_info __initdata imote2_i2c_board_info[] = {
> /* Through a nand gate - Also beware, on V2 sensor board the
> * pull up resistors are missing.
> */
> - .irq = IRQ_GPIO(99),
> + .irq = pxa_gpio_to_irq(99),
> }, { /* ITS400 Sensor board only */
> .type = "tsl2561",
> .addr = 0x49,
> /* Through a nand gate - Also beware, on V2 sensor board the
> * pull up resistors are missing.
> */
> - .irq = IRQ_GPIO(99),
> + .irq = pxa_gpio_to_irq(99),
> }, { /* ITS400 Sensor board only */
> .type = "tmp175",
> .addr = 0x4A,
> - .irq = IRQ_GPIO(96),
> + .irq = pxa_gpio_to_irq(96),
> }, { /* IMB400 Multimedia board */
> .type = "wm8940",
> .addr = 0x1A,
> @@ -661,8 +661,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = IRQ_GPIO(40),
> - .end = IRQ_GPIO(40),
> + .start = pxa_gpio_to_irq(40),
> + .end = pxa_gpio_to_irq(40),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> @@ -707,7 +707,7 @@ static int stargate2_mci_init(struct device *dev,
> }
> gpio_direction_input(SG2_GPIO_nSD_DETECT);
>
> - err = request_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT),
> + err = request_irq(pxa_gpio_to_irq(SG2_GPIO_nSD_DETECT),
> stargate2_detect_int,
> IRQ_TYPE_EDGE_BOTH,
> "MMC card detect",
> @@ -738,7 +738,7 @@ static void stargate2_mci_setpower(struct device *dev, unsigned int vdd)
>
> static void stargate2_mci_exit(struct device *dev, void *data)
> {
> - free_irq(IRQ_GPIO(SG2_GPIO_nSD_DETECT), data);
> + free_irq(pxa_gpio_to_irq(SG2_GPIO_nSD_DETECT), data);
> gpio_free(SG2_SD_POWER_ENABLE);
> gpio_free(SG2_GPIO_nSD_DETECT);
> }
> @@ -938,18 +938,18 @@ static struct i2c_board_info __initdata stargate2_i2c_board_info[] = {
> /* Through a nand gate - Also beware, on V2 sensor board the
> * pull up resistors are missing.
> */
> - .irq = IRQ_GPIO(99),
> + .irq = pxa_gpio_to_irq(99),
> }, { /* ITS400 Sensor board only */
> .type = "tsl2561",
> .addr = 0x49,
> /* Through a nand gate - Also beware, on V2 sensor board the
> * pull up resistors are missing.
> */
> - .irq = IRQ_GPIO(99),
> + .irq = pxa_gpio_to_irq(99),
> }, { /* ITS400 Sensor board only */
> .type = "tmp175",
> .addr = 0x4A,
> - .irq = IRQ_GPIO(96),
> + .irq = pxa_gpio_to_irq(96),
> },
> };
>
> diff --git a/arch/arm/mach-pxa/vpac270.c b/arch/arm/mach-pxa/vpac270.c
> index 261f258..f648608 100644
> --- a/arch/arm/mach-pxa/vpac270.c
> +++ b/arch/arm/mach-pxa/vpac270.c
> @@ -395,8 +395,8 @@ static struct resource vpac270_dm9000_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [2] = {
> - .start = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
> - .end = IRQ_GPIO(GPIO114_VPAC270_ETH_IRQ),
> + .start = pxa_gpio_to_irq(GPIO114_VPAC270_ETH_IRQ),
> + .end = pxa_gpio_to_irq(GPIO114_VPAC270_ETH_IRQ),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> },
> };
> @@ -433,7 +433,7 @@ static pxa2xx_audio_ops_t vpac270_ac97_pdata = {
> };
>
> static struct ucb1400_pdata vpac270_ucb1400_pdata = {
> - .irq = IRQ_GPIO(GPIO113_VPAC270_TS_IRQ),
> + .irq = pxa_gpio_to_irq(GPIO113_VPAC270_TS_IRQ),
> };
>
> static struct platform_device vpac270_ucb1400_device = {
> diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c
> index 93c64d8..dcdf0d2 100644
> --- a/arch/arm/mach-pxa/zylonite_pxa300.c
> +++ b/arch/arm/mach-pxa/zylonite_pxa300.c
> @@ -231,12 +231,12 @@ static struct i2c_board_info zylonite_i2c_board_info[] = {
> .type = "pca9539",
> .addr = 0x74,
> .platform_data = &gpio_exp[0],
> - .irq = IRQ_GPIO(18),
> + .irq = pxa_gpio_to_irq(18),
> }, {
> .type = "pca9539",
> .addr = 0x75,
> .platform_data = &gpio_exp[1],
> - .irq = IRQ_GPIO(19),
> + .irq = pxa_gpio_to_irq(19),
> },
> };
>
> diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
> index 5ab42f8..d667d8d 100644
> --- a/arch/arm/plat-pxa/gpio.c
> +++ b/arch/arm/plat-pxa/gpio.c
> @@ -282,6 +282,20 @@ void __init pxa_init_gpio(int mux_irq, int start, int end,
> __raw_writel(~0,c->regbase + GEDR_OFFSET);
> }
>
> +#ifdef CONFIG_ARCH_PXA
> + irq = gpio_to_irq(0);
> + irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> + handle_edge_irq);
> + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> + irq_set_chained_handler(IRQ_GPIO0, pxa_gpio_demux_handler);
> +
> + irq = gpio_to_irq(1);
> + irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> + handle_edge_irq);
> + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> + irq_set_chained_handler(IRQ_GPIO1, pxa_gpio_demux_handler);
> +#endif
> +
> for (irq = pxa_gpio_to_irq(start); irq <= pxa_gpio_to_irq(end);
> irq++) {
> irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> --
> 1.7.2.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Patch 7022 bug
From: Russell King - ARM Linux @ 2011-09-29 22:27 UTC (permalink / raw)
To: linux-arm-kernel
Noticed this in linux-next's build logs for assabet's defconfig:
/opt/crosstool/gcc-4.4.0-nolibc/arm-linux/bin/arm-linux-ld:--defsym zreladdr=: syntax error
@@ -1,6 +1,7 @@
- zreladdr-y := 0xc0008000
ifeq ($(CONFIG_ARCH_SA1100),y)
- zreladdr-$(CONFIG_SA1111) := 0xc0208000
+ zreladdr-$(CONFIG_SA1111) += 0xc0208000
+else
+ zreladdr-y += 0xc0008000
You deleted the initial zreladdr-y, which means that in the case of
ARCH_SA1100=y and SA1111=n, no zreladdr is set.
^ permalink raw reply
* [PATCH 5/5] ARM: pxa: move gpio driver into drivers directory
From: Grant Likely @ 2011-09-29 22:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1317309546-19682-5-git-send-email-haojian.zhuang@marvell.com>
On Thu, Sep 29, 2011 at 11:19:06PM +0800, Haojian Zhuang wrote:
> Move gpio driver from plat-pxa to drivers/gpio directory. Only leave
> gpio number macro in mach/gpio.h.
>
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> ---
> arch/arm/mach-mmp/Kconfig | 3 +
> arch/arm/mach-mmp/Makefile | 2 +-
> arch/arm/mach-mmp/aspenite.c | 4 +-
> arch/arm/mach-mmp/flint.c | 4 +-
> arch/arm/mach-mmp/gpio.c | 89 ++++++
> arch/arm/mach-mmp/gplugd.c | 2 +-
> arch/arm/mach-mmp/include/mach/gpio.h | 24 +--
> arch/arm/mach-mmp/include/mach/irqs.h | 4 +-
> arch/arm/mach-mmp/mmp2.c | 17 --
> arch/arm/mach-mmp/pxa168.c | 17 --
> arch/arm/mach-mmp/pxa910.c | 17 --
> arch/arm/mach-mmp/tavorevb.c | 4 +-
> arch/arm/mach-mmp/teton_bga.c | 2 +-
> arch/arm/mach-mmp/ttc_dkb.c | 2 +-
> arch/arm/mach-pxa/Kconfig | 6 +
> arch/arm/mach-pxa/Makefile | 2 +-
> arch/arm/mach-pxa/gpio.c | 92 ++++++
> arch/arm/mach-pxa/include/mach/gpio.h | 64 -----
> arch/arm/mach-pxa/pxa25x.c | 3 -
> arch/arm/mach-pxa/pxa27x.c | 2 -
> arch/arm/mach-pxa/pxa3xx.c | 2 -
> arch/arm/mach-pxa/pxa95x.c | 2 -
> arch/arm/plat-pxa/Makefile | 1 -
> arch/arm/plat-pxa/gpio.c | 352 -----------------------
> arch/arm/plat-pxa/include/plat/gpio.h | 65 -----
> drivers/gpio/Kconfig | 6 +
> drivers/gpio/Makefile | 1 +
> drivers/gpio/gpio-pxa.c | 500 +++++++++++++++++++++++++++++++++
> include/linux/gpio-pxa.h | 105 +++++++
> 29 files changed, 816 insertions(+), 578 deletions(-)
> create mode 100644 arch/arm/mach-mmp/gpio.c
> create mode 100644 arch/arm/mach-pxa/gpio.c
> delete mode 100644 arch/arm/plat-pxa/gpio.c
> delete mode 100644 arch/arm/plat-pxa/include/plat/gpio.h
> create mode 100644 drivers/gpio/gpio-pxa.c
> create mode 100644 include/linux/gpio-pxa.h
>
> diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
> index 56ef5f6..47810fb 100644
> --- a/arch/arm/mach-mmp/Kconfig
> +++ b/arch/arm/mach-mmp/Kconfig
> @@ -89,18 +89,21 @@ endmenu
> config CPU_PXA168
> bool
> select CPU_MOHAWK
> + select GPIO_PXA
> help
> Select code specific to PXA168
>
> config CPU_PXA910
> bool
> select CPU_MOHAWK
> + select GPIO_PXA
> help
> Select code specific to PXA910
>
> config CPU_MMP2
> bool
> select CPU_PJ4
> + select GPIO_PXA
> help
> Select code specific to MMP2. MMP2 is ARMv7 compatible.
> endif
> diff --git a/arch/arm/mach-mmp/Makefile b/arch/arm/mach-mmp/Makefile
> index b0ac942..5af46eb 100644
> --- a/arch/arm/mach-mmp/Makefile
> +++ b/arch/arm/mach-mmp/Makefile
> @@ -2,7 +2,7 @@
> # Makefile for Marvell's PXA168 processors line
> #
>
> -obj-y += common.o clock.o devices.o time.o
> +obj-y += common.o clock.o devices.o time.o gpio.o
>
> # SoC support
> obj-$(CONFIG_CPU_PXA168) += pxa168.o irq-pxa168.o
> diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
> index 6b19812..88770cf 100644
> --- a/arch/arm/mach-mmp/aspenite.c
> +++ b/arch/arm/mach-mmp/aspenite.c
> @@ -119,8 +119,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = pxa_gpio_to_irq(27),
> - .end = pxa_gpio_to_irq(27),
> + .start = mmp_gpio_to_irq(27),
> + .end = mmp_gpio_to_irq(27),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/flint.c b/arch/arm/mach-mmp/flint.c
> index f466a2c..19dfdf5 100644
> --- a/arch/arm/mach-mmp/flint.c
> +++ b/arch/arm/mach-mmp/flint.c
> @@ -87,8 +87,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = pxa_gpio_to_irq(155),
> - .end = pxa_gpio_to_irq(155),
> + .start = mmp_gpio_to_irq(155),
> + .end = mmp_gpio_to_irq(155),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/gpio.c b/arch/arm/mach-mmp/gpio.c
> new file mode 100644
> index 0000000..345341d5
> --- /dev/null
> +++ b/arch/arm/mach-mmp/gpio.c
> @@ -0,0 +1,89 @@
> +/*
> + * linux/arch/arm/mach-mmp/gpio.c
> + *
> + * MMP series specific gpio init
> + *
> + * Copyright (C) 2011 Marvell International Ltd.
> + *
> + * Author:
> + * Haojian Zhuang <haojian.zhuang@marvell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/gpio-pxa.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/io.h>
> +
> +#include <mach/cputype.h>
> +#include <mach/irqs.h>
> +#include <mach/regs-apbc.h>
> +
> +#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
> +#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
> +
> +static struct __initdata pxa_gpio_platform_data mmp_gpio_config;
> +
> +static struct __initdata resource mmp_resources_gpio[] = {
> + {
> + .start = 0xd4010000,
> + .end = 0xd401ffff,
> + .flags = IORESOURCE_MEM,
> + }, {
> + .start = IRQ_PXA168_GPIOX,
> + .end = IRQ_PXA168_GPIOX,
> + .name = "gpio_mux",
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> +static struct platform_device mmp_gpio = {
> + .name = "pxa-gpio",
> + .id = -1,
> + .num_resources = ARRAY_SIZE(mmp_resources_gpio),
> + .resource = mmp_resources_gpio,
> +};
> +
> +static int __init mmp_gpio_init(void)
> +{
> + int size = sizeof(struct pxa_gpio_platform_data);
> + u32 reg_base = GPIO_REGS_VIRT;
> + int i;
> +
> + if (cpu_is_pxa168() || cpu_is_pxa910()) {
> + /* enable GPIO clock */
> + __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA168_GPIO);
> +
> + /* unmask GPIO edge detection for all 4 banks - APMASKx */
> + for (i = 0; i < 4; i++)
> + __raw_writel(0xffffffff, APMASK(i));
> + mmp_gpio_config.gpio_type = MMP_GPIO;
> + mmp_gpio_config.gpio_end = 127;
> + } else if (cpu_is_mmp2()) {
> + /* enable GPIO clock */
> + __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_MMP2_GPIO);
> +
> + /* unmask GPIO edge detection for all 6 banks -- APMASKx */
> + for (i = 0; i < 6; i++)
> + __raw_writel(0xffffffff, APMASK(i));
> + mmp_gpio_config.gpio_type = MMP2_GPIO;
> + mmp_gpio_config.gpio_end = 191;
> + } else
> + return 0;
> +
> + pxa_gpio_regs.gplr = reg_base + GPLR_OFFSET;
> + pxa_gpio_regs.gpdr = reg_base + GPDR_OFFSET;
> + pxa_gpio_regs.gpsr = reg_base + GPSR_OFFSET;
> + pxa_gpio_regs.gpcr = reg_base + GPCR_OFFSET;
> + pxa_gpio_regs.grer = reg_base + GRER_OFFSET;
> + pxa_gpio_regs.gfer = reg_base + GFER_OFFSET;
> + pxa_gpio_regs.gedr = reg_base + GEDR_OFFSET;
> +
> + platform_device_add_data(&mmp_gpio, &mmp_gpio_config, size);
> + platform_device_register(&mmp_gpio);
> + return 0;
> +}
> +postcore_initcall(mmp_gpio_init);
You'll also want to bail on this init function if a DT is passed to
the kernel. Otherwise it looks okay.
> diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
> index 98e25d9..32776f3 100644
> --- a/arch/arm/mach-mmp/gplugd.c
> +++ b/arch/arm/mach-mmp/gplugd.c
> @@ -9,11 +9,11 @@
> */
>
> #include <linux/init.h>
> +#include <linux/gpio.h>
>
> #include <asm/mach/arch.h>
> #include <asm/mach-types.h>
>
> -#include <mach/gpio.h>
> #include <mach/pxa168.h>
> #include <mach/mfp-pxa168.h>
>
> diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
> index 89d499e..9a2f4e1 100644
> --- a/arch/arm/mach-mmp/include/mach/gpio.h
> +++ b/arch/arm/mach-mmp/include/mach/gpio.h
> @@ -3,31 +3,9 @@
>
> #include <mach/addr-map.h>
> #include <mach/irqs.h>
> -#include <asm-generic/gpio.h>
>
> -#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
> -
> -#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> -#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
> +#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
Nit: don't change the whitespace on this line because it isn't
actually changing functionally, but diff makes it look like it is.
I assume these remaining macros will be removed/reworked in a future
patch?
>
> #define NR_BUILTIN_GPIO IRQ_GPIO_NUM
>
> -#define gpio_to_bank(gpio) ((gpio) >> 5)
> -
> -#define __gpio_is_inverted(gpio) (0)
> -#define __gpio_is_occupied(gpio) (0)
> -
> -/* NOTE: these macros are defined here to make optimization of
> - * gpio_{get,set}_value() to work when 'gpio' is a constant.
> - * Usage of these macros otherwise is no longer recommended,
> - * use generic GPIO API whenever possible.
> - */
> -#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
> -
> -#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
> -#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
> -#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
> -#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
> -
> -#include <plat/gpio.h>
> #endif /* __ASM_MACH_GPIO_H */
> diff --git a/arch/arm/mach-mmp/include/mach/irqs.h b/arch/arm/mach-mmp/include/mach/irqs.h
> index 2971a00..6a72198 100644
> --- a/arch/arm/mach-mmp/include/mach/irqs.h
> +++ b/arch/arm/mach-mmp/include/mach/irqs.h
> @@ -220,8 +220,8 @@
>
> #define IRQ_GPIO_START 128
> #define IRQ_GPIO_NUM 192
> -#define pxa_gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> -#define pxa_irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
> +#define mmp_gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
> +#define mmp_irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
>
> #define IRQ_BOARD_START (IRQ_GPIO_START + IRQ_GPIO_NUM)
>
> diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
> index 1935834..5d31333 100644
> --- a/arch/arm/mach-mmp/mmp2.c
> +++ b/arch/arm/mach-mmp/mmp2.c
> @@ -33,8 +33,6 @@
>
> #define MFPR_VIRT_BASE (APB_VIRT_BASE + 0x1e000)
>
> -#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x9c)
> -
> static struct mfp_addr_map mmp2_addr_map[] __initdata = {
>
> MFP_ADDR_X(GPIO0, GPIO58, 0x54),
> @@ -94,24 +92,9 @@ void mmp2_clear_pmic_int(void)
> __raw_writel(data, mfpr_pmic);
> }
>
> -static void __init mmp2_init_gpio(void)
> -{
> - int i;
> -
> - /* enable GPIO clock */
> - __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_MMP2_GPIO);
> -
> - /* unmask GPIO edge detection for all 6 banks -- APMASKx */
> - for (i = 0; i < 6; i++)
> - __raw_writel(0xffffffff, APMASK(i));
> -
> - pxa_init_gpio(IRQ_MMP2_GPIO, 0, 167, NULL);
> -}
> -
> void __init mmp2_init_irq(void)
> {
> mmp2_init_icu();
> - mmp2_init_gpio();
> }
>
> static void sdhc_clk_enable(struct clk *clk)
> diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
> index e6f6789..630453a 100644
> --- a/arch/arm/mach-mmp/pxa168.c
> +++ b/arch/arm/mach-mmp/pxa168.c
> @@ -43,26 +43,9 @@ static struct mfp_addr_map pxa168_mfp_addr_map[] __initdata =
> MFP_ADDR_END,
> };
>
> -#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
> -
> -static void __init pxa168_init_gpio(void)
> -{
> - int i;
> -
> - /* enable GPIO clock */
> - __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA168_GPIO);
> -
> - /* unmask GPIO edge detection for all 4 banks - APMASKx */
> - for (i = 0; i < 4; i++)
> - __raw_writel(0xffffffff, APMASK(i));
> -
> - pxa_init_gpio(IRQ_PXA168_GPIOX, 0, 127, NULL);
> -}
> -
> void __init pxa168_init_irq(void)
> {
> icu_init_irq();
> - pxa168_init_gpio();
> }
>
> /* APB peripheral clocks */
> diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
> index c70b4dd..19ebfe3 100644
> --- a/arch/arm/mach-mmp/pxa910.c
> +++ b/arch/arm/mach-mmp/pxa910.c
> @@ -77,26 +77,9 @@ static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
> MFP_ADDR_END,
> };
>
> -#define APMASK(i) (GPIO_REGS_VIRT + BANK_OFF(i) + 0x09c)
> -
> -static void __init pxa910_init_gpio(void)
> -{
> - int i;
> -
> - /* enable GPIO clock */
> - __raw_writel(APBC_APBCLK | APBC_FNCLK, APBC_PXA910_GPIO);
> -
> - /* unmask GPIO edge detection for all 4 banks - APMASKx */
> - for (i = 0; i < 4; i++)
> - __raw_writel(0xffffffff, APMASK(i));
> -
> - pxa_init_gpio(IRQ_PXA910_AP_GPIO, 0, 127, NULL);
> -}
> -
> void __init pxa910_init_irq(void)
> {
> icu_init_irq();
> - pxa910_init_gpio();
> }
>
> /* APB peripheral clocks */
> diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
> index c5e1529..c15fa2b 100644
> --- a/arch/arm/mach-mmp/tavorevb.c
> +++ b/arch/arm/mach-mmp/tavorevb.c
> @@ -70,8 +70,8 @@ static struct resource smc91x_resources[] = {
> .flags = IORESOURCE_MEM,
> },
> [1] = {
> - .start = pxa_gpio_to_irq(80),
> - .end = pxa_gpio_to_irq(80),
> + .start = mmp_gpio_to_irq(80),
> + .end = mmp_gpio_to_irq(80),
> .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
> }
> };
> diff --git a/arch/arm/mach-mmp/teton_bga.c b/arch/arm/mach-mmp/teton_bga.c
> index 79bbbc2..4539fe3 100644
> --- a/arch/arm/mach-mmp/teton_bga.c
> +++ b/arch/arm/mach-mmp/teton_bga.c
> @@ -66,7 +66,7 @@ static struct pxa27x_keypad_platform_data teton_bga_keypad_info __initdata = {
> static struct i2c_board_info teton_bga_i2c_info[] __initdata = {
> {
> I2C_BOARD_INFO("ds1337", 0x68),
> - .irq = pxa_gpio_to_irq(RTC_INT_GPIO)
> + .irq = mmp_gpio_to_irq(RTC_INT_GPIO)
> },
> };
>
> diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
> index a420b07..b27e17e 100644
> --- a/arch/arm/mach-mmp/ttc_dkb.c
> +++ b/arch/arm/mach-mmp/ttc_dkb.c
> @@ -136,7 +136,7 @@ static struct i2c_board_info ttc_dkb_i2c_info[] = {
> {
> .type = "max7312",
> .addr = 0x23,
> - .irq = pxa_gpio_to_irq(80),
> + .irq = mmp_gpio_to_irq(80),
> .platform_data = &max7312_data,
> },
> };
> diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
> index cd19309..2b81f95 100644
> --- a/arch/arm/mach-pxa/Kconfig
> +++ b/arch/arm/mach-pxa/Kconfig
> @@ -604,24 +604,28 @@ endmenu
> config PXA25x
> bool
> select CPU_XSCALE
> + select GPIO_PXA
> help
> Select code specific to PXA21x/25x/26x variants
>
> config PXA27x
> bool
> select CPU_XSCALE
> + select GPIO_PXA
> help
> Select code specific to PXA27x variants
>
> config CPU_PXA26x
> bool
> select PXA25x
> + select GPIO_PXA
> help
> Select code specific to PXA26x (codename Dalhart)
>
> config PXA3xx
> bool
> select CPU_XSC3
> + select GPIO_PXA
> help
> Select code specific to PXA3xx variants
>
> @@ -647,6 +651,7 @@ config CPU_PXA320
> config CPU_PXA930
> bool
> select PXA3xx
> + select GPIO_PXA
> help
> PXA930 (codename Tavor-P)
>
> @@ -659,6 +664,7 @@ config CPU_PXA935
> config PXA95x
> bool
> select CPU_PJ4
> + select GPIO_PXA
> help
> Select code specific to PXA95x variants
>
> diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
> index cc39d17..ab34cae 100644
> --- a/arch/arm/mach-pxa/Makefile
> +++ b/arch/arm/mach-pxa/Makefile
> @@ -3,7 +3,7 @@
> #
>
> # Common support (must be linked before board specific support)
> -obj-y += clock.o devices.o generic.o irq.o \
> +obj-y += clock.o devices.o generic.o irq.o gpio.o\
> time.o reset.o
> obj-$(CONFIG_PM) += pm.o sleep.o standby.o
>
> diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c
> new file mode 100644
> index 0000000..de65c59
> --- /dev/null
> +++ b/arch/arm/mach-pxa/gpio.c
> @@ -0,0 +1,92 @@
> +/*
> + * linux/arch/arm/mach-pxa/gpio.c
> + *
> + * PXA series specific gpio init
> + *
> + * Copyright (C) 2011 Marvell International Ltd.
> + *
> + * Author:
> + * Haojian Zhuang <haojian.zhuang@marvell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/gpio-pxa.h>
> +#include <linux/platform_device.h>
> +
> +#include <mach/hardware.h>
> +#include <mach/irqs.h>
> +
> +static struct __initdata pxa_gpio_platform_data pxa_gpio_config;
> +
> +static struct __initdata resource pxa_resources_gpio[] = {
static struct resource pxa_resources_gpio[] __initdata = {
> + {
> + .start = 0x40e00000,
> + .end = 0x40e0ffff,
> + .flags = IORESOURCE_MEM,
> + }, {
> + .start = IRQ_GPIO0,
> + .end = IRQ_GPIO0,
> + .name = "gpio0",
> + .flags = IORESOURCE_IRQ,
> + }, {
> + .start = IRQ_GPIO1,
> + .end = IRQ_GPIO1,
> + .name = "gpio1",
> + .flags = IORESOURCE_IRQ,
> + }, {
> + .start = IRQ_GPIO_2_x,
> + .end = IRQ_GPIO_2_x,
> + .name = "gpio_mux",
> + .flags = IORESOURCE_IRQ,
> + },
> +};
> +
> +static struct platform_device pxa_gpio = {
> + .name = "pxa-gpio",
> + .id = -1,
> + .num_resources = ARRAY_SIZE(pxa_resources_gpio),
> + .resource = pxa_resources_gpio,
> +};
> +
> +static int __init pxa_gpio_init(void)
> +{
> + int size = sizeof(struct pxa_gpio_platform_data);
> + u32 reg_base = io_p2v(0x40E00000);
> +
> + if (cpu_is_pxa25x()) {
> +#ifdef CONFIG_PXA26x
> + pxa_gpio_config.gpio_type = PXA26X_GPIO;
> + pxa_gpio_config.gpio_end = 89;
> +#else
> + pxa_gpio_config.gpio_type = PXA25X_GPIO;
> + pxa_gpio_config.gpio_end = 84;
> +#endif
Not multiplatform friendly. The subarch may not support
multiplatform, but that's no excuse for adding either/or #ifdef
blocks. I'd rather see one #ifdef for PXA26x and another for PXA25x,
and the code organizes so that they can peacefully co-exist.
> + } else if (cpu_is_pxa27x()) {
> + pxa_gpio_config.gpio_type = PXA27X_GPIO;
> + pxa_gpio_config.gpio_end = 120;
> + } else if (cpu_is_pxa93x() || cpu_is_pxa95x()) {
> + pxa_gpio_config.gpio_type = PXA93X_GPIO;
> + pxa_gpio_config.gpio_end = 191;
> + } else if (cpu_is_pxa3xx()) {
> + pxa_gpio_config.gpio_type = PXA3XX_GPIO;
> + pxa_gpio_config.gpio_end = 127;
> + } else
> + return 0;
> +
> + pxa_gpio_regs.gplr = reg_base + GPLR_OFFSET;
> + pxa_gpio_regs.gpdr = reg_base + GPDR_OFFSET;
> + pxa_gpio_regs.gpsr = reg_base + GPSR_OFFSET;
> + pxa_gpio_regs.gpcr = reg_base + GPCR_OFFSET;
> + pxa_gpio_regs.grer = reg_base + GRER_OFFSET;
> + pxa_gpio_regs.gfer = reg_base + GFER_OFFSET;
> + pxa_gpio_regs.gedr = reg_base + GEDR_OFFSET;
> + pxa_gpio_regs.gafr = reg_base + GAFR_OFFSET;
I'd rather have this layout knowledge as part of the driver
rather than using platform data to pass stuff. The driver can make
the selection either based on device name, or by testing
cpio_is_pxa*() directly. We already have the mechanisms needed for
this.
Same goes for mmp_gpio_init().
> +
> + platform_device_add_data(&pxa_gpio, &pxa_gpio_config, size);
> + platform_device_register(&pxa_gpio);
> + return 0;
> +}
> +postcore_initcall(pxa_gpio_init);
Same as mmp_gpio_init, this function needs to be skipped if a DT is
passed to the kernel.
> diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
> index d58efb5..6db7f59 100644
> --- a/arch/arm/mach-pxa/include/mach/gpio.h
> +++ b/arch/arm/mach-pxa/include/mach/gpio.h
> @@ -25,71 +25,7 @@
> #define __ASM_ARCH_PXA_GPIO_H
>
> #include <mach/irqs.h>
> -#include <mach/hardware.h>
> -#include <asm-generic/gpio.h>
> -
> -#define GPIO_REGS_VIRT io_p2v(0x40E00000)
> -
> -#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> -#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
> -
> -/* More handy macros. The argument is a literal GPIO number. */
> -
> -#define GPIO_bit(x) (1 << ((x) & 0x1f))
> -
> -/* GPIO Pin Level Registers */
> -#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
> -/* GPIO Pin Direction Registers */
> -#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
> -/* GPIO Pin Output Set Registers */
> -#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
> -/* GPIO Pin Output Clear Registers */
> -#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
> -/* GPIO Rising Edge Detect Registers */
> -#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
> -/* GPIO Falling Edge Detect Registers */
> -#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
> -/* GPIO Edge Detect Status Registers */
> -#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
> -/* GPIO Alternate Function Select Registers */
> -#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
> -
>
> #define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
>
> -#define gpio_to_bank(gpio) ((gpio) >> 5)
> -
> -#ifdef CONFIG_CPU_PXA26x
> -/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
> - * as well as their Alternate Function value being '1' for GPIO in GAFRx.
> - */
> -static inline int __gpio_is_inverted(unsigned gpio)
> -{
> - return cpu_is_pxa25x() && gpio > 85;
> -}
> -#else
> -static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
> -#endif
> -
> -/*
> - * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
> - * function of a GPIO, and GPDRx cannot be altered once configured. It
> - * is attributed as "occupied" here (I know this terminology isn't
> - * accurate, you are welcome to propose a better one :-)
> - */
> -static inline int __gpio_is_occupied(unsigned gpio)
> -{
> - if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
> - int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
> - int dir = GPDR(gpio) & GPIO_bit(gpio);
> -
> - if (__gpio_is_inverted(gpio))
> - return af != 1 || dir == 0;
> - else
> - return af != 0 || dir != 0;
> - } else
> - return GPDR(gpio) & GPIO_bit(gpio);
> -}
> -
> -#include <plat/gpio.h>
> #endif
> diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
> index 2ae1739..1c5070d 100644
> --- a/arch/arm/mach-pxa/pxa25x.c
> +++ b/arch/arm/mach-pxa/pxa25x.c
> @@ -311,14 +311,12 @@ set_pwer:
> void __init pxa25x_init_irq(void)
> {
> pxa_init_irq(32, pxa25x_set_wake);
> - pxa_init_gpio(IRQ_GPIO_2_x, 2, 84, pxa25x_set_wake);
> }
>
> #ifdef CONFIG_CPU_PXA26x
> void __init pxa26x_init_irq(void)
> {
> pxa_init_irq(32, pxa25x_set_wake);
> - pxa_init_gpio(IRQ_GPIO_2_x, 2, 89, pxa25x_set_wake);
> }
> #endif
>
> @@ -368,7 +366,6 @@ static int __init pxa25x_init(void)
>
> register_syscore_ops(&pxa_irq_syscore_ops);
> register_syscore_ops(&pxa2xx_mfp_syscore_ops);
> - register_syscore_ops(&pxa_gpio_syscore_ops);
> register_syscore_ops(&pxa2xx_clock_syscore_ops);
>
> ret = platform_add_devices(pxa25x_devices,
> diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
> index 03d0728..638edf4 100644
> --- a/arch/arm/mach-pxa/pxa27x.c
> +++ b/arch/arm/mach-pxa/pxa27x.c
> @@ -385,7 +385,6 @@ static int pxa27x_set_wake(struct irq_data *d, unsigned int on)
> void __init pxa27x_init_irq(void)
> {
> pxa_init_irq(34, pxa27x_set_wake);
> - pxa_init_gpio(IRQ_GPIO_2_x, 2, 120, pxa27x_set_wake);
> }
>
> static struct map_desc pxa27x_io_desc[] __initdata = {
> @@ -454,7 +453,6 @@ static int __init pxa27x_init(void)
>
> register_syscore_ops(&pxa_irq_syscore_ops);
> register_syscore_ops(&pxa2xx_mfp_syscore_ops);
> - register_syscore_ops(&pxa_gpio_syscore_ops);
> register_syscore_ops(&pxa2xx_clock_syscore_ops);
>
> ret = platform_add_devices(devices, ARRAY_SIZE(devices));
> diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
> index f18a6eb..fe4db28 100644
> --- a/arch/arm/mach-pxa/pxa3xx.c
> +++ b/arch/arm/mach-pxa/pxa3xx.c
> @@ -389,7 +389,6 @@ void __init pxa3xx_init_irq(void)
>
> pxa_init_irq(56, pxa3xx_set_wake);
> pxa_init_ext_wakeup_irq(pxa3xx_set_wake);
> - pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
> }
>
> static struct map_desc pxa3xx_io_desc[] __initdata = {
> @@ -461,7 +460,6 @@ static int __init pxa3xx_init(void)
>
> register_syscore_ops(&pxa_irq_syscore_ops);
> register_syscore_ops(&pxa3xx_mfp_syscore_ops);
> - register_syscore_ops(&pxa_gpio_syscore_ops);
> register_syscore_ops(&pxa3xx_clock_syscore_ops);
>
> ret = platform_add_devices(devices, ARRAY_SIZE(devices));
> diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
> index de25ceb..b115829 100644
> --- a/arch/arm/mach-pxa/pxa95x.c
> +++ b/arch/arm/mach-pxa/pxa95x.c
> @@ -235,7 +235,6 @@ static struct clk_lookup pxa95x_clkregs[] = {
> void __init pxa95x_init_irq(void)
> {
> pxa_init_irq(96, NULL);
> - pxa_init_gpio(IRQ_GPIO_2_x, 2, 127, NULL);
> }
>
> /*
> @@ -282,7 +281,6 @@ static int __init pxa95x_init(void)
> return ret;
>
> register_syscore_ops(&pxa_irq_syscore_ops);
> - register_syscore_ops(&pxa_gpio_syscore_ops);
> register_syscore_ops(&pxa3xx_clock_syscore_ops);
>
> ret = platform_add_devices(devices, ARRAY_SIZE(devices));
> diff --git a/arch/arm/plat-pxa/Makefile b/arch/arm/plat-pxa/Makefile
> index 3aca5ba..f302d04 100644
> --- a/arch/arm/plat-pxa/Makefile
> +++ b/arch/arm/plat-pxa/Makefile
> @@ -4,7 +4,6 @@
>
> obj-y := dma.o
>
> -obj-$(CONFIG_GENERIC_GPIO) += gpio.o
> obj-$(CONFIG_PXA3xx) += mfp.o
> obj-$(CONFIG_PXA95x) += mfp.o
> obj-$(CONFIG_ARCH_MMP) += mfp.o
> diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
> deleted file mode 100644
> index d667d8d..0000000
> --- a/arch/arm/plat-pxa/gpio.c
> +++ /dev/null
> @@ -1,352 +0,0 @@
> -/*
> - * linux/arch/arm/plat-pxa/gpio.c
> - *
> - * Generic PXA GPIO handling
> - *
> - * Author: Nicolas Pitre
> - * Created: Jun 15, 2001
> - * Copyright: MontaVista Software Inc.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - */
> -#include <linux/gpio.h>
> -#include <linux/init.h>
> -#include <linux/irq.h>
> -#include <linux/io.h>
> -#include <linux/syscore_ops.h>
> -#include <linux/slab.h>
> -
> -int pxa_last_gpio;
> -
> -struct pxa_gpio_chip {
> - struct gpio_chip chip;
> - void __iomem *regbase;
> - char label[10];
> -
> - unsigned long irq_mask;
> - unsigned long irq_edge_rise;
> - unsigned long irq_edge_fall;
> -
> -#ifdef CONFIG_PM
> - unsigned long saved_gplr;
> - unsigned long saved_gpdr;
> - unsigned long saved_grer;
> - unsigned long saved_gfer;
> -#endif
> -};
> -
> -static DEFINE_SPINLOCK(gpio_lock);
> -static struct pxa_gpio_chip *pxa_gpio_chips;
> -
> -#define for_each_gpio_chip(i, c) \
> - for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
> -
> -static inline void __iomem *gpio_chip_base(struct gpio_chip *c)
> -{
> - return container_of(c, struct pxa_gpio_chip, chip)->regbase;
> -}
> -
> -static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
> -{
> - return &pxa_gpio_chips[gpio_to_bank(gpio)];
> -}
> -
> -static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
> -{
> - void __iomem *base = gpio_chip_base(chip);
> - uint32_t value, mask = 1 << offset;
> - unsigned long flags;
> -
> - spin_lock_irqsave(&gpio_lock, flags);
> -
> - value = __raw_readl(base + GPDR_OFFSET);
> - if (__gpio_is_inverted(chip->base + offset))
> - value |= mask;
> - else
> - value &= ~mask;
> - __raw_writel(value, base + GPDR_OFFSET);
> -
> - spin_unlock_irqrestore(&gpio_lock, flags);
> - return 0;
> -}
> -
> -static int pxa_gpio_direction_output(struct gpio_chip *chip,
> - unsigned offset, int value)
> -{
> - void __iomem *base = gpio_chip_base(chip);
> - uint32_t tmp, mask = 1 << offset;
> - unsigned long flags;
> -
> - __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
> -
> - spin_lock_irqsave(&gpio_lock, flags);
> -
> - tmp = __raw_readl(base + GPDR_OFFSET);
> - if (__gpio_is_inverted(chip->base + offset))
> - tmp &= ~mask;
> - else
> - tmp |= mask;
> - __raw_writel(tmp, base + GPDR_OFFSET);
> -
> - spin_unlock_irqrestore(&gpio_lock, flags);
> - return 0;
> -}
> -
> -static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
> -{
> - return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
> -}
> -
> -static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> -{
> - __raw_writel(1 << offset, gpio_chip_base(chip) +
> - (value ? GPSR_OFFSET : GPCR_OFFSET));
> -}
> -
> -static int __init pxa_init_gpio_chip(int gpio_end)
> -{
> - int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
> - struct pxa_gpio_chip *chips;
> -
> - chips = kzalloc(nbanks * sizeof(struct pxa_gpio_chip), GFP_KERNEL);
> - if (chips == NULL) {
> - pr_err("%s: failed to allocate GPIO chips\n", __func__);
> - return -ENOMEM;
> - }
> -
> - for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
> - struct gpio_chip *c = &chips[i].chip;
> -
> - sprintf(chips[i].label, "gpio-%d", i);
> - chips[i].regbase = (void __iomem *)GPIO_BANK(i);
> -
> - c->base = gpio;
> - c->label = chips[i].label;
> -
> - c->direction_input = pxa_gpio_direction_input;
> - c->direction_output = pxa_gpio_direction_output;
> - c->get = pxa_gpio_get;
> - c->set = pxa_gpio_set;
> -
> - /* number of GPIOs on last bank may be less than 32 */
> - c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
> - gpiochip_add(c);
> - }
> - pxa_gpio_chips = chips;
> - return 0;
> -}
> -
> -/* Update only those GRERx and GFERx edge detection register bits if those
> - * bits are set in c->irq_mask
> - */
> -static inline void update_edge_detect(struct pxa_gpio_chip *c)
> -{
> - uint32_t grer, gfer;
> -
> - grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask;
> - gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask;
> - grer |= c->irq_edge_rise & c->irq_mask;
> - gfer |= c->irq_edge_fall & c->irq_mask;
> - __raw_writel(grer, c->regbase + GRER_OFFSET);
> - __raw_writel(gfer, c->regbase + GFER_OFFSET);
> -}
> -
> -static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
> -{
> - struct pxa_gpio_chip *c;
> - int gpio = pxa_irq_to_gpio(d->irq);
> - unsigned long gpdr, mask = GPIO_bit(gpio);
> -
> - c = gpio_to_pxachip(gpio);
> -
> - if (type == IRQ_TYPE_PROBE) {
> - /* Don't mess with enabled GPIOs using preconfigured edges or
> - * GPIOs set to alternate function or to output during probe
> - */
> - if ((c->irq_edge_rise | c->irq_edge_fall) & GPIO_bit(gpio))
> - return 0;
> -
> - if (__gpio_is_occupied(gpio))
> - return 0;
> -
> - type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
> - }
> -
> - gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
> -
> - if (__gpio_is_inverted(gpio))
> - __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET);
> - else
> - __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET);
> -
> - if (type & IRQ_TYPE_EDGE_RISING)
> - c->irq_edge_rise |= mask;
> - else
> - c->irq_edge_rise &= ~mask;
> -
> - if (type & IRQ_TYPE_EDGE_FALLING)
> - c->irq_edge_fall |= mask;
> - else
> - c->irq_edge_fall &= ~mask;
> -
> - update_edge_detect(c);
> -
> - pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, d->irq, gpio,
> - ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
> - ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : ""));
> - return 0;
> -}
> -
> -static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
> -{
> - struct pxa_gpio_chip *c;
> - int loop, gpio, gpio_base, n;
> - unsigned long gedr;
> -
> - do {
> - loop = 0;
> - for_each_gpio_chip(gpio, c) {
> - gpio_base = c->chip.base;
> -
> - gedr = __raw_readl(c->regbase + GEDR_OFFSET);
> - gedr = gedr & c->irq_mask;
> - __raw_writel(gedr, c->regbase + GEDR_OFFSET);
> -
> - n = find_first_bit(&gedr, BITS_PER_LONG);
> - while (n < BITS_PER_LONG) {
> - loop = 1;
> -
> - generic_handle_irq(pxa_gpio_to_irq(gpio_base + n));
> - n = find_next_bit(&gedr, BITS_PER_LONG, n + 1);
> - }
> - }
> - } while (loop);
> -}
> -
> -static void pxa_ack_muxed_gpio(struct irq_data *d)
> -{
> - int gpio = pxa_irq_to_gpio(d->irq);
> - struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> -
> - __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
> -}
> -
> -static void pxa_mask_muxed_gpio(struct irq_data *d)
> -{
> - int gpio = pxa_irq_to_gpio(d->irq);
> - struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> - uint32_t grer, gfer;
> -
> - c->irq_mask &= ~GPIO_bit(gpio);
> -
> - grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
> - gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
> - __raw_writel(grer, c->regbase + GRER_OFFSET);
> - __raw_writel(gfer, c->regbase + GFER_OFFSET);
> -}
> -
> -static void pxa_unmask_muxed_gpio(struct irq_data *d)
> -{
> - int gpio = pxa_irq_to_gpio(d->irq);
> - struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> -
> - c->irq_mask |= GPIO_bit(gpio);
> - update_edge_detect(c);
> -}
> -
> -static struct irq_chip pxa_muxed_gpio_chip = {
> - .name = "GPIO",
> - .irq_ack = pxa_ack_muxed_gpio,
> - .irq_mask = pxa_mask_muxed_gpio,
> - .irq_unmask = pxa_unmask_muxed_gpio,
> - .irq_set_type = pxa_gpio_irq_type,
> -};
> -
> -void __init pxa_init_gpio(int mux_irq, int start, int end,
> - int (*fn)(struct irq_data *, unsigned int))
> -{
> - struct pxa_gpio_chip *c;
> - int gpio, irq;
> -
> - pxa_last_gpio = end;
> -
> - /* Initialize GPIO chips */
> - pxa_init_gpio_chip(end);
> -
> - /* clear all GPIO edge detects */
> - for_each_gpio_chip(gpio, c) {
> - __raw_writel(0, c->regbase + GFER_OFFSET);
> - __raw_writel(0, c->regbase + GRER_OFFSET);
> - __raw_writel(~0,c->regbase + GEDR_OFFSET);
> - }
> -
> -#ifdef CONFIG_ARCH_PXA
> - irq = gpio_to_irq(0);
> - irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> - handle_edge_irq);
> - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> - irq_set_chained_handler(IRQ_GPIO0, pxa_gpio_demux_handler);
> -
> - irq = gpio_to_irq(1);
> - irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> - handle_edge_irq);
> - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> - irq_set_chained_handler(IRQ_GPIO1, pxa_gpio_demux_handler);
> -#endif
> -
> - for (irq = pxa_gpio_to_irq(start); irq <= pxa_gpio_to_irq(end);
> - irq++) {
> - irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> - handle_edge_irq);
> - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> - }
> -
> - /* Install handler for GPIO>=2 edge detect interrupts */
> - irq_set_chained_handler(mux_irq, pxa_gpio_demux_handler);
> - pxa_muxed_gpio_chip.irq_set_wake = fn;
> -}
> -
> -#ifdef CONFIG_PM
> -static int pxa_gpio_suspend(void)
> -{
> - struct pxa_gpio_chip *c;
> - int gpio;
> -
> - for_each_gpio_chip(gpio, c) {
> - c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET);
> - c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
> - c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET);
> - c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET);
> -
> - /* Clear GPIO transition detect bits */
> - __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET);
> - }
> - return 0;
> -}
> -
> -static void pxa_gpio_resume(void)
> -{
> - struct pxa_gpio_chip *c;
> - int gpio;
> -
> - for_each_gpio_chip(gpio, c) {
> - /* restore level with set/clear */
> - __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET);
> - __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET);
> -
> - __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET);
> - __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET);
> - __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET);
> - }
> -}
> -#else
> -#define pxa_gpio_suspend NULL
> -#define pxa_gpio_resume NULL
> -#endif
> -
> -struct syscore_ops pxa_gpio_syscore_ops = {
> - .suspend = pxa_gpio_suspend,
> - .resume = pxa_gpio_resume,
> -};
> diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
> deleted file mode 100644
> index d31c2a5..0000000
> --- a/arch/arm/plat-pxa/include/plat/gpio.h
> +++ /dev/null
> @@ -1,65 +0,0 @@
> -#ifndef __PLAT_GPIO_H
> -#define __PLAT_GPIO_H
> -
> -#define __ARM_GPIOLIB_COMPLEX
> -
> -struct irq_data;
> -
> -/*
> - * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
> - * one set of registers. The register offsets are organized below:
> - *
> - * GPLR GPDR GPSR GPCR GRER GFER GEDR
> - * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
> - * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
> - * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
> - *
> - * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
> - * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
> - * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
> - *
> - * NOTE:
> - * BANK 3 is only available on PXA27x and later processors.
> - * BANK 4 and 5 are only available on PXA935
> - */
> -
> -#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
> -
> -#define GPLR_OFFSET 0x00
> -#define GPDR_OFFSET 0x0C
> -#define GPSR_OFFSET 0x18
> -#define GPCR_OFFSET 0x24
> -#define GRER_OFFSET 0x30
> -#define GFER_OFFSET 0x3C
> -#define GEDR_OFFSET 0x48
> -
> -static inline int gpio_get_value(unsigned gpio)
> -{
> - if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO))
> - return GPLR(gpio) & GPIO_bit(gpio);
> - else
> - return __gpio_get_value(gpio);
> -}
> -
> -static inline void gpio_set_value(unsigned gpio, int value)
> -{
> - if (__builtin_constant_p(gpio) && (gpio < NR_BUILTIN_GPIO)) {
> - if (value)
> - GPSR(gpio) = GPIO_bit(gpio);
> - else
> - GPCR(gpio) = GPIO_bit(gpio);
> - } else
> - __gpio_set_value(gpio, value);
> -}
> -
> -#define gpio_cansleep __gpio_cansleep
> -
> -/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
> - * Those cases currently cause holes in the GPIO number space, the
> - * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
> - */
> -extern int pxa_last_gpio;
> -
> -extern void pxa_init_gpio(int mux_irq, int start, int end,
> - int (*fn)(struct irq_data *, unsigned int));
> -#endif /* __PLAT_GPIO_H */
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 6465030..08fe9f6 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -141,6 +141,12 @@ config GPIO_PL061
> help
> Say yes here to support the PrimeCell PL061 GPIO device
>
> +config GPIO_PXA
> + def_bool y
> + depends on ARCH_PXA || ARCH_MMP
> + help
> + Say yes here to support the PXA GPIO device
> +
> config GPIO_XILINX
> bool "Xilinx GPIO support"
> depends on PPC_OF || MICROBLAZE
> diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
> index a4c8ac9..194899f 100644
> --- a/drivers/gpio/Makefile
> +++ b/drivers/gpio/Makefile
> @@ -40,6 +40,7 @@ obj-$(CONFIG_GPIO_PCA953X) += gpio-pca953x.o
> obj-$(CONFIG_GPIO_PCF857X) += gpio-pcf857x.o
> obj-$(CONFIG_GPIO_PCH) += gpio-pch.o
> obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o
> +obj-$(CONFIG_GPIO_PXA) += gpio-pxa.o
> obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
> obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
> obj-$(CONFIG_PLAT_SAMSUNG) += gpio-samsung.o
> diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
> new file mode 100644
> index 0000000..21d1394
> --- /dev/null
> +++ b/drivers/gpio/gpio-pxa.c
> @@ -0,0 +1,500 @@
> +/*
> + * linux/arch/arm/plat-pxa/gpio.c
> + *
> + * Generic PXA GPIO handling
> + *
> + * Author: Nicolas Pitre
> + * Created: Jun 15, 2001
> + * Copyright: MontaVista Software Inc.
> + *
> + * Copyright (C) 2011 Marvell Technology
> + * Moved to drivers/gpio - Haojian Zhuang <haojian.zhuang@marvell.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/gpio.h>
> +#include <linux/gpio-pxa.h>
> +#include <linux/irq.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +#include <linux/syscore_ops.h>
> +
> +static int pxa_last_gpio;
> +
> +struct pxa_gpio_irq_data {
> + int gpio_type;
> + int irq_gpio0;
> + int irq_gpio1;
> + int irq_mux;
> +};
> +
> +struct pxa_gpio_chip {
> + struct gpio_chip chip;
> + void __iomem *regbase;
> + char label[10];
> +
> + unsigned long irq_mask;
> + unsigned long irq_edge_rise;
> + unsigned long irq_edge_fall;
> + struct pxa_gpio_irq_data *data;
> +
> +#ifdef CONFIG_PM
> + unsigned long saved_gplr;
> + unsigned long saved_gpdr;
> + unsigned long saved_grer;
> + unsigned long saved_gfer;
> +#endif
> +};
> +
> +struct pxa_gpio_regs pxa_gpio_regs;
> +
> +static DEFINE_SPINLOCK(gpio_lock);
> +static struct pxa_gpio_chip *pxa_gpio_chips;
> +
> +#define for_each_gpio_chip(i, c) \
> + for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
> +
> +static inline void __iomem *gpio_chip_base(struct gpio_chip *c)
> +{
> + return container_of(c, struct pxa_gpio_chip, chip)->regbase;
> +}
> +
> +static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
> +{
> + return &pxa_gpio_chips[gpio_to_bank(gpio)];
> +}
> +
> +static int __gpio_is_inverted(int gpio)
> +{
> + struct pxa_gpio_chip *c;
> + struct pxa_gpio_irq_data *data;
> +
> + c = gpio_to_pxachip(gpio);
> + data = c->data;
> +#ifdef CONFIG_ARCH_PXA
> + if (gpio_is_pxa_type(data->gpio_type)) {
> + if (data->gpio_type == PXA26X_GPIO && gpio > 84)
> + return 1;
> + else
> + return 0;
> + }
> +#endif
> +#ifdef CONFIG_ARCH_MMP
> + if (gpio_is_mmp_type(data->gpio_type))
> + return 0;
> +#endif
Instead of encoding it into pdata, it would be simpler to select the
type by assiging an (platform_driver*)->id_table and using the .data
member in the table to select the correct initialization data. That
means using the name of the device to select the correct
initialization.
> + return 0;
> +}
> +
> +static int __gpio_is_irq(int gpio)
> +{
> + struct pxa_gpio_chip *c;
> + struct pxa_gpio_irq_data *data;
> + int af = 0, dir = 0;
> + int ret;
> +
> + c = gpio_to_pxachip(gpio);
> + data = c->data;
> + switch (data->gpio_type) {
> + case PXA25X_GPIO:
> + case PXA26X_GPIO:
> + case PXA27X_GPIO:
> + af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
> + dir = GPDR(gpio) & GPIO_bit(gpio);
> + if ((data->gpio_type == PXA26X_GPIO) && (gpio > 84))
> + ret = (af != 1) || (dir == 0);
> + else
> + ret = (af != 0) || (dir != 0);
> + break;
> + default:
> + ret = GPDR(gpio) & GPIO_bit(gpio);
> + break;
> + }
> + return ret;
> +}
> +
> +static inline int mgpio_to_irq(int gpio)
> +{
> + struct pxa_gpio_chip *c;
> + struct pxa_gpio_irq_data *data;
> +
> + c = gpio_to_pxachip(gpio);
> + data = c->data;
> +#ifdef CONFIG_ARCH_PXA
> + if (gpio_is_pxa_type(data->gpio_type))
> + return pxa_gpio_to_irq(gpio);
> +#endif
> +#ifdef CONFIG_ARCH_MMP
> + if (gpio_is_mmp_type(data->gpio_type))
> + return mmp_gpio_to_irq(gpio);
> +#endif
> + return 0;
> +}
> +
> +static inline int mirq_to_gpio(struct irq_data *d)
> +{
> + struct pxa_gpio_irq_data *data = irq_data_get_irq_chip_data(d);
> +
> +#ifdef CONFIG_ARCH_PXA
> + if (gpio_is_pxa_type(data->gpio_type))
> + return pxa_irq_to_gpio(d->irq);
> +#endif
> +#ifdef CONFIG_ARCH_MMP
> + if (gpio_is_mmp_type(data->gpio_type))
> + return mmp_irq_to_gpio(d->irq);
> +#endif
> + return 0;
> +}
> +
> +static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
> +{
> + void __iomem *base = gpio_chip_base(chip);
> + uint32_t value, mask = 1 << offset;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&gpio_lock, flags);
> +
> + value = __raw_readl(base + GPDR_OFFSET);
> + if (__gpio_is_inverted(chip->base + offset))
> + value |= mask;
> + else
> + value &= ~mask;
> + __raw_writel(value, base + GPDR_OFFSET);
> +
> + spin_unlock_irqrestore(&gpio_lock, flags);
> + return 0;
> +}
> +
> +static int pxa_gpio_direction_output(struct gpio_chip *chip,
> + unsigned offset, int value)
> +{
> + void __iomem *base = gpio_chip_base(chip);
> + uint32_t tmp, mask = 1 << offset;
> + unsigned long flags;
> +
> + __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
> +
> + spin_lock_irqsave(&gpio_lock, flags);
> +
> + tmp = __raw_readl(base + GPDR_OFFSET);
> + if (__gpio_is_inverted(chip->base + offset))
> + tmp &= ~mask;
> + else
> + tmp |= mask;
> + __raw_writel(tmp, base + GPDR_OFFSET);
> +
> + spin_unlock_irqrestore(&gpio_lock, flags);
> + return 0;
> +}
> +
> +static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
> +{
> + return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
> +}
> +
> +static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
> +{
> + __raw_writel(1 << offset, gpio_chip_base(chip) +
> + (value ? GPSR_OFFSET : GPCR_OFFSET));
> +}
> +
> +static int __init pxa_init_gpio_chip(int gpio_end,
> + struct pxa_gpio_irq_data *data)
> +{
> + int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
> + struct pxa_gpio_chip *chips;
> +
> + chips = kzalloc(nbanks * sizeof(struct pxa_gpio_chip), GFP_KERNEL);
> + if (chips == NULL) {
> + pr_err("%s: failed to allocate GPIO chips\n", __func__);
> + return -ENOMEM;
> + }
> +
> + for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
> + struct gpio_chip *c = &chips[i].chip;
> +
> + sprintf(chips[i].label, "gpio-%d", i);
> + chips[i].regbase = (void __iomem *)GPIO_BANK(i);
> + chips[i].data = data;
> +
> + c->base = gpio;
> + c->label = chips[i].label;
> +
> + c->direction_input = pxa_gpio_direction_input;
> + c->direction_output = pxa_gpio_direction_output;
> + c->get = pxa_gpio_get;
> + c->set = pxa_gpio_set;
> +
> + /* number of GPIOs on last bank may be less than 32 */
> + c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
> + gpiochip_add(c);
> + }
> + pxa_gpio_chips = chips;
> + return 0;
> +}
> +
> +/* Update only those GRERx and GFERx edge detection register bits if those
> + * bits are set in c->irq_mask
> + */
> +static inline void update_edge_detect(struct pxa_gpio_chip *c)
> +{
> + uint32_t grer, gfer;
> +
> + grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask;
> + gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask;
> + grer |= c->irq_edge_rise & c->irq_mask;
> + gfer |= c->irq_edge_fall & c->irq_mask;
> + __raw_writel(grer, c->regbase + GRER_OFFSET);
> + __raw_writel(gfer, c->regbase + GFER_OFFSET);
> +}
> +
> +static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
> +{
> + struct pxa_gpio_chip *c;
> + int gpio = mirq_to_gpio(d);
> + unsigned long gpdr, mask = GPIO_bit(gpio);
> +
> + c = gpio_to_pxachip(gpio);
> +
> + if (type == IRQ_TYPE_PROBE) {
> + /* Don't mess with enabled GPIOs using preconfigured edges or
> + * GPIOs set to alternate function or to output during probe
> + */
> + if ((c->irq_edge_rise | c->irq_edge_fall) & GPIO_bit(gpio))
> + return 0;
> +
> + if (!__gpio_is_irq(gpio))
> + return 0;
> +
> + type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
> + }
> +
> + gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
> +
> + if (__gpio_is_inverted(gpio))
> + __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET);
> + else
> + __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET);
> +
> + if (type & IRQ_TYPE_EDGE_RISING)
> + c->irq_edge_rise |= mask;
> + else
> + c->irq_edge_rise &= ~mask;
> +
> + if (type & IRQ_TYPE_EDGE_FALLING)
> + c->irq_edge_fall |= mask;
> + else
> + c->irq_edge_fall &= ~mask;
> +
> + update_edge_detect(c);
> +
> + pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, d->irq, gpio,
> + ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
> + ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : ""));
> + return 0;
> +}
> +
> +static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
> +{
> + struct pxa_gpio_chip *c;
> + int loop, gpio, gpio_base, n;
> + unsigned long gedr;
> +
> + do {
> + loop = 0;
> + for_each_gpio_chip(gpio, c) {
> + gpio_base = c->chip.base;
> +
> + gedr = __raw_readl(c->regbase + GEDR_OFFSET);
> + gedr = gedr & c->irq_mask;
> + __raw_writel(gedr, c->regbase + GEDR_OFFSET);
> +
> + n = find_first_bit(&gedr, BITS_PER_LONG);
> + while (n < BITS_PER_LONG) {
> + loop = 1;
> +
> + irq = mgpio_to_irq(gpio_base + n);
> + generic_handle_irq(irq);
> + n = find_next_bit(&gedr, BITS_PER_LONG, n + 1);
> + }
> + }
> + } while (loop);
> +}
> +
> +static void pxa_ack_muxed_gpio(struct irq_data *d)
> +{
> + int gpio = mirq_to_gpio(d);
> + struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> +
> + __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
> +}
> +
> +static void pxa_mask_muxed_gpio(struct irq_data *d)
> +{
> + int gpio = mirq_to_gpio(d);
> + struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> + uint32_t grer, gfer;
> +
> + c->irq_mask &= ~GPIO_bit(gpio);
> +
> + grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
> + gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
> + __raw_writel(grer, c->regbase + GRER_OFFSET);
> + __raw_writel(gfer, c->regbase + GFER_OFFSET);
> +}
> +
> +static void pxa_unmask_muxed_gpio(struct irq_data *d)
> +{
> + int gpio = mirq_to_gpio(d);
> + struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
> +
> + c->irq_mask |= GPIO_bit(gpio);
> + update_edge_detect(c);
> +}
> +
> +static struct irq_chip pxa_muxed_gpio_chip = {
> + .name = "GPIO",
> + .irq_ack = pxa_ack_muxed_gpio,
> + .irq_mask = pxa_mask_muxed_gpio,
> + .irq_unmask = pxa_unmask_muxed_gpio,
> + .irq_set_type = pxa_gpio_irq_type,
> +};
> +
> +
> +static int __init pxa_gpio_probe(struct platform_device *pdev)
This needs to be __devinit for correctness.
> +{
> + struct pxa_gpio_platform_data *pdata;
> + struct pxa_gpio_chip *c;
> + struct pxa_gpio_irq_data *mux_data;
> + int gpio, irq;
> + int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0;
> +
> + if (!pdev->dev.platform_data)
> + return -EINVAL;
> + pdata = pdev->dev.platform_data;
> + pxa_last_gpio = pdata->gpio_end;
> +
> + mux_data = kzalloc(sizeof(struct pxa_gpio_irq_data), GFP_KERNEL);
> + if (mux_data < 0)
> + return -ENOMEM;
> +
> + irq0 = platform_get_irq_byname(pdev, "gpio0");
> + irq1 = platform_get_irq_byname(pdev, "gpio1");
> + irq_mux = platform_get_irq_byname(pdev, "gpio_mux");
> + if ((irq0 > 0 && irq1 < 0) || (irq0 < 0 && irq1 > 0) || (irq_mux < 0))
> + return -EINVAL;
> +
> + if (irq0 > 0) {
> + mux_data->irq_gpio0 = irq0;
> + mux_data->irq_gpio1 = irq1;
> + gpio_offset = 2;
> + }
> + mux_data->irq_mux = irq_mux;
> + mux_data->gpio_type = pdata->gpio_type;
> +
> + /* Initialize GPIO chips */
> + pxa_init_gpio_chip(pdata->gpio_end, mux_data);
> +
> + /* clear all GPIO edge detects */
> + for_each_gpio_chip(gpio, c) {
> + __raw_writel(0, c->regbase + GFER_OFFSET);
> + __raw_writel(0, c->regbase + GRER_OFFSET);
> + __raw_writel(~0,c->regbase + GEDR_OFFSET);
> + }
> +
> +#ifdef CONFIG_ARCH_PXA
> + if (irq0 > 0) {
> + irq = pxa_gpio_to_irq(0);
> + irq_set_chip_data(irq, mux_data);
> + irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> + handle_edge_irq);
> + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> + irq_set_chained_handler(irq0, pxa_gpio_demux_handler);
> +
> + irq = pxa_gpio_to_irq(1);
> + irq_set_chip_data(irq, mux_data);
> + irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> + handle_edge_irq);
> + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> + irq_set_chained_handler(irq1, pxa_gpio_demux_handler);
> + }
> +#endif /* CONFIG_ARCH_PXA */
> +
> + for (irq = mgpio_to_irq(gpio_offset);
> + irq <= mgpio_to_irq(pdata->gpio_end); irq++) {
> + irq_set_chip_data(irq, mux_data);
> + irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
> + handle_edge_irq);
> + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
> + }
> +
> + irq_set_chained_handler(irq_mux, pxa_gpio_demux_handler);
> + return 0;
> +}
> +
> +static struct platform_driver pxa_gpio_driver = {
> + .probe = pxa_gpio_probe,
> + .driver = {
> + .owner = THIS_MODULE,
> + .name = "pxa-gpio",
> + },
> +};
> +
> +static int __init pxa_gpio_init(void)
> +{
> + return platform_driver_register(&pxa_gpio_driver);
> +}
> +postcore_initcall(pxa_gpio_init);
> +
> +#ifdef CONFIG_PM
> +static int pxa_gpio_suspend(void)
> +{
> + struct pxa_gpio_chip *c;
> + int gpio;
> +
> + for_each_gpio_chip(gpio, c) {
> + c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET);
> + c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
> + c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET);
> + c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET);
> +
> + /* Clear GPIO transition detect bits */
> + __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET);
> + }
> + return 0;
> +}
> +
> +static void pxa_gpio_resume(void)
> +{
> + struct pxa_gpio_chip *c;
> + int gpio;
> +
> + for_each_gpio_chip(gpio, c) {
> + /* restore level with set/clear */
> + __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET);
> + __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET);
> +
> + __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET);
> + __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET);
> + __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET);
> + }
> +}
> +#else
> +#define pxa_gpio_suspend NULL
> +#define pxa_gpio_resume NULL
> +#endif
> +
> +struct syscore_ops pxa_gpio_syscore_ops = {
> + .suspend = pxa_gpio_suspend,
> + .resume = pxa_gpio_resume,
> +};
> +
> +static int __init pxa_gpio_sysinit(void)
> +{
> + register_syscore_ops(&pxa_gpio_syscore_ops);
> + return 0;
> +}
> +postcore_initcall(pxa_gpio_sysinit);
> diff --git a/include/linux/gpio-pxa.h b/include/linux/gpio-pxa.h
> new file mode 100644
> index 0000000..97d89af
> --- /dev/null
> +++ b/include/linux/gpio-pxa.h
> @@ -0,0 +1,105 @@
> +#ifndef __GPIO_PXA_H
> +#define __GPIO_PXA_H
> +
> +#include <asm/io.h>
> +
> +/*
> + * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
> + * one set of registers. The register offsets are organized below:
> + *
> + * GPLR -- GPIO Pin Level Registers
> + * GPDR -- GPIO Pin Direction Registers
> + * GPSR -- GPIO Pin Output Set Registers
> + * GPCR -- GPIO Pin Output Clear Registers
> + * GRER -- GPIO Rising Edge Detect Registers
> + * GFER -- GPIO Falling Edge Detect Registers
> + * GEDR -- GPIO Edge Detect Status Registers
> + *
> + * GPLR GPDR GPSR GPCR GRER GFER GEDR
> + * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
> + * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
> + * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
> + *
> + * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
> + * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
> + * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
> + *
> + * NOTE:
> + * BANK 3 is only available on PXA27x and later processors.
> + * BANK 4 and 5 are only available on PXA935
> + */
> +
> +#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> +
> +#define gpio_to_bank(x) ((x) >> 5)
> +
> +/* More handy macros. The argument is a literal GPIO number. */
> +
> +#define GPIO_bit(x) (1 << ((x) & 0x1f))
> +
> +#define GPLR_OFFSET 0x00
> +#define GPDR_OFFSET 0x0C
> +#define GPSR_OFFSET 0x18
> +#define GPCR_OFFSET 0x24
> +#define GRER_OFFSET 0x30
> +#define GFER_OFFSET 0x3C
> +#define GEDR_OFFSET 0x48
> +#define GAFR_OFFSET 0x54
> +
> +enum {
> + /*
> + * Interrupt of GPIO0 & GPIO1 is dependant in PXA series.
> + * Interrupt of all GPIO is muxed into one in MMP series.
> + */
> + PXA25X_GPIO = 0,
> + PXA26X_GPIO,
> + PXA27X_GPIO,
> + PXA3XX_GPIO,
> + PXA93X_GPIO,
> + MMP_GPIO = 0x10,
> + MMP2_GPIO,
> +};
> +
> +#define MASK_GPIO_PXA 0x0f
> +#define MASK_GPIO_MMP 0xf0
> +
> +struct pxa_gpio_platform_data {
> + int gpio_end;
> + int gpio_type;
> +};
> +
> +static inline int gpio_is_pxa_type(int type)
> +{
> + return type & MASK_GPIO_PXA;
> +}
> +
> +static inline int gpio_is_mmp_type(int type)
> +{
> + return type & MASK_GPIO_MMP;
> +}
> +
> +struct pxa_gpio_regs {
> + u32 gplr;
> + u32 gpdr;
> + u32 gpsr;
> + u32 gpcr;
> + u32 grer;
> + u32 gfer;
> + u32 gedr;
> + u32 gafr;
> +};
> +
> +extern struct pxa_gpio_regs pxa_gpio_regs;
> +
> +#define GPLR(x) (*(volatile u32 *)(pxa_gpio_regs.gplr + BANK_OFF((x >> 5))))
> +#define GPDR(x) (*(volatile u32 *)(pxa_gpio_regs.gpdr + BANK_OFF((x >> 5))))
> +#define GPSR(x) (*(volatile u32 *)(pxa_gpio_regs.gpsr + BANK_OFF((x >> 5))))
> +#define GPCR(x) (*(volatile u32 *)(pxa_gpio_regs.gpcr + BANK_OFF((x >> 5))))
> +#define GRER(x) (*(volatile u32 *)(pxa_gpio_regs.grer + BANK_OFF((x >> 5))))
> +#define GFER(x) (*(volatile u32 *)(pxa_gpio_regs.gfer + BANK_OFF((x >> 5))))
> +#define GEDR(x) (*(volatile u32 *)(pxa_gpio_regs.gedr + BANK_OFF((x >> 5))))
> +#define GAFR(x) (*(volatile u32 *)(pxa_gpio_regs.gafr + (((x) & 0x70) >> 2)))
> +
> +#define GPIO_BANK(n) (pxa_gpio_regs.gplr + BANK_OFF(n))
All these macros really need a pxa_gpio prefix, but that can be done
in a separate patch.
> +
> +#endif /* __GPIO_PXA_H */
> --
> 1.7.2.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH] PM: HIBERNATION: add resume_wait param to support MMC-like devices as resume file
From: Barry Song @ 2011-09-29 23:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAKPcRGr3EzjS2es6HniuQziEivpsfH2r=d_Y=nkrsFW59g6xSw@mail.gmail.com>
2011/9/29 Luca Tettamanti <kronos.it@gmail.com>:
> On Thu, Sep 29, 2011 at 11:29 AM, Barry Song <Barry.Song@csr.com> wrote:
>> From: Barry Song <baohua.song@csr.com>
>>
>> Some devices like mmc are async detected very slow. For example,
>> drivers/mmc/host/sdhci.c launchs a 200ms delayed work to detect
>> mmc partitions then add disk.
>>
>> we do have wait_for_device_probe and scsi_complete_async_scans
>> before calling swsusp_check, but it is not enough to wait mmc.
>>
>> This patch adds resumewait kernel param just like rootwait so
>> that we have enough time to wait mmc ready. The differene is
>> here we wait for resume partition but rootwait waits for rootfs
>> partition.
>
> I assume that such a device would need "rootwait" to boot in the first
> place; why don't you "overload" the param to also enable waiting in
> the resume path?
not real. for an embedded product, the type of the rootfs, the place
of the rootfs and the way to mount rootfs are pretty flexible.
even though both rootfs and resume file use mmc, they will be in
different partitions at least. so i don't think rootwait can overload
resumewait.
>
> Luca
>
-barry
^ permalink raw reply
* [PATCH] PM: HIBERNATION: add resume_wait param to support MMC-like devices as resume file
From: Barry Song @ 2011-09-29 23:21 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAKPcRGpPG2Z_tMQFHz8fpBLhLO4dx58AVhYWmPdZ_0pV7pVK6A@mail.gmail.com>
2011/9/29 Luca Tettamanti <kronos.it@gmail.com>:
> On Thu, Sep 29, 2011 at 5:47 PM, Luca Tettamanti <kronos.it@gmail.com> wrote:
>> On Thu, Sep 29, 2011 at 11:29 AM, Barry Song <Barry.Song@csr.com> wrote:
>>> From: Barry Song <baohua.song@csr.com>
>>>
>>> Some devices like mmc are async detected very slow. For example,
>>> drivers/mmc/host/sdhci.c launchs a 200ms delayed work to detect
>>> mmc partitions then add disk.
>>>
>>> we do have wait_for_device_probe and scsi_complete_async_scans
>>> before calling swsusp_check, but it is not enough to wait mmc.
>>>
>>> This patch adds resumewait kernel param just like rootwait so
>>> that we have enough time to wait mmc ready. The differene is
>>> here we wait for resume partition but rootwait waits for rootfs
>>> partition.
>>
>> I assume that such a device would need "rootwait" to boot in the first
>> place; why don't you "overload" the param to also enable waiting in
>> the resume path?
>
> And in case that makes sense, it might be worthwhile to refactor a
> common helper to be also used in do_mounts.c, e.g.
> dev_t wait_for_device(char *name)
it is ok until we have many cases which wait for devices by polling.
but there are only two by the moment.
here i don't see it is worthwhile since the current codes are short
and clear enough.
>
> L
-barry
^ permalink raw reply
* Git pull request: mach/vmalloc.h removal, and ioremap optimizations
From: Nicolas Pitre @ 2011-09-29 23:57 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4E84E0CA.2050905@gmail.com>
On Thu, 29 Sep 2011, Rob Herring wrote:
> On 09/29/2011 03:47 PM, Nicolas Pitre wrote:
> > On Thu, 29 Sep 2011, Rob Herring wrote:
> >
> >> So it was really Realview PBX I wanted to test my GIC changes on. Well,
> >> turns out it's got a similar problem, too.
> >>
> >> However, the fix for it should perhaps be a bit different. The problem
> >> is that the virtual address of REALVIEW_PBX_TILE_GIC_CPU_BASE is not
> >> aligned. Then 0x100 + 4KB length overlaps into the DIST_BASE. So do we
> >> fix it in the platform or should the core code mask out the lower bits
> >> of the virt addr before doing any size calculations?
> >
> > Please fix it in the platform static declaration. No need to put
> > run time code for something that can be fixed in the source.
> >
> Except that 2 out of 2 machines I've tried are broken.
You've been lucky... or maybe the authors of the versatile and realview
support shared the same ... habits.
In any case, it is plain wrong to use overlapping mappings anyway. If
you do have a mapping to start at 0xf0000100 with a size of 4096 bytes,
then the only way to satisfy this is to map two pages. If in practice
only one page was enough because only the first 32 bytes are accessed,
then you should really specify the size as 32. Or use a 4K aligned
start address if you want to stick with a 4K size.
But to simply mask out the low address bits _before_ determining the
mapping end is just lying to yourself. What if some day such a mapping
that ends up crossing a page boundary is legit? Better be more careful
and rigorous with the actual mapping parameters rather than forcing the
core code to guess what was meant.
And in this case, the map_desc entry order just hid the issue by having
a later mapping overwrite the extra page from the previous one. If the
map_desc entries were reversed then you'd have ended up with the wrong
mapping in place which is a bug. At least with my series this kind of
mapping mistake is now flagged which is a good thing.
> Anyway, patch is coming.
Applied, thanks.
Nicolas
^ permalink raw reply
* [PATCH 1/2] ARM: gic: add irq_domain support
From: Grant Likely @ 2011-09-30 0:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <4E84DCF4.4020904@gmail.com>
On Thu, Sep 29, 2011 at 04:02:44PM -0500, Rob Herring wrote:
> On 09/29/2011 12:15 PM, Grant Likely wrote:
> > On Wed, Sep 28, 2011 at 10:53:55PM -0500, Rob Herring wrote:
> >> From: Rob Herring <rob.herring@calxeda.com>
> >>
> >> Convert the gic interrupt controller to use irq domains in preparation
> >> for device-tree binding and MULTI_IRQ. This allows for translation between
> >> GIC interrupt IDs and Linux irq numbers.
> >>
> >> The meaning of irq_offset has changed. It now is just the number of skipped
> >> GIC interrupt IDs for the controller. It will be 16 for primary GIC and 32
> >> for secondary GICs.
> >
> > [...]
> >
> >> /*
> >> @@ -81,7 +82,7 @@ static inline unsigned int gic_irq(struct irq_data *d)
> >> */
> >> static void gic_mask_irq(struct irq_data *d)
> >> {
> >> - u32 mask = 1 << (d->irq % 32);
> >> + u32 mask = 1 << (gic_irq(d) % 32);
> >
> > This can probably change simply to d->hwirq if irq_offset is
> > eliminated as I describe below.
> >
> >> void __init gic_init(unsigned int gic_nr, unsigned int irq_start,
> >> void __iomem *dist_base, void __iomem *cpu_base)
> >> {
> >> struct gic_chip_data *gic;
> >> + struct irq_domain *domain;
> >> + int gic_irqs;
> >>
> >> BUG_ON(gic_nr >= MAX_GIC_NR);
> >>
> >> gic = &gic_data[gic_nr];
> >> + domain = &gic->domain;
> >> gic->dist_base = dist_base;
> >> gic->cpu_base = cpu_base;
> >> - gic->irq_offset = (irq_start - 1) & ~31;
> >>
> >> - if (gic_nr == 0)
> >> + /*
> >> + * For primary GICs, skip over SGIs.
> >> + * For secondary GICs, skip over PPIs, too.
> >> + */
> >> + if (gic_nr == 0) {
> >> gic_cpu_base_addr = cpu_base;
> >> + gic->irq_offset = 16;
> >> + irq_start = (irq_start & ~31) + 16;
> >
> > With the switch to irq_domain, there should no longer be any need for
> > a ~31 mask on the irq_start number. Yes, you'll want to make sure
> > that it doesn't allocate below irq 16, but the driver should
> > completely use the irq_domain to manage the mapping from linux-irq
> > number to hwirq number. The ~31 mask appears to have been an
> > optimization to quickly calculate hwirq number from the linux one, but
> > that value is now found in irq_data->hwirq.
>
> I started out exactly this way removing irq_offset. The problem is the
> core irq domain code assumes that hwirq starts at 0, but for the gic it
> starts at 16 or 32.
>
> It could be fixed in the domain core, but that would effectively mean
> moving irq_offset into the core.
Fix irq_domain. If it cannot handle this trivial case, then it won't
be able to handle the complex powerpc use cases.
g.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox