linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: dove: DT support for Marvell Dove
@ 2012-08-06 12:23 Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
                   ` (7 more replies)
  0 siblings, 8 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch set adds DT support for Marvell Dove SoC and three boards
equipped with this SoC. The work is based on device tree support for
Marvell Orion based SoCs introduced in 3.6-rc1.

The first three patches move mach-dove closer to Marvell Kirkwood's
setup code by unifying the clock setup routines, adding clock gating
control, and support for Marvell's crypto engine to mach-dove.

Patches 4 and 5 add a generic DT machine descriptor to mach-dove and
corresponding DT descriptors for the SoC and already supported boards.

Finally, the last patch adds a DT descriptor for the SolidRun CuBox,
a plug computer based on Marvell Dove.

This patch set relies on a DT support patch for sdhci-dove that has
been sent to the corresponding maintainers a few days ago.

Sebastian Hesselbarth (6):
  ARM: dove: unify clock setup
  ARM: dove: add clock gating control
  ARM: dove: add crypto engine
  ARM: dove: add device tree based machine descriptor
  ARM: dove: add device tree descriptors
  ARM: dove: SolidRun CuBox DT

 arch/arm/boot/dts/dove-cm-a510.dts   |   38 ++++++++
 arch/arm/boot/dts/dove-cubox.dts     |   42 +++++++++
 arch/arm/boot/dts/dove-dove-db.dts   |   38 ++++++++
 arch/arm/boot/dts/dove.dtsi          |  143 ++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Kconfig           |    7 ++
 arch/arm/mach-dove/Makefile.boot     |    4 +
 arch/arm/mach-dove/common.c          |  159 +++++++++++++++++++++++++++++++---
 arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++----
 8 files changed, 455 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
-- 
1.7.10.4


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

* [PATCH 1/6] ARM: dove: unify clock setup
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-11  9:12   ` Andrew Lunn
  2012-08-06 12:23 ` [PATCH 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch synchronizes the clock setup of dove with other orion-based
platforms.

In dove_find_tclk there was a note about DOVE_SAMPLE_HI/LO register to
detect tclk. While it might be possible to set a different tclk frequency 
with reset strapping the Dove datasheets don't tell anything about tclk 
frequency here. Therefore, I removed that comment.

Also, the patch ensures that tclk is always clocked by prepare/enable.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 4db5de5..20b765c 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
  ****************************************************************************/
@@ -70,14 +68,18 @@ void __init dove_map_io(void)
 /*****************************************************************************
  * CLK tree
  ****************************************************************************/
+static int dove_tclk;
 static struct clk *tclk;
 
-static void __init clk_init(void)
+static 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);
+
+	/* Ensure tclk is always clocked */
+	clk_prepare_enable(tclk);
 }
 
 /*****************************************************************************
@@ -187,16 +189,16 @@ void __init dove_init_early(void)
 	orion_time_set_base(TIMER_VIRT_BASE);
 }
 
-static int get_tclk(void)
+static int __init dove_find_tclk(void)
 {
-	/* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
 	return 166666667;
 }
 
 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 = {
@@ -284,8 +286,8 @@ 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);
+	pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
+		(dove_tclk + 499999) / 1000000);
 
 #ifdef CONFIG_CACHE_TAUROS2
 	tauros2_init();
@@ -293,7 +295,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();
-- 
1.7.10.4


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

* [PATCH 2/6] ARM: dove: add clock gating control
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds clock gates from the clock gating control register
available on dove. All clock gates are hooked up to tclk, except for
gigabit ethernet controller (ge) which is a child of gephy to allow
both enabled/disabled at the same time.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c          |   59 +++++++++++++++++++++++++++++++++-
 arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++++++++++++++-----------
 2 files changed, 94 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 20b765c..e074f1c 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -16,6 +16,7 @@
 #include <linux/clk-provider.h>
 #include <linux/ata_platform.h>
 #include <linux/gpio.h>
+#include <linux/mv643xx_i2c.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/timex.h>
@@ -24,6 +25,7 @@
 #include <asm/mach/time.h>
 #include <asm/mach/pci.h>
 #include <mach/dove.h>
+#include <mach/pm.h>
 #include <mach/bridge-regs.h>
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
@@ -31,6 +33,7 @@
 #include <plat/ehci-orion.h>
 #include <plat/common.h>
 #include <plat/addr-map.h>
+#include <plat/mv_xor.h>
 #include "common.h"
 
 /*****************************************************************************
@@ -69,14 +72,68 @@ void __init dove_map_io(void)
  * CLK tree
  ****************************************************************************/
 static int dove_tclk;
+
+static DEFINE_SPINLOCK(gating_lock);
 static struct clk *tclk;
 
+static struct clk __init *dove_register_gate(const char *name,
+					     const char *parent, u8 bit_idx)
+{
+	return clk_register_gate(NULL, name, parent, 0,
+				 (void __iomem *)CLOCK_GATING_CONTROL,
+				 bit_idx, 0, &gating_lock);
+}
+
 static void __init dove_clk_init(void)
 {
+	struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
+	struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
+	struct clk *xor0, *xor1, *ge, *gephy;
+
 	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
 				       dove_tclk);
 
-	orion_clkdev_init(tclk);
+	usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
+	usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
+	sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
+	pex0 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE0);
+	pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
+	sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
+	sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
+	nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
+	camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
+	i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
+	i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
+	crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
+	ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
+	pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
+	xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
+	xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
+	gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
+	ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
+
+	orion_clkdev_add(NULL, "orion_spi.0", tclk);
+	orion_clkdev_add(NULL, "orion_spi.1", tclk);
+	orion_clkdev_add(NULL, "orion_wdt", tclk);
+	orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
+
+	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
+	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
+	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge);
+	orion_clkdev_add("0", "sata_mv.0", sata);
+	orion_clkdev_add("0", "pcie", pex0);
+	orion_clkdev_add("1", "pcie", pex1);
+	orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
+	orion_clkdev_add(NULL, "sdhci-dove.1", sdio1);
+	orion_clkdev_add(NULL, "orion_nand", nand);
+	orion_clkdev_add(NULL, "cafe1000-ccic.0", camera);
+	orion_clkdev_add(NULL, "kirkwood-i2s.0", i2s0);
+	orion_clkdev_add(NULL, "kirkwood-i2s.1", i2s1);
+	orion_clkdev_add(NULL, "mv_crypto", crypto);
+	orion_clkdev_add(NULL, "dove-ac97", ac97);
+	orion_clkdev_add(NULL, "dove-pdma", pdma);
+	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".0", xor0);
+	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1);
 
 	/* Ensure tclk is always clocked */
 	clk_prepare_enable(tclk);
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 3ad9f94..7bcd0df 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -13,24 +13,42 @@
 #include <mach/irqs.h>
 
 #define CLOCK_GATING_CONTROL	(DOVE_PMU_VIRT_BASE + 0x38)
-#define  CLOCK_GATING_USB0_MASK		(1 << 0)
-#define  CLOCK_GATING_USB1_MASK		(1 << 1)
-#define  CLOCK_GATING_GBE_MASK		(1 << 2)
-#define  CLOCK_GATING_SATA_MASK		(1 << 3)
-#define  CLOCK_GATING_PCIE0_MASK	(1 << 4)
-#define  CLOCK_GATING_PCIE1_MASK	(1 << 5)
-#define  CLOCK_GATING_SDIO0_MASK	(1 << 8)
-#define  CLOCK_GATING_SDIO1_MASK	(1 << 9)
-#define  CLOCK_GATING_NAND_MASK		(1 << 10)
-#define  CLOCK_GATING_CAMERA_MASK	(1 << 11)
-#define  CLOCK_GATING_I2S0_MASK		(1 << 12)
-#define  CLOCK_GATING_I2S1_MASK		(1 << 13)
-#define  CLOCK_GATING_CRYPTO_MASK	(1 << 15)
-#define  CLOCK_GATING_AC97_MASK		(1 << 21)
-#define  CLOCK_GATING_PDMA_MASK		(1 << 22)
-#define  CLOCK_GATING_XOR0_MASK		(1 << 23)
-#define  CLOCK_GATING_XOR1_MASK		(1 << 24)
-#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << 30)
+#define  CLOCK_GATING_BIT_USB0		0
+#define  CLOCK_GATING_BIT_USB1		1
+#define  CLOCK_GATING_BIT_GBE		2
+#define  CLOCK_GATING_BIT_SATA		3
+#define  CLOCK_GATING_BIT_PCIE0		4
+#define  CLOCK_GATING_BIT_PCIE1		5
+#define  CLOCK_GATING_BIT_SDIO0		8
+#define  CLOCK_GATING_BIT_SDIO1		9
+#define  CLOCK_GATING_BIT_NAND		10
+#define  CLOCK_GATING_BIT_CAMERA	11
+#define  CLOCK_GATING_BIT_I2S0		12
+#define  CLOCK_GATING_BIT_I2S1		13
+#define  CLOCK_GATING_BIT_CRYPTO	15
+#define  CLOCK_GATING_BIT_AC97		21
+#define  CLOCK_GATING_BIT_PDMA		22
+#define  CLOCK_GATING_BIT_XOR0		23
+#define  CLOCK_GATING_BIT_XOR1		24
+#define  CLOCK_GATING_BIT_GIGA_PHY	30
+#define  CLOCK_GATING_USB0_MASK		(1 << CLOCK_GATING_BIT_USB0)
+#define  CLOCK_GATING_USB1_MASK		(1 << CLOCK_GATING_BIT_USB1)
+#define  CLOCK_GATING_GBE_MASK		(1 << CLOCK_GATING_BIT_GBE)
+#define  CLOCK_GATING_SATA_MASK		(1 << CLOCK_GATING_BIT_SATA)
+#define  CLOCK_GATING_PCIE0_MASK	(1 << CLOCK_GATING_BIT_PCIE0)
+#define  CLOCK_GATING_PCIE1_MASK	(1 << CLOCK_GATING_BIT_PCIE1)
+#define  CLOCK_GATING_SDIO0_MASK	(1 << CLOCK_GATING_BIT_SDIO0)
+#define  CLOCK_GATING_SDIO1_MASK	(1 << CLOCK_GATING_BIT_SDIO1)
+#define  CLOCK_GATING_NAND_MASK		(1 << CLOCK_GATING_BIT_NAND)
+#define  CLOCK_GATING_CAMERA_MASK	(1 << CLOCK_GATING_BIT_CAMERA)
+#define  CLOCK_GATING_I2S0_MASK		(1 << CLOCK_GATING_BIT_I2S0)
+#define  CLOCK_GATING_I2S1_MASK		(1 << CLOCK_GATING_BIT_I2S1)
+#define  CLOCK_GATING_CRYPTO_MASK	(1 << CLOCK_GATING_BIT_CRYPTO)
+#define  CLOCK_GATING_AC97_MASK		(1 << CLOCK_GATING_BIT_AC97)
+#define  CLOCK_GATING_PDMA_MASK		(1 << CLOCK_GATING_BIT_PDMA)
+#define  CLOCK_GATING_XOR0_MASK		(1 << CLOCK_GATING_BIT_XOR0)
+#define  CLOCK_GATING_XOR1_MASK		(1 << CLOCK_GATING_BIT_XOR1)
+#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << CLOCK_GATING_BIT_GIGA_PHY)
 
 #define PMU_INTERRUPT_CAUSE	(DOVE_PMU_VIRT_BASE + 0x50)
 #define PMU_INTERRUPT_MASK	(DOVE_PMU_VIRT_BASE + 0x54)
-- 
1.7.10.4


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

* [PATCH 3/6] ARM: dove: add crypto engine
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds a dove specific setup function for the Marvell CESA
crypto engine available on orion based SoCs. Dove setup was just
missing a function to call orion_crypto_init with dove specific
setup.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index e074f1c..6f2fe65 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -263,6 +263,15 @@ struct sys_timer dove_timer = {
 };
 
 /*****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+void __init dove_crypto_init(void)
+{
+	orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
+			  DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
+}
+
+/*****************************************************************************
  * XOR 0
  ****************************************************************************/
 void __init dove_xor0_init(void)
-- 
1.7.10.4


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

* [PATCH 4/6] ARM: dove: add device tree based machine descriptor
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                   ` (2 preceding siblings ...)
  2012-08-06 12:23 ` [PATCH 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This adds a generic DT_MACHINE for mach-dove. As with other orion based
SoCs there still is some glue code required to make all internal devices
work, i.e. auxdata is provided to pass clocks to corresponding device
drivers. 

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/Kconfig  |    7 +++++
 arch/arm/mach-dove/common.c |   67 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index dd937c5..00154e7 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -15,6 +15,13 @@ config MACH_CM_A510
 	  Say 'Y' here if you want your kernel to support the
 	  CompuLab CM-A510 Board.
 
+config MACH_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.
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 6f2fe65..6f594bd3 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -17,6 +17,8 @@
 #include <linux/ata_platform.h>
 #include <linux/gpio.h>
 #include <linux/mv643xx_i2c.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/timex.h>
@@ -30,6 +32,7 @@
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
 #include <plat/time.h>
+#include <plat/irq.h>
 #include <plat/ehci-orion.h>
 #include <plat/common.h>
 #include <plat/addr-map.h>
@@ -384,3 +387,67 @@ void dove_restart(char mode, const char *cmd)
 	while (1)
 		;
 }
+
+#if defined(CONFIG_MACH_DOVE_DT)
+/*
+ * Auxdata required until real OF clock provider
+ */
+struct of_dev_auxdata dove_auxdata_lookup[] __initdata = {
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1014600, "orion_spi.1", NULL),
+	OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
+	OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
+		       NULL),
+	OF_DEV_AUXDATA("marvell,orion-sata", 0xf10a0000, "sata_mv.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1092000, "sdhci-dove.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1090000, "sdhci-dove.1", NULL),
+	{},
+};
+
+static struct mv643xx_eth_platform_data dove_dt_ge00_data = {
+	.phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+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 not ported to DT yet */
+	dove_rtc_init();
+	dove_xor0_init();
+	dove_xor1_init();
+
+	dove_ge00_init(&dove_dt_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_pcie_init(1, 1);
+	dove_crypto_init();
+
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     dove_auxdata_lookup, NULL);
+}
+
+static const char * const dove_dt_board_compat[] = {
+	"marvell,dove",
+	NULL
+};
+
+DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
+	.map_io		= dove_map_io,
+	.init_early	= dove_init_early,
+	.init_irq	= orion_dt_init_irq,
+	.timer		= &dove_timer,
+	.init_machine	= dove_dt_init,
+	.restart	= dove_restart,
+	.dt_compat	= dove_dt_board_compat,
+MACHINE_END
+#endif
-- 
1.7.10.4


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

* [PATCH 5/6] ARM: dove: add device tree descriptors
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                   ` (3 preceding siblings ...)
  2012-08-06 12:23 ` [PATCH 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-06 12:23 ` [PATCH 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds device tree decriptors for dove SoC and currently
supported boards.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cm-a510.dts |   38 ++++++++++
 arch/arm/boot/dts/dove-dove-db.dts |   38 ++++++++++
 arch/arm/boot/dts/dove.dtsi        |  143 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot   |    3 +
 4 files changed, 222 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

diff --git a/arch/arm/boot/dts/dove-cm-a510.dts b/arch/arm/boot/dts/dove-cm-a510.dts
new file mode 100644
index 0000000..61a8062
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cm-a510.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Compulab CM-A510";
+	compatible = "compulab,cm-a510", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove-dove-db.dts b/arch/arm/boot/dts/dove-dove-db.dts
new file mode 100644
index 0000000..e5a920b
--- /dev/null
+++ b/arch/arm/boot/dts/dove-dove-db.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Marvell DB-MV88AP510-BP Development Board";
+	compatible = "marvell,dove-db", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash ST-M25P32-VMF6P */
+	spi-flash@0 {
+		compatible = "st,m25p32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
new file mode 100644
index 0000000..96fb824
--- /dev/null
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -0,0 +1,143 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,dove";
+	model = "Marvell Armada 88AP510 SoC";
+
+	interrupt-parent = <&intc>;
+
+	intc: interrupt-controller {
+		compatible = "marvell,orion-intc";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0xf1020204 0x04>,
+		      <0xf1020214 0x04>;
+	};
+
+	mbus@f1000000 {
+		compatible = "simple-bus";
+		ranges = <0 0xf1000000 0x4000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		uart0: serial@12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <7>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart1: serial@12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <8>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart2: serial@12200 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <9>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart3: serial@12300 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <10>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		wdt: wdt@20300 {
+			compatible = "marvell,orion-wdt";
+			reg = <0x20300 0x28>;
+		};
+
+		gpio0: gpio@d0400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0400 0x20>;
+			ngpio = <32>;
+			interrupts = <12>, <13>, <14>, <60>;
+		};
+
+		gpio1: gpio@d0420 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0420 0x20>;
+			ngpio = <32>;
+			interrupts = <61>;
+		};
+
+		gpio2: gpio@e8400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xe8400 0x0c>;
+			ngpio = <8>;
+		};
+
+		spi0: spi@10600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			interrupts = <6>;
+			reg = <0x10600 0x28>;
+			status = "disabled";
+		};
+
+		spi1: spi@14600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			interrupts = <5>;
+			reg = <0x14600 0x28>;
+			status = "disabled";
+		};
+
+		i2c0: i2c@11000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x11000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <11>;
+			clock-frequency = <400000>;
+			timeout-ms = <1000>;
+			status = "disabled";
+		};
+
+		sdio0: sdio@92000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x92000 0x100>;
+			interrupts = <35>, <37>;
+			status = "disabled";
+		};
+
+		sdio1: sdio@90000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x90000 0x100>;
+			interrupts = <36>, <38>;
+			status = "disabled";
+		};
+
+		sata0: sata@a0000 {
+			compatible = "marvell,orion-sata";
+			reg = <0xa0000 0x2400>;
+			interrupts = <62>;
+			nr-ports = <1>;
+			status = "disabled";
+		};
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 760a0ef..94ab6b3 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_DT) += dove-dove-db.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
-- 
1.7.10.4


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

* [PATCH 6/6] ARM: dove: SolidRun CuBox DT
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                   ` (4 preceding siblings ...)
  2012-08-06 12:23 ` [PATCH 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
@ 2012-08-06 12:23 ` Sebastian Hesselbarth
  2012-08-06 14:02 ` [PATCH 0/6] ARM: dove: DT support for Marvell Dove Arnd Bergmann
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
  7 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 12:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds basic support for the SolidRun CuBox to DT based
mach-dove. There are still some issues related to ongoing orion/mvebu
development, e.g. gpio-led will not work as there is no DT pinctrl
for dove yet and we don't have board specific setup code. Nevertheless,
the DT description is already introduced here.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cubox.dts |   42 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot |    1 +
 2 files changed, 43 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts

diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
new file mode 100644
index 0000000..0adbd5a
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -0,0 +1,42 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "SolidRun CuBox";
+	compatible = "solidrun,cubox", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		power {
+			label = "Power";
+			gpios = <&gpio0 18 1>;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&uart0 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sata0 { status = "okay"; };
+&i2c0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 94ab6b3..cfac9c5 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -4,3 +4,4 @@ initrd_phys-y	:= 0x00800000
 
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-dove-db.dtb
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cubox.dtb
-- 
1.7.10.4


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

* Re: [PATCH 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                   ` (5 preceding siblings ...)
  2012-08-06 12:23 ` [PATCH 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
@ 2012-08-06 14:02 ` Arnd Bergmann
  2012-08-06 14:16   ` Sebastian Hesselbarth
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
  7 siblings, 1 reply; 30+ messages in thread
From: Arnd Bergmann @ 2012-08-06 14:02 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

On Monday 06 August 2012, Sebastian Hesselbarth wrote:
> This patch set adds DT support for Marvell Dove SoC and three boards
> equipped with this SoC. The work is based on device tree support for
> Marvell Orion based SoCs introduced in 3.6-rc1.
> 
> The first three patches move mach-dove closer to Marvell Kirkwood's
> setup code by unifying the clock setup routines, adding clock gating
> control, and support for Marvell's crypto engine to mach-dove.
> 
> Patches 4 and 5 add a generic DT machine descriptor to mach-dove and
> corresponding DT descriptors for the SoC and already supported boards.
> 
> Finally, the last patch adds a DT descriptor for the SolidRun CuBox,
> a plug computer based on Marvell Dove.
> 
> This patch set relies on a DT support patch for sdhci-dove that has
> been sent to the corresponding maintainers a few days ago.

This looks vert nice!

Acked-by: Arnd Bergmann <arnd@arndb.de>

Has anyone tested it on cm-a510 and dove-db? Once we can reasonably
assume that there are no regressions compared to using the board
files, I think we can plan for removing the non-DT support in
mach-dove. If it's been tested positively, that can well be at
the same time as adding the DT support, otherwise I think we should
wait a couple of releases while having both simultaneously.

	Arnd

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

* Re: [PATCH 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-06 14:02 ` [PATCH 0/6] ARM: dove: DT support for Marvell Dove Arnd Bergmann
@ 2012-08-06 14:16   ` Sebastian Hesselbarth
  2012-08-06 14:23     ` Arnd Bergmann
  2012-08-07 16:53     ` Russell King - ARM Linux
  0 siblings, 2 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-06 14:16 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson, Thomas Petazzoni

On 8/6/12, Arnd Bergmann <arnd@arndb.de> wrote:
> This looks vert nice!
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Hi Arnd,

thanks for the ack!

> Has anyone tested it on cm-a510 and dove-db? Once we can reasonably
> assume that there are no regressions compared to using the board
> files, I think we can plan for removing the non-DT support in
> mach-dove. If it's been tested positively, that can well be at
> the same time as adding the DT support, otherwise I think we should
> wait a couple of releases while having both simultaneously.

Unfortunately, I has not (yet) been tested on cm-a510 nor dove-db but
from the status of the exisiting non-DT setup files I strongly doubt that
anyone is using current mainline kernel for mach-dove.

I suggest to keep non-DT support until we have pinctrl and gpiolib drivers
done. Thomas Petazzoni and I have been working on pinctrl that will be
posted in a few days and gpiolib driver needs some more cleanup but is
basically working. Until then I guess most of the other orion drivers have
DT support (eth and xor IIRC).

After that I am definitely fine with removing non-DT support although
there is neither DT support in u-boot installed on my CuBox nor
mach-dove support in mainline u-boot.

Sebastian

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

* Re: [PATCH 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-06 14:16   ` Sebastian Hesselbarth
@ 2012-08-06 14:23     ` Arnd Bergmann
  2012-08-07 16:53     ` Russell King - ARM Linux
  1 sibling, 0 replies; 30+ messages in thread
From: Arnd Bergmann @ 2012-08-06 14:23 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson, Thomas Petazzoni

On Monday 06 August 2012, Sebastian Hesselbarth wrote:
> I suggest to keep non-DT support until we have pinctrl and gpiolib drivers
> done. Thomas Petazzoni and I have been working on pinctrl that will be
> posted in a few days and gpiolib driver needs some more cleanup but is
> basically working. Until then I guess most of the other orion drivers have
> DT support (eth and xor IIRC).

Ok, sounds resonable.

	Arnd

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

* Re: [PATCH 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-06 14:16   ` Sebastian Hesselbarth
  2012-08-06 14:23     ` Arnd Bergmann
@ 2012-08-07 16:53     ` Russell King - ARM Linux
  2012-08-07 19:32       ` Sebastian Hesselbarth
  1 sibling, 1 reply; 30+ messages in thread
From: Russell King - ARM Linux @ 2012-08-07 16:53 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Arnd Bergmann, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson, Thomas Petazzoni

On Mon, Aug 06, 2012 at 04:16:57PM +0200, Sebastian Hesselbarth wrote:
> After that I am definitely fine with removing non-DT support although
> there is neither DT support in u-boot installed on my CuBox nor
> mach-dove support in mainline u-boot.

As I have a Cubox, this is of interest to me.  However, not related to
your patches, here's some news I have on the Cubox.

Firstly, a big thanks to Nicolas Pitre for sending me this cute little
box.  Finally, I see my idea of having an ARM based Linux box as a
media player becoming a reality (I thought maybe the OMAP3430LDP would
do it, or maybe the OMAP4430SDP, but progress on OMAP platforms is
dreadfully slow - and complicated...)

I've recently pushed a fix into mainline (and stable) for VFP support
with Thumb instructions.  I noticed that the Cubox kernel had a different
fix, this "different" fix will need to be removed when Cubox folk update
to the next kernel from mainline.

Video support, not great.  The supplied Ubuntu Lucid stuff install
(including the latest dev kernel from the solid-run folk) doesn't work
with any of the tree HDMI devices I've tried it with:

. A Plasma TV refused to recognise the cubox existing.  Works with a PC
  running Linux.
. A LCD PC monitor with HDMI input.  If the monitor is disconnected, the
  Cubox booted, and the monitor connected, you get a picture, but you
  lose the top, left, bottom and right of the display off the side of the
  monitor.  No amount of adjusting on the monitor fixes this.
. A cheap LCD TV with HDMI input, 1080i (but not properly 1080p capable)
  only works when the Cubox is booted with the TV turned on and HDMI
  input selected.  If the Cubox is booted with the TV off or HDMI input
  deselected, it fails.  Even so, like the LCD PC monitor, the image is
  far too big.  I suspect there's something wrong with the HDMI chip
  setup.

What is obvious is that there is no HDMI hotplug support and reconfiguring
of the display.  So, I've been investigating the Linux DRM/DRI support -
both the kernel and X11 side, and I have something that is getting close
to being ready.  Last night I finally disabled the kernel dovefb driver,
and have X11 using solely my new DRM driver.

This gives us several advantages, not only does the DRM layer generate
hotplug events, but it also doesn't need such a large amount of "video
memory" reserved.  It can dynamically allocate objects for graphics
operations, and such like.  This, along side CMA should allow us to get
rid of quite a bit of the statically claimed RAM areas.  Another
advantage is that we can automatically reconfigure the X11 display on
hotplug to the capabilities of the attached monitor.  This works nicely
here. :)

	This brings up another off-topic point (not just about the
	cubox) - I think more people should be looking at the DRM
	stuff when they're creating video drivers.

The next thing to talk about is video overlay via the X11 Xvideo extension.
Yuck, this is not nice.  It relies upon using the X11 Xvideo SHM support,
using the shared memory as a two way buffer.  This buffer which is supposed
to contain graphic data passed from the app to X is instead used to pass
control and address pointers between the decoding application and the
kernel dovefb driver (!) and back again to the decoding application.  Note
that it doesn't even declare a different format for this kind of thing,
it merely relies on magic numbers and a checksum.

The side effect of that is applications using the Xvideo extension
properly do not work very well, partly because the formats they want to
use aren't presented by the dovefb X11 driver.

Now, when trying vlc on the cubox, it failed totally (the Qt libraries
from Ubuntu Lucid are built with neon support, and the Armada510 has
no Neon support - it is VFPv3 with only 16 double registers.)
Rebuilding libQtGui without Neon support fixes this (the cubox is currently
rebuilding the Qt package at the moment, which is going to take a while).
Next problem is there's something up with mpeg audio decoding, but ogg
decoding in vlc is fine.

With Qt fixed, DRM, and a better X11 driver, I now have vlc able to
reasonably display full screen video on the Cubox - and like on my PC,
it appears to play back at a destination resolution of 624x576 (so SD)
and then scales to the size you want the video to be.  Same for totem
with the same source material.

However, this won't be using the on-chip mpeg decoding (yet).  CPU
usage sits at around 30% while vlc playback is running.

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

* Re: [PATCH 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-07 16:53     ` Russell King - ARM Linux
@ 2012-08-07 19:32       ` Sebastian Hesselbarth
  0 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-07 19:32 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Arnd Bergmann, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson, Thomas Petazzoni

On 08/07/2012 06:53 PM, Russell King - ARM Linux wrote:
> I've recently pushed a fix into mainline (and stable) for VFP support
> with Thumb instructions.  I noticed that the Cubox kernel had a different
> fix, this "different" fix will need to be removed when Cubox folk update
> to the next kernel from mainline.

Russell,

I read about that fix but honestly, that is way to deep into ARM
architecture for me. All I realized while having my Cubox is that the
supplied kernel tree is very messy and on Debian wheezy/armhf almost
all applications started over ssh -X fail with segfault. I was hoping
that bringing the cubox into mainline kernel tree will help here -
and luckily the (hacking) community is growing!

> Video support, not great.  The supplied Ubuntu Lucid stuff install
> (including the latest dev kernel from the solid-run folk) doesn't work
> with any of the tree HDMI devices I've tried it with:

HDMI is another topic that I want to work on as soon as the main SoC
stuff is ported over to mainline. HDMI output actually is done by some
nxp HDMI transmitter that translates the rgb 888 video from lcd controller
on dove. AFAIR the HDMI transmitter code is "open", i.e. free to clean up
and port. I haven't looked closely into lcd yet but on Cubox the lcd pixclk
comes from an external clk chip (si5351a) that I have a quite ready driver
for. The existing driver does a table based setup of the plls and does not
hit 148.5 MHz precisely. The driver I wrote is based on an AN from SiLabs
and is also already based on common clk framework.

> . A LCD PC monitor with HDMI input.  If the monitor is disconnected, the
>    Cubox booted, and the monitor connected, you get a picture, but you
>    lose the top, left, bottom and right of the display off the side of the
>    monitor.  No amount of adjusting on the monitor fixes this.

There have been many reports of people no being able to get proper resolutions
with the original kernel setup. I know there are people working on gfx support
and xbmc. Maybe you hit the solid-run.com forums and have a look there.

> What is obvious is that there is no HDMI hotplug support and reconfiguring
> of the display.  So, I've been investigating the Linux DRM/DRI support -
> both the kernel and X11 side, and I have something that is getting close
> to being ready.  Last night I finally disabled the kernel dovefb driver,
> and have X11 using solely my new DRM driver.

Great, keep me posted and I ll be happy to test it.

> However, this won't be using the on-chip mpeg decoding (yet).  CPU
> usage sits at around 30% while vlc playback is running.

The bad thing with GLES and video decoding is that it all relies on
some dirty closed source user space libraries. But again, as I am not
that familiar with gfx and decoding drivers, I didn't look into that.

Sebastian

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

* Re: [PATCH 1/6] ARM: dove: unify clock setup
  2012-08-06 12:23 ` [PATCH 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
@ 2012-08-11  9:12   ` Andrew Lunn
  2012-08-11  9:38     ` Sebastian Hesselbarth
  0 siblings, 1 reply; 30+ messages in thread
From: Andrew Lunn @ 2012-08-11  9:12 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

Hi Sebastian

> -static void __init clk_init(void)
> +static 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);
> +
> +	/* Ensure tclk is always clocked */
> +	clk_prepare_enable(tclk);
>  }

"ticking" would be better than clocked. 

Since this is a root fixed clock, is it necessary to prepare_enable()
it? I think prepare and enable become NOPs in this situation.

    Andrew

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

* Re: [PATCH 1/6] ARM: dove: unify clock setup
  2012-08-11  9:12   ` Andrew Lunn
@ 2012-08-11  9:38     ` Sebastian Hesselbarth
  0 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11  9:38 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Russell King, Jason Cooper, linux-arm-kernel, linux-kernel,
	Rabeeh Khoury, Ian Molton, Arnd Bergmann, Maen Suleiman,
	Olof Johansson

On 08/11/2012 11:12 AM, Andrew Lunn wrote:
>> +	/* Ensure tclk is always clocked */
>> +	clk_prepare_enable(tclk);
>>   }
>
> "ticking" would be better than clocked.
>
> Since this is a root fixed clock, is it necessary to prepare_enable()
> it? I think prepare and enable become NOPs in this situation.

Hi Andrew,

yes you are right, it is useless to prepare or enable a fixed rate clk.
I cannot be gated anyway. I'll update the patch and resend soon.

Sebastian


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

* [PATCH v2 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                   ` (6 preceding siblings ...)
  2012-08-06 14:02 ` [PATCH 0/6] ARM: dove: DT support for Marvell Dove Arnd Bergmann
@ 2012-08-11 10:35 ` Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
                     ` (6 more replies)
  7 siblings, 7 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch set adds DT support for Marvell Dove SoC and three boards
equipped with this SoC. The work is based on device tree support for
Marvell Orion based SoCs introduced in 3.6-rc1.

The first three patches move mach-dove closer to Marvell Kirkwood's
setup code by unifying the clock setup routines, adding clock gating
control, and support for Marvell's crypto engine to mach-dove.

Patches 4 and 5 add a generic DT machine descriptor to mach-dove and
corresponding DT descriptors for the SoC and already supported boards.

Finally, the last patch adds a DT descriptor for the SolidRun CuBox,
a plug computer based on Marvell Dove.

This patch set relies on a DT support patch for sdhci-dove that has
been sent to the corresponding maintainers a few days ago.

Sebastian Hesselbarth (6):
  ARM: dove: unify clock setup
  ARM: dove: add clock gating control
  ARM: dove: add crypto engine
  ARM: dove: add device tree based machine descriptor
  ARM: dove: add device tree descriptors
  ARM: dove: SolidRun CuBox DT

 arch/arm/boot/dts/dove-cm-a510.dts   |   38 +++++++++
 arch/arm/boot/dts/dove-cubox.dts     |   42 +++++++++
 arch/arm/boot/dts/dove-dove-db.dts   |   38 +++++++++
 arch/arm/boot/dts/dove.dtsi          |  143 +++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Kconfig           |    7 ++
 arch/arm/mach-dove/Makefile.boot     |    4 +
 arch/arm/mach-dove/common.c          |  156 +++++++++++++++++++++++++++++++---
 arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++----
 8 files changed, 452 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>

v2: Removed clk_prepare_enable for tclk and updated subsequent patches
-- 
1.7.10.4


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

* [PATCH v2 1/6] ARM: dove: unify clock setup
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch synchronizes the clock setup of dove with other orion-based
platforms.

In dove_find_tclk there was a note about DOVE_SAMPLE_HI/LO register to
detect tclk. While it might be possible to set a different tclk frequency
with reset strapping the Dove datasheets don't tell anything about tclk
frequency here. Therefore, I removed that comment.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>

v2: remove useless clk_prepare_enable for fixed rate tclk
---
 arch/arm/mach-dove/common.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 4db5de5..b6f092c 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
  ****************************************************************************/
@@ -70,12 +68,13 @@ void __init dove_map_io(void)
 /*****************************************************************************
  * CLK tree
  ****************************************************************************/
+static int dove_tclk;
 static struct clk *tclk;
 
-static void __init clk_init(void)
+static 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,16 +186,16 @@ void __init dove_init_early(void)
 	orion_time_set_base(TIMER_VIRT_BASE);
 }
 
-static int get_tclk(void)
+static int __init dove_find_tclk(void)
 {
-	/* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
 	return 166666667;
 }
 
 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 = {
@@ -284,8 +283,8 @@ 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);
+	pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
+		(dove_tclk + 499999) / 1000000);
 
 #ifdef CONFIG_CACHE_TAUROS2
 	tauros2_init();
@@ -293,7 +292,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();
-- 
1.7.10.4


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

* [PATCH v2 2/6] ARM: dove: add clock gating control
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-12 15:22     ` Andrew Lunn
  2012-08-11 10:35   ` [PATCH v2 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds clock gates from the clock gating control register
available on dove. All clock gates are hooked up to tclk, except for
gigabit ethernet controller (ge) which is a child of gephy to allow
both enabled/disabled at the same time.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>

v2: adapted to removed clk_prepare_enable from patch 1
---
 arch/arm/mach-dove/common.c          |   59 +++++++++++++++++++++++++++++++++-
 arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++++++++++++++-----------
 2 files changed, 94 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index b6f092c..7281591 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -16,6 +16,7 @@
 #include <linux/clk-provider.h>
 #include <linux/ata_platform.h>
 #include <linux/gpio.h>
+#include <linux/mv643xx_i2c.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/timex.h>
@@ -24,6 +25,7 @@
 #include <asm/mach/time.h>
 #include <asm/mach/pci.h>
 #include <mach/dove.h>
+#include <mach/pm.h>
 #include <mach/bridge-regs.h>
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
@@ -31,6 +33,7 @@
 #include <plat/ehci-orion.h>
 #include <plat/common.h>
 #include <plat/addr-map.h>
+#include <plat/mv_xor.h>
 #include "common.h"
 
 /*****************************************************************************
@@ -69,14 +72,68 @@ void __init dove_map_io(void)
  * CLK tree
  ****************************************************************************/
 static int dove_tclk;
+
+static DEFINE_SPINLOCK(gating_lock);
 static struct clk *tclk;
 
+static struct clk __init *dove_register_gate(const char *name,
+					     const char *parent, u8 bit_idx)
+{
+	return clk_register_gate(NULL, name, parent, 0,
+				 (void __iomem *)CLOCK_GATING_CONTROL,
+				 bit_idx, 0, &gating_lock);
+}
+
 static void __init dove_clk_init(void)
 {
+	struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
+	struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
+	struct clk *xor0, *xor1, *ge, *gephy;
+
 	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
 				       dove_tclk);
 
-	orion_clkdev_init(tclk);
+	usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
+	usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
+	sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
+	pex0 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE0);
+	pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
+	sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
+	sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
+	nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
+	camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
+	i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
+	i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
+	crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
+	ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
+	pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
+	xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
+	xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
+	gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
+	ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
+
+	orion_clkdev_add(NULL, "orion_spi.0", tclk);
+	orion_clkdev_add(NULL, "orion_spi.1", tclk);
+	orion_clkdev_add(NULL, "orion_wdt", tclk);
+	orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
+
+	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
+	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
+	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge);
+	orion_clkdev_add("0", "sata_mv.0", sata);
+	orion_clkdev_add("0", "pcie", pex0);
+	orion_clkdev_add("1", "pcie", pex1);
+	orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
+	orion_clkdev_add(NULL, "sdhci-dove.1", sdio1);
+	orion_clkdev_add(NULL, "orion_nand", nand);
+	orion_clkdev_add(NULL, "cafe1000-ccic.0", camera);
+	orion_clkdev_add(NULL, "kirkwood-i2s.0", i2s0);
+	orion_clkdev_add(NULL, "kirkwood-i2s.1", i2s1);
+	orion_clkdev_add(NULL, "mv_crypto", crypto);
+	orion_clkdev_add(NULL, "dove-ac97", ac97);
+	orion_clkdev_add(NULL, "dove-pdma", pdma);
+	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".0", xor0);
+	orion_clkdev_add(NULL, MV_XOR_SHARED_NAME ".1", xor1);
 }
 
 /*****************************************************************************
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 3ad9f94..7bcd0df 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -13,24 +13,42 @@
 #include <mach/irqs.h>
 
 #define CLOCK_GATING_CONTROL	(DOVE_PMU_VIRT_BASE + 0x38)
-#define  CLOCK_GATING_USB0_MASK		(1 << 0)
-#define  CLOCK_GATING_USB1_MASK		(1 << 1)
-#define  CLOCK_GATING_GBE_MASK		(1 << 2)
-#define  CLOCK_GATING_SATA_MASK		(1 << 3)
-#define  CLOCK_GATING_PCIE0_MASK	(1 << 4)
-#define  CLOCK_GATING_PCIE1_MASK	(1 << 5)
-#define  CLOCK_GATING_SDIO0_MASK	(1 << 8)
-#define  CLOCK_GATING_SDIO1_MASK	(1 << 9)
-#define  CLOCK_GATING_NAND_MASK		(1 << 10)
-#define  CLOCK_GATING_CAMERA_MASK	(1 << 11)
-#define  CLOCK_GATING_I2S0_MASK		(1 << 12)
-#define  CLOCK_GATING_I2S1_MASK		(1 << 13)
-#define  CLOCK_GATING_CRYPTO_MASK	(1 << 15)
-#define  CLOCK_GATING_AC97_MASK		(1 << 21)
-#define  CLOCK_GATING_PDMA_MASK		(1 << 22)
-#define  CLOCK_GATING_XOR0_MASK		(1 << 23)
-#define  CLOCK_GATING_XOR1_MASK		(1 << 24)
-#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << 30)
+#define  CLOCK_GATING_BIT_USB0		0
+#define  CLOCK_GATING_BIT_USB1		1
+#define  CLOCK_GATING_BIT_GBE		2
+#define  CLOCK_GATING_BIT_SATA		3
+#define  CLOCK_GATING_BIT_PCIE0		4
+#define  CLOCK_GATING_BIT_PCIE1		5
+#define  CLOCK_GATING_BIT_SDIO0		8
+#define  CLOCK_GATING_BIT_SDIO1		9
+#define  CLOCK_GATING_BIT_NAND		10
+#define  CLOCK_GATING_BIT_CAMERA	11
+#define  CLOCK_GATING_BIT_I2S0		12
+#define  CLOCK_GATING_BIT_I2S1		13
+#define  CLOCK_GATING_BIT_CRYPTO	15
+#define  CLOCK_GATING_BIT_AC97		21
+#define  CLOCK_GATING_BIT_PDMA		22
+#define  CLOCK_GATING_BIT_XOR0		23
+#define  CLOCK_GATING_BIT_XOR1		24
+#define  CLOCK_GATING_BIT_GIGA_PHY	30
+#define  CLOCK_GATING_USB0_MASK		(1 << CLOCK_GATING_BIT_USB0)
+#define  CLOCK_GATING_USB1_MASK		(1 << CLOCK_GATING_BIT_USB1)
+#define  CLOCK_GATING_GBE_MASK		(1 << CLOCK_GATING_BIT_GBE)
+#define  CLOCK_GATING_SATA_MASK		(1 << CLOCK_GATING_BIT_SATA)
+#define  CLOCK_GATING_PCIE0_MASK	(1 << CLOCK_GATING_BIT_PCIE0)
+#define  CLOCK_GATING_PCIE1_MASK	(1 << CLOCK_GATING_BIT_PCIE1)
+#define  CLOCK_GATING_SDIO0_MASK	(1 << CLOCK_GATING_BIT_SDIO0)
+#define  CLOCK_GATING_SDIO1_MASK	(1 << CLOCK_GATING_BIT_SDIO1)
+#define  CLOCK_GATING_NAND_MASK		(1 << CLOCK_GATING_BIT_NAND)
+#define  CLOCK_GATING_CAMERA_MASK	(1 << CLOCK_GATING_BIT_CAMERA)
+#define  CLOCK_GATING_I2S0_MASK		(1 << CLOCK_GATING_BIT_I2S0)
+#define  CLOCK_GATING_I2S1_MASK		(1 << CLOCK_GATING_BIT_I2S1)
+#define  CLOCK_GATING_CRYPTO_MASK	(1 << CLOCK_GATING_BIT_CRYPTO)
+#define  CLOCK_GATING_AC97_MASK		(1 << CLOCK_GATING_BIT_AC97)
+#define  CLOCK_GATING_PDMA_MASK		(1 << CLOCK_GATING_BIT_PDMA)
+#define  CLOCK_GATING_XOR0_MASK		(1 << CLOCK_GATING_BIT_XOR0)
+#define  CLOCK_GATING_XOR1_MASK		(1 << CLOCK_GATING_BIT_XOR1)
+#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << CLOCK_GATING_BIT_GIGA_PHY)
 
 #define PMU_INTERRUPT_CAUSE	(DOVE_PMU_VIRT_BASE + 0x50)
 #define PMU_INTERRUPT_MASK	(DOVE_PMU_VIRT_BASE + 0x54)
-- 
1.7.10.4


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

* [PATCH v2 3/6] ARM: dove: add crypto engine
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds a dove specific setup function for the Marvell CESA
crypto engine available on orion based SoCs. Dove setup was just
missing a function to call orion_crypto_init with dove specific
setup.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 7281591..88e3d91 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -260,6 +260,15 @@ struct sys_timer dove_timer = {
 };
 
 /*****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+void __init dove_crypto_init(void)
+{
+	orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
+			  DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
+}
+
+/*****************************************************************************
  * XOR 0
  ****************************************************************************/
 void __init dove_xor0_init(void)
-- 
1.7.10.4


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

* [PATCH v2 4/6] ARM: dove: add device tree based machine descriptor
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
                     ` (2 preceding siblings ...)
  2012-08-11 10:35   ` [PATCH v2 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This adds a generic DT_MACHINE for mach-dove. As with other orion based
SoCs there still is some glue code required to make all internal devices
work, i.e. auxdata is provided to pass clocks to corresponding device
drivers.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/Kconfig  |    7 +++++
 arch/arm/mach-dove/common.c |   67 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index dd937c5..00154e7 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -15,6 +15,13 @@ config MACH_CM_A510
 	  Say 'Y' here if you want your kernel to support the
 	  CompuLab CM-A510 Board.
 
+config MACH_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.
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 88e3d91..d860f3b 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -17,6 +17,8 @@
 #include <linux/ata_platform.h>
 #include <linux/gpio.h>
 #include <linux/mv643xx_i2c.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/timex.h>
@@ -30,6 +32,7 @@
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
 #include <plat/time.h>
+#include <plat/irq.h>
 #include <plat/ehci-orion.h>
 #include <plat/common.h>
 #include <plat/addr-map.h>
@@ -381,3 +384,67 @@ void dove_restart(char mode, const char *cmd)
 	while (1)
 		;
 }
+
+#if defined(CONFIG_MACH_DOVE_DT)
+/*
+ * Auxdata required until real OF clock provider
+ */
+struct of_dev_auxdata dove_auxdata_lookup[] __initdata = {
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1014600, "orion_spi.1", NULL),
+	OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
+	OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
+		       NULL),
+	OF_DEV_AUXDATA("marvell,orion-sata", 0xf10a0000, "sata_mv.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1092000, "sdhci-dove.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1090000, "sdhci-dove.1", NULL),
+	{},
+};
+
+static struct mv643xx_eth_platform_data dove_dt_ge00_data = {
+	.phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+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 not ported to DT yet */
+	dove_rtc_init();
+	dove_xor0_init();
+	dove_xor1_init();
+
+	dove_ge00_init(&dove_dt_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_pcie_init(1, 1);
+	dove_crypto_init();
+
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     dove_auxdata_lookup, NULL);
+}
+
+static const char * const dove_dt_board_compat[] = {
+	"marvell,dove",
+	NULL
+};
+
+DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
+	.map_io		= dove_map_io,
+	.init_early	= dove_init_early,
+	.init_irq	= orion_dt_init_irq,
+	.timer		= &dove_timer,
+	.init_machine	= dove_dt_init,
+	.restart	= dove_restart,
+	.dt_compat	= dove_dt_board_compat,
+MACHINE_END
+#endif
-- 
1.7.10.4


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

* [PATCH v2 5/6] ARM: dove: add device tree descriptors
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
                     ` (3 preceding siblings ...)
  2012-08-11 10:35   ` [PATCH v2 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-11 10:35   ` [PATCH v2 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds device tree decriptors for dove SoC and currently
supported boards.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cm-a510.dts |   38 ++++++++++
 arch/arm/boot/dts/dove-dove-db.dts |   38 ++++++++++
 arch/arm/boot/dts/dove.dtsi        |  143 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot   |    3 +
 4 files changed, 222 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

diff --git a/arch/arm/boot/dts/dove-cm-a510.dts b/arch/arm/boot/dts/dove-cm-a510.dts
new file mode 100644
index 0000000..61a8062
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cm-a510.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Compulab CM-A510";
+	compatible = "compulab,cm-a510", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove-dove-db.dts b/arch/arm/boot/dts/dove-dove-db.dts
new file mode 100644
index 0000000..e5a920b
--- /dev/null
+++ b/arch/arm/boot/dts/dove-dove-db.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Marvell DB-MV88AP510-BP Development Board";
+	compatible = "marvell,dove-db", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash ST-M25P32-VMF6P */
+	spi-flash@0 {
+		compatible = "st,m25p32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
new file mode 100644
index 0000000..96fb824
--- /dev/null
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -0,0 +1,143 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,dove";
+	model = "Marvell Armada 88AP510 SoC";
+
+	interrupt-parent = <&intc>;
+
+	intc: interrupt-controller {
+		compatible = "marvell,orion-intc";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0xf1020204 0x04>,
+		      <0xf1020214 0x04>;
+	};
+
+	mbus@f1000000 {
+		compatible = "simple-bus";
+		ranges = <0 0xf1000000 0x4000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		uart0: serial@12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <7>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart1: serial@12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <8>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart2: serial@12200 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <9>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart3: serial@12300 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <10>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		wdt: wdt@20300 {
+			compatible = "marvell,orion-wdt";
+			reg = <0x20300 0x28>;
+		};
+
+		gpio0: gpio@d0400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0400 0x20>;
+			ngpio = <32>;
+			interrupts = <12>, <13>, <14>, <60>;
+		};
+
+		gpio1: gpio@d0420 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0420 0x20>;
+			ngpio = <32>;
+			interrupts = <61>;
+		};
+
+		gpio2: gpio@e8400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xe8400 0x0c>;
+			ngpio = <8>;
+		};
+
+		spi0: spi@10600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			interrupts = <6>;
+			reg = <0x10600 0x28>;
+			status = "disabled";
+		};
+
+		spi1: spi@14600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			interrupts = <5>;
+			reg = <0x14600 0x28>;
+			status = "disabled";
+		};
+
+		i2c0: i2c@11000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x11000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <11>;
+			clock-frequency = <400000>;
+			timeout-ms = <1000>;
+			status = "disabled";
+		};
+
+		sdio0: sdio@92000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x92000 0x100>;
+			interrupts = <35>, <37>;
+			status = "disabled";
+		};
+
+		sdio1: sdio@90000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x90000 0x100>;
+			interrupts = <36>, <38>;
+			status = "disabled";
+		};
+
+		sata0: sata@a0000 {
+			compatible = "marvell,orion-sata";
+			reg = <0xa0000 0x2400>;
+			interrupts = <62>;
+			nr-ports = <1>;
+			status = "disabled";
+		};
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 760a0ef..94ab6b3 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_DT) += dove-dove-db.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
-- 
1.7.10.4


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

* [PATCH v2 6/6] ARM: dove: SolidRun CuBox DT
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
                     ` (4 preceding siblings ...)
  2012-08-11 10:35   ` [PATCH v2 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
@ 2012-08-11 10:35   ` Sebastian Hesselbarth
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-11 10:35 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

This patch adds basic support for the SolidRun CuBox to DT based
mach-dove. There are still some issues related to ongoing orion/mvebu
development, e.g. gpio-led will not work as there is no DT pinctrl
for dove yet and we don't have board specific setup code. Nevertheless,
the DT description is already introduced here.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cubox.dts |   42 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot |    1 +
 2 files changed, 43 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts

diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
new file mode 100644
index 0000000..0adbd5a
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -0,0 +1,42 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "SolidRun CuBox";
+	compatible = "solidrun,cubox", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		power {
+			label = "Power";
+			gpios = <&gpio0 18 1>;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&uart0 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sata0 { status = "okay"; };
+&i2c0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 94ab6b3..cfac9c5 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -4,3 +4,4 @@ initrd_phys-y	:= 0x00800000
 
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-dove-db.dtb
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cubox.dtb
-- 
1.7.10.4


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

* Re: [PATCH v2 2/6] ARM: dove: add clock gating control
  2012-08-11 10:35   ` [PATCH v2 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
@ 2012-08-12 15:22     ` Andrew Lunn
  0 siblings, 0 replies; 30+ messages in thread
From: Andrew Lunn @ 2012-08-12 15:22 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Arnd Bergmann,
	Maen Suleiman, Olof Johansson

On Sat, Aug 11, 2012 at 12:35:22PM +0200, Sebastian Hesselbarth wrote:
> This patch adds clock gates from the clock gating control register
> available on dove. All clock gates are hooked up to tclk, except for
> gigabit ethernet controller (ge) which is a child of gephy to allow
> both enabled/disabled at the same time.
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> ---
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Rabeeh Khoury <rabeeh@solid-run.com>
> Cc: Ian Molton <ian.molton@codethink.co.uk>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Maen Suleiman <maen@marvell.com>
> Cc: Olof Johansson <olof@lixom.net>
> 
> v2: adapted to removed clk_prepare_enable from patch 1
> ---
>  arch/arm/mach-dove/common.c          |   59 +++++++++++++++++++++++++++++++++-
>  arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++++++++++++++-----------
>  2 files changed, 94 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
> index b6f092c..7281591 100644
> --- a/arch/arm/mach-dove/common.c
> +++ b/arch/arm/mach-dove/common.c
> @@ -16,6 +16,7 @@
>  #include <linux/clk-provider.h>
>  #include <linux/ata_platform.h>
>  #include <linux/gpio.h>
> +#include <linux/mv643xx_i2c.h>
>  #include <asm/page.h>
>  #include <asm/setup.h>
>  #include <asm/timex.h>
> @@ -24,6 +25,7 @@
>  #include <asm/mach/time.h>
>  #include <asm/mach/pci.h>
>  #include <mach/dove.h>
> +#include <mach/pm.h>
>  #include <mach/bridge-regs.h>
>  #include <asm/mach/arch.h>
>  #include <linux/irq.h>
> @@ -31,6 +33,7 @@
>  #include <plat/ehci-orion.h>
>  #include <plat/common.h>
>  #include <plat/addr-map.h>
> +#include <plat/mv_xor.h>
>  #include "common.h"
>  
>  /*****************************************************************************
> @@ -69,14 +72,68 @@ void __init dove_map_io(void)
>   * CLK tree
>   ****************************************************************************/
>  static int dove_tclk;
> +
> +static DEFINE_SPINLOCK(gating_lock);
>  static struct clk *tclk;
>  
> +static struct clk __init *dove_register_gate(const char *name,
> +					     const char *parent, u8 bit_idx)
> +{
> +	return clk_register_gate(NULL, name, parent, 0,
> +				 (void __iomem *)CLOCK_GATING_CONTROL,
> +				 bit_idx, 0, &gating_lock);
> +}
> +
>  static void __init dove_clk_init(void)
>  {
> +	struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
> +	struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
> +	struct clk *xor0, *xor1, *ge, *gephy;
> +
>  	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
>  				       dove_tclk);
>  
> -	orion_clkdev_init(tclk);
> +	usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
> +	usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
> +	sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
> +	pex0 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE0);
> +	pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
> +	sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
> +	sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
> +	nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
> +	camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
> +	i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
> +	i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
> +	crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
> +	ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
> +	pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
> +	xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
> +	xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
> +	gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
> +	ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
> +
> +	orion_clkdev_add(NULL, "orion_spi.0", tclk);
> +	orion_clkdev_add(NULL, "orion_spi.1", tclk);
> +	orion_clkdev_add(NULL, "orion_wdt", tclk);
> +	orion_clkdev_add(NULL, MV64XXX_I2C_CTLR_NAME ".0", tclk);
> +
> +	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
> +	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
> +	orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge);

Hi Sebastian

Take a look at the patch [PATCH v3 7/7] NET: mv643xx: remove device
name macro, from Ian Molten, and the discussion around the macro
MV643XX_ETH_NAME and its friend.

It is probably best to not use the I2C and XOR macro as well.

		 Andrew

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

* [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
                     ` (5 preceding siblings ...)
  2012-08-11 10:35   ` [PATCH v2 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
@ 2012-08-15 17:07   ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
                       ` (6 more replies)
  6 siblings, 7 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch set adds DT support for Marvell Dove SoC and three boards
equipped with this SoC. The work is based on device tree support for
Marvell Orion based SoCs introduced in 3.6-rc1.

The first three patches move mach-dove closer to Marvell Kirkwood's
setup code by unifying the clock setup routines, adding clock gating
control, and support for Marvell's crypto engine to mach-dove.

Patches 4 and 5 add a generic DT machine descriptor to mach-dove and
corresponding DT descriptors for the SoC and already supported boards.

Finally, the last patch adds a DT descriptor for the SolidRun CuBox,
a plug computer based on Marvell Dove.

This patch set relies on a DT support patch for sdhci-dove that has
been accepted on mmc-next for 3.7 as commit
b2293055c1e1200acbb46523976852d1686fdfa4.

Changes:
v2: removed clk_prepare_enable for tclk and updated subsequent patches
v3: fixed a typo in clk_gate name for pex0
    removed device name macros from clk gate names

Sebastian Hesselbarth (6):
  ARM: dove: unify clock setup
  ARM: dove: add clock gating control
  ARM: dove: add crypto engine
  ARM: dove: add device tree based machine descriptor
  ARM: dove: add device tree descriptors
  ARM: dove: SolidRun CuBox DT

 arch/arm/boot/dts/dove-cm-a510.dts   |   38 +++++++++
 arch/arm/boot/dts/dove-cubox.dts     |   42 +++++++++
 arch/arm/boot/dts/dove-dove-db.dts   |   38 +++++++++
 arch/arm/boot/dts/dove.dtsi          |  143 +++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Kconfig           |    7 ++
 arch/arm/mach-dove/Makefile.boot     |    4 +
 arch/arm/mach-dove/common.c          |  156 +++++++++++++++++++++++++++++++---
 arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++----
 8 files changed, 452 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>

-- 
1.7.10.4


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

* [PATCH v3 1/6] ARM: dove: unify clock setup
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch synchronizes the clock setup of dove with other orion-based
platforms.

In dove_find_tclk there was a note about DOVE_SAMPLE_HI/LO register to
detect tclk. While it might be possible to set a different tclk frequency
with reset strapping the Dove datasheets don't tell anything about tclk
frequency here. Therefore, I removed that comment.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

v2: remove useless clk_prepare_enable for fixed rate tclk

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 4db5de5..b6f092c 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
  ****************************************************************************/
@@ -70,12 +68,13 @@ void __init dove_map_io(void)
 /*****************************************************************************
  * CLK tree
  ****************************************************************************/
+static int dove_tclk;
 static struct clk *tclk;
 
-static void __init clk_init(void)
+static 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,16 +186,16 @@ void __init dove_init_early(void)
 	orion_time_set_base(TIMER_VIRT_BASE);
 }
 
-static int get_tclk(void)
+static int __init dove_find_tclk(void)
 {
-	/* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
 	return 166666667;
 }
 
 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 = {
@@ -284,8 +283,8 @@ 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);
+	pr_info("Dove 88AP510 SoC, TCLK = %d MHz.\n",
+		(dove_tclk + 499999) / 1000000);
 
 #ifdef CONFIG_CACHE_TAUROS2
 	tauros2_init();
@@ -293,7 +292,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();
-- 
1.7.10.4


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

* [PATCH v3 2/6] ARM: dove: add clock gating control
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
                       ` (4 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch adds clock gates from the clock gating control register
available on dove. All clock gates are hooked up to tclk, except for
gigabit ethernet controller (ge) which is a child of gephy to allow
both enabled/disabled at the same time.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c          |   57 +++++++++++++++++++++++++++++++++-
 arch/arm/mach-dove/include/mach/pm.h |   54 +++++++++++++++++++++-----------
 2 files changed, 92 insertions(+), 19 deletions(-)

v2: adapted to removed clk_prepare_enable from patch 1
v3: fixed a typo in clk_gate name for pex0
    removed device name macros from clk gate names

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index b6f092c..9b2f961 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -24,6 +24,7 @@
 #include <asm/mach/time.h>
 #include <asm/mach/pci.h>
 #include <mach/dove.h>
+#include <mach/pm.h>
 #include <mach/bridge-regs.h>
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
@@ -69,14 +70,68 @@ void __init dove_map_io(void)
  * CLK tree
  ****************************************************************************/
 static int dove_tclk;
+
+static DEFINE_SPINLOCK(gating_lock);
 static struct clk *tclk;
 
+static struct clk __init *dove_register_gate(const char *name,
+					     const char *parent, u8 bit_idx)
+{
+	return clk_register_gate(NULL, name, parent, 0,
+				 (void __iomem *)CLOCK_GATING_CONTROL,
+				 bit_idx, 0, &gating_lock);
+}
+
 static void __init dove_clk_init(void)
 {
+	struct clk *usb0, *usb1, *sata, *pex0, *pex1, *sdio0, *sdio1;
+	struct clk *nand, *camera, *i2s0, *i2s1, *crypto, *ac97, *pdma;
+	struct clk *xor0, *xor1, *ge, *gephy;
+
 	tclk = clk_register_fixed_rate(NULL, "tclk", NULL, CLK_IS_ROOT,
 				       dove_tclk);
 
-	orion_clkdev_init(tclk);
+	usb0 = dove_register_gate("usb0", "tclk", CLOCK_GATING_BIT_USB0);
+	usb1 = dove_register_gate("usb1", "tclk", CLOCK_GATING_BIT_USB1);
+	sata = dove_register_gate("sata", "tclk", CLOCK_GATING_BIT_SATA);
+	pex0 = dove_register_gate("pex0", "tclk", CLOCK_GATING_BIT_PCIE0);
+	pex1 = dove_register_gate("pex1", "tclk", CLOCK_GATING_BIT_PCIE1);
+	sdio0 = dove_register_gate("sdio0", "tclk", CLOCK_GATING_BIT_SDIO0);
+	sdio1 = dove_register_gate("sdio1", "tclk", CLOCK_GATING_BIT_SDIO1);
+	nand = dove_register_gate("nand", "tclk", CLOCK_GATING_BIT_NAND);
+	camera = dove_register_gate("camera", "tclk", CLOCK_GATING_BIT_CAMERA);
+	i2s0 = dove_register_gate("i2s0", "tclk", CLOCK_GATING_BIT_I2S0);
+	i2s1 = dove_register_gate("i2s1", "tclk", CLOCK_GATING_BIT_I2S1);
+	crypto = dove_register_gate("crypto", "tclk", CLOCK_GATING_BIT_CRYPTO);
+	ac97 = dove_register_gate("ac97", "tclk", CLOCK_GATING_BIT_AC97);
+	pdma = dove_register_gate("pdma", "tclk", CLOCK_GATING_BIT_PDMA);
+	xor0 = dove_register_gate("xor0", "tclk", CLOCK_GATING_BIT_XOR0);
+	xor1 = dove_register_gate("xor1", "tclk", CLOCK_GATING_BIT_XOR1);
+	gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);
+	ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);
+
+	orion_clkdev_add(NULL, "orion_spi.0", tclk);
+	orion_clkdev_add(NULL, "orion_spi.1", tclk);
+	orion_clkdev_add(NULL, "orion_wdt", tclk);
+	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
+
+	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
+	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
+	orion_clkdev_add(NULL, "mv643xx_eth.0", ge);
+	orion_clkdev_add("0", "sata_mv.0", sata);
+	orion_clkdev_add("0", "pcie", pex0);
+	orion_clkdev_add("1", "pcie", pex1);
+	orion_clkdev_add(NULL, "sdhci-dove.0", sdio0);
+	orion_clkdev_add(NULL, "sdhci-dove.1", sdio1);
+	orion_clkdev_add(NULL, "orion_nand", nand);
+	orion_clkdev_add(NULL, "cafe1000-ccic.0", camera);
+	orion_clkdev_add(NULL, "kirkwood-i2s.0", i2s0);
+	orion_clkdev_add(NULL, "kirkwood-i2s.1", i2s1);
+	orion_clkdev_add(NULL, "mv_crypto", crypto);
+	orion_clkdev_add(NULL, "dove-ac97", ac97);
+	orion_clkdev_add(NULL, "dove-pdma", pdma);
+	orion_clkdev_add(NULL, "mv_xor_shared.0", xor0);
+	orion_clkdev_add(NULL, "mv_xor_shared.1", xor1);
 }
 
 /*****************************************************************************
diff --git a/arch/arm/mach-dove/include/mach/pm.h b/arch/arm/mach-dove/include/mach/pm.h
index 3ad9f94..7bcd0df 100644
--- a/arch/arm/mach-dove/include/mach/pm.h
+++ b/arch/arm/mach-dove/include/mach/pm.h
@@ -13,24 +13,42 @@
 #include <mach/irqs.h>
 
 #define CLOCK_GATING_CONTROL	(DOVE_PMU_VIRT_BASE + 0x38)
-#define  CLOCK_GATING_USB0_MASK		(1 << 0)
-#define  CLOCK_GATING_USB1_MASK		(1 << 1)
-#define  CLOCK_GATING_GBE_MASK		(1 << 2)
-#define  CLOCK_GATING_SATA_MASK		(1 << 3)
-#define  CLOCK_GATING_PCIE0_MASK	(1 << 4)
-#define  CLOCK_GATING_PCIE1_MASK	(1 << 5)
-#define  CLOCK_GATING_SDIO0_MASK	(1 << 8)
-#define  CLOCK_GATING_SDIO1_MASK	(1 << 9)
-#define  CLOCK_GATING_NAND_MASK		(1 << 10)
-#define  CLOCK_GATING_CAMERA_MASK	(1 << 11)
-#define  CLOCK_GATING_I2S0_MASK		(1 << 12)
-#define  CLOCK_GATING_I2S1_MASK		(1 << 13)
-#define  CLOCK_GATING_CRYPTO_MASK	(1 << 15)
-#define  CLOCK_GATING_AC97_MASK		(1 << 21)
-#define  CLOCK_GATING_PDMA_MASK		(1 << 22)
-#define  CLOCK_GATING_XOR0_MASK		(1 << 23)
-#define  CLOCK_GATING_XOR1_MASK		(1 << 24)
-#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << 30)
+#define  CLOCK_GATING_BIT_USB0		0
+#define  CLOCK_GATING_BIT_USB1		1
+#define  CLOCK_GATING_BIT_GBE		2
+#define  CLOCK_GATING_BIT_SATA		3
+#define  CLOCK_GATING_BIT_PCIE0		4
+#define  CLOCK_GATING_BIT_PCIE1		5
+#define  CLOCK_GATING_BIT_SDIO0		8
+#define  CLOCK_GATING_BIT_SDIO1		9
+#define  CLOCK_GATING_BIT_NAND		10
+#define  CLOCK_GATING_BIT_CAMERA	11
+#define  CLOCK_GATING_BIT_I2S0		12
+#define  CLOCK_GATING_BIT_I2S1		13
+#define  CLOCK_GATING_BIT_CRYPTO	15
+#define  CLOCK_GATING_BIT_AC97		21
+#define  CLOCK_GATING_BIT_PDMA		22
+#define  CLOCK_GATING_BIT_XOR0		23
+#define  CLOCK_GATING_BIT_XOR1		24
+#define  CLOCK_GATING_BIT_GIGA_PHY	30
+#define  CLOCK_GATING_USB0_MASK		(1 << CLOCK_GATING_BIT_USB0)
+#define  CLOCK_GATING_USB1_MASK		(1 << CLOCK_GATING_BIT_USB1)
+#define  CLOCK_GATING_GBE_MASK		(1 << CLOCK_GATING_BIT_GBE)
+#define  CLOCK_GATING_SATA_MASK		(1 << CLOCK_GATING_BIT_SATA)
+#define  CLOCK_GATING_PCIE0_MASK	(1 << CLOCK_GATING_BIT_PCIE0)
+#define  CLOCK_GATING_PCIE1_MASK	(1 << CLOCK_GATING_BIT_PCIE1)
+#define  CLOCK_GATING_SDIO0_MASK	(1 << CLOCK_GATING_BIT_SDIO0)
+#define  CLOCK_GATING_SDIO1_MASK	(1 << CLOCK_GATING_BIT_SDIO1)
+#define  CLOCK_GATING_NAND_MASK		(1 << CLOCK_GATING_BIT_NAND)
+#define  CLOCK_GATING_CAMERA_MASK	(1 << CLOCK_GATING_BIT_CAMERA)
+#define  CLOCK_GATING_I2S0_MASK		(1 << CLOCK_GATING_BIT_I2S0)
+#define  CLOCK_GATING_I2S1_MASK		(1 << CLOCK_GATING_BIT_I2S1)
+#define  CLOCK_GATING_CRYPTO_MASK	(1 << CLOCK_GATING_BIT_CRYPTO)
+#define  CLOCK_GATING_AC97_MASK		(1 << CLOCK_GATING_BIT_AC97)
+#define  CLOCK_GATING_PDMA_MASK		(1 << CLOCK_GATING_BIT_PDMA)
+#define  CLOCK_GATING_XOR0_MASK		(1 << CLOCK_GATING_BIT_XOR0)
+#define  CLOCK_GATING_XOR1_MASK		(1 << CLOCK_GATING_BIT_XOR1)
+#define  CLOCK_GATING_GIGA_PHY_MASK	(1 << CLOCK_GATING_BIT_GIGA_PHY)
 
 #define PMU_INTERRUPT_CAUSE	(DOVE_PMU_VIRT_BASE + 0x50)
 #define PMU_INTERRUPT_MASK	(DOVE_PMU_VIRT_BASE + 0x54)
-- 
1.7.10.4


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

* [PATCH v3 3/6] ARM: dove: add crypto engine
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch adds a dove specific setup function for the Marvell CESA
crypto engine available on orion based SoCs. Dove setup was just
missing a function to call orion_crypto_init with dove specific
setup.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/common.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 9b2f961..66689ce 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -258,6 +258,15 @@ struct sys_timer dove_timer = {
 };
 
 /*****************************************************************************
+ * Cryptographic Engines and Security Accelerator (CESA)
+ ****************************************************************************/
+void __init dove_crypto_init(void)
+{
+	orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE,
+			  DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO);
+}
+
+/*****************************************************************************
  * XOR 0
  ****************************************************************************/
 void __init dove_xor0_init(void)
-- 
1.7.10.4


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

* [PATCH v3 4/6] ARM: dove: add device tree based machine descriptor
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                       ` (2 preceding siblings ...)
  2012-08-15 17:07     ` [PATCH v3 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This adds a generic DT_MACHINE for mach-dove. As with other orion based
SoCs there still is some glue code required to make all internal devices
work, i.e. auxdata is provided to pass clocks to corresponding device
drivers.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/mach-dove/Kconfig  |    7 +++++
 arch/arm/mach-dove/common.c |   67 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/arch/arm/mach-dove/Kconfig b/arch/arm/mach-dove/Kconfig
index dd937c5..00154e7 100644
--- a/arch/arm/mach-dove/Kconfig
+++ b/arch/arm/mach-dove/Kconfig
@@ -15,6 +15,13 @@ config MACH_CM_A510
 	  Say 'Y' here if you want your kernel to support the
 	  CompuLab CM-A510 Board.
 
+config MACH_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.
+
 endmenu
 
 endif
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 66689ce..810ea15 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -16,6 +16,8 @@
 #include <linux/clk-provider.h>
 #include <linux/ata_platform.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/timex.h>
@@ -29,6 +31,7 @@
 #include <asm/mach/arch.h>
 #include <linux/irq.h>
 #include <plat/time.h>
+#include <plat/irq.h>
 #include <plat/ehci-orion.h>
 #include <plat/common.h>
 #include <plat/addr-map.h>
@@ -379,3 +382,67 @@ void dove_restart(char mode, const char *cmd)
 	while (1)
 		;
 }
+
+#if defined(CONFIG_MACH_DOVE_DT)
+/*
+ * Auxdata required until real OF clock provider
+ */
+struct of_dev_auxdata dove_auxdata_lookup[] __initdata = {
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
+	OF_DEV_AUXDATA("marvell,orion-spi", 0xf1014600, "orion_spi.1", NULL),
+	OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
+	OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
+		       NULL),
+	OF_DEV_AUXDATA("marvell,orion-sata", 0xf10a0000, "sata_mv.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1092000, "sdhci-dove.0", NULL),
+	OF_DEV_AUXDATA("marvell,dove-sdhci", 0xf1090000, "sdhci-dove.1", NULL),
+	{},
+};
+
+static struct mv643xx_eth_platform_data dove_dt_ge00_data = {
+	.phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT,
+};
+
+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 not ported to DT yet */
+	dove_rtc_init();
+	dove_xor0_init();
+	dove_xor1_init();
+
+	dove_ge00_init(&dove_dt_ge00_data);
+	dove_ehci0_init();
+	dove_ehci1_init();
+	dove_pcie_init(1, 1);
+	dove_crypto_init();
+
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     dove_auxdata_lookup, NULL);
+}
+
+static const char * const dove_dt_board_compat[] = {
+	"marvell,dove",
+	NULL
+};
+
+DT_MACHINE_START(DOVE_DT, "Marvell Dove (Flattened Device Tree)")
+	.map_io		= dove_map_io,
+	.init_early	= dove_init_early,
+	.init_irq	= orion_dt_init_irq,
+	.timer		= &dove_timer,
+	.init_machine	= dove_dt_init,
+	.restart	= dove_restart,
+	.dt_compat	= dove_dt_board_compat,
+MACHINE_END
+#endif
-- 
1.7.10.4


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

* [PATCH v3 5/6] ARM: dove: add device tree descriptors
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                       ` (3 preceding siblings ...)
  2012-08-15 17:07     ` [PATCH v3 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-08-15 17:07     ` [PATCH v3 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
  2012-09-10  2:41     ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Jason Cooper
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch adds device tree decriptors for dove SoC and currently
supported boards.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cm-a510.dts |   38 ++++++++++
 arch/arm/boot/dts/dove-dove-db.dts |   38 ++++++++++
 arch/arm/boot/dts/dove.dtsi        |  143 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot   |    3 +
 4 files changed, 222 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
 create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
 create mode 100644 arch/arm/boot/dts/dove.dtsi

diff --git a/arch/arm/boot/dts/dove-cm-a510.dts b/arch/arm/boot/dts/dove-cm-a510.dts
new file mode 100644
index 0000000..61a8062
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cm-a510.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Compulab CM-A510";
+	compatible = "compulab,cm-a510", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove-dove-db.dts b/arch/arm/boot/dts/dove-dove-db.dts
new file mode 100644
index 0000000..e5a920b
--- /dev/null
+++ b/arch/arm/boot/dts/dove-dove-db.dts
@@ -0,0 +1,38 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "Marvell DB-MV88AP510-BP Development Board";
+	compatible = "marvell,dove-db", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+};
+
+&uart0 { status = "okay"; };
+&uart1 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sdio1 { status = "okay"; };
+&sata0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash ST-M25P32-VMF6P */
+	spi-flash@0 {
+		compatible = "st,m25p32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
+
+&i2c0 {
+	  status = "okay";
+};
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi
new file mode 100644
index 0000000..96fb824
--- /dev/null
+++ b/arch/arm/boot/dts/dove.dtsi
@@ -0,0 +1,143 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,dove";
+	model = "Marvell Armada 88AP510 SoC";
+
+	interrupt-parent = <&intc>;
+
+	intc: interrupt-controller {
+		compatible = "marvell,orion-intc";
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		reg = <0xf1020204 0x04>,
+		      <0xf1020214 0x04>;
+	};
+
+	mbus@f1000000 {
+		compatible = "simple-bus";
+		ranges = <0 0xf1000000 0x4000000>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		uart0: serial@12000 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <7>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart1: serial@12100 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <8>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart2: serial@12200 {
+			compatible = "ns16550a";
+			reg = <0x12000 0x100>;
+			reg-shift = <2>;
+			interrupts = <9>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		uart3: serial@12300 {
+			compatible = "ns16550a";
+			reg = <0x12100 0x100>;
+			reg-shift = <2>;
+			interrupts = <10>;
+			clock-frequency = <166666667>;
+			status = "disabled";
+		};
+
+		wdt: wdt@20300 {
+			compatible = "marvell,orion-wdt";
+			reg = <0x20300 0x28>;
+		};
+
+		gpio0: gpio@d0400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0400 0x20>;
+			ngpio = <32>;
+			interrupts = <12>, <13>, <14>, <60>;
+		};
+
+		gpio1: gpio@d0420 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xd0420 0x20>;
+			ngpio = <32>;
+			interrupts = <61>;
+		};
+
+		gpio2: gpio@e8400 {
+			compatible = "marvell,orion-gpio";
+			#gpio-cells = <2>;
+			gpio-controller;
+			reg = <0xe8400 0x0c>;
+			ngpio = <8>;
+		};
+
+		spi0: spi@10600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <0>;
+			interrupts = <6>;
+			reg = <0x10600 0x28>;
+			status = "disabled";
+		};
+
+		spi1: spi@14600 {
+			compatible = "marvell,orion-spi";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			cell-index = <1>;
+			interrupts = <5>;
+			reg = <0x14600 0x28>;
+			status = "disabled";
+		};
+
+		i2c0: i2c@11000 {
+			compatible = "marvell,mv64xxx-i2c";
+			reg = <0x11000 0x20>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			interrupts = <11>;
+			clock-frequency = <400000>;
+			timeout-ms = <1000>;
+			status = "disabled";
+		};
+
+		sdio0: sdio@92000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x92000 0x100>;
+			interrupts = <35>, <37>;
+			status = "disabled";
+		};
+
+		sdio1: sdio@90000 {
+			compatible = "marvell,dove-sdhci";
+			reg = <0x90000 0x100>;
+			interrupts = <36>, <38>;
+			status = "disabled";
+		};
+
+		sata0: sata@a0000 {
+			compatible = "marvell,orion-sata";
+			reg = <0xa0000 0x2400>;
+			interrupts = <62>;
+			nr-ports = <1>;
+			status = "disabled";
+		};
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 760a0ef..94ab6b3 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_DT) += dove-dove-db.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
-- 
1.7.10.4


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

* [PATCH v3 6/6] ARM: dove: SolidRun CuBox DT
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                       ` (4 preceding siblings ...)
  2012-08-15 17:07     ` [PATCH v3 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
@ 2012-08-15 17:07     ` Sebastian Hesselbarth
  2012-09-10  2:41     ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Jason Cooper
  6 siblings, 0 replies; 30+ messages in thread
From: Sebastian Hesselbarth @ 2012-08-15 17:07 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Russell King, Jason Cooper, Andrew Lunn, linux-arm-kernel,
	linux-kernel, Rabeeh Khoury, Ian Molton, Maen Suleiman,
	Olof Johansson

This patch adds basic support for the SolidRun CuBox to DT based
mach-dove. There are still some issues related to ongoing orion/mvebu
development, e.g. gpio-led will not work as there is no DT pinctrl
for dove yet and we don't have board specific setup code. Nevertheless,
the DT description is already introduced here.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: Rabeeh Khoury <rabeeh@solid-run.com>
Cc: Ian Molton <ian.molton@codethink.co.uk>
Cc: Maen Suleiman <maen@marvell.com>
Cc: Olof Johansson <olof@lixom.net>
---
 arch/arm/boot/dts/dove-cubox.dts |   42 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-dove/Makefile.boot |    1 +
 2 files changed, 43 insertions(+)
 create mode 100644 arch/arm/boot/dts/dove-cubox.dts

diff --git a/arch/arm/boot/dts/dove-cubox.dts b/arch/arm/boot/dts/dove-cubox.dts
new file mode 100644
index 0000000..0adbd5a
--- /dev/null
+++ b/arch/arm/boot/dts/dove-cubox.dts
@@ -0,0 +1,42 @@
+/dts-v1/;
+
+/include/ "dove.dtsi"
+
+/ {
+	model = "SolidRun CuBox";
+	compatible = "solidrun,cubox", "marvell,dove";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x40000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		power {
+			label = "Power";
+			gpios = <&gpio0 18 1>;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&uart0 { status = "okay"; };
+&sdio0 { status = "okay"; };
+&sata0 { status = "okay"; };
+&i2c0 { status = "okay"; };
+
+&spi0 {
+	status = "okay";
+
+	/* spi0.0: 4M Flash Winbond W25Q32BV */
+	spi-flash@0 {
+		compatible = "st,w25q32";
+		spi-max-frequency = <20000000>;
+		reg = <0>;
+	};
+};
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 94ab6b3..cfac9c5 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -4,3 +4,4 @@ initrd_phys-y	:= 0x00800000
 
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-dove-db.dtb
 dtb-$(CONFIG_MACH_DOVE_DT) += dove-cm-a510.dtb
+dtb-$(CONFIG_MACH_DOVE_DT) += dove-cubox.dtb
-- 
1.7.10.4


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

* Re: [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove
  2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
                       ` (5 preceding siblings ...)
  2012-08-15 17:07     ` [PATCH v3 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
@ 2012-09-10  2:41     ` Jason Cooper
  6 siblings, 0 replies; 30+ messages in thread
From: Jason Cooper @ 2012-09-10  2:41 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Andrew Lunn, Russell King, linux-kernel, Rabeeh Khoury,
	Maen Suleiman, Olof Johansson, Ian Molton, linux-arm-kernel

On Wed, Aug 15, 2012 at 07:07:29PM +0200, Sebastian Hesselbarth wrote:
> This patch set adds DT support for Marvell Dove SoC and three boards
> equipped with this SoC. The work is based on device tree support for
> Marvell Orion based SoCs introduced in 3.6-rc1.
> 
> The first three patches move mach-dove closer to Marvell Kirkwood's
> setup code by unifying the clock setup routines, adding clock gating
> control, and support for Marvell's crypto engine to mach-dove.
> 
> Patches 4 and 5 add a generic DT machine descriptor to mach-dove and
> corresponding DT descriptors for the SoC and already supported boards.
> 
> Finally, the last patch adds a DT descriptor for the SolidRun CuBox,
> a plug computer based on Marvell Dove.
> 
> This patch set relies on a DT support patch for sdhci-dove that has
> been accepted on mmc-next for 3.7 as commit
> b2293055c1e1200acbb46523976852d1686fdfa4.
> 
> Changes:
> v2: removed clk_prepare_enable for tclk and updated subsequent patches
> v3: fixed a typo in clk_gate name for pex0
>     removed device name macros from clk gate names
> 
> Sebastian Hesselbarth (6):
>   ARM: dove: unify clock setup
>   ARM: dove: add clock gating control
>   ARM: dove: add crypto engine
>   ARM: dove: add device tree based machine descriptor
>   ARM: dove: add device tree descriptors
>   ARM: dove: SolidRun CuBox DT
> 
>  arch/arm/boot/dts/dove-cm-a510.dts   |   38 +++++++++
>  arch/arm/boot/dts/dove-cubox.dts     |   42 +++++++++
>  arch/arm/boot/dts/dove-dove-db.dts   |   38 +++++++++
>  arch/arm/boot/dts/dove.dtsi          |  143 +++++++++++++++++++++++++++++++
>  arch/arm/mach-dove/Kconfig           |    7 ++
>  arch/arm/mach-dove/Makefile.boot     |    4 +
>  arch/arm/mach-dove/common.c          |  156 +++++++++++++++++++++++++++++++---
>  arch/arm/mach-dove/include/mach/pm.h |   54 ++++++++----
>  8 files changed, 452 insertions(+), 30 deletions(-)
>  create mode 100644 arch/arm/boot/dts/dove-cm-a510.dts
>  create mode 100644 arch/arm/boot/dts/dove-cubox.dts
>  create mode 100644 arch/arm/boot/dts/dove-dove-db.dts
>  create mode 100644 arch/arm/boot/dts/dove.dtsi
> 
> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Whole series applied to:

git://git.infradead.org/users/jcooper/linux.git kirkwood/boards

thx,

Jason.

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

end of thread, other threads:[~2012-09-10  2:41 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-06 12:23 [PATCH 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
2012-08-11  9:12   ` Andrew Lunn
2012-08-11  9:38     ` Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
2012-08-06 12:23 ` [PATCH 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
2012-08-06 14:02 ` [PATCH 0/6] ARM: dove: DT support for Marvell Dove Arnd Bergmann
2012-08-06 14:16   ` Sebastian Hesselbarth
2012-08-06 14:23     ` Arnd Bergmann
2012-08-07 16:53     ` Russell King - ARM Linux
2012-08-07 19:32       ` Sebastian Hesselbarth
2012-08-11 10:35 ` [PATCH v2 " Sebastian Hesselbarth
2012-08-11 10:35   ` [PATCH v2 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
2012-08-11 10:35   ` [PATCH v2 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
2012-08-12 15:22     ` Andrew Lunn
2012-08-11 10:35   ` [PATCH v2 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
2012-08-11 10:35   ` [PATCH v2 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
2012-08-11 10:35   ` [PATCH v2 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
2012-08-11 10:35   ` [PATCH v2 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
2012-08-15 17:07   ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 1/6] ARM: dove: unify clock setup Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 2/6] ARM: dove: add clock gating control Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 3/6] ARM: dove: add crypto engine Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 4/6] ARM: dove: add device tree based machine descriptor Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 5/6] ARM: dove: add device tree descriptors Sebastian Hesselbarth
2012-08-15 17:07     ` [PATCH v3 6/6] ARM: dove: SolidRun CuBox DT Sebastian Hesselbarth
2012-09-10  2:41     ` [PATCH v3 0/6] ARM: dove: DT support for Marvell Dove Jason Cooper

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).