Skip to contentSkip to conversation

RFC: marvell dreamplug dft support

PATCH New Jason Cooper 10 participants 43 messages Aug 9, 2011 – Feb 28, 2012

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

v2 cover RFC: marvell dreamplug dft support

All,

First, a warning. Do not apply the last patch in the series! It has no hope of compiling. I'm trying to learn how to add board support to the Linux kernel _and_ now trying to learn how to do it using devicetree.

In short, I'm lost. ;-) Any and all help appreciated.

In my sad attempt to add devicetree support, I used arch/arm/mach-kirkwood/include/mach/kirkwood.h to stub out the addresses. It's my understanding that most peripherals on this SoC are register-based. So, I haven't added external-bus{...}; yet.

Based on kirkwood.h, there doesn't seem to be any obvious register size definition, should I omit that all around in my devicetree?

I'm guessing at a lot of the compatible="" properties, I simply chose the .name string I found in the respective code. Is this correct?

I see nothing obvious to indicate an irq handler similar to that mentioned in [1]. Any thoughts? I found the irq table, just no way to use it.

Also, I'll rename dreamplug-setup.c -> dreamplug-dt.c once I have something working.

[1] has been a great help, thanks Grant!

thx,

Jason.

[1] http://devicetree.org/Device_Tree_Usage

Jason Cooper (3):
arm/kirkwood: TEMP hack till mach-types is updated. arm/kirkwood: add dreamplug support.
arm: kirkwood: dreamplug fdt support

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   64 +++++++++++++
 arch/arm/mach-kirkwood/Kconfig           |    8 ++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/dreamplug-setup.c |  151 ++++++++++++++++++++++++++++++
 arch/arm/tools/mach-types                |    1 +
 6 files changed, 227 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/mach-kirkwood/dreamplug-setup.c
#1 lore raw

PATCH v2 1/3 RFC: arm/kirkwood: TEMP hack till mach-types is updated.

DO NOT SUBMIT!

---
 arch/arm/tools/mach-types |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/tools/mach-types +1 -0
index 3b3776d..d5c5779 100644
@@ -1113,3 +1113,4 @@ blissc			MACH_BLISSC		BLISSC			3491
 thales_adc		MACH_THALES_ADC		THALES_ADC		3492
 ubisys_p9d_evp		MACH_UBISYS_P9D_EVP	UBISYS_P9D_EVP		3493
 atdgp318		MACH_ATDGP318		ATDGP318		3494
+dreamplug		MACH_DREAMPLUG		DREAMPLUG		3550
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v2 1/3 RFC: arm/kirkwood: TEMP hack till mach-types is updated.

Quoted 12 lines · Jason Cooper

DO NOT SUBMIT!

---
 arch/arm/tools/mach-types |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/tools/mach-types +0 -0
index 3b3776d..d5c5779 100644

arch/arm/tools/mach-types blissc MACH_BLISSC BLISSC 3491 · line 1116

Quoted 4 lines
arch/arm/tools/mach-types +1 -0
@@ -1113,3 +1113,4 @@ blissc			MACH_BLISSC		BLISSC			3491
 thales_adc		MACH_THALES_ADC		THALES_ADC		3492
 ubisys_p9d_evp		MACH_UBISYS_P9D_EVP	UBISYS_P9D_EVP		3493
 atdgp318		MACH_ATDGP318		ATDGP318		3494
+dreamplug		MACH_DREAMPLUG		DREAMPLUG		3550

Also completely unneeded when adding DT-only board support.

g.

#3 lore raw

PATCH v2 1/3 RFC: arm/kirkwood: TEMP hack till mach-types is updated.

In reply to Jason Cooper
Quoted 12 lines · Jason Cooper

DO NOT SUBMIT!

---
 arch/arm/tools/mach-types |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/tools/mach-types +0 -0
index 3b3776d..d5c5779 100644

arch/arm/tools/mach-types blissc MACH_BLISSC BLISSC 3491 · line 1116

Quoted 4 lines
arch/arm/tools/mach-types +1 -0
@@ -1113,3 +1113,4 @@ blissc			MACH_BLISSC		BLISSC			3491
 thales_adc		MACH_THALES_ADC		THALES_ADC		3492
 ubisys_p9d_evp		MACH_UBISYS_P9D_EVP	UBISYS_P9D_EVP		3493
 atdgp318		MACH_ATDGP318		ATDGP318		3494
+dreamplug		MACH_DREAMPLUG		DREAMPLUG		3550

Oops, I replied to a really old email. Ignore my comments.

g.

#4 lore raw

PATCH v2 2/3 RFC: arm/kirkwood: add dreamplug support.

In reply to Jason Cooper

Copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash. LED pins are correct.

---
 arch/arm/mach-kirkwood/Kconfig           |    6 ++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/dreamplug-setup.c |  144 ++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-kirkwood/dreamplug-setup.c
arch/arm/mach-kirkwood/Kconfig +6 -0
index 7fc603b..e93c610 100644
@@ -44,6 +44,12 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config MACH_DREAMPLUG
+	bool "Marvell DreamPlug Reference Board"
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug Reference Board.
+
 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 5dcaa81..c443a13 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_MACH_MV88F6281GTW_GE)	+= mv88f6281gtw_ge-setup.o
 obj-$(CONFIG_MACH_SHEEVAPLUG)		+= sheevaplug-setup.o
 obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG)	+= sheevaplug-setup.o
 obj-$(CONFIG_MACH_GURUPLUG)		+= guruplug-setup.o
+obj-$(CONFIG_MACH_DREAMPLUG)		+= dreamplug-setup.o
 obj-$(CONFIG_MACH_DOCKSTAR)		+= dockstar-setup.o
 obj-$(CONFIG_MACH_TS219)		+= ts219-setup.o tsx1x-common.o
 obj-$(CONFIG_MACH_TS41X)		+= ts41x-setup.o tsx1x-common.o
arch/arm/mach-kirkwood/dreamplug-setup.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v2 2/3 RFC: arm/kirkwood: add dreamplug support.

Jason Cooper <[email protected]> writes:

Hi,

Quoted 2 lines

Copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash. LED pins are correct.

Why don't use modify guruplug.c instead and use some if (machine_is_*) tests to handle the differences like what was done for openrd ? I find it quite wasteful to add a new machine file while (I guess) it should be easier to modify existing code.

Regards,
Arnaud

#6 lore raw

PATCH v2 2/3 RFC: arm/kirkwood: add dreamplug support.

Quoted 8 lines · Arnaud Patard
Quoted 2 lines · Jason Cooper

Copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash. LED pins are correct.

Why don't use modify guruplug.c instead and use some if (machine_is_*) tests to handle the differences like what was done for openrd ? I find it quite wasteful to add a new machine file while (I guess) it should be easier to modify existing code.

Interesting, I hadn't looked carefully at openrd. Thanks for the pointer. In my grand plan, there will be a boot/dts/kirkwood.dtsi, and then a boot/dts/kirkwood-dreamplug.dts and, hopefully, a single mach-kirkwood/board-dt.c ... This patch [2/3] was left in because it was the legacy way of doing things, at it works. I wanted to show my thought process (wrong and right) for migrating dreamplug to devicetree. Dreamplug hasn't made it into mainline yet, because it isn't devicetree.

If I can get it right, migrating the other mach-kirkwood/*-setup.c should be simply boot/dts/kirkwood-*.dts

thx,

Jason.

#7 lore raw

PATCH v2 2/3 RFC: arm/kirkwood: add dreamplug support.

In reply to Jason Cooper
Quoted 10 lines · Jason Cooper

Copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash. LED pins are correct.

---
 arch/arm/mach-kirkwood/Kconfig           |    6 ++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/dreamplug-setup.c |  144 ++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-kirkwood/dreamplug-setup.c

Hi Jason,

If the boards are reasonably similar, the way to go using the device tree is to have separate dts files but share a single board file that uses the device tree to figure out the differences.

For the on-chip components, you can even share most of the device tree contents with an include directive.

In the actual board file, do not list any platform devices, but make sure that the contents of the device tree file describe the devices completely. Try to avoid any dependencies on the specific board name (other than the initial match entry) but instead describe the differences accurately.

Arnd

#8 lore raw

PATCH v2 3/3 RFC: arm: kirkwood: dreamplug fdt support

In reply to Jason Cooper

Do Not Apply! Does not build! This patch is just a conversation starter to help me learn how to add devicetree support to arm devices.

I chose the dreamplug because it isn't supported in mainline yet.

---
 arch/arm/boot/dts/kirkwood-dreamplug.dts |   64 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig           |    6 ++-
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/dreamplug-setup.c |   15 +++++--
 4 files changed, 81 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +64 -0
new file mode 100644
index 0000000..954d03f
@@ -0,0 +1,64 @@
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "marvell,kirkwood-dreamplug";
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		cpu at 0 {
+			compatible = "arm,arm926ejs";
+			reg = <0>;
+		};
+	};
+
+	rtc at f1000300 {
+		compatible = "marvell,mvrtc";
+		reg = <0xf1000300 0xXXX>;
+	};
+
+	spi at f1000600 {
+		compatible = "marvell,orion_spi";
+		reg = <0xf1000600 0xXXX>;
+	};
+
+	i2c at f1001000 {
+		compatible = "marvell,XXX";
+		reg = <0xf1001000 0xXXX>;
+	};
+
+	serial at f1002000 {
+		compatible = "marvell,serial8250";
+		reg = <0xf1002000 0xXXXX>;
+	};
+
+	serial at f1002100 {
+		compatible = "marvell,serial8250";
+		reg = <0xf1002100 0xXXXX>;
+	};
+
+	usb at f1050000 {
+		compatible = "marvell,orion-ehci";
+		reg = <0xf1050000 0xXXX>;
+	};
+
+	ethernet at f1070000 {
+		compatible = "marvell,XXX";
+		reg = <0xf1070000 0xXXXX>;
+	};
+
+	ethernet at f1074000 {
+		compatible = "marvell,XXX";
+		reg = <0xf1074000 0xXXXX>;
+	};
+
+	sata at f1080000 {
+		compatible = "marvell,sata_mv";
+		reg = <0xf1080000 0xXXXX>;
+	};
+
+	sdio at f1090000 {
+		compatible = "marvell,XXX";
+		reg = <0xf1090000 0xXXX>;
+	};
+};
arch/arm/mach-kirkwood/Kconfig +4 -2
index e93c610..ea87090 100644
@@ -45,10 +45,12 @@ config MACH_GURUPLUG
 	  Marvell GuruPlug Reference Board.
 
 config MACH_DREAMPLUG
-	bool "Marvell DreamPlug Reference Board"
+	bool "Marvell DreamPlug Reference Board (FDT Support)"
+	select USE_OF
 	help
 	  Say 'Y' here if you want your kernel to support the
-	  Marvell DreamPlug Reference Board.
+	  Marvell DreamPlug Reference Board using the 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"
arch/arm/mach-kirkwood/Makefile.boot +2 -0
index 67039c3..53dbe1f 100644
@@ -1,3 +1,5 @@
    zreladdr-y	:= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DREAMPLUG) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/dreamplug-setup.c +11 -4
index 981bc71..4128ab7 100644
@@ -11,6 +11,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
 #include <linux/mtd/partitions.h>
 #include <linux/ata_platform.h>
 #include <linux/mv643xx_eth.h>
@@ -110,6 +112,10 @@ static unsigned int dreamplug_mpp_config[] __initdata = {
 	0
 };
 
+static struct of_device_id dreamplug_dt_match_table[] __initdata = {
+	{ .compatible = "marvell,kirkwood-dreamplug", },
+};
+
 static void __init dreamplug_init(void)
 {
 	/*
@@ -131,14 +137,15 @@ static void __init dreamplug_init(void)
 	kirkwood_sdio_init(&dreamplug_mvsdio_data);
 
 	platform_device_register(&dreamplug_leds);
+	of_platform_populate(NULL, dreamplug_dt_match_table, NULL, NULL);
 }
 
-MACHINE_START(DREAMPLUG, "Marvell DreamPlug Reference Board")
-	/* Maintainer: Siddarth Gore <[email protected]> */
-	.boot_params	= 0x00000100,
-	.init_machine	= dreamplug_init,
+MACHINE_START(DREAMPLUG, "Marvell DreamPlug (Flattened Device Tree)")
 	.map_io		= kirkwood_map_io,
 	.init_early	= kirkwood_init_early,
 	.init_irq	= kirkwood_init_irq,
 	.timer		= &kirkwood_timer,
+	.init_machine	= dreamplug_init,
+	.dt_compat	= kirkwood_dt_board_compat,
+	.boot_params	= 0x00000100,
 MACHINE_END
Signature · 1 line
1.7.0.4
#9 lore raw

PATCH v3 1/1 arm: kirkwood: add dreamplug support.

In reply to Jason Cooper

Copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

---
Changes from v1

- attempting dts, looking for pointers.

Changes from v2

- resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased against same.
- removed lame fdt attempt, others are working on kirkwood fdt. Will convert once kirkwood fdt is mainline.
- s/boot_params/atag_offset/
- added kirkwood_reset
- 1 checkpatch.pl warning (help in Kconfig), looks the same as all other kirkwood boards...

 arch/arm/mach-kirkwood/Kconfig           |    6 +
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/dreamplug-setup.c |  151 ++++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-kirkwood/dreamplug-setup.c
arch/arm/mach-kirkwood/Kconfig +6 -0
index 7fc603b..e93c610 100644
@@ -44,6 +44,12 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config MACH_DREAMPLUG
+	bool "Marvell DreamPlug Reference Board"
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug Reference Board.
+
 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 5dcaa81..c443a13 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_MACH_MV88F6281GTW_GE)	+= mv88f6281gtw_ge-setup.o
 obj-$(CONFIG_MACH_SHEEVAPLUG)		+= sheevaplug-setup.o
 obj-$(CONFIG_MACH_ESATA_SHEEVAPLUG)	+= sheevaplug-setup.o
 obj-$(CONFIG_MACH_GURUPLUG)		+= guruplug-setup.o
+obj-$(CONFIG_MACH_DREAMPLUG)		+= dreamplug-setup.o
 obj-$(CONFIG_MACH_DOCKSTAR)		+= dockstar-setup.o
 obj-$(CONFIG_MACH_TS219)		+= ts219-setup.o tsx1x-common.o
 obj-$(CONFIG_MACH_TS41X)		+= ts41x-setup.o tsx1x-common.o
arch/arm/mach-kirkwood/dreamplug-setup.c new file +151 -0

151 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#10 lore raw

v4 cover arm: kirkwood: add dreamplug/devicetree support

In reply to Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

In a future patch series, I plan to migrate spi/flash/partitions over to devicetree.

When the migration is complete, board-dt.c will not be specific to the dreamplug, and dts files can be written for all of the other kirkwood boards.

Jason Cooper (3):
arm: ignore devicetree blobs.
arm: kirkwood: add dreamplug (fdt) support.
arm: kirkwood: convert uart0 to devicetree.

 arch/arm/boot/.gitignore                 |    1 +
 arch/arm/boot/dts/kirkwood-dreamplug.dts |   19 +++
 arch/arm/boot/dts/kirkwood.dtsi          |   14 +++
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  180 ++++++++++++++++++++++++++++++
 7 files changed, 231 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
Signature · 1 line
1.7.3.4
#11 lore raw

PATCH v2 1/3 arm: ignore devicetree blobs.

---
NOTE: This is the first version of this patch, so no change history.

 arch/arm/boot/.gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/boot/.gitignore +1 -0
index ce1c5ff..3c79f85 100644
@@ -3,3 +3,4 @@ zImage
 xipImage
 bootpImage
 uImage
+*.dtb
Signature · 1 line
1.7.3.4
#12 lore raw

PATCH 1/3 arm: ignore devicetree blobs.

Quoted 1 line · Jason Cooper

arch/arm/boot/.gitignore zImage · line 6

Quoted 9 lines
arch/arm/boot/.gitignore +1 -0
index ce1c5ff..3c79f85 100644
@@ -3,3 +3,4 @@ zImage
 xipImage
 bootpImage
 uImage
+*.dtb

This patch should probably go through Russell's tree. It looks obviously correct so unless someone complains in the next few days, just put it into the patch tracker system.

Arnd

#13 lore raw

PATCH 1/3 arm: ignore devicetree blobs.

In reply to Jason Cooper
Quoted 2 lines · Jason Cooper

/me claims prior art:

	http://mid.gmane.org/1323808612-14976-1-git-send-email-u.kleine-koenig at pengutronix.de

Best regards
Uwe

Quoted 24 lines

---
NOTE: This is the first version of this patch, so no change history.

 arch/arm/boot/.gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/boot/.gitignore +1 -0
index ce1c5ff..3c79f85 100644
@@ -3,3 +3,4 @@ zImage
 xipImage
 bootpImage
 uImage
+*.dtb
Signature · 7 lines
1.7.3.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#14 lore raw

PATCH 1/3 arm: ignore devicetree blobs.

Quoted 6 lines · Uwe Kleine-K?nig
Quoted 2 lines · Jason Cooper

/me claims prior art:

	http://mid.gmane.org/1323808612-14976-1-git-send-email-u.kleine-koenig at pengutronix.de

Multiple people proposed this...

Grant accepted my patch, and it is already in -next:

See next-20110222

810ae3d26507e61d1f7a69e9716443df1ce41449
ARM: devicetree: Add .dtb files to arch/arm/boot/.gitignore

Cheers
---Dave

Quoted 36 lines

Best regards
Uwe

Quoted 24 lines

---
NOTE: This is the first version of this patch, so no change history.

 arch/arm/boot/.gitignore |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/boot/.gitignore +1 -0
index ce1c5ff..3c79f85 100644
@@ -3,3 +3,4 @@ zImage
 xipImage
 bootpImage
 uImage
+*.dtb
Signature · 7 lines
1.7.3.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 6 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss at lists.ozlabs.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
author
#15 lore raw

PATCH v2 1/3 arm: ignore devicetree blobs.

Dave,

Quoted 8 lines · Dave Martin
Quoted 6 lines · Uwe Kleine-K?nig
Quoted 2 lines · Jason Cooper

/me claims prior art:

	http://mid.gmane.org/1323808612-14976-1-git-send-email-u.kleine-koenig at pengutronix.de
Quoted 8 lines

Multiple people proposed this...

Grant accepted my patch, and it is already in -next:

See next-20110222

810ae3d26507e61d1f7a69e9716443df1ce41449
ARM: devicetree: Add .dtb files to arch/arm/boot/.gitignore

awesome, I'll drop this from the next version of the series, then.

thx,

Jason.

#16 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

In reply to Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

- attempting dts, looking for pointers.

Changes from v2

- resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased against same.
- removed lame fdt attempt, others are working on kirkwood fdt. Will convert once kirkwood fdt is mainline.
- s/boot_params/atag_offset/
- added kirkwood_reset
- 1 checkpatch.pl warning (help in Kconfig), looks the same as all other kirkwood boards...

Changes from v3

- rebased against v3.3-rc3 (recommended by Arnd)
- use devicetree to determine which board we are on
- added patch to configure uart0 from devicetree

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   19 +++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  182 ++++++++++++++++++++++++++++++
 6 files changed, 224 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +19 -0
new file mode 100644
index 0000000..fbfaaf6
@@ -0,0 +1,19 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Marvell Dreamplug";
+	compatible = "marvell,dreamplug", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+
+};
arch/arm/boot/dts/kirkwood.dtsi new file +6 -0
new file mode 100644
index 0000000..771c6bb
@@ -0,0 +1,6 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,kirkwood";
+};
+
arch/arm/mach-kirkwood/Kconfig +14 -0
index 7fc603b..6095884 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	depends on ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (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 5dcaa81..acbc5e1 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
+obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
arch/arm/mach-kirkwood/Makefile.boot +2 -0
index 760a0ef..16f9385 100644
@@ -1,3 +1,5 @@
    zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/board-dt.c new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#17 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 7 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Quoted 7 lines

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

Looks good to me.

I'm adding Nicolas and Lennert to Cc to make sure they see the mail.

#18 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

Quoted 7 lines
Quoted 1 line

Looks good to me.

I'm adding Nicolas and Lennert to Cc to make sure they see the mail.

I'm fine with the approach.

Arnd, Jason: please feel free to work something out between yourselves to move those patches into the arm-soc tree.

Nicolas

#19 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

In reply to Jason Cooper
Quoted 95 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

- attempting dts, looking for pointers.

Changes from v2

- resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased against same.
- removed lame fdt attempt, others are working on kirkwood fdt. Will convert once kirkwood fdt is mainline.
- s/boot_params/atag_offset/
- added kirkwood_reset
- 1 checkpatch.pl warning (help in Kconfig), looks the same as all other kirkwood boards...

Changes from v3

- rebased against v3.3-rc3 (recommended by Arnd)
- use devicetree to determine which board we are on
- added patch to configure uart0 from devicetree

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   19 +++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  182 ++++++++++++++++++++++++++++++
 6 files changed, 224 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +19 -0
new file mode 100644
index 0000000..fbfaaf6
@@ -0,0 +1,19 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Marvell Dreamplug";
+	compatible = "marvell,dreamplug", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+
+};
arch/arm/boot/dts/kirkwood.dtsi new file +6 -0
new file mode 100644
index 0000000..771c6bb
@@ -0,0 +1,6 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,kirkwood";
+};
+
arch/arm/mach-kirkwood/Kconfig +3 -0
index 7fc603b..6095884 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF

arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG · line 59

Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +10 -0
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	depends on ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (Flattened Device Tree).

Why do you need 2 entries?

Quoted 153 lines
arch/arm/mach-kirkwood/Kconfig +1 -0
+
 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 5dcaa81..acbc5e1 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
+obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
arch/arm/mach-kirkwood/Makefile.boot +2 -0
index 760a0ef..16f9385 100644
@@ -1,3 +1,5 @@
    zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/board-dt.c new file +124 -0
new file mode 100644
index 0000000..ab13eb9
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2012 (C), Jason Cooper <[email protected]>
+ *
+ * arch/arm/mach-kirkwood/board-dt.c
+ *
+ * Marvell DreamPlug Reference Board Setup
+ *
+ * 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/mtd/partitions.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/leds.h>
+#include <linux/mtd/physmap.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/orion_spi.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct of_device_id kirkwood_dt_match_table[] __initdata = {
+	{ .compatible = "simple-bus", },
+	{ }
+};
+
+struct mtd_partition dreamplug_partitions[] = {
+	{
+		.name	= "u-boot",
+		.size	= SZ_512K,
+		.offset = 0,
+	},
+	{
+		.name	= "u-boot env",
+		.size	= SZ_64K,
+		.offset = SZ_512K + SZ_512K,
+	},
+	{
+		.name	= "dtb",
+		.size	= SZ_64K,
+		.offset = SZ_512K + SZ_512K + SZ_512K,
+	},
+};
+
+static const struct flash_platform_data dreamplug_spi_slave_data = {
+	.type		= "mx25l1606e",
+	.name		= "spi_flash",
+	.parts		= dreamplug_partitions,
+	.nr_parts	= ARRAY_SIZE(dreamplug_partitions),
+};
+
+static struct spi_board_info __initdata dreamplug_spi_slave_info[] = {
+	{
+		.modalias	= "m25p80",
+		.platform_data	= &dreamplug_spi_slave_data,
+		.irq		= -1,
+		.max_speed_hz	= 50000000,
+		.bus_num	= 0,
+		.chip_select	= 0,
+	},
+};
+
+static struct mv643xx_eth_platform_data dreamplug_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(0),
+};
+
+static struct mv643xx_eth_platform_data dreamplug_ge01_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(1),
+};
+
+static struct mv_sata_platform_data dreamplug_sata_data = {
+	.n_ports	= 1,
+};
+
+static struct mvsdio_platform_data dreamplug_mvsdio_data = {
+	/* unfortunately the CD signal has not been connected */
+};
+
+static struct gpio_led dreamplug_led_pins[] = {
+	{
+		.name			= "dreamplug:blue:bluetooth",
+		.gpio			= 47,
+		.active_low		= 1,
+	},
+	{
+		.name			= "dreamplug:green:wifi",
+		.gpio			= 48,
+		.active_low		= 1,
+	},
+	{
+		.name			= "dreamplug:green:wifi_ap",
+		.gpio			= 49,
+		.active_low		= 1,
+	},
+};
+
+static struct gpio_led_platform_data dreamplug_led_data = {
+	.leds		= dreamplug_led_pins,
+	.num_leds	= ARRAY_SIZE(dreamplug_led_pins),
+};
+
+static struct platform_device dreamplug_leds = {
+	.name	= "leds-gpio",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &dreamplug_led_data,
+	}
+};
+

arch/arm/mach-kirkwood/board-dt.c line 134

Quoted 10 lines
arch/arm/mach-kirkwood/board-dt.c new file +10 -0
+static unsigned int dreamplug_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
+	MPP3_SPI_MISO,
+	MPP47_GPIO,	/* Bluetooth LED */
+	MPP48_GPIO,	/* Wifi LED */
+	MPP49_GPIO,	/* Wifi AP LED */
+	0
+};

Do you need this to boot? All this data should come from the dtb.

Quoted 18 lines
arch/arm/mach-kirkwood/board-dt.c new file +18 -0
+
+static void __init dreamplug_init(void)
+{
+	/*
+	 * Basic setup. Needs to be called early.
+	 */
+	kirkwood_mpp_conf(dreamplug_mpp_config);
+
+	kirkwood_uart0_init();
+
+	spi_register_board_info(dreamplug_spi_slave_info,
+				ARRAY_SIZE(dreamplug_spi_slave_info));
+	kirkwood_spi_init();
+
+	kirkwood_ehci_init();
+	kirkwood_ge00_init(&dreamplug_ge00_data);
+	kirkwood_ge01_init(&dreamplug_ge01_data);
+	kirkwood_sata_init(&dreamplug_sata_data);

arch/arm/mach-kirkwood/board-dt.c line 162

Quoted 10 lines
arch/arm/mach-kirkwood/board-dt.c new file +10 -0
+	kirkwood_sdio_init(&dreamplug_mvsdio_data);
+
+	platform_device_register(&dreamplug_leds);
+}
+
+static void __init kirkwood_dt_init(void)
+{
+	kirkwood_init();
+
+	if (!of_machine_is_compatible("kirkwood,dreamplug"))

Huh? Your string doesn't match your dts file.

You've already matched against "marvell,dreamplug", so is this check necessary?

Rob

Quoted 20 lines
arch/arm/mach-kirkwood/board-dt.c new file +20 -0
+		dreamplug_init();
+
+	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
+}
+
+static const char *kirkwood_dt_board_compat[] = {
+	"marvell,dreamplug",
+	NULL
+};
+
+DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
+	/* Maintainer: Jason Cooper <[email protected]> */
+	.map_io		= kirkwood_map_io,
+	.init_early	= kirkwood_init_early,
+	.init_irq	= kirkwood_init_irq,
+	.timer		= &kirkwood_timer,
+	.init_machine	= kirkwood_dt_init,
+	.restart	= kirkwood_restart,
+	.dt_compat	= kirkwood_dt_board_compat,
+MACHINE_END
#20 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 10 lines · Rob Herring
Quoted 8 lines · Jason Cooper
arch/arm/mach-kirkwood/Kconfig +0 -0
index 7fc603b..6095884 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
Quoted 15 lines

arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG · line 59

Quoted 13 lines
arch/arm/mach-kirkwood/Kconfig +13 -0
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	depends on ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (Flattened Device Tree).

Why do you need 2 entries?

The first one is used to build the board file for all DT based machines, the second one is used to select the dts file. I would be enough to have just the first one, but that makes it harder to find for people looking for dreamplug.

Maybe change the text to "Generic Marvell Kirkwood DT based (e.g. DreamPlug)"?

Quoted 5 lines
Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static unsigned int dreamplug_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
Quoted 8 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 6 lines
arch/arm/mach-kirkwood/Kconfig +6 -0
+	MPP3_SPI_MISO,
+	MPP47_GPIO,	/* Bluetooth LED */
+	MPP48_GPIO,	/* Wifi LED */
+	MPP49_GPIO,	/* Wifi AP LED */
+	0
+};

Do you need this to boot? All this data should come from the dtb.

Putting this into the dtb would require converting kirkwood to use the pinctrl subsystem first, if we want to have proper bindings. When I did the hands-on review of the code with Jason during ELC, we decided to leave this being done the legacy way for now, which also matches how Tegra does it until we have the pinctrl bindings.

Also note how the patch description says "Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next." I think this is the best approach indeed and I'd probably leave the pinctrl stuff until the end.

Quoted 11 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 6 lines
arch/arm/mach-kirkwood/Kconfig +6 -0
+
+static void __init kirkwood_dt_init(void)
+{
+	kirkwood_init();
+
+	if (!of_machine_is_compatible("kirkwood,dreamplug"))

Huh? Your string doesn't match your dts file.

You've already matched against "marvell,dreamplug", so is this check necessary?

It's wrong, and the condition is negated. It should be

	if (of_machine_is_compatible("marvell,dreamplug"))
		dreamplug_init();

The idea is that there is one init function for all dt based kirkwood machines, which contains special setup functions for those boards that don't (yet) describe all the hardware in the dt.

Quoted 5 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static const char *kirkwood_dt_board_compat[] = {
+	"marvell,dreamplug",
+	NULL
+};

Since you mention the name, it should probably be "globalscale,dreamplug" because the device is made by GlobalScale instead of Marvell.

Arnd

author
#21 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 27 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring
Quoted 8 lines · Jason Cooper
arch/arm/mach-kirkwood/Kconfig +0 -0
index 7fc603b..6095884 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
Quoted 15 lines

arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG · line 59

Quoted 13 lines
arch/arm/mach-kirkwood/Kconfig +13 -0
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	depends on ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (Flattened Device Tree).

Why do you need 2 entries?

Quoted 6 lines

The first one is used to build the board file for all DT based machines, the second one is used to select the dts file. I would be enough to have just the first one, but that makes it harder to find for people looking for dreamplug.

Maybe change the text to "Generic Marvell Kirkwood DT based (e.g. DreamPlug)"?

I was thinking about this more, and had, I hope, a better idea: change the 'depends on ARCH_KIRKWOOD_DT' to 'selects ARCH_KIRKWOOD_DT' and remove the first entry. This way, the logic remains the same and the word 'Dreamplug' is always visible. Any objections?

Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static unsigned int dreamplug_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
Quoted 8 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 6 lines
arch/arm/mach-kirkwood/Kconfig +6 -0
+	MPP3_SPI_MISO,
+	MPP47_GPIO,	/* Bluetooth LED */
+	MPP48_GPIO,	/* Wifi LED */
+	MPP49_GPIO,	/* Wifi AP LED */
+	0
+};

Do you need this to boot? All this data should come from the dtb.

Putting this into the dtb would require converting kirkwood to use the pinctrl subsystem first, if we want to have proper bindings. When I did the hands-on review of the code with Jason during ELC, we decided to leave this being done the legacy way for now, which also matches how Tegra does it until we have the pinctrl bindings.

Quoted 4 lines

Also note how the patch description says "Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next." I think this is the best approach indeed and I'd probably leave the pinctrl stuff until the end.

Agreed.

Quoted 14 lines
Quoted 11 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 6 lines
arch/arm/mach-kirkwood/Kconfig +6 -0
+
+static void __init kirkwood_dt_init(void)
+{
+	kirkwood_init();
+
+	if (!of_machine_is_compatible("kirkwood,dreamplug"))

Huh? Your string doesn't match your dts file.

You've already matched against "marvell,dreamplug", so is this check necessary?

It's wrong, and the condition is negated. It should be

Quoted 7 lines
	if (of_machine_is_compatible("marvell,dreamplug"))
		dreamplug_init();

The idea is that there is one init function for all dt based kirkwood machines, which contains special setup functions for those boards that don't (yet) describe all the hardware in the dt.

Good catch, will fix in v5.

Quoted 8 lines
Quoted 5 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static const char *kirkwood_dt_board_compat[] = {
+	"marvell,dreamplug",
+	NULL
+};

Since you mention the name, it should probably be "globalscale,dreamplug" because the device is made by GlobalScale instead of Marvell.

hmm, Globalscale Tech is, as I understand it, a turn-key manufacturer. They are simply building Marvell's development platforms for them, handling sales, etc. My impression was that Marvell designed the board and contracted Globalscale to build and distribute it.

I don't care which we use, but is the convention to use the SoC designer (marvell,dreamplug), the SoC (kirkwood,dreamplug), or the brand (globalscale,dreamplug)?

If there is no set standard, I think the SoC is most accurate, as nothing prevents a manufacturer from swapping out ICs/SoCs between manufacturing runs of the same make/model. Look at certain wifi USB devices for examples.

thx,

Jason.

#22 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 105 lines · Jason
Quoted 27 lines · Arnd Bergmann
Quoted 10 lines · Rob Herring
Quoted 8 lines · Jason Cooper
arch/arm/mach-kirkwood/Kconfig +0 -0
index 7fc603b..6095884 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG

? ? Say 'Y' here if you want your kernel to support the ? ? Marvell GuruPlug Reference Board.

Quoted 15 lines

arch/arm/mach-kirkwood/Kconfig config MACH_GURUPLUG

Quoted 13 lines
arch/arm/mach-kirkwood/Kconfig +13 -0
+config ARCH_KIRKWOOD_DT
+ bool "Marvell Kirkwood Flattened Device Tree"
+ select USE_OF
+ help
+ ? Say 'Y' here if you want your kernel to support the
+ ? Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+ bool "Marvell DreamPlug (Flattened Device Tree)"
+ depends on ARCH_KIRKWOOD_DT
+ help
+ ? Say 'Y' here if you want your kernel to support the
+ ? Marvell DreamPlug (Flattened Device Tree).

Why do you need 2 entries?

Quoted 6 lines

The first one is used to build the board file for all DT based machines, the second one is used to select the dts file. I would be enough to have just the first one, but that makes it harder to find for people looking for dreamplug.

Maybe change the text to "Generic Marvell Kirkwood DT based (e.g. DreamPlug)"?

I was thinking about this more, and had, I hope, a better idea: ?change the 'depends on ARCH_KIRKWOOD_DT' to 'selects ARCH_KIRKWOOD_DT' and remove the first entry. ?This way, the logic remains the same and the word 'Dreamplug' is always visible. ?Any objections?

Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static unsigned int dreamplug_mpp_config[] __initdata = {
+ MPP0_SPI_SCn,
+ MPP1_SPI_MOSI,
+ MPP2_SPI_SCK,
Quoted 8 lines
Quoted 6 lines

+ MPP3_SPI_MISO,
+ MPP47_GPIO, ? ? /* Bluetooth LED */
+ MPP48_GPIO, ? ? /* Wifi LED */
+ MPP49_GPIO, ? ? /* Wifi AP LED */
+ 0
+};

Do you need this to boot? All this data should come from the dtb.

Putting this into the dtb would require converting kirkwood to use the pinctrl subsystem first, if we want to have proper bindings. When I did the hands-on review of the code with Jason during ELC, we decided to leave this being done the legacy way for now, which also matches how Tegra does it until we have the pinctrl bindings.

Quoted 4 lines

Also note how the patch description says "Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next." I think this is the best approach indeed and I'd probably leave the pinctrl stuff until the end.

Agreed.

Quoted 14 lines
Quoted 11 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 6 lines
arch/arm/mach-kirkwood/Kconfig +6 -0
+
+static void __init kirkwood_dt_init(void)
+{
+ kirkwood_init();
+
+ if (!of_machine_is_compatible("kirkwood,dreamplug"))

Huh? Your string doesn't match your dts file.

You've already matched against "marvell,dreamplug", so is this check necessary?

It's wrong, and the condition is negated. It should be

Quoted 7 lines

? ? ? if (of_machine_is_compatible("marvell,dreamplug")) ? ? ? ? ? ? ? dreamplug_init();

The idea is that there is one init function for all dt based kirkwood machines, which contains special setup functions for those boards that don't (yet) describe all the hardware in the dt.

Good catch, will fix in v5.

Quoted 8 lines
Quoted 5 lines

arch/arm/mach-kirkwood/Kconfig

Quoted 5 lines
arch/arm/mach-kirkwood/Kconfig +5 -0
+
+static const char *kirkwood_dt_board_compat[] = {
+ "marvell,dreamplug",
+ NULL
+};

Since you mention the name, it should probably be "globalscale,dreamplug" because the device is made by GlobalScale instead of Marvell.

hmm, Globalscale Tech is, as I understand it, a turn-key manufacturer. They are simply building Marvell's development platforms for them, handling sales, etc. ?My impression was that Marvell designed the board and contracted Globalscale to build and distribute it.

Quoted 8 lines

I don't care which we use, but is the convention to use the SoC designer (marvell,dreamplug), the SoC (kirkwood,dreamplug), or the brand (globalscale,dreamplug)?

If there is no set standard, I think the SoC is most accurate, as nothing prevents a manufacturer from swapping out ICs/SoCs between manufacturing runs of the same make/model. ?Look at certain wifi USB devices for examples.

convention is to use the vendor of the device. If it is marketed as a Marvell product, then use "marvell,...". If it is Globalscale, then "globalscale,...". The actual SoC on the device is irrelevant for the top level compatible property name.

g.

author
#23 lore raw

PATCH v4 2/3 arm: kirkwood: add dreamplug (fdt) support.

Quoted 4 lines · Grant Likely
Quoted 3 lines · Jason
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Rob Herring

On 02/22/2012 01:18 PM, Jason Cooper wrote:

...

Quoted 23 lines
Quoted 14 lines
Quoted 8 lines
Quoted 5 lines

arch/arm/mach-kirkwood/board-dt.c line 171

Quoted 5 lines
arch/arm/mach-kirkwood/board-dt.c new file +5 -0
+
+static const char *kirkwood_dt_board_compat[] = {
+ "marvell,dreamplug",
+ NULL
+};

Since you mention the name, it should probably be "globalscale,dreamplug" because the device is made by GlobalScale instead of Marvell.

hmm, Globalscale Tech is, as I understand it, a turn-key manufacturer. They are simply building Marvell's development platforms for them, handling sales, etc. ?My impression was that Marvell designed the board and contracted Globalscale to build and distribute it.

Quoted 8 lines

I don't care which we use, but is the convention to use the SoC designer (marvell,dreamplug), the SoC (kirkwood,dreamplug), or the brand (globalscale,dreamplug)?

If there is no set standard, I think the SoC is most accurate, as nothing prevents a manufacturer from swapping out ICs/SoCs between manufacturing runs of the same make/model. ?Look at certain wifi USB devices for examples.

Quoted 4 lines

convention is to use the vendor of the device. If it is marketed as a Marvell product, then use "marvell,...". If it is Globalscale, then "globalscale,...". The actual SoC on the device is irrelevant for the top level compatible property name.

globalscale it is, then. Thanks for the clarification.

thx,

Jason.

#24 lore raw

PATCH v2 3/3 arm: kirkwood: convert uart0 to devicetree.

In reply to Jason Cooper

This uart is common to all kirkwood SoC's, so I placed it in the kirkwood.dtsi.

---
NOTE: first version of this patch, no changelog.

 arch/arm/boot/dts/kirkwood.dtsi   |    8 ++++++++
 arch/arm/mach-kirkwood/board-dt.c |    2 --
 2 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +8 -0
index 771c6bb..0531dbb 100644
@@ -2,5 +2,13 @@
 
 / {
 	compatible = "marvell,kirkwood";
+
+	serial at f1012000 {
+		compatible = "ns16550a";
+		reg = <0xf1012000 0xff>;
+		reg-shift = <2>;
+		interrupts = <33>;
+		clock-frequency = <200000000>;
+	};
 };
 
arch/arm/mach-kirkwood/board-dt.c +0 -2
index ab13eb9..e247ca7 100644
@@ -140,8 +140,6 @@ static void __init dreamplug_init(void)
 	 */
 	kirkwood_mpp_conf(dreamplug_mpp_config);
 
-	kirkwood_uart0_init();
-
 	spi_register_board_info(dreamplug_spi_slave_info,
 				ARRAY_SIZE(dreamplug_spi_slave_info));
 	kirkwood_spi_init();
Signature · 1 line
1.7.3.4
#25 lore raw

PATCH 3/3 arm: kirkwood: convert uart0 to devicetree.

Quoted 4 lines · Jason Cooper

This uart is common to all kirkwood SoC's, so I placed it in the kirkwood.dtsi.

I'm not sure how we are handling this for other platforms, but my feeling is that the serial port information should be in the board specific dts file, because there are multiple serial ports on the chips and individual boards may only provide one of them.

Alternatively, you could list all serial ports in the dts file and use the linux,stdout-path "chosen" property to tell the kernel which one to use.

Arnd

author
#26 lore raw

PATCH v2 3/3 arm: kirkwood: convert uart0 to devicetree.

Quoted 11 lines · Arnd Bergmann
Quoted 4 lines · Jason Cooper

This uart is common to all kirkwood SoC's, so I placed it in the kirkwood.dtsi.

I'm not sure how we are handling this for other platforms, but my feeling is that the serial port information should be in the board specific dts file, because there are multiple serial ports on the chips and individual boards may only provide one of them.

On closer inspection, it looks like the openrd board and the qnap boards are including uart1, nothing else does. I'll redo it and resubmit.

Quoted 3 lines

Alternatively, you could list all serial ports in the dts file and use the linux,stdout-path "chosen" property to tell the kernel which one to use.

All of the boards use uart0 as the default tty, so I'm thinking uart0 is declared in all boards (.dts), and the two that need it, declare uart1 in the same dts.

Does that sound right?

thx,

Jason.

#27 lore raw

v5 cover arm: kirkwood: add dreamplug/devicetree support

In reply to Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

In a future patch series, I plan to migrate spi/flash/partitions over to devicetree.

When the migration is complete, board-dt.c will not be specific to the dreamplug, and dts files can be written for all of the other kirkwood boards.

Jason Cooper (2):
arm: kirkwood: add dreamplug (fdt) support.
arm: kirkwood: convert uart0 to devicetree.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   25 ++++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  180 ++++++++++++++++++++++++++++++
 6 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
Signature · 1 line
1.7.3.4
#28 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

- attempting dts, looking for pointers.

Changes from v2

- resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased against same.
- removed lame fdt attempt, others are working on kirkwood fdt. Will convert once kirkwood fdt is mainline.
- s/boot_params/atag_offset/
- added kirkwood_reset
- 1 checkpatch.pl warning (help in Kconfig), looks the same as all other kirkwood boards...

Changes from v3

- rebased against v3.3-rc3 (recommended by Arnd)
- use devicetree to determine which board we are on
- added patch to configure uart0 from devicetree

Changes from v4

- fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig.
- changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by Grant Likely.
- fixed of_machine_is_compatible() logic for calling dreamplug specific init functions.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   18 +++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  182 ++++++++++++++++++++++++++++++
 6 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +18 -0
new file mode 100644
index 0000000..765813f
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Globalscale Technologies Dreamplug";
+	compatible = "globalscale,dreamplug", "globalscale,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+};
arch/arm/boot/dts/kirkwood.dtsi new file +6 -0
new file mode 100644
index 0000000..18fd47e
@@ -0,0 +1,6 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "globalscale,kirkwood";
+};
+
arch/arm/mach-kirkwood/Kconfig +14 -0
index 7fc603b..90ceab7 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (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 5dcaa81..acbc5e1 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
+obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
arch/arm/mach-kirkwood/Makefile.boot +2 -0
index 760a0ef..16f9385 100644
@@ -1,3 +1,5 @@
    zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/board-dt.c new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#29 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

Quoted 61 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. ?First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

? - attempting dts, looking for pointers.

Changes from v2

? - resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased ? ? against same.
? - removed lame fdt attempt, others are working on kirkwood fdt. ?Will ? ? convert once kirkwood fdt is mainline.
? - s/boot_params/atag_offset/
? - added kirkwood_reset
? - 1 checkpatch.pl warning (help in Kconfig), looks the same as all ? ? other kirkwood boards...

Changes from v3

? - rebased against v3.3-rc3 (recommended by Arnd) ? - use devicetree to determine which board we are on ? - added patch to configure uart0 from devicetree

Changes from v4

? - fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig. ? - changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by ? ? Grant Likely.
? - fixed of_machine_is_compatible() logic for calling dreamplug specific ? ? init functions.

?arch/arm/boot/dts/kirkwood-dreamplug.dts | ? 18 +++
?arch/arm/boot/dts/kirkwood.dtsi ? ? ? ? ?| ? ?6 +
?arch/arm/mach-kirkwood/Kconfig ? ? ? ? ? | ? 14 +++
?arch/arm/mach-kirkwood/Makefile ? ? ? ? ?| ? ?1 +
?arch/arm/mach-kirkwood/Makefile.boot ? ? | ? ?2 +
?arch/arm/mach-kirkwood/board-dt.c ? ? ? ?| ?182 ++++++++++++++++++++++++++++++

?6 files changed, 223 insertions(+), 0 deletions(-) ?create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts ?create mode 100644 arch/arm/boot/dts/kirkwood.dtsi ?create mode 100644 arch/arm/mach-kirkwood/board-dt.c

arch/arm/boot/dts/kirkwood-dreamplug.dts new file +0 -0
new file mode 100644
index 0000000..765813f

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +7 -0
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+ ? ? ? model = "Globalscale Technologies Dreamplug";
+ ? ? ? compatible = "globalscale,dreamplug", "globalscale,kirkwood";

Hahaha... okay, more clarification is needed here.

The compatible property is a list, and the first entry must always be the exact device model. That is why the vendor of the hardware is in the prefix. However, the following entries are a list of devices that it is 'compatible' with. In the case of the top-level compatible property, we've been using the convention of including a string for the SoC, and in that case the manufacturer is indeed Marvell.

Also, *be specific*. Kirkwood is a family of processors, not a single SoC. The compatible string should reflect that. So, in your case, compatible should look something like:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281";

g.

author
#30 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

Quoted 79 lines · Grant Likely
Quoted 61 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. ?First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

? - attempting dts, looking for pointers.

Changes from v2

? - resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased ? ? against same.
? - removed lame fdt attempt, others are working on kirkwood fdt. ?Will ? ? convert once kirkwood fdt is mainline.
? - s/boot_params/atag_offset/
? - added kirkwood_reset
? - 1 checkpatch.pl warning (help in Kconfig), looks the same as all ? ? other kirkwood boards...

Changes from v3

? - rebased against v3.3-rc3 (recommended by Arnd) ? - use devicetree to determine which board we are on ? - added patch to configure uart0 from devicetree

Changes from v4

? - fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig. ? - changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by ? ? Grant Likely.
? - fixed of_machine_is_compatible() logic for calling dreamplug specific ? ? init functions.

?arch/arm/boot/dts/kirkwood-dreamplug.dts | ? 18 +++
?arch/arm/boot/dts/kirkwood.dtsi ? ? ? ? ?| ? ?6 +
?arch/arm/mach-kirkwood/Kconfig ? ? ? ? ? | ? 14 +++
?arch/arm/mach-kirkwood/Makefile ? ? ? ? ?| ? ?1 +
?arch/arm/mach-kirkwood/Makefile.boot ? ? | ? ?2 +
?arch/arm/mach-kirkwood/board-dt.c ? ? ? ?| ?182 ++++++++++++++++++++++++++++++

?6 files changed, 223 insertions(+), 0 deletions(-) ?create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts ?create mode 100644 arch/arm/boot/dts/kirkwood.dtsi ?create mode 100644 arch/arm/mach-kirkwood/board-dt.c

arch/arm/boot/dts/kirkwood-dreamplug.dts new file +0 -0
new file mode 100644
index 0000000..765813f

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +7 -0
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+ ? ? ? model = "Globalscale Technologies Dreamplug";
+ ? ? ? compatible = "globalscale,dreamplug", "globalscale,kirkwood";

Hahaha... okay, more clarification is needed here.

The compatible property is a list, and the first entry must always be the exact device model. That is why the vendor of the hardware is in the prefix. However, the following entries are a list of devices that it is 'compatible' with. In the case of the top-level compatible property, we've been using the convention of including a string for the SoC, and in that case the manufacturer is indeed Marvell.

Quoted 5 lines

Also, *be specific*. Kirkwood is a family of processors, not a single SoC. The compatible string should reflect that. So, in your case, compatible should look something like:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281";

ahhh... ok. So, my board-dt.c should have:

static const char *kirkwood_dt_board_compat[] = {
"marvell,kirkwood",
NULL
};

And then the test to run the dreamplug specific init should be:

        if (of_machine_is_compatible("globalscale,dreamplug"))
                dreamplug_init();

And then, kirkwood.dtsi:

compatible = "marvell,kirkwood";

and kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281-a1";

My only question is, should the kirkwood.dtsi have just "marvell,kirkwood", or "marvell,kirkwood","marvell,kirkwood-88f6281-a1"?

I'm guessing kirkwood.dtsi is a generic devicetree, and should just be "marvell,kirkwood". If that's true, then *kirkwood_dt_board_compat should just be "marvell,kirkwood" since board-dt.c should be able to handle any kirkwood SoC.

Sorry for being so dense.

thx,

Jason.

#31 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

Quoted 102 lines · Jason
Quoted 79 lines · Grant Likely
Quoted 61 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. ?First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

? - attempting dts, looking for pointers.

Changes from v2

? - resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased ? ? against same.
? - removed lame fdt attempt, others are working on kirkwood fdt. ?Will ? ? convert once kirkwood fdt is mainline.
? - s/boot_params/atag_offset/
? - added kirkwood_reset
? - 1 checkpatch.pl warning (help in Kconfig), looks the same as all ? ? other kirkwood boards...

Changes from v3

? - rebased against v3.3-rc3 (recommended by Arnd) ? - use devicetree to determine which board we are on ? - added patch to configure uart0 from devicetree

Changes from v4

? - fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig. ? - changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by ? ? Grant Likely.
? - fixed of_machine_is_compatible() logic for calling dreamplug specific ? ? init functions.

?arch/arm/boot/dts/kirkwood-dreamplug.dts | ? 18 +++
?arch/arm/boot/dts/kirkwood.dtsi ? ? ? ? ?| ? ?6 +
?arch/arm/mach-kirkwood/Kconfig ? ? ? ? ? | ? 14 +++
?arch/arm/mach-kirkwood/Makefile ? ? ? ? ?| ? ?1 +
?arch/arm/mach-kirkwood/Makefile.boot ? ? | ? ?2 +
?arch/arm/mach-kirkwood/board-dt.c ? ? ? ?| ?182 ++++++++++++++++++++++++++++++

?6 files changed, 223 insertions(+), 0 deletions(-) ?create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts ?create mode 100644 arch/arm/boot/dts/kirkwood.dtsi ?create mode 100644 arch/arm/mach-kirkwood/board-dt.c

arch/arm/boot/dts/kirkwood-dreamplug.dts new file +0 -0
new file mode 100644
index 0000000..765813f

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +7 -0
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+ ? ? ? model = "Globalscale Technologies Dreamplug";
+ ? ? ? compatible = "globalscale,dreamplug", "globalscale,kirkwood";

Hahaha... okay, more clarification is needed here.

The compatible property is a list, and the first entry must always be the exact device model. ?That is why the vendor of the hardware is in the prefix. ?However, the following entries are a list of devices that it is 'compatible' with. ?In the case of the top-level compatible property, we've been using the convention of including a string for the SoC, and in that case the manufacturer is indeed Marvell.

Quoted 5 lines

Also, *be specific*. ?Kirkwood is a family of processors, not a single SoC. ?The compatible string should reflect that. ?So, in your case, compatible should look something like:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281";

ahhh... ok. ?So, my board-dt.c should have:

static const char *kirkwood_dt_board_compat[] = {
? ? ? ?"marvell,kirkwood",
? ? ? ?NULL
};

And then the test to run the dreamplug specific init should be:

? ? ? ?if (of_machine_is_compatible("globalscale,dreamplug")) ? ? ? ? ? ? ? ?dreamplug_init();

And then, kirkwood.dtsi:

compatible = "marvell,kirkwood";

Quoted 7 lines

and kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281-a1";

My only question is, should the kirkwood.dtsi have just "marvell,kirkwood", or "marvell,kirkwood","marvell,kirkwood-88f6281-a1"?

Fix the order. The list is ordered from most specific to least. Also, if the silicon revision can be read out of the SoC at runtime, then including the -a1 revision is probably overkill.

So, something like the following is fine:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";

BTW, does the dreamplug have a part number?

Quoted 11 lines

I'm guessing kirkwood.dtsi is a generic devicetree, and should just be "marvell,kirkwood". ?If that's true, then *kirkwood_dt_board_compat should just be "marvell,kirkwood" since board-dt.c should be able to handle any kirkwood SoC.

Sorry for being so dense.

thx,

Jason.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
author
#32 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

Quoted 108 lines · Grant Likely
Quoted 107 lines · Jason
Quoted 79 lines · Grant Likely
Quoted 61 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. ?First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

? - attempting dts, looking for pointers.

Changes from v2

? - resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased ? ? against same.
? - removed lame fdt attempt, others are working on kirkwood fdt. ?Will ? ? convert once kirkwood fdt is mainline.
? - s/boot_params/atag_offset/
? - added kirkwood_reset
? - 1 checkpatch.pl warning (help in Kconfig), looks the same as all ? ? other kirkwood boards...

Changes from v3

? - rebased against v3.3-rc3 (recommended by Arnd) ? - use devicetree to determine which board we are on ? - added patch to configure uart0 from devicetree

Changes from v4

? - fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig. ? - changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by ? ? Grant Likely.
? - fixed of_machine_is_compatible() logic for calling dreamplug specific ? ? init functions.

?arch/arm/boot/dts/kirkwood-dreamplug.dts | ? 18 +++
?arch/arm/boot/dts/kirkwood.dtsi ? ? ? ? ?| ? ?6 +
?arch/arm/mach-kirkwood/Kconfig ? ? ? ? ? | ? 14 +++
?arch/arm/mach-kirkwood/Makefile ? ? ? ? ?| ? ?1 +
?arch/arm/mach-kirkwood/Makefile.boot ? ? | ? ?2 +
?arch/arm/mach-kirkwood/board-dt.c ? ? ? ?| ?182 ++++++++++++++++++++++++++++++

?6 files changed, 223 insertions(+), 0 deletions(-) ?create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts ?create mode 100644 arch/arm/boot/dts/kirkwood.dtsi ?create mode 100644 arch/arm/mach-kirkwood/board-dt.c

arch/arm/boot/dts/kirkwood-dreamplug.dts new file +0 -0
new file mode 100644
index 0000000..765813f

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +7 -0
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+ ? ? ? model = "Globalscale Technologies Dreamplug";
+ ? ? ? compatible = "globalscale,dreamplug", "globalscale,kirkwood";

Hahaha... okay, more clarification is needed here.

The compatible property is a list, and the first entry must always be the exact device model. ?That is why the vendor of the hardware is in the prefix. ?However, the following entries are a list of devices that it is 'compatible' with. ?In the case of the top-level compatible property, we've been using the convention of including a string for the SoC, and in that case the manufacturer is indeed Marvell.

Quoted 5 lines

Also, *be specific*. ?Kirkwood is a family of processors, not a single SoC. ?The compatible string should reflect that. ?So, in your case, compatible should look something like:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281";

ahhh... ok. ?So, my board-dt.c should have:

static const char *kirkwood_dt_board_compat[] = {
? ? ? ?"marvell,kirkwood",
? ? ? ?NULL
};

And then the test to run the dreamplug specific init should be:

? ? ? ?if (of_machine_is_compatible("globalscale,dreamplug")) ? ? ? ? ? ? ? ?dreamplug_init();

And then, kirkwood.dtsi:

compatible = "marvell,kirkwood";

and kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281-a1";

Quoted 6 lines
Quoted 2 lines

My only question is, should the kirkwood.dtsi have just "marvell,kirkwood", or "marvell,kirkwood","marvell,kirkwood-88f6281-a1"?

Fix the order. The list is ordered from most specific to least. Also, if the silicon revision can be read out of the SoC at runtime, then including the -a1 revision is probably overkill.

With kirkwood, it's able to determine the whole SoC part number (see arch/arm/mach-kirkwood/common.c:394 kirkwood_id()). So, the kernel doesn't need to rely on the devicetree to determine which kirkwood it is at runtime.

I'll include it as you've recommended. I'd rather stick with convention until we can prove we need to do otherwise.

Quoted 6 lines

So, something like the following is fine:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";

BTW, does the dreamplug have a part number?

Yes, so I'll do in kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"

Thanks for the help

Jason.

author
#33 lore raw

PATCH v5 1/2 arm: kirkwood: add dreamplug (fdt) support.

In reply to Grant Likely
Quoted 108 lines · Grant Likely
Quoted 107 lines · Jason
Quoted 79 lines · Grant Likely
Quoted 61 lines · Jason Cooper

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. ?First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. ?Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

? - attempting dts, looking for pointers.

Changes from v2

? - resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased ? ? against same.
? - removed lame fdt attempt, others are working on kirkwood fdt. ?Will ? ? convert once kirkwood fdt is mainline.
? - s/boot_params/atag_offset/
? - added kirkwood_reset
? - 1 checkpatch.pl warning (help in Kconfig), looks the same as all ? ? other kirkwood boards...

Changes from v3

? - rebased against v3.3-rc3 (recommended by Arnd) ? - use devicetree to determine which board we are on ? - added patch to configure uart0 from devicetree

Changes from v4

? - fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig. ? - changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by ? ? Grant Likely.
? - fixed of_machine_is_compatible() logic for calling dreamplug specific ? ? init functions.

?arch/arm/boot/dts/kirkwood-dreamplug.dts | ? 18 +++
?arch/arm/boot/dts/kirkwood.dtsi ? ? ? ? ?| ? ?6 +
?arch/arm/mach-kirkwood/Kconfig ? ? ? ? ? | ? 14 +++
?arch/arm/mach-kirkwood/Makefile ? ? ? ? ?| ? ?1 +
?arch/arm/mach-kirkwood/Makefile.boot ? ? | ? ?2 +
?arch/arm/mach-kirkwood/board-dt.c ? ? ? ?| ?182 ++++++++++++++++++++++++++++++

?6 files changed, 223 insertions(+), 0 deletions(-) ?create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts ?create mode 100644 arch/arm/boot/dts/kirkwood.dtsi ?create mode 100644 arch/arm/mach-kirkwood/board-dt.c

arch/arm/boot/dts/kirkwood-dreamplug.dts new file +0 -0
new file mode 100644
index 0000000..765813f

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +7 -0
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+ ? ? ? model = "Globalscale Technologies Dreamplug";
+ ? ? ? compatible = "globalscale,dreamplug", "globalscale,kirkwood";

Hahaha... okay, more clarification is needed here.

The compatible property is a list, and the first entry must always be the exact device model. ?That is why the vendor of the hardware is in the prefix. ?However, the following entries are a list of devices that it is 'compatible' with. ?In the case of the top-level compatible property, we've been using the convention of including a string for the SoC, and in that case the manufacturer is indeed Marvell.

Quoted 5 lines

Also, *be specific*. ?Kirkwood is a family of processors, not a single SoC. ?The compatible string should reflect that. ?So, in your case, compatible should look something like:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281";

ahhh... ok. ?So, my board-dt.c should have:

static const char *kirkwood_dt_board_compat[] = {
? ? ? ?"marvell,kirkwood",
? ? ? ?NULL
};

And then the test to run the dreamplug specific init should be:

? ? ? ?if (of_machine_is_compatible("globalscale,dreamplug")) ? ? ? ? ? ? ? ?dreamplug_init();

And then, kirkwood.dtsi:

compatible = "marvell,kirkwood";

and kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281-a1";

Quoted 6 lines
Quoted 2 lines

My only question is, should the kirkwood.dtsi have just "marvell,kirkwood", or "marvell,kirkwood","marvell,kirkwood-88f6281-a1"?

Fix the order. The list is ordered from most specific to least. Also, if the silicon revision can be read out of the SoC at runtime, then including the -a1 revision is probably overkill.

With kirkwood, it's able to determine the whole SoC part number (see arch/arm/mach-kirkwood/common.c:394 kirkwood_id()). So, the kernel doesn't need to rely on the devicetree to determine which kirkwood it is at runtime.

I'll include it as you've recommended. I'd rather stick with convention until we can prove we need to do otherwise.

Quoted 6 lines

So, something like the following is fine:

compatible = "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";

BTW, does the dreamplug have a part number?

Yes, so I'll do in kirkwood-dreamplug.dts:

compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood"

Thanks for the help

Jason.

#34 lore raw

PATCH v2 2/2 arm: kirkwood: convert uart0 to devicetree.

In reply to Jason Cooper

This uart is the primary console for the dreamplug. Removed kirkwood_uart0_init() call from board-dt.c.

---
Changes from v1

- moved serial config from kirkwood.dtsi to kirkwood-dreamplug.dts as suggested by Arnd Bergman.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |    7 +++++++
 arch/arm/mach-kirkwood/board-dt.c        |    2 --
 2 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/boot/dts/kirkwood-dreamplug.dts +7 -0
index 765813f..9cdda80 100644
@@ -15,4 +15,11 @@
 		bootargs = "console=ttyS0,115200n8 earlyprintk";
 	};
 
+	serial at f1012000 {
+		compatible = "ns16550a";
+		reg = <0xf1012000 0xff>;
+		reg-shift = <2>;
+		interrupts = <33>;
+		clock-frequency = <200000000>;
+	};
 };
arch/arm/mach-kirkwood/board-dt.c +0 -2
index 76392af..fbe6405 100644
@@ -140,8 +140,6 @@ static void __init dreamplug_init(void)
 	 */
 	kirkwood_mpp_conf(dreamplug_mpp_config);
 
-	kirkwood_uart0_init();
-
 	spi_register_board_info(dreamplug_spi_slave_info,
 				ARRAY_SIZE(dreamplug_spi_slave_info));
 	kirkwood_spi_init();
Signature · 1 line
1.7.3.4
#35 lore raw

v5 cover arm: kirkwood: add dreamplug/devicetree support

In reply to Jason Cooper
Quoted 8 lines · Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

I needed the following (obvious) patch against u-boot:

include/configs/dreamplug.h +2 -0
index 0f2f9a2..76f9eea 100644
@@ -148,4 +148,6 @@
  */
 #define CONFIG_DISPLAY_CPUINFO
 
+#define CONFIG_OF_LIBFDT
+
 #endif /* _CONFIG_DREAMPLUG_H */

Ian.

author
#36 lore raw

v5 cover arm: kirkwood: add dreamplug/devicetree support

Quoted 11 lines · Ian Campbell
Quoted 8 lines · Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

thanks!

Quoted 1 line

I needed the following (obvious) patch against u-boot:

yes, I forgot to mention that. By any chance, have you tested booting non-fdt kernels from u-boot with this option enabled? I'm fairly sure it will work, but I haven't tested it myself.

If you can boot both fdt and non-fdt kernels with this enabled, submit it to u-boot, CC: Prafulla, and I'll ack it.

thx,

Jason.

Quoted 16 lines
include/configs/dreamplug.h +2 -0
index 0f2f9a2..76f9eea 100644
@@ -148,4 +148,6 @@
  */
 #define CONFIG_DISPLAY_CPUINFO
 
+#define CONFIG_OF_LIBFDT
+
 #endif /* _CONFIG_DREAMPLUG_H */

Ian.

#37 lore raw

v5 cover arm: kirkwood: add dreamplug/devicetree support

Quoted 13 lines · Jason
Quoted 11 lines · Ian Campbell
Quoted 8 lines · Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

Quoted 7 lines

thanks!

Quoted 1 line

I needed the following (obvious) patch against u-boot:

yes, I forgot to mention that. By any chance, have you tested booting non-fdt kernels from u-boot with this option enabled? I'm fairly sure it will work, but I haven't tested it myself.

I hadn't but I have now, it worked fine booting my existing kernel (which uses v3 of your previous non-FDT dreamplug patches) with the updated u-boot.

Quoted 2 lines

If you can boot both fdt and non-fdt kernels with this enabled, submit it to u-boot, CC: Prafulla, and I'll ack it.

Done.

Thanks,
Ian.

#38 lore raw

v6 cover arm: kirkwood: add dreamplug/devicetree support

In reply to Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

In a future patch series, I plan to migrate spi/flash/partitions over to devicetree.

When the migration is complete, board-dt.c will not be specific to the dreamplug, and dts files can be written for all of the other kirkwood boards.

Jason Cooper (2):
arm: kirkwood: add dreamplug (fdt) support.
arm: kirkwood: convert uart0 to devicetree.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   25 ++++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  180 ++++++++++++++++++++++++++++++
 6 files changed, 228 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
Signature · 1 line
1.7.3.4
#39 lore raw

PATCH v6 1/2 arm: kirkwood: add dreamplug (fdt) support.

Initially, copied guruplug-setup.c and did s/guruplug/dreamplug/g. Then, switched to SPI based NOR flash.

After talking to Arnd Bergman, chose an incremental approach to adding devicetree support. First, we use the dtb to tell us we are on the dreamplug, then we gradually port over drivers.

Driver porting will start with the uart (see next patch), and progress from there. Possibly, spi/flash/partitions will be next.

When done, board-dt.c will no longer be dreamplug specific, and dt's can be made for the other kirkwood boards.

---
Changes from v1

- attempting dts, looking for pointers.

Changes from v2

- resubmit as MACH_TYPE_DREAMPLUG (3550) is in arm/for-next, rebased against same.
- removed lame fdt attempt, others are working on kirkwood fdt. Will convert once kirkwood fdt is mainline.
- s/boot_params/atag_offset/
- added kirkwood_reset
- 1 checkpatch.pl warning (help in Kconfig), looks the same as all other kirkwood boards...

Changes from v3

- rebased against v3.3-rc3 (recommended by Arnd)
- use devicetree to determine which board we are on
- added patch to configure uart0 from devicetree

Changes from v4

- fixed Kconfig logic so user can always see 'Dreamplug' in menuconfig.
- changed 'marvell,dreamplug' to 'globalscale,dreamplug' as suggested by Grant Likely.
- fixed of_machine_is_compatible() logic for calling dreamplug specific init functions.

Changes from v5

- fixed compatible property in fdt as clarified by Grant Likely.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |   18 +++
 arch/arm/boot/dts/kirkwood.dtsi          |    6 +
 arch/arm/mach-kirkwood/Kconfig           |   14 +++
 arch/arm/mach-kirkwood/Makefile          |    1 +
 arch/arm/mach-kirkwood/Makefile.boot     |    2 +
 arch/arm/mach-kirkwood/board-dt.c        |  182 ++++++++++++++++++++++++++++++
 6 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dreamplug.dts
 create mode 100644 arch/arm/boot/dts/kirkwood.dtsi
 create mode 100644 arch/arm/mach-kirkwood/board-dt.c
arch/arm/boot/dts/kirkwood-dreamplug.dts new file +18 -0
new file mode 100644
index 0000000..0424d99
@@ -0,0 +1,18 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Globalscale Technologies Dreamplug";
+	compatible = "globalscale,dreamplug-003-ds2001", "globalscale,dreamplug", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x20000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+};
arch/arm/boot/dts/kirkwood.dtsi new file +6 -0
new file mode 100644
index 0000000..771c6bb
@@ -0,0 +1,6 @@
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "marvell,kirkwood";
+};
+
arch/arm/mach-kirkwood/Kconfig +14 -0
index 7fc603b..90ceab7 100644
@@ -44,6 +44,20 @@ config MACH_GURUPLUG
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell GuruPlug Reference Board.
 
+config ARCH_KIRKWOOD_DT
+	bool "Marvell Kirkwood Flattened Device Tree"
+	select USE_OF
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell Kirkwood using flattened device tree.
+
+config MACH_DREAMPLUG_DT
+	bool "Marvell DreamPlug (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Marvell DreamPlug (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 5dcaa81..acbc5e1 100644
@@ -20,3 +20,4 @@ obj-$(CONFIG_MACH_NET5BIG_V2)		+= netxbig_v2-setup.o lacie_v2-common.o
 obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
+obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
arch/arm/mach-kirkwood/Makefile.boot +2 -0
index 760a0ef..16f9385 100644
@@ -1,3 +1,5 @@
    zreladdr-y	+= 0x00008000
 params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
+
+dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/board-dt.c new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#40 lore raw

PATCH v2 2/2 arm: kirkwood: convert uart0 to devicetree.

In reply to Jason Cooper

This uart is the primary console for the dreamplug. Removed kirkwood_uart0_init() call from board-dt.c.

---
Changes from v1

- moved serial config from kirkwood.dtsi to kirkwood-dreamplug.dts as suggested by Arnd Bergman.

 arch/arm/boot/dts/kirkwood-dreamplug.dts |    7 +++++++
 arch/arm/mach-kirkwood/board-dt.c        |    2 --
 2 files changed, 7 insertions(+), 2 deletions(-)
arch/arm/boot/dts/kirkwood-dreamplug.dts +7 -0
index 0424d99..8a5dff8 100644
@@ -15,4 +15,11 @@
 		bootargs = "console=ttyS0,115200n8 earlyprintk";
 	};
 
+	serial at f1012000 {
+		compatible = "ns16550a";
+		reg = <0xf1012000 0xff>;
+		reg-shift = <2>;
+		interrupts = <33>;
+		clock-frequency = <200000000>;
+	};
 };
arch/arm/mach-kirkwood/board-dt.c +0 -2
index 76392af..fbe6405 100644
@@ -140,8 +140,6 @@ static void __init dreamplug_init(void)
 	 */
 	kirkwood_mpp_conf(dreamplug_mpp_config);
 
-	kirkwood_uart0_init();
-
 	spi_register_board_info(dreamplug_spi_slave_info,
 				ARRAY_SIZE(dreamplug_spi_slave_info));
 	kirkwood_spi_init();
Signature · 1 line
1.7.3.4
#41 lore raw

v6 cover arm: kirkwood: add dreamplug/devicetree support

In reply to Jason Cooper
Quoted 12 lines · Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

In a future patch series, I plan to migrate spi/flash/partitions over to devicetree.

Quoted 6 lines

When the migration is complete, board-dt.c will not be specific to the dreamplug, and dts files can be written for all of the other kirkwood boards.

Jason Cooper (2):
arm: kirkwood: add dreamplug (fdt) support.
arm: kirkwood: convert uart0 to devicetree.

Applied to the kirkwood/board branch and pulled into next/boards.

Great work!

I've made two trivial manual changes, please do these yourself next time:

1. Subject should start with "ARM: kirkwood:", not "arm: kirkwood:" by convention.

2. Nico and I had both replied with "Acked-by:". When you get one of these replies, add that line under your "Signed-off-by:" line.

If you have more changes for dreamplug, please submit those on top of these patches now.

Arnd

author
#42 lore raw

v6 cover arm: kirkwood: add dreamplug/devicetree support

Quoted 16 lines · Arnd Bergmann
Quoted 15 lines · Jason Cooper

This patch series provides initial support for devicetree on kirkwood for the dreamplug platform. After discussing the approach with Arnd Bergman last week at ELC, we decided to take an incremental approach to the conversion. First, I would detect that we were on the dreamplug via the devicetree blob. Then, configure uart0 via devicetree. We chose the uart since it is already well supported under devicetree.

This patch series has been boot-tested on the dreamplug.

In a future patch series, I plan to migrate spi/flash/partitions over to devicetree.

When the migration is complete, board-dt.c will not be specific to the dreamplug, and dts files can be written for all of the other kirkwood boards.

Quoted 7 lines
Quoted 3 lines

Jason Cooper (2):
arm: kirkwood: add dreamplug (fdt) support.
arm: kirkwood: convert uart0 to devicetree.

Applied to the kirkwood/board branch and pulled into next/boards.

Great work!

Well, that was easier than I thought. Thanks.

Quoted 4 lines

I've made two trivial manual changes, please do these yourself next time:

1. Subject should start with "ARM: kirkwood:", not "arm: kirkwood:" by convention.

Sorry, will do.

Quoted 2 lines

2. Nico and I had both replied with "Acked-by:". When you get one of these replies, add that line under your "Signed-off-by:" line.

Ahh, I always wondered how those made the transition. Will add that to my process.

Quoted 2 lines

If you have more changes for dreamplug, please submit those on top of these patches now.

Okay, SPI coming up next.

thx,

Jason.