Skip to contentSkip to conversation

ARM: initial DTS support for km_kirkwood

RFC PATCH New Valentin Longchamp 3 participants 7 messages Aug 28, 2012 – Sep 3, 2012

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

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

This initial support is minimal: the kernel can boot with network (ge0), serial port and NAND functional.

---
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts |   29 +++++++++++
 arch/arm/mach-kirkwood/Kconfig             |    7 +++
 arch/arm/mach-kirkwood/Makefile            |    1 +
 arch/arm/mach-kirkwood/Makefile.boot       |    1 +
 arch/arm/mach-kirkwood/board-dt.c          |    4 ++
 arch/arm/mach-kirkwood/board-km_kirkwood.c |   75 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    6 ++
 7 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-km_kirkwood.dts
 create mode 100644 arch/arm/mach-kirkwood/board-km_kirkwood.c
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +29 -0
new file mode 100644
index 0000000..60118d5
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Keymile Kirkwood Reference Design";
+	compatible = "keymile,km_kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x08000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
+		};
+
+		nand at 3000000 {
+			status = "ok";
+			chip-delay = <25>;
+		};
+	};
+};
arch/arm/mach-kirkwood/Kconfig +7 -0
index ca5c15a..a2a99a1 100644
@@ -109,6 +109,13 @@ config MACH_LSXL_DT
 	  Buffalo Linkstation LS-XHL & LS-CHLv2 devices, using
 	  Flattened Device Tree.
 
+config MACH_KM_KIRKWOOD_DT
+	bool "Keymile Kirkwood Reference Design (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
arch/arm/mach-kirkwood/Makefile +1 -0
index 055c85a..f23ed81 100644
@@ -28,3 +28,4 @@ obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
 obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
+obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
arch/arm/mach-kirkwood/Makefile.boot +1 -0
index a571755..4f1dc3c 100644
@@ -11,3 +11,4 @@ dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-qnap-ts219.dtb
 dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
 dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
 dtb-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
+dtb-$(CONFIG_MACH_KM_KIRKWOOD_DT) += kirkwood-km_kirkwood.dtb
arch/arm/mach-kirkwood/board-dt.c +4 -0
index e4eb450..9decc97 100644
@@ -87,6 +87,9 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("buffalo,lsxl"))
 		lsxl_init();
 
+	if (of_machine_is_compatible("keymile,km_kirkwood"))
+		km_kirkwood_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -100,6 +103,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"qnap,ts219",
 	"seagate,goflexnet",
 	"buffalo,lsxl",
+	"keymile,km_kirkwood",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +75 -0

75 lines not on this page · raw message

arch/arm/mach-kirkwood/common.h +6 -0
index 304dd1a..219eecc 100644
@@ -94,6 +94,12 @@ void lsxl_init(void);
 static inline void lsxl_init(void) {};
 #endif
 
+#ifdef CONFIG_MACH_KM_KIRKWOOD_DT
+void km_kirkwood_init(void);
+#else
+static inline void km_kirkwood_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
Signature · 1 line
1.7.1
#1 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

Hi Valentin

Quoted 5 lines

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

Is there a public datasheet for this device?

Quoted 34 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +28 -0
new file mode 100644
index 0000000..7a103db
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
+ * Valentin Longchamp <[email protected]>
+ *
+ * arch/arm/mach-kirkwood/board-km_kirkwood.c
+ *
+ * Keymile km_kirkwood Reference Desing Init for drivers not converted to
+ * flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_fdt.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/gpio.h>
+#include <linux/mtd/physmap.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi.h>

arch/arm/mach-kirkwood/board-km_kirkwood.c line 38

Quoted 10 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +10 -0
+#include <linux/clk.h>
+#include <linux/clk-private.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/kirkwood.h>
+#include <mach/bridge-regs.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"

Please remove all the header files you don't need.

Quoted 15 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +15 -0
+
+static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
+};
+
+static unsigned int km_kirkwood_mpp_config[] __initdata = {
+	MPP8_GPIO,	/* I2C SDA */
+	MPP9_GPIO,	/* I2C SCL */
+	0
+};
+
+void __init km_kirkwood_init(void)
+{
+	struct clk *sata_clk;
+	/*

arch/arm/mach-kirkwood/board-km_kirkwood.c line 63

Quoted 10 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +10 -0
+	 * Basic setup. Needs to be called early.
+	 */
+
+	kirkwood_mpp_conf(km_kirkwood_mpp_config);
+
+	/*
+	 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
+	 * SATA bits (14-15) of the Clock Gating Control Register. Since these
+	 * devices are also not present in this variant, their clocks get
+	 * disabled because unused when clk_disable_unused() gets called.

So there is no SATA at all on this SoC? Anything else missing which a 'normal' kirkwood has?

If there a way to identify the chipset? e.g. what does

kirkwood_pcie_id(&dev, &rev);

give? It would be better to not create the clocks at all, if we could determine at runtime the hardware was not there.

Apart from these comments, the patch looks good.

Andrew

#2 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

Hi Andrew,

Quoted 9 lines · Andrew Lunn

Hi Valentin

Quoted 5 lines

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

Is there a public datasheet for this device?

Unfortunately I am not aware of such a document. I have just checked on Marvell's website and I haven't found anything. All the documents we have are under NDA.

Quoted 39 lines
Quoted 39 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +32 -0
new file mode 100644
index 0000000..7a103db
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2012 2012 KEYMILE AG, CH-3097 Bern
+ * Valentin Longchamp <[email protected]>
+ *
+ * arch/arm/mach-kirkwood/board-km_kirkwood.c
+ *
+ * Keymile km_kirkwood Reference Desing Init for drivers not converted to
+ * flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_fdt.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/gpio.h>
+#include <linux/mtd/physmap.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi.h>
+#include <linux/clk.h>
+#include <linux/clk-private.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
Quoted 8 lines

arch/arm/mach-kirkwood/board-km_kirkwood.c line 38

Quoted 6 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +6 -0
+#include <asm/mach/map.h>
+#include <mach/kirkwood.h>
+#include <mach/bridge-regs.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"

Please remove all the header files you don't need.

OK.

Quoted 21 lines
Quoted 21 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +20 -0
+
+static struct mv643xx_eth_platform_data km_kirkwood_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
+};
+
+static unsigned int km_kirkwood_mpp_config[] __initdata = {
+	MPP8_GPIO,	/* I2C SDA */
+	MPP9_GPIO,	/* I2C SCL */
+	0
+};
+
+void __init km_kirkwood_init(void)
+{
+	struct clk *sata_clk;
+	/*
+	 * Basic setup. Needs to be called early.
+	 */
+
+	kirkwood_mpp_conf(km_kirkwood_mpp_config);
+
Quoted 8 lines

arch/arm/mach-kirkwood/board-km_kirkwood.c line 63

Quoted 5 lines
arch/arm/mach-kirkwood/board-km_kirkwood.c new file +5 -0
+	/*
+	 * Our variant of kirkwood (integrated in the Bobcat) hangs on accessing
+	 * SATA bits (14-15) of the Clock Gating Control Register. Since these
+	 * devices are also not present in this variant, their clocks get
+	 * disabled because unused when clk_disable_unused() gets called.

So there is no SATA at all on this SoC? Anything else missing which a 'normal' kirkwood has?

No SATA at all. Yes, other missing peripherals are RTC, SDIO, I2S (Audio), TDM, TS (MPEG-2 Transport Stream).

Quoted 8 lines

If there a way to identify the chipset? e.g. what does

kirkwood_pcie_id(&dev, &rev);

give? It would be better to not create the clocks at all, if we could determine at runtime the hardware was not there.

Yeah I agree, it would be much better. However here is what is returned from the kirkwood_pcie_id call in kirkwood_dt_init() (kirkwood_id())

Quoted 1 line

Kirkwood: MV88F6281-A0, TCLK=200000000.

To me it looks like this is the exact same ID as the usual kirkwood version so we cannot determine this at runtime (at least not with that ID).

Valentin

#3 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

In reply to Valentin Longchamp
Quoted 46 lines · Valentin Longchamp

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

This initial support is minimal: the kernel can boot with network (ge0), serial port and NAND functional.

---
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts |   29 +++++++++++
 arch/arm/mach-kirkwood/Kconfig             |    7 +++
 arch/arm/mach-kirkwood/Makefile            |    1 +
 arch/arm/mach-kirkwood/Makefile.boot       |    1 +
 arch/arm/mach-kirkwood/board-dt.c          |    4 ++
 arch/arm/mach-kirkwood/board-km_kirkwood.c |   75 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    6 ++
 7 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-km_kirkwood.dts
 create mode 100644 arch/arm/mach-kirkwood/board-km_kirkwood.c
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +17 -0
new file mode 100644
index 0000000..60118d5
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Keymile Kirkwood Reference Design";
+	compatible = "keymile,km_kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x08000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+

arch/arm/boot/dts/kirkwood-km_kirkwood.dts line 27

Quoted 10 lines
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +10 -0
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
+		};
+
+		nand at 3000000 {
+			status = "ok";
+			chip-delay = <25>;
+		};

Is there a partition layout for this board?

thx,

Jason.

#4 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

Quoted 51 lines · Jason Cooper
Quoted 50 lines · Valentin Longchamp

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

This initial support is minimal: the kernel can boot with network (ge0), serial port and NAND functional.

---
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts |   29 +++++++++++
 arch/arm/mach-kirkwood/Kconfig             |    7 +++
 arch/arm/mach-kirkwood/Makefile            |    1 +
 arch/arm/mach-kirkwood/Makefile.boot       |    1 +
 arch/arm/mach-kirkwood/board-dt.c          |    4 ++
 arch/arm/mach-kirkwood/board-km_kirkwood.c |   75 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    6 ++
 7 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-km_kirkwood.dts
 create mode 100644 arch/arm/mach-kirkwood/board-km_kirkwood.c
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +21 -0
new file mode 100644
index 0000000..60118d5
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Keymile Kirkwood Reference Design";
+	compatible = "keymile,km_kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x08000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
Quoted 9 lines

arch/arm/boot/dts/kirkwood-km_kirkwood.dts line 27

Quoted 6 lines
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +6 -0
+		};
+
+		nand at 3000000 {
+			status = "ok";
+			chip-delay = <25>;
+		};

Is there a partition layout for this board?

Well, there is one: one big UBI partition on the whole NAND chip (we then create UBI volumes when building the initial system and dynamically create additional ones when neeeded). But this UBI partition gets detected perfecly well without this partition layout so I left it out.

Valentin

#5 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

Quoted 15 lines · Valentin Longchamp
Quoted 13 lines · Jason Cooper

arch/arm/boot/dts/kirkwood-km_kirkwood.dts line 27

Quoted 10 lines · Valentin Longchamp
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +10 -0
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
+		};
+
+		nand at 3000000 {
+			status = "ok";
+			chip-delay = <25>;
+		};

Is there a partition layout for this board?

Quoted 4 lines

Well, there is one: one big UBI partition on the whole NAND chip (we then create UBI volumes when building the initial system and dynamically create additional ones when neeeded). But this UBI partition gets detected perfecly well without this partition layout so I left it out.

ok, just wanted to make sure it wasn't left out. I look forward to v2 with Andrew's suggestions.

thx,

Jason.

#6 lore raw

RFC PATCH 1/1 ARM: initial DTS support for km_kirkwood

In reply to Valentin Longchamp
Quoted 29 lines · Valentin Longchamp

This is a first attempt to support the km_kirkwood reference design with a device tree. This km_kirkwood design is present in many Keymile products. It is based on the Marvell Bobcat SOC which integrates a Kirkwood CPU next to a big L2 Ethernet Switch. The Kirkwood in the SOC is very similar to the "normal" one, but there are a few differences.

This initial support is minimal: the kernel can boot with network (ge0), serial port and NAND functional.

---
 arch/arm/boot/dts/kirkwood-km_kirkwood.dts |   29 +++++++++++
 arch/arm/mach-kirkwood/Kconfig             |    7 +++
 arch/arm/mach-kirkwood/Makefile            |    1 +
 arch/arm/mach-kirkwood/Makefile.boot       |    1 +
 arch/arm/mach-kirkwood/board-dt.c          |    4 ++
 arch/arm/mach-kirkwood/board-km_kirkwood.c |   75 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    6 ++
 7 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-km_kirkwood.dts
 create mode 100644 arch/arm/mach-kirkwood/board-km_kirkwood.c
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +0 -0
new file mode 100644
index 0000000..60118d5

arch/arm/boot/dts/kirkwood-km_kirkwood.dts line 7

Quoted 7 lines
arch/arm/boot/dts/kirkwood-km_kirkwood.dts new file +7 -0
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Keymile Kirkwood Reference Design";
+	compatible = "keymile,km_kirkwood", "marvell,kirkwood-88f6281", "marvell,kirkwood";

Hi Valentin.

The compatibility here should probably be

marvell,kirkwood-98DX4122

not marvell,kirkwood-88f6281, just to make it clear we are not talking about a normal kirkwood SoC, but a kirkwood embedded inside a 98DX4122.

Thanks

Andrew