Skip to contentSkip to conversation

ARM: dts: dove: Basic devicetree support for Marvell Dove

PATCH New Sebastian Hesselbarth 5 participants 13 messages Jul 3, 2012 – Jul 8, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM: dts: dove: Basic devicetree support for Marvell Dove

This patch series add very basic devicetree support for Marvell Dove. It is based on Kirkwood dts and therefore supports uart and rtc by dt only.

The patches have not been tested on neither Dove-DB nor CM-A510 but on SolidRun Cubox that is not supported by mainline kernel, yet.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org

Sebastian Hesselbarth (3):
ARM: dts: dove: Add devicetree descriptors
ARM: dts: dove: Add devicetree-based board setup
ARM: dts: dove: Integrate devicetree support

 arch/arm/boot/dts/dove-cm-a510.dtsi |   27 ++++++++++
 arch/arm/boot/dts/dove-dove-db.dtsi |   27 ++++++++++
 arch/arm/boot/dts/dove.dtsi         |   55 +++++++++++++++++++++
 arch/arm/mach-dove/Kconfig          |   20 ++++++++
 arch/arm/mach-dove/Makefile         |    4 ++
 arch/arm/mach-dove/Makefile.boot    |    3 ++
 arch/arm/mach-dove/board-cm-a510.c  |   86 ++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dove-db.c  |   92 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dt.c       |   73 +++++++++++++++++++++++++++
 arch/arm/mach-dove/common.c         |   17 ++++---
 arch/arm/mach-dove/common.h         |   25 ++++++++++
 12 files changed, 444 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dtsi
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dtsi
 create mode 100644 arch/arm/boot/dts/dove.dtsi
 create mode 100644 arch/arm/mach-dove/board-cm-a510.c
 create mode 100644 arch/arm/mach-dove/board-dove-db.c
 create mode 100644 arch/arm/mach-dove/board-dt.c
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/3 ARM: dts: dove: Add devicetree descriptors

This adds devicetree descriptors for Marvell Dove and currently supported boards.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/boot/dts/dove-cm-a510.dtsi |   27 +++++++++++++++++
 arch/arm/boot/dts/dove-dove-db.dtsi |   27 +++++++++++++++++
 arch/arm/boot/dts/dove.dtsi         |   55 +++++++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dtsi
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dtsi
 create mode 100644 arch/arm/boot/dts/dove.dtsi
arch/arm/boot/dts/dove-cm-a510.dtsi new file +27 -0
new file mode 100644
index 0000000..5cdebbb
@@ -0,0 +1,27 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Compulab CM-A510";
+	compatible = "compulab,cm-a510", "mrvl,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			status = "ok";
+		};
+
+		serial at 12100 {
+			status = "ok";
+		};
+	};
+};
arch/arm/boot/dts/dove-dove-db.dtsi new file +27 -0
new file mode 100644
index 0000000..16c4a65
@@ -0,0 +1,27 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Marvell DB-MV88AP510-BP Development Board";
+	compatible = "marvell,dove-db", "mrvl,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			status = "ok";
+		};
+
+		serial at 12100 {
+			status = "ok";
+		};
+	};
+};
arch/arm/boot/dts/dove.dtsi new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
1.7.10
#2 lore raw

PATCH 1/3 ARM: dts: dove: Add devicetree descriptors

Quoted 2 lines · Sebastian Hesselbarth

This adds devicetree descriptors for Marvell Dove and currently supported boards.

[snip]

Quoted 9 lines
arch/arm/boot/dts/dove.dtsi new file +6 -0
@@ -0,0 +1,55 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "mrvl,dove";
+
+	ocp at f1000000 {

arch/arm/boot/dts/dove.dtsi line 16

Quoted 10 lines
arch/arm/boot/dts/dove.dtsi new file +10 -0
+		compatible = "simple-bus";
+		ranges = <0 0xf1000000 0x8000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		serial at 12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <7>;

This requires having an interrupt parent node which is missing. Since the parent defines the number of cells that needs to be done first.

Rob

Quoted 40 lines
arch/arm/boot/dts/dove.dtsi new file +39 -0
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		serial at 12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <8>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		serial at 12200 {
+			compatible = "ns16550a";
+			reg = <0x12200 0x100>;
+			reg-shift = <2>;
+			interrupts = <9>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		serial at 12300 {
+			compatible = "ns16550a";
+			reg = <0x12300 0x100>;
+			reg-shift = <2>;
+			interrupts = <10>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		rtc at d8500 {
+			compatible = "mrvl,dove-rtc", "mrvl,orion-rtc";
+			reg = <0xd8500 0x20>;
+			interrupts = <133>;
+		};
+
+	};
+};
#3 lore raw

PATCH 2/3 ARM: dts: dove: Add devicetree-based board setup

In reply to Sebastian Hesselbarth

This adds devicetree-based board setup files for Marvell Dove and currently supported boards.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-dove/board-cm-a510.c |   86 +++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dove-db.c |   92 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dt.c      |   73 ++++++++++++++++++++++++++++
 3 files changed, 251 insertions(+)
 create mode 100644 arch/arm/mach-dove/board-cm-a510.c
 create mode 100644 arch/arm/mach-dove/board-dove-db.c
 create mode 100644 arch/arm/mach-dove/board-dt.c
arch/arm/mach-dove/board-cm-a510.c new file +86 -0
new file mode 100644
index 0000000..1eda62f
@@ -0,0 +1,86 @@
+/*
+ * arch/arm/mach-dove/board-cm-a510.c
+ *
+ * Copyright (C) 2010 CompuLab, Ltd.
+ * Konstantin Sinyuk <[email protected]>
+ *
+ * Compulab CM-A510 Board Init
+ * for drivers not converted to flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <mach/dove.h>
+
+#include "common.h"
+
+static struct mv643xx_eth_platform_data cm_a510_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+static struct mv_sata_platform_data cm_a510_sata_data = {
+	.n_ports        = 1,
+};
+
+/*
+ * SPI Devices:
+ * SPI0: 1M Flash Winbond w25q32bv
+ */
+static const struct flash_platform_data cm_a510_spi_flash_data = {
+	.type		= "w25q32bv",
+};
+
+static struct spi_board_info __initdata cm_a510_spi_flash_info[] = {
+	{
+		.modalias       = "m25p80",
+		.platform_data  = &cm_a510_spi_flash_data,
+		.irq            = -1,
+		.max_speed_hz   = 20000000,
+		.bus_num        = 0,
+		.chip_select    = 0,
+	},
+};
+
+static int __init cm_a510_pci_init(void)
+{
+	if (machine_is_cm_a510())
+		dove_pcie_init(1, 1);
+
+	return 0;
+}
+
+subsys_initcall(cm_a510_pci_init);
+
+/* Board Init */
+void __init cm_a510_init(void)
+{
+	/*
+	 * Basic Dove setup. Needs to be called early.
+	 */
+	dove_init();
+
+	dove_ge00_init(&cm_a510_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_sata_init(&cm_a510_sata_data);
+	dove_sdio0_init();
+	dove_sdio1_init();
+	dove_spi0_init();
+	dove_spi1_init();
+	dove_i2c_init();
+	spi_register_board_info(cm_a510_spi_flash_info,
+				ARRAY_SIZE(cm_a510_spi_flash_info));
+}
arch/arm/mach-dove/board-dove-db.c new file +92 -0

92 lines not on this page · raw message

arch/arm/mach-dove/board-dt.c new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
1.7.10
#4 lore raw

PATCH 2/3 ARM: dts: dove: Add devicetree-based board setup

Quoted 11 lines · Sebastian Hesselbarth

This adds devicetree-based board setup files for Marvell Dove and currently supported boards.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 arch/arm/mach-dove/board-cm-a510.c |   86 +++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dove-db.c |   92 ++++++++++++++++++++++++++++++++++++

Much of this code will be removed with proper bindings and is the same for these 2 boards. I'd rather see a more minimal board support starting with interrupts and platform device creation from DT.

Rob

Quoted 276 lines
 arch/arm/mach-dove/board-dt.c      |   73 ++++++++++++++++++++++++++++
 3 files changed, 251 insertions(+)
 create mode 100644 arch/arm/mach-dove/board-cm-a510.c
 create mode 100644 arch/arm/mach-dove/board-dove-db.c
 create mode 100644 arch/arm/mach-dove/board-dt.c
arch/arm/mach-dove/board-cm-a510.c new file +86 -0
new file mode 100644
index 0000000..1eda62f
@@ -0,0 +1,86 @@
+/*
+ * arch/arm/mach-dove/board-cm-a510.c
+ *
+ * Copyright (C) 2010 CompuLab, Ltd.
+ * Konstantin Sinyuk <[email protected]>
+ *
+ * Compulab CM-A510 Board Init
+ * for drivers not converted to flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+
+#include <mach/dove.h>
+
+#include "common.h"
+
+static struct mv643xx_eth_platform_data cm_a510_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+static struct mv_sata_platform_data cm_a510_sata_data = {
+	.n_ports        = 1,
+};
+
+/*
+ * SPI Devices:
+ * SPI0: 1M Flash Winbond w25q32bv
+ */
+static const struct flash_platform_data cm_a510_spi_flash_data = {
+	.type		= "w25q32bv",
+};
+
+static struct spi_board_info __initdata cm_a510_spi_flash_info[] = {
+	{
+		.modalias       = "m25p80",
+		.platform_data  = &cm_a510_spi_flash_data,
+		.irq            = -1,
+		.max_speed_hz   = 20000000,
+		.bus_num        = 0,
+		.chip_select    = 0,
+	},
+};
+
+static int __init cm_a510_pci_init(void)
+{
+	if (machine_is_cm_a510())
+		dove_pcie_init(1, 1);
+
+	return 0;
+}
+
+subsys_initcall(cm_a510_pci_init);
+
+/* Board Init */
+void __init cm_a510_init(void)
+{
+	/*
+	 * Basic Dove setup. Needs to be called early.
+	 */
+	dove_init();
+
+	dove_ge00_init(&cm_a510_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_sata_init(&cm_a510_sata_data);
+	dove_sdio0_init();
+	dove_sdio1_init();
+	dove_spi0_init();
+	dove_spi1_init();
+	dove_i2c_init();
+	spi_register_board_info(cm_a510_spi_flash_info,
+				ARRAY_SIZE(cm_a510_spi_flash_info));
+}
arch/arm/mach-dove/board-dove-db.c new file +92 -0
new file mode 100644
index 0000000..21094d4
@@ -0,0 +1,92 @@
+/*
+ * arch/arm/mach-dove/board-dove-db.c
+ *
+ * Marvell DB-MV88AP510-BP Development Board Init
+ * for drivers not converted to flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/mtd/physmap.h>
+#include <linux/mtd/nand.h>
+#include <linux/timer.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/i2c.h>
+#include <linux/pci.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/gpio.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/dove.h>
+#include "common.h"
+
+static struct mv643xx_eth_platform_data dove_db_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+static struct mv_sata_platform_data dove_db_sata_data = {
+	.n_ports        = 1,
+};
+
+/*****************************************************************************
+ * SPI Devices:
+ *     SPI0: 4M Flash ST-M25P32-VMF6P
+ ****************************************************************************/
+static const struct flash_platform_data dove_db_spi_flash_data = {
+	.type		= "m25p64",
+};
+
+static struct spi_board_info __initdata dove_db_spi_flash_info[] = {
+	{
+		.modalias       = "m25p80",
+		.platform_data  = &dove_db_spi_flash_data,
+		.irq            = -1,
+		.max_speed_hz   = 20000000,
+		.bus_num        = 0,
+		.chip_select    = 0,
+	},
+};
+
+/*****************************************************************************
+ * PCI
+ ****************************************************************************/
+static int __init dove_db_pci_init(void)
+{
+	if (machine_is_dove_db())
+		dove_pcie_init(1, 1);
+
+	return 0;
+}
+
+subsys_initcall(dove_db_pci_init);
+
+/*****************************************************************************
+ * Board Init
+ ****************************************************************************/
+void __init dove_db_init(void)
+{
+	/*
+	 * Basic Dove setup. Needs to be called early.
+	 */
+	dove_init();
+
+	dove_ge00_init(&dove_db_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_sata_init(&dove_db_sata_data);
+	dove_sdio0_init();
+	dove_sdio1_init();
+	dove_spi0_init();
+	dove_spi1_init();
+	dove_i2c_init();
+	spi_register_board_info(dove_db_spi_flash_info,
+				ARRAY_SIZE(dove_db_spi_flash_info));
+}
arch/arm/mach-dove/board-dt.c new file +73 -0
new file mode 100644
index 0000000..7b5d481
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2012 (C)
+ *   Sebastian Hesselbarth <[email protected]>
+ *
+ * arch/arm/mach-dove/board-dt.c
+ *
+ * Flattened Device Tree board initialization
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/kexec.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/bridge-regs.h>
+#include "common.h"
+
+static struct of_device_id dove_dt_match_table[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{ }
+};
+
+static void __init dove_dt_init(void)
+{
+	pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
+		(dove_tclk + 499999) / 1000000);
+
+#ifdef CONFIG_CACHE_TAUROS2
+	tauros2_init();
+#endif
+	dove_setup_cpu_mbus();
+
+	/* Setup root of clk tree */
+	dove_clk_init();
+
+	/* internal devices that every board has */
+	dove_xor0_init();
+	dove_xor1_init();
+
+	if (of_machine_is_compatible("marvell,dove-db"))
+		dove_db_init();
+
+	if (of_machine_is_compatible("compulab,cm-a510"))
+		cm_a510_init();
+
+	of_platform_populate(NULL, dove_dt_match_table, NULL, NULL);
+}
+
+static const char * const dove_dt_board_compat[] = {
+	"marvell,dove-db",
+	"compulab,cm-a510",
+	NULL
+};
+
+DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
+	/* Maintainer:  Sebastian Hesselbarth
+	 *              <[email protected]>
+	 */
+	.map_io		= dove_map_io,
+	.init_early	= dove_init_early,
+	.init_irq	= dove_init_irq,
+	.timer		= &dove_timer,
+	.init_machine	= dove_dt_init,
+	.restart	= dove_restart,
+	.dt_compat	= dove_dt_board_compat,
+MACHINE_END
+
#5 lore raw

PATCH 3/3 ARM: dts: dove: Integrate devicetree support

In reply to Sebastian Hesselbarth

This integrates devicetree support for Marvell Dove and currently suppported boards.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at 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(-)
arch/arm/mach-dove/Kconfig +20 -0
index dd937c5..8dff8fc 100644
@@ -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
arch/arm/mach-dove/Makefile +4 -0
index fa0f018..bdb39f5 100644
@@ -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
arch/arm/mach-dove/Makefile.boot +3 -0
index 760a0ef..185e988 100644
@@ -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
arch/arm/mach-dove/common.c +9 -8
index 9493076..6236035 100644
@@ -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();
arch/arm/mach-dove/common.h +25 -0
index 6432a3b..a11f842 100644
@@ -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
Signature · 1 line
1.7.10
#6 lore raw

PATCH 3/3 ARM: dts: dove: Integrate devicetree support

Quoted 34 lines · Sebastian Hesselbarth

This integrates devicetree support for Marvell Dove and currently suppported boards.

Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at 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(-)
arch/arm/mach-dove/Kconfig +10 -0
index dd937c5..8dff8fc 100644
@@ -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

arch/arm/mach-dove/Kconfig config MACH_CM_A510 · line 37

Quoted 10 lines
arch/arm/mach-dove/Kconfig +10 -0
+	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.

Quoted 127 lines
arch/arm/mach-dove/Kconfig +0 -0
 endmenu
 
 endif
arch/arm/mach-dove/Makefile +4 -0
index fa0f018..bdb39f5 100644
@@ -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
arch/arm/mach-dove/Makefile.boot +3 -0
index 760a0ef..185e988 100644
@@ -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
arch/arm/mach-dove/common.c +9 -8
index 9493076..6236035 100644
@@ -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();
arch/arm/mach-dove/common.h +25 -0
index 6432a3b..a11f842 100644
@@ -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
#7 lore raw

PATCH 3/3 ARM: dts: dove: Integrate devicetree support

Quoted 6 lines · Rob Herring
Quoted 3 lines · Sebastian Hesselbarth

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

#8 lore raw

PATCH 3/3 ARM: dts: dove: Integrate devicetree support

Quoted 8 lines · Sebastian Hesselbarth

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

maintainer
#9 lore raw

cover ARM: dts: dove: Basic devicetree support for Marvell Dove

In reply to Sebastian Hesselbarth
Quoted 6 lines · Sebastian Hesselbarth

This patch series add very basic devicetree support for Marvell Dove. It is based on Kirkwood dts and therefore supports uart and rtc by dt only.

The patches have not been tested on neither Dove-DB nor CM-A510 but on SolidRun Cubox that is not supported by mainline kernel, yet.

Hi Sebastian

Quoted 11 lines
Cc Jason Cooper <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Russell King <[email protected]>
Cc linux-arm-kernel at lists.infradead.org

Sebastian Hesselbarth (3):
ARM: dts: dove: Add devicetree descriptors
ARM: dts: dove: Add devicetree-based board setup
ARM: dts: dove: Integrate devicetree support

Quoted 14 lines
 arch/arm/boot/dts/dove-cm-a510.dtsi |   27 ++++++++++
 arch/arm/boot/dts/dove-dove-db.dtsi |   27 ++++++++++
 arch/arm/boot/dts/dove.dtsi         |   55 +++++++++++++++++++++
 arch/arm/mach-dove/Kconfig          |   20 ++++++++
 arch/arm/mach-dove/Makefile         |    4 ++
 arch/arm/mach-dove/Makefile.boot    |    3 ++
 arch/arm/mach-dove/board-cm-a510.c  |   86 ++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dove-db.c  |   92 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/board-dt.c       |   73 +++++++++++++++++++++++++++
 arch/arm/mach-dove/common.c         |   17 ++++---
 arch/arm/mach-dove/common.h         |   25 ++++++++++
 12 files changed, 444 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dtsi
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dtsi

These two should be dts files, not dtsi. They are not include files.

I also noticed a few mrvl in the compatibility strings. We have decided to use marvell.

Andrew

#10 lore raw

cover ARM: dts: dove: Basic devicetree support for Marvell Dove

Quoted 4 lines · Andrew Lunn
Quoted 2 lines

create mode 100644 arch/arm/boot/dts/dove-cm-a510.dtsi create mode 100644 arch/arm/boot/dts/dove-dove-db.dtsi

These two should be dts files, not dtsi. They are not include files.

Ok, I will move them to .dts files for v2 of the patches

Quoted 2 lines

I also noticed a few mrvl in the compatibility strings. We have decided to use marvell.

I am fine with 'marvell' instead of 'mrvl'. But the name change has not been commited to arm-soc, yet? I can create a patch to rename all occurrences of mrvl to marvell if you like.

Sebastian

maintainer
#11 lore raw

cover ARM: dts: dove: Basic devicetree support for Marvell Dove

Quoted 4 lines

I am fine with 'marvell' instead of 'mrvl'. But the name change has not been commited to arm-soc, yet? I can create a patch to rename all occurrences of mrvl to marvell if you like.

Hi Sebastian

Jason has been working on this. Not sure what the status is.

I also have patches for interrupt controllers, GPIO controls, and a few of the other device drivers. I will try to post them ASAP for a second review round. It would be good if you can test them out on your little cube.

Thanks
Andrew

#12 lore raw

cover ARM: dts: dove: Basic devicetree support for Marvell Dove

Quoted 5 lines · Andrew Lunn
Quoted 4 lines

I am fine with 'marvell' instead of 'mrvl'. But the name change has not been commited to arm-soc, yet? I can create a patch to rename all occurrences of mrvl to marvell if you like.

Jason has been working on this. Not sure what the status is.

Barring unforseen circumstances, I should be posting this with a few others tonight or tomorrow.

thx,

Jason.