LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/3] PXA1928 GPIO support
@ 2015-01-27  4:46 Rob Herring
  2015-01-27  4:46 ` [PATCH 1/3] gpio: pxa: remove mach IRQ includes Rob Herring
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Rob Herring @ 2015-01-27  4:46 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot; +Cc: linux-gpio, linux-kernel, Rob Herring

PXA1928 is an ARMv8 SOC in the PXA/MMP family. This series enables 
building on ARM64 and adds support for the PXA1928. The PXA1928 
GPIO differs from previous generations by adding a 6th GPIO bank.

Rob

Rob Herring (3):
  gpio: pxa: remove mach IRQ includes
  dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio
  gpio: pxa: add PXA1928 gpio type support

 .../devicetree/bindings/gpio/mrvl-gpio.txt         |  4 +-
 drivers/gpio/gpio-pxa.c                            | 55 +++++++++++++---------
 2 files changed, 35 insertions(+), 24 deletions(-)

-- 
2.1.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] gpio: pxa: remove mach IRQ includes
  2015-01-27  4:46 [PATCH 0/3] PXA1928 GPIO support Rob Herring
@ 2015-01-27  4:46 ` Rob Herring
  2015-02-03 12:38   ` Linus Walleij
  2015-01-27  4:46 ` [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio Rob Herring
  2015-01-27  4:46 ` [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support Rob Herring
  2 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-01-27  4:46 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot; +Cc: linux-gpio, linux-kernel, Rob Herring

In preparation to enable ARCH_MMP on ARM64, the include of mach/irqs.h
must be eliminated. mach/irqs.h was being included for IRQ_GPIO{0,1},
but these IRQs are always passed in as resources now. We can use irq0
and irq1 and get rid of IRQ_GPIOx. Get rid of the ifdef in the process
as it is no longer needed.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
---
 drivers/gpio/gpio-pxa.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index ad3feec..b4fb8de 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -17,6 +17,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio-pxa.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/irqchip/chained_irq.h>
@@ -27,8 +28,6 @@
 #include <linux/syscore_ops.h>
 #include <linux/slab.h>
 
-#include <mach/irqs.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:
@@ -629,19 +628,18 @@ static int pxa_gpio_probe(struct platform_device *pdev)
 	}
 
 	if (!use_of) {
-#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
+		if (irq0 > 0) {
+			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);
+		}
+		if (irq1 > 0) {
+			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);
+		}
 
 		for (irq  = gpio_to_irq(gpio_offset);
 			irq <= gpio_to_irq(pxa_last_gpio); irq++) {
@@ -649,13 +647,13 @@ static int pxa_gpio_probe(struct platform_device *pdev)
 						 handle_edge_irq);
 			set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
 		}
-	} else {
-		if (irq0 > 0)
-			irq_set_chained_handler(irq0, pxa_gpio_demux_handler);
-		if (irq1 > 0)
-			irq_set_chained_handler(irq1, pxa_gpio_demux_handler);
 	}
 
+	if (irq0 > 0)
+		irq_set_chained_handler(irq0, pxa_gpio_demux_handler);
+	if (irq1 > 0)
+		irq_set_chained_handler(irq1, pxa_gpio_demux_handler);
+
 	irq_set_chained_handler(irq_mux, pxa_gpio_demux_handler);
 	return 0;
 }
-- 
2.1.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio
  2015-01-27  4:46 [PATCH 0/3] PXA1928 GPIO support Rob Herring
  2015-01-27  4:46 ` [PATCH 1/3] gpio: pxa: remove mach IRQ includes Rob Herring
@ 2015-01-27  4:46 ` Rob Herring
  2015-02-03 12:39   ` Linus Walleij
  2015-01-27  4:46 ` [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support Rob Herring
  2 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-01-27  4:46 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-kernel, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, devicetree

Add a new compatible string for PXA1928 GPIO controller. The IP block is
same as prior chips with a 6th bank added.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: devicetree@vger.kernel.org
---
 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
index b2afdb2..67a2e4e 100644
--- a/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/mrvl-gpio.txt
@@ -3,8 +3,8 @@
 Required properties:
 - compatible : Should be "intel,pxa25x-gpio", "intel,pxa26x-gpio",
 		"intel,pxa27x-gpio", "intel,pxa3xx-gpio",
-		"marvell,pxa93x-gpio", "marvell,mmp-gpio" or
-		"marvell,mmp2-gpio".
+		"marvell,pxa93x-gpio", "marvell,mmp-gpio",
+		"marvell,mmp2-gpio" or marvell,pxa1928-gpio.
 - reg : Address and length of the register set for the device
 - interrupts : Should be the port interrupt shared by all gpio pins.
   There're three gpio interrupts in arch-pxa, and they're gpio0,
-- 
2.1.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support
  2015-01-27  4:46 [PATCH 0/3] PXA1928 GPIO support Rob Herring
  2015-01-27  4:46 ` [PATCH 1/3] gpio: pxa: remove mach IRQ includes Rob Herring
  2015-01-27  4:46 ` [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio Rob Herring
@ 2015-01-27  4:46 ` Rob Herring
  2015-02-03 12:41   ` Linus Walleij
  2 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-01-27  4:46 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: linux-gpio, linux-kernel, Rob Herring, Jing Xiang, Xiangzhan Meng

Add support for PXA1928 GPIOs. The PXA1928 adds a 6th bank from previous
generations.

Signed-off-by: Jing Xiang <jxiang@marvell.com>
Signed-off-by: Xiangzhan Meng <mengxzh@marvell.com>
[robh: ported to 3.19 from vendor kernel]
Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
---
 drivers/gpio/gpio-pxa.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
index b4fb8de..2fdb04b 100644
--- a/drivers/gpio/gpio-pxa.c
+++ b/drivers/gpio/gpio-pxa.c
@@ -41,9 +41,12 @@
  * BANK 4 - 0x0104  0x0110  0x011C  0x0128  0x0134  0x0140  0x014C
  * BANK 5 - 0x0108  0x0114  0x0120  0x012C  0x0138  0x0144  0x0150
  *
+ * BANK 6 - 0x0200  0x020C  0x0218  0x0224  0x0230  0x023C  0x0248
+ *
  * NOTE:
  *   BANK 3 is only available on PXA27x and later processors.
- *   BANK 4 and 5 are only available on PXA935
+ *   BANK 4 and 5 are only available on PXA935, PXA1928
+ *   BANK 6 is only available on PXA1928
  */
 
 #define GPLR_OFFSET	0x00
@@ -56,7 +59,8 @@
 #define GAFR_OFFSET	0x54
 #define ED_MASK_OFFSET	0x9C	/* GPIO edge detection for AP side */
 
-#define BANK_OFF(n)	(((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
+#define BANK_OFF(n)	(((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100)	\
+			+ (((n) % 3) << 2))
 
 int pxa_last_gpio;
 static int irq_base;
@@ -92,6 +96,7 @@ enum pxa_gpio_type {
 	PXA93X_GPIO,
 	MMP_GPIO = 0x10,
 	MMP2_GPIO,
+	PXA1928_GPIO,
 };
 
 struct pxa_gpio_id {
@@ -139,6 +144,11 @@ static struct pxa_gpio_id mmp2_id = {
 	.gpio_nums	= 192,
 };
 
+static struct pxa_gpio_id pxa1928_id = {
+	.type		= PXA1928_GPIO,
+	.gpio_nums	= 224,
+};
+
 #define for_each_gpio_chip(i, c)			\
 	for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
 
@@ -486,6 +496,7 @@ static int pxa_gpio_nums(struct platform_device *pdev)
 	case PXA93X_GPIO:
 	case MMP_GPIO:
 	case MMP2_GPIO:
+	case PXA1928_GPIO:
 		gpio_type = pxa_id->type;
 		count = pxa_id->gpio_nums - 1;
 		break;
@@ -505,6 +516,7 @@ static const struct of_device_id pxa_gpio_dt_ids[] = {
 	{ .compatible = "marvell,pxa93x-gpio",	.data = &pxa93x_id, },
 	{ .compatible = "marvell,mmp-gpio",	.data = &mmp_id, },
 	{ .compatible = "marvell,mmp2-gpio",	.data = &mmp2_id, },
+	{ .compatible = "marvell,pxa1928-gpio",	.data = &pxa1928_id, },
 	{}
 };
 
@@ -666,6 +678,7 @@ static const struct platform_device_id gpio_id_table[] = {
 	{ "pxa93x-gpio",	(unsigned long)&pxa93x_id },
 	{ "mmp-gpio",		(unsigned long)&mmp_id },
 	{ "mmp2-gpio",		(unsigned long)&mmp2_id },
+	{ "pxa1928-gpio",	(unsigned long)&pxa1928_id },
 	{ },
 };
 
-- 
2.1.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] gpio: pxa: remove mach IRQ includes
  2015-01-27  4:46 ` [PATCH 1/3] gpio: pxa: remove mach IRQ includes Rob Herring
@ 2015-02-03 12:38   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2015-02-03 12:38 UTC (permalink / raw)
  To: Rob Herring; +Cc: Alexandre Courbot, linux-gpio, linux-kernel

On Tue, Jan 27, 2015 at 5:46 AM, Rob Herring <robh@kernel.org> wrote:

> In preparation to enable ARCH_MMP on ARM64, the include of mach/irqs.h
> must be eliminated. mach/irqs.h was being included for IRQ_GPIO{0,1},
> but these IRQs are always passed in as resources now. We can use irq0
> and irq1 and get rid of IRQ_GPIOx. Get rid of the ifdef in the process
> as it is no longer needed.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>

Nice cleanup, patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio
  2015-01-27  4:46 ` [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio Rob Herring
@ 2015-02-03 12:39   ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2015-02-03 12:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, devicetree

On Tue, Jan 27, 2015 at 5:46 AM, Rob Herring <robh@kernel.org> wrote:

> Add a new compatible string for PXA1928 GPIO controller. The IP block is
> same as prior chips with a 6th bank added.
>
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Pawel Moll <pawel.moll@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
> Cc: Kumar Gala <galak@codeaurora.org>
> Cc: devicetree@vger.kernel.org

Patch applied to the GPIO tree.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support
  2015-01-27  4:46 ` [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support Rob Herring
@ 2015-02-03 12:41   ` Linus Walleij
  2015-02-03 13:44     ` Rob Herring
  0 siblings, 1 reply; 9+ messages in thread
From: Linus Walleij @ 2015-02-03 12:41 UTC (permalink / raw)
  To: Rob Herring
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Jing Xiang, Xiangzhan Meng

On Tue, Jan 27, 2015 at 5:46 AM, Rob Herring <robh@kernel.org> wrote:

> Add support for PXA1928 GPIOs. The PXA1928 adds a 6th bank from previous
> generations.
>
> Signed-off-by: Jing Xiang <jxiang@marvell.com>
> Signed-off-by: Xiangzhan Meng <mengxzh@marvell.com>
> [robh: ported to 3.19 from vendor kernel]
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>

Patch applied...

> -#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
> +#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100)       \
> +                       + (((n) % 3) << 2))

While this is a bit convoluted.

Someone care to send a patch converting it to something like a
parseable static inline?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support
  2015-02-03 12:41   ` Linus Walleij
@ 2015-02-03 13:44     ` Rob Herring
  2015-03-02 14:46       ` Linus Walleij
  0 siblings, 1 reply; 9+ messages in thread
From: Rob Herring @ 2015-02-03 13:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Jing Xiang, Xiangzhan Meng

On Tue, Feb 3, 2015 at 6:41 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Jan 27, 2015 at 5:46 AM, Rob Herring <robh@kernel.org> wrote:
>
>> Add support for PXA1928 GPIOs. The PXA1928 adds a 6th bank from previous
>> generations.
>>
>> Signed-off-by: Jing Xiang <jxiang@marvell.com>
>> Signed-off-by: Xiangzhan Meng <mengxzh@marvell.com>
>> [robh: ported to 3.19 from vendor kernel]
>> Signed-off-by: Rob Herring <robh@kernel.org>
>> Cc: Linus Walleij <linus.walleij@linaro.org>
>> Cc: Alexandre Courbot <gnurou@gmail.com>
>
> Patch applied...
>
>> -#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
>> +#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100)       \
>> +                       + (((n) % 3) << 2))
>
> While this is a bit convoluted.
>
> Someone care to send a patch converting it to something like a
> parseable static inline?

I should have looked more closely than just taking the vendor code.
This was needlessly convoluted before and this just added on to it. It
can be simplified down to this:

#define BANK_OFF(n) (((n) / 3) << 8) + (((n) % 3) << 2)

I'll send a fix unless you want to fix up this patch.

Rob

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support
  2015-02-03 13:44     ` Rob Herring
@ 2015-03-02 14:46       ` Linus Walleij
  0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2015-03-02 14:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Jing Xiang, Xiangzhan Meng

On Tue, Feb 3, 2015 at 2:44 PM, Rob Herring <robh@kernel.org> wrote:
> On Tue, Feb 3, 2015 at 6:41 AM, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Tue, Jan 27, 2015 at 5:46 AM, Rob Herring <robh@kernel.org> wrote:
>>
>>> Add support for PXA1928 GPIOs. The PXA1928 adds a 6th bank from previous
>>> generations.
>>>
>>> Signed-off-by: Jing Xiang <jxiang@marvell.com>
>>> Signed-off-by: Xiangzhan Meng <mengxzh@marvell.com>
>>> [robh: ported to 3.19 from vendor kernel]
>>> Signed-off-by: Rob Herring <robh@kernel.org>
>>> Cc: Linus Walleij <linus.walleij@linaro.org>
>>> Cc: Alexandre Courbot <gnurou@gmail.com>
>>
>> Patch applied...
>>
>>> -#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
>>> +#define BANK_OFF(n)    (((n) < 3) ? (n) << 2 : ((n) > 5 ? 0x200 : 0x100)       \
>>> +                       + (((n) % 3) << 2))
>>
>> While this is a bit convoluted.
>>
>> Someone care to send a patch converting it to something like a
>> parseable static inline?
>
> I should have looked more closely than just taking the vendor code.
> This was needlessly convoluted before and this just added on to it. It
> can be simplified down to this:
>
> #define BANK_OFF(n) (((n) / 3) << 8) + (((n) % 3) << 2)
>
> I'll send a fix unless you want to fix up this patch.

I never saw a fixup patch, so if you have time... please tend to it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-02 14:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-27  4:46 [PATCH 0/3] PXA1928 GPIO support Rob Herring
2015-01-27  4:46 ` [PATCH 1/3] gpio: pxa: remove mach IRQ includes Rob Herring
2015-02-03 12:38   ` Linus Walleij
2015-01-27  4:46 ` [PATCH 2/3] dt/bindings: gpio: add compatible string for marvell,pxa1928-gpio Rob Herring
2015-02-03 12:39   ` Linus Walleij
2015-01-27  4:46 ` [PATCH 3/3] gpio: pxa: add PXA1928 gpio type support Rob Herring
2015-02-03 12:41   ` Linus Walleij
2015-02-03 13:44     ` Rob Herring
2015-03-02 14:46       ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).