diff mbox

[3/3] ARM: dts: dove: Integrate devicetree support

Message ID 1341318868-24567-6-git-send-email-sebastian.hesselbarth@googlemail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sebastian Hesselbarth July 3, 2012, 12:34 p.m. UTC
This integrates devicetree support for Marvell Dove and currently
suppported boards.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-dove/Kconfig       |   20 ++++++++++++++++++++
 arch/arm/mach-dove/Makefile      |    4 ++++
 arch/arm/mach-dove/Makefile.boot |    3 +++
 arch/arm/mach-dove/common.c      |   17 +++++++++--------
 arch/arm/mach-dove/common.h      |   25 +++++++++++++++++++++++++
 5 files changed, 61 insertions(+), 8 deletions(-)

Comments

Rob Herring July 7, 2012, 7:34 p.m. UTC | #1
On 07/03/2012 07:34 AM, Sebastian Hesselbarth wrote:
> This integrates devicetree support for Marvell Dove and currently
> suppported boards.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@googlemail.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  arch/arm/mach-dove/Kconfig       |   20 ++++++++++++++++++++
>  arch/arm/mach-dove/Makefile      |    4 ++++
>  arch/arm/mach-dove/Makefile.boot |    3 +++
>  arch/arm/mach-dove/common.c      |   17 +++++++++--------
>  arch/arm/mach-dove/common.h      |   25 +++++++++++++++++++++++++
>  5 files changed, 61 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
> index dd937c5..8dff8fc 100644
> --- a/arch/arm/mach-dove/Kconfig
> +++ b/arch/arm/mach-dove/Kconfig
> @@ -15,6 +15,26 @@ config MACH_CM_A510
>  	  Say 'Y' here if you want your kernel to support the
>  	  CompuLab CM-A510 Board.
>  
> +config ARCH_DOVE_DT
> +	bool "Marvell Dove Flattened Device Tree"
> +	select USE_OF
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  Marvell Dove using flattened device tree.
> +
> +config MACH_DOVE_DB_DT
> +	bool "Marvell DB-MV88AP510 Development Board (Flattened Device Tree)"
> +	select ARCH_DOVE_DT
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  Marvell DB-MV88AP510 Development Board (Flattened Device Tree).
> +
> +config MACH_CM_A510_DT
> +	bool "CompuLab CM-A510 Board (Flattened Device Tree)"
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  CompuLab CM-A510 Board (Flattened Device Tree).
> +

You should remove these board config options. A goal with DT is to
remove board related code.

>  endmenu
>  
>  endif
> diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile
> index fa0f018..bdb39f5 100644
> --- a/arch/arm/mach-dove/Makefile
> +++ b/arch/arm/mach-dove/Makefile
> @@ -2,3 +2,7 @@ obj-y				+= common.o addr-map.o irq.o pcie.o mpp.o
>  
>  obj-$(CONFIG_MACH_DOVE_DB)	+= dove-db-setup.o
>  obj-$(CONFIG_MACH_CM_A510)	+= cm-a510.o
> +
> +obj-$(CONFIG_ARCH_DOVE_DT)		+= board-dt.o
> +obj-$(CONFIG_MACH_DOVE_DB_DT)	+= board-dove-db.o
> +obj-$(CONFIG_MACH_CM_A510_DT)	+= board-cm-a510.o
> diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
> index 760a0ef..185e988 100644
> --- a/arch/arm/mach-dove/Makefile.boot
> +++ b/arch/arm/mach-dove/Makefile.boot
> @@ -1,3 +1,6 @@
>     zreladdr-y	+= 0x00008000
>  params_phys-y	:= 0x00000100
>  initrd_phys-y	:= 0x00800000
> +
> +dtb-$(CONFIG_MACH_DOVE_DB_DT) += dove-dove-db.dtb
> +dtb-$(CONFIG_MACH_CM_A510_DT) += dove-cm-a510.dtb
> diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
> index 9493076..6236035 100644
> --- a/arch/arm/mach-dove/common.c
> +++ b/arch/arm/mach-dove/common.c
> @@ -33,8 +33,6 @@
>  #include <plat/addr-map.h>
>  #include "common.h"
>  
> -static int get_tclk(void);
> -
>  /*****************************************************************************
>   * I/O Address Mapping
>   ****************************************************************************/
> @@ -72,10 +70,10 @@ void __init dove_map_io(void)
>   ****************************************************************************/
>  static struct clk *tclk;
>  
> -static void __init clk_init(void)
> +void __init dove_clk_init(void)
>  {
>  	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
> -				       get_tclk());
> +				       dove_tclk);
>  
>  	orion_clkdev_init(tclk);
>  }
> @@ -187,7 +185,9 @@ void __init dove_init_early(void)
>  	orion_time_set_base(TIMER_VIRT_BASE);
>  }
>  
> -static int get_tclk(void)
> +int dove_tclk;
> +
> +static int __init dove_find_tclk(void)
>  {
>  	/* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
>  	return 166666667;
> @@ -195,8 +195,9 @@ static int get_tclk(void)
>  
>  static void __init dove_timer_init(void)
>  {
> +	dove_tclk = dove_find_tclk();
>  	orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
> -			IRQ_DOVE_BRIDGE, get_tclk());
> +			IRQ_DOVE_BRIDGE, dove_tclk);
>  }
>  
>  struct sys_timer dove_timer = {
> @@ -285,7 +286,7 @@ void __init dove_sdio1_init(void)
>  void __init dove_init(void)
>  {
>  	printk(KERN_INFO "Dove 88AP510 SoC, ");
> -	printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000);
> +	printk(KERN_INFO "TCLK = %dMHz\n", (dove_tclk + 499999) / 1000000);
>  
>  #ifdef CONFIG_CACHE_TAUROS2
>  	tauros2_init();
> @@ -293,7 +294,7 @@ void __init dove_init(void)
>  	dove_setup_cpu_mbus();
>  
>  	/* Setup root of clk tree */
> -	clk_init();
> +	dove_clk_init();
>  
>  	/* internal devices that every board has */
>  	dove_rtc_init();
> diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
> index 6432a3b..a11f842 100644
> --- a/arch/arm/mach-dove/common.h
> +++ b/arch/arm/mach-dove/common.h
> @@ -40,4 +40,29 @@ void dove_sdio0_init(void);
>  void dove_sdio1_init(void);
>  void dove_restart(char, const char *);
>  
> +/* board init functions for boards not fully converted to fdt */
> +#ifdef CONFIG_MACH_DOVE_DB_DT
> +void dove_db_init(void);
> +#else
> +static inline void dove_db_init(void) {};
> +#endif
> +
> +#ifdef CONFIG_MACH_CM_A510_DT
> +void cm_a510_init(void);
> +#else
> +static inline void cm_a510_init(void) {};
> +#endif
> +
> +/* early init functions not converted to fdt yet */
> +void dove_clk_init(void);
> +void dove_rtc_init(void);
> +void dove_xor0_init(void);
> +void dove_xor1_init(void);
> +
> +extern int dove_tclk;
> +
> +#ifdef CONFIG_CACHE_TAUROS2
> +#include <asm/hardware/cache-tauros2.h>
> +#endif
> +
>  #endif
>
Sebastian Hesselbarth July 7, 2012, 9:08 p.m. UTC | #2
On 07/07/2012 09:34 PM, Rob Herring wrote:
> On 07/03/2012 07:34 AM, Sebastian Hesselbarth wrote:
>> This integrates devicetree support for Marvell Dove and currently
>> suppported boards.
>>
> You should remove these board config options. A goal with DT is to
> remove board related code.

Hi Rob,

I should have mentioned that this patch series' main goal was not
to present a full blown DT support for mach-dove but to keep up
with ongoing DT support for mach-kirkwood by Andrew Lunn. Both
machs heavily rely on plat-orion and these patches were meant to
help porting to DT.

I can keep the patches for now and resend them later when more
core stuff of plat-orion has been ported to DT.

Sebastian
Arnd Bergmann July 8, 2012, 6:57 p.m. UTC | #3
On Saturday 07 July 2012, Sebastian Hesselbarth wrote:
> I should have mentioned that this patch series' main goal was not
> to present a full blown DT support for mach-dove but to keep up
> with ongoing DT support for mach-kirkwood by Andrew Lunn. Both
> machs heavily rely on plat-orion and these patches were meant to
> help porting to DT.
> 
> I can keep the patches for now and resend them later when more
> core stuff of plat-orion has been ported to DT.

A lot of the devices you have in your new board files actually
have DT bindings already or have patches that got posted.

I think it makes more sense for mach-dove to go all the way
from the start:

* Add full .dts files for the two boards that are already supported
in mainline, and for the board you are testing with

* Add your board-dt.c contents directly to common.c

* Have no other board-* files at all, but instead work on adding
the missing bindings.

I don't think there is much value in duplicating the two exisitng
board files like your patch does. Adding support for a new mach-dove
board should be doable without such a file in 3.6.

	Arnd
diff mbox

Patch

diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index dd937c5..8dff8fc 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -15,6 +15,26 @@  config MACH_CM_A510
 	  Say 'Y' here if you want your kernel to support the
 	  CompuLab CM-A510 Board.
 
+config ARCH_DOVE_DT
+	bool "Marvell Dove Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Dove using flattened device tree.
+
+config MACH_DOVE_DB_DT
+	bool "Marvell DB-MV88AP510 Development Board (Flattened Device Tree)"
+	select ARCH_DOVE_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DB-MV88AP510 Development Board (Flattened Device Tree).
+
+config MACH_CM_A510_DT
+	bool "CompuLab CM-A510 Board (Flattened Device Tree)"
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  CompuLab CM-A510 Board (Flattened Device Tree).
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-dove/Makefile b/arch/arm/mach-dove/Makefile
index fa0f018..bdb39f5 100644
--- a/arch/arm/mach-dove/Makefile
+++ b/arch/arm/mach-dove/Makefile
@@ -2,3 +2,7 @@  obj-y				+= common.o addr-map.o irq.o pcie.o mpp.o
 
 obj-$(CONFIG_MACH_DOVE_DB)	+= dove-db-setup.o
 obj-$(CONFIG_MACH_CM_A510)	+= cm-a510.o
+
+obj-$(CONFIG_ARCH_DOVE_DT)		+= board-dt.o
+obj-$(CONFIG_MACH_DOVE_DB_DT)	+= board-dove-db.o
+obj-$(CONFIG_MACH_CM_A510_DT)	+= board-cm-a510.o
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 760a0ef..185e988 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -1,3 +1,6 @@ 
    zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DOVE_DB_DT) += dove-dove-db.dtb
+dtb-$(CONFIG_MACH_CM_A510_DT) += dove-cm-a510.dtb
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 9493076..6236035 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -33,8 +33,6 @@ 
 #include <plat/addr-map.h>
 #include "common.h"
 
-static int get_tclk(void);
-
 /*****************************************************************************
  * I/O Address Mapping
  ****************************************************************************/
@@ -72,10 +70,10 @@  void __init dove_map_io(void)
  ****************************************************************************/
 static struct clk *tclk;
 
-static void __init clk_init(void)
+void __init dove_clk_init(void)
 {
 	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
-				       get_tclk());
+				       dove_tclk);
 
 	orion_clkdev_init(tclk);
 }
@@ -187,7 +185,9 @@  void __init dove_init_early(void)
 	orion_time_set_base(TIMER_VIRT_BASE);
 }
 
-static int get_tclk(void)
+int dove_tclk;
+
+static int __init dove_find_tclk(void)
 {
 	/* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
 	return 166666667;
@@ -195,8 +195,9 @@  static int get_tclk(void)
 
 static void __init dove_timer_init(void)
 {
+	dove_tclk = dove_find_tclk();
 	orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
-			IRQ_DOVE_BRIDGE, get_tclk());
+			IRQ_DOVE_BRIDGE, dove_tclk);
 }
 
 struct sys_timer dove_timer = {
@@ -285,7 +286,7 @@  void __init dove_sdio1_init(void)
 void __init dove_init(void)
 {
 	printk(KERN_INFO "Dove 88AP510 SoC, ");
-	printk(KERN_INFO "TCLK = %dMHz\n", (get_tclk() + 499999) / 1000000);
+	printk(KERN_INFO "TCLK = %dMHz\n", (dove_tclk + 499999) / 1000000);
 
 #ifdef CONFIG_CACHE_TAUROS2
 	tauros2_init();
@@ -293,7 +294,7 @@  void __init dove_init(void)
 	dove_setup_cpu_mbus();
 
 	/* Setup root of clk tree */
-	clk_init();
+	dove_clk_init();
 
 	/* internal devices that every board has */
 	dove_rtc_init();
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
index 6432a3b..a11f842 100644
--- a/arch/arm/mach-dove/common.h
+++ b/arch/arm/mach-dove/common.h
@@ -40,4 +40,29 @@  void dove_sdio0_init(void);
 void dove_sdio1_init(void);
 void dove_restart(char, const char *);
 
+/* board init functions for boards not fully converted to fdt */
+#ifdef CONFIG_MACH_DOVE_DB_DT
+void dove_db_init(void);
+#else
+static inline void dove_db_init(void) {};
+#endif
+
+#ifdef CONFIG_MACH_CM_A510_DT
+void cm_a510_init(void);
+#else
+static inline void cm_a510_init(void) {};
+#endif
+
+/* early init functions not converted to fdt yet */
+void dove_clk_init(void);
+void dove_rtc_init(void);
+void dove_xor0_init(void);
+void dove_xor1_init(void);
+
+extern int dove_tclk;
+
+#ifdef CONFIG_CACHE_TAUROS2
+#include <asm/hardware/cache-tauros2.h>
+#endif
+
 #endif