public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: pxa: prepare pxa25x interrupts for device-tree platforms
@ 2016-04-10 19:29 Robert Jarzmik
  2016-04-10 19:29 ` [PATCH 2/3] ARM: pxa: add pxa25x device-tree support Robert Jarzmik
       [not found] ` <1460316600-15978-1-git-send-email-robert.jarzmik-GANU6spQydw@public.gmane.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Jarzmik @ 2016-04-10 19:29 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
  Cc: linux-arm-kernel, devicetree, linux-kernel

Add the device-tree interrupts initialization function required to have
a generic pxa25x device-tree machine.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/mach-pxa/generic.h | 1 +
 arch/arm/mach-pxa/pxa25x.c  | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 0b1dbb54871a..3f914d97cac2 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -27,6 +27,7 @@ extern void pxa_timer_init(void);
 
 #define pxa25x_handle_irq icip_handle_irq
 extern int __init pxa25x_clocks_init(void);
+extern void __init pxa25x_dt_init_irq(void);
 extern void __init pxa25x_init_irq(void);
 extern void __init pxa25x_map_io(void);
 extern void __init pxa26x_init_irq(void);
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 823504f48f80..a0de9a9ae64e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -151,6 +151,12 @@ void __init pxa26x_init_irq(void)
 }
 #endif
 
+void __init pxa25x_dt_init_irq(void)
+{
+	if (IS_ENABLED(CONFIG_OF))
+		pxa_dt_irq_init(pxa25x_set_wake);
+}
+
 static struct map_desc pxa25x_io_desc[] __initdata = {
 	{	/* Mem Ctl */
 		.virtual	= (unsigned long)SMEMC_VIRT,
-- 
2.1.4

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

* [PATCH 2/3] ARM: pxa: add pxa25x device-tree support
  2016-04-10 19:29 [PATCH 1/3] ARM: pxa: prepare pxa25x interrupts for device-tree platforms Robert Jarzmik
@ 2016-04-10 19:29 ` Robert Jarzmik
  2016-04-17 15:24   ` Arnd Bergmann
       [not found] ` <1460316600-15978-1-git-send-email-robert.jarzmik-GANU6spQydw@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Robert Jarzmik @ 2016-04-10 19:29 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
  Cc: linux-arm-kernel, devicetree, linux-kernel

Add a device-tree machine entry (DT_MACHINE_START) for pxa25x based
platforms.

Take the opportunity to sort the file machine descriptions by
alphabetical order.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 arch/arm/mach-pxa/Kconfig  | 11 +++++++++++
 arch/arm/mach-pxa/Makefile |  3 ++-
 arch/arm/mach-pxa/pxa-dt.c | 37 ++++++++++++++++++++++++++-----------
 arch/arm/mach-pxa/pxa25x.c | 12 ++++++------
 4 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index cd894d69e766..76fbc115ec33 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -4,6 +4,17 @@ menu "Intel PXA2xx/PXA3xx Implementations"
 
 comment "Intel/Marvell Dev Platforms (sorted by hardware release time)"
 
+config MACH_PXA25X_DT
+	bool "Support PXA25x platforms from device tree"
+	select PINCTRL
+	select POWER_SUPPLY
+	select PXA25x
+	select USE_OF
+	help
+	  Include support for Marvell PXA25x based platforms using
+	  the device tree. Needn't select any other machine while
+	  MACH_PXA25x_DT is enabled.
+
 config MACH_PXA27X_DT
 	bool "Support PXA27x platforms from device tree"
 	select PINCTRL
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 2ceed407eda9..ef25dc597f30 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -19,8 +19,9 @@ obj-$(CONFIG_CPU_PXA930)	+= pxa930.o
 # NOTE: keep the order of boards in accordance to their order in Kconfig
 
 # Device Tree support
-obj-$(CONFIG_MACH_PXA3XX_DT)	+= pxa-dt.o
+obj-$(CONFIG_MACH_PXA25X_DT)	+= pxa-dt.o
 obj-$(CONFIG_MACH_PXA27X_DT)	+= pxa-dt.o
+obj-$(CONFIG_MACH_PXA3XX_DT)	+= pxa-dt.o
 
 # Intel/Marvell Dev Platforms
 obj-$(CONFIG_ARCH_LUBBOCK)	+= lubbock.o
diff --git a/arch/arm/mach-pxa/pxa-dt.c b/arch/arm/mach-pxa/pxa-dt.c
index f128133a8f30..3e331e61f995 100644
--- a/arch/arm/mach-pxa/pxa-dt.c
+++ b/arch/arm/mach-pxa/pxa-dt.c
@@ -18,20 +18,18 @@
 
 #include "generic.h"
 
-#ifdef CONFIG_PXA3xx
-static const char *const pxa3xx_dt_board_compat[] __initconst = {
-	"marvell,pxa300",
-	"marvell,pxa310",
-	"marvell,pxa320",
+#ifdef CONFIG_PXA25x
+static const char * const pxa25x_dt_board_compat[] __initconst = {
+	"marvell,pxa250",
 	NULL,
 };
 
-DT_MACHINE_START(PXA_DT, "Marvell PXA3xx (Device Tree Support)")
-	.map_io		= pxa3xx_map_io,
-	.init_irq	= pxa3xx_dt_init_irq,
-	.handle_irq	= pxa3xx_handle_irq,
+DT_MACHINE_START(PXA25X_DT, "Marvell PXA25x (Device Tree Support)")
+	.map_io		= pxa25x_map_io,
+	.init_irq	= pxa25x_dt_init_irq,
+	.handle_irq	= pxa25x_handle_irq,
 	.restart	= pxa_restart,
-	.dt_compat	= pxa3xx_dt_board_compat,
+	.dt_compat	= pxa25x_dt_board_compat,
 MACHINE_END
 #endif
 
@@ -41,7 +39,7 @@ static const char * const pxa27x_dt_board_compat[] __initconst = {
 	NULL,
 };
 
-DT_MACHINE_START(PXA27X_DT, "Marvell PXA2xx (Device Tree Support)")
+DT_MACHINE_START(PXA27X_DT, "Marvell PXA27x (Device Tree Support)")
 	.map_io		= pxa27x_map_io,
 	.init_irq	= pxa27x_dt_init_irq,
 	.handle_irq	= pxa27x_handle_irq,
@@ -49,3 +47,20 @@ DT_MACHINE_START(PXA27X_DT, "Marvell PXA2xx (Device Tree Support)")
 	.dt_compat	= pxa27x_dt_board_compat,
 MACHINE_END
 #endif
+
+#ifdef CONFIG_PXA3xx
+static const char *const pxa3xx_dt_board_compat[] __initconst = {
+	"marvell,pxa300",
+	"marvell,pxa310",
+	"marvell,pxa320",
+	NULL,
+};
+
+DT_MACHINE_START(PXA_DT, "Marvell PXA3xx (Device Tree Support)")
+	.map_io		= pxa3xx_map_io,
+	.init_irq	= pxa3xx_dt_init_irq,
+	.handle_irq	= pxa3xx_handle_irq,
+	.restart	= pxa_restart,
+	.dt_compat	= pxa3xx_dt_board_compat,
+MACHINE_END
+#endif
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index a0de9a9ae64e..6110fa91be5e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -212,12 +212,12 @@ static int __init pxa25x_init(void)
 		register_syscore_ops(&pxa_irq_syscore_ops);
 		register_syscore_ops(&pxa2xx_mfp_syscore_ops);
 
-		pxa2xx_set_dmac_info(16, 40);
-		pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
-		ret = platform_add_devices(pxa25x_devices,
-					   ARRAY_SIZE(pxa25x_devices));
-		if (ret)
-			return ret;
+		if (!of_have_populated_dt()) {
+			pxa2xx_set_dmac_info(16, 40);
+			pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info);
+			ret = platform_add_devices(pxa25x_devices,
+						   ARRAY_SIZE(pxa25x_devices));
+		}
 	}
 
 	return ret;
-- 
2.1.4

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

* [PATCH 3/3] ARM: dts: add pxa25x .dtsi file
       [not found] ` <1460316600-15978-1-git-send-email-robert.jarzmik-GANU6spQydw@public.gmane.org>
@ 2016-04-10 19:30   ` Robert Jarzmik
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Jarzmik @ 2016-04-10 19:30 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

This file describes pxa25x SoCs. Not all devices are listed yet, only
the subset which was already tested with a lubbock board.

Signed-off-by: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
---
 arch/arm/boot/dts/pxa25x.dtsi | 92 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 arch/arm/boot/dts/pxa25x.dtsi

diff --git a/arch/arm/boot/dts/pxa25x.dtsi b/arch/arm/boot/dts/pxa25x.dtsi
new file mode 100644
index 000000000000..0d1e012178c4
--- /dev/null
+++ b/arch/arm/boot/dts/pxa25x.dtsi
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2016 Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+#include "pxa2xx.dtsi"
+#include "dt-bindings/clock/pxa-clock.h"
+
+/ {
+	model = "Marvell PXA25x family SoC";
+	compatible = "marvell,pxa250";
+
+	clocks {
+	       /*
+		* The muxing of external clocks/internal dividers for osc* clock
+		* sources has been hidden under the carpet by now.
+		*/
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		clks: pxa2xx_clks@41300004 {
+			compatible = "marvell,pxa250-core-clocks";
+			#clock-cells = <1>;
+			status = "okay";
+		};
+
+		/* timer oscillator */
+		clktimer: oscillator {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency  = <3686400>;
+			clock-output-names = "ostimer";
+		};
+	};
+
+	pxabus {
+		pdma: dma-controller@40000000 {
+			compatible = "marvell,pdma-1.0";
+			reg = <0x40000000 0x10000>;
+			interrupts = <25>;
+			#dma-channels = <16>;
+			#dma-cells = <2>;
+			#dma-requests = <40>;
+			status = "okay";
+		};
+
+		pxairq: interrupt-controller@40d00000 {
+			marvell,intc-priority;
+			marvell,intc-nr-irqs = <32>;
+		};
+
+		pinctrl: pinctrl@40e00000 {
+			reg = <0x40e00054 0x20 0x40e0000c 0xc 0x40e0010c 4
+			       0x40f00020 0x10>;
+			compatible = "marvell,pxa25x-pinctrl";
+		};
+
+		gpio: gpio@40e00000 {
+			compatible = "intel,pxa25x-gpio";
+			gpio-ranges = <&pinctrl 0 0 84>;
+			clocks = <&clks CLK_NONE>;
+		};
+
+		pwm0: pwm@40b00000 {
+			compatible = "marvell,pxa250-pwm";
+			reg = <0x40b00000 0x10>;
+			#pwm-cells = <1>;
+			clocks = <&clks CLK_PWM0>;
+		};
+
+		pwm1: pwm@40b00010 {
+			compatible = "marvell,pxa250-pwm";
+			reg = <0x40b00010 0x10>;
+			#pwm-cells = <1>;
+			clocks = <&clks CLK_PWM1>;
+		};
+	};
+
+	timer@40a00000 {
+		compatible = "marvell,pxa-timer";
+		reg = <0x40a00000 0x20>;
+		interrupts = <26>;
+		clocks = <&clktimer>;
+		status = "okay";
+	};
+};
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/3] ARM: pxa: add pxa25x device-tree support
  2016-04-10 19:29 ` [PATCH 2/3] ARM: pxa: add pxa25x device-tree support Robert Jarzmik
@ 2016-04-17 15:24   ` Arnd Bergmann
  2016-04-20  6:37     ` Robert Jarzmik
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2016-04-17 15:24 UTC (permalink / raw)
  To: Robert Jarzmik
  Cc: Daniel Mack, Haojian Zhuang, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala, linux-arm-kernel,
	devicetree, linux-kernel

On Sunday 10 April 2016 21:29:59 Robert Jarzmik wrote:
> +
> +DT_MACHINE_START(PXA_DT, "Marvell PXA3xx (Device Tree Support)")
> +       .map_io         = pxa3xx_map_io,
> +       .init_irq       = pxa3xx_dt_init_irq,
> +       .handle_irq     = pxa3xx_handle_irq,
> +       .restart        = pxa_restart,
> +       .dt_compat      = pxa3xx_dt_board_compat,
> +MACHINE_END
> 

Nothing wrong with your series, it's a straightforward continuation of what
you have for the other platforms, but I have a few comments on the method
overall, and it might be good if you could work on improving those next,
basically eliminating most of the machine descriptor contents in the long
run:

- It would be nice not to call map_io() at all and instead ensure that all
  drivers that have DT bindings use ioremap. The main reason for this is
  that relying on the hardwired mapping makes it easy to get things wrong
  in the bindings, by leaving out required memory ranges.

- The init_irq()/handle_irq() callbacks can probably be replaced with
  a IRQCHIP_DECLARE() statement per irqchip variant, which then goes
  on to initialize the controller and set the handler.

- The restart method is the least important here, but I guess we can
  convert that into a driver, or use an existing one from DT, like
  drivers/power/reset/gpio-restart.c

	Arnd

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

* Re: [PATCH 2/3] ARM: pxa: add pxa25x device-tree support
  2016-04-17 15:24   ` Arnd Bergmann
@ 2016-04-20  6:37     ` Robert Jarzmik
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Jarzmik @ 2016-04-20  6:37 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Daniel Mack, Haojian Zhuang, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Kumar Gala,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> writes:

> On Sunday 10 April 2016 21:29:59 Robert Jarzmik wrote:
>> +
>> +DT_MACHINE_START(PXA_DT, "Marvell PXA3xx (Device Tree Support)")
>> +       .map_io         = pxa3xx_map_io,
>> +       .init_irq       = pxa3xx_dt_init_irq,
>> +       .handle_irq     = pxa3xx_handle_irq,
>> +       .restart        = pxa_restart,
>> +       .dt_compat      = pxa3xx_dt_board_compat,
>> +MACHINE_END
>> 
>
> Nothing wrong with your series, it's a straightforward continuation of what
> you have for the other platforms, but I have a few comments on the method
> overall, and it might be good if you could work on improving those next,
> basically eliminating most of the machine descriptor contents in the long
> run:
>
> - It would be nice not to call map_io() at all and instead ensure that all
>   drivers that have DT bindings use ioremap. The main reason for this is
>   that relying on the hardwired mapping makes it easy to get things wrong
>   in the bindings, by leaving out required memory ranges.
Okay, that sounds good, I'll add it to my todo list.
I seem to remember some legacy driver relying on one of these mapping (cpufreq
for pxa relying on memory controller maybe ...), but that's a fix easy enough to
queue. Let's hope I'm not bitten by something else.

> - The init_irq()/handle_irq() callbacks can probably be replaced with
>   a IRQCHIP_DECLARE() statement per irqchip variant, which then goes
>   on to initialize the controller and set the handler.
Okay, I'll verify that, especially that the ordering is ensured, ie. that
interrupts are available at the same time that when it was the machine code
calling the irq init, and that's also going to my todo list.

>
> - The restart method is the least important here, but I guess we can
>   convert that into a driver, or use an existing one from DT, like
>   drivers/power/reset/gpio-restart.c
I think most of the required stuff is already done. The only remaining part is
the reset status clearing specific to pxa, which as you said would ask for a
very tiny driver.

As soon as I'm done with the ac97 rework and if no v4l2 pressure is applied to
pxa, I'll work on this and the MMP to pinctrl conversion.

Thanks for the comments, and cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-04-20  6:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 19:29 [PATCH 1/3] ARM: pxa: prepare pxa25x interrupts for device-tree platforms Robert Jarzmik
2016-04-10 19:29 ` [PATCH 2/3] ARM: pxa: add pxa25x device-tree support Robert Jarzmik
2016-04-17 15:24   ` Arnd Bergmann
2016-04-20  6:37     ` Robert Jarzmik
     [not found] ` <1460316600-15978-1-git-send-email-robert.jarzmik-GANU6spQydw@public.gmane.org>
2016-04-10 19:30   ` [PATCH 3/3] ARM: dts: add pxa25x .dtsi file Robert Jarzmik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox