All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 0/5] Add support for DNS-320 and DNS-325 using devicetree
@ 2012-03-27 21:54 ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

Thanks again to Arnd, Jason & Scott. The differences here are fairly minor.
Apart from documentation, I'm guessing that the changes aren't significant
enough to revoke Acked-by, please flame me if I'm wrong!

Changes since v2:
* Split patches further, separating orion_nand and kirkwood changes
* dts renames: "bank-width", not "width". "okay", not "ok"
* Separate documentation out into separate patch, add references to
  partition.txt to all mtd bindings.

Changes since v1:
* Rebase against kirkwood_dt_for_3.4, removing premature devicetree ports.
* Move additions into a separate board-dnskw.c. It could be separated further
  into a board-dns320.c and board-dns325.c but it probably isn't worth it.
* s/marvell,/mrvl,/g
* Include an example dtb partition in documentation
* Copy structure of serial nodes to allow common options for NAND to be set
  in kirkwood.dtsi
* Simplifications in orion-nand.c

Jamie Lentin (5):
  ARM: kirkwood: Basic support for DNS-320 and DNS-325
  mtd: Add orion_nand devicetree bindings
  ARM: kirkwood: Allow nand to be configured via. devicetree
  ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
  mtd: Move fdt partition documentation to a seperate file

 .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
 .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 +
 .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 +
 .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 +
 .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +--
 .../devicetree/bindings/mtd/orion-nand.txt         |   49 ++++
 .../devicetree/bindings/mtd/partition.txt          |   38 +++
 arch/arm/boot/dts/kirkwood-dns320.dts              |   64 +++++
 arch/arm/boot/dts/kirkwood-dns325.dts              |   59 +++++
 arch/arm/boot/dts/kirkwood.dtsi                    |   15 +-
 arch/arm/mach-kirkwood/Kconfig                     |   23 ++
 arch/arm/mach-kirkwood/Makefile                    |    1 +
 arch/arm/mach-kirkwood/Makefile.boot               |    2 +
 arch/arm/mach-kirkwood/board-dnskw.c               |  275 ++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c                  |    5 +
 arch/arm/mach-kirkwood/common.c                    |   12 +
 arch/arm/mach-kirkwood/common.h                    |    6 +
 drivers/mtd/nand/orion_nand.c                      |   35 +++-
 18 files changed, 595 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt
 create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

-- 
1.7.9.1

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

* [PATCH V3 0/5] Add support for DNS-320 and DNS-325 using devicetree
@ 2012-03-27 21:54 ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Thanks again to Arnd, Jason & Scott. The differences here are fairly minor.
Apart from documentation, I'm guessing that the changes aren't significant
enough to revoke Acked-by, please flame me if I'm wrong!

Changes since v2:
* Split patches further, separating orion_nand and kirkwood changes
* dts renames: "bank-width", not "width". "okay", not "ok"
* Separate documentation out into separate patch, add references to
  partition.txt to all mtd bindings.

Changes since v1:
* Rebase against kirkwood_dt_for_3.4, removing premature devicetree ports.
* Move additions into a separate board-dnskw.c. It could be separated further
  into a board-dns320.c and board-dns325.c but it probably isn't worth it.
* s/marvell,/mrvl,/g
* Include an example dtb partition in documentation
* Copy structure of serial nodes to allow common options for NAND to be set
  in kirkwood.dtsi
* Simplifications in orion-nand.c

Jamie Lentin (5):
  ARM: kirkwood: Basic support for DNS-320 and DNS-325
  mtd: Add orion_nand devicetree bindings
  ARM: kirkwood: Allow nand to be configured via. devicetree
  ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
  mtd: Move fdt partition documentation to a seperate file

 .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
 .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 +
 .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 +
 .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 +
 .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +--
 .../devicetree/bindings/mtd/orion-nand.txt         |   49 ++++
 .../devicetree/bindings/mtd/partition.txt          |   38 +++
 arch/arm/boot/dts/kirkwood-dns320.dts              |   64 +++++
 arch/arm/boot/dts/kirkwood-dns325.dts              |   59 +++++
 arch/arm/boot/dts/kirkwood.dtsi                    |   15 +-
 arch/arm/mach-kirkwood/Kconfig                     |   23 ++
 arch/arm/mach-kirkwood/Makefile                    |    1 +
 arch/arm/mach-kirkwood/Makefile.boot               |    2 +
 arch/arm/mach-kirkwood/board-dnskw.c               |  275 ++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c                  |    5 +
 arch/arm/mach-kirkwood/common.c                    |   12 +
 arch/arm/mach-kirkwood/common.h                    |    6 +
 drivers/mtd/nand/orion_nand.c                      |   35 +++-
 18 files changed, 595 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
 create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt
 create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

-- 
1.7.9.1

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-03-27 21:54 ` Jamie Lentin
@ 2012-03-27 21:54   ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

Add support for the DNS-320 and DNS-325. Describe as much as currently possible
in the devicetree files, create a board-dnskw.c for everything else.

Use IEEE-compliant "okay", rather than "ok"

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
 arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
 arch/arm/mach-kirkwood/Kconfig        |   23 +++
 arch/arm/mach-kirkwood/Makefile       |    1 +
 arch/arm/mach-kirkwood/Makefile.boot  |    2 +
 arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |    5 +
 arch/arm/mach-kirkwood/common.h       |    6 +
 8 files changed, 396 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
new file mode 100644
index 0000000..78c834f
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "D-Link DNS-320 NAS (Rev A1)";
+	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp@f1000000 {
+		serial@12000 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+
+		serial@12100 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
new file mode 100644
index 0000000..23241ab
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "D-Link DNS-325 NAS (Rev A1)";
+	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp@f1000000 {
+		serial@12000 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+	};
+};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 90ceab7..d594b6e 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell DreamPlug (Flattened Device Tree).
 
+config MACH_DNSKW_DT
+        bool
+
+config MACH_DNS320_DT
+	bool "D-Link DNS-320 (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	select MACH_DNSKW_DT
+	select CONFIG_MTD_OF_PARTS
+	select CONFIG_SERIAL_OF_PLATFORM
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  D-Link DNS-320 NAS, using Flattened Device Tree.
+
+config MACH_DNS325_DT
+	bool "D-Link DNS-325 (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	select MACH_DNSKW_DT
+	select CONFIG_MTD_OF_PARTS
+	select CONFIG_SERIAL_OF_PLATFORM
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  D-Link DNS-325 NAS, using Flattened Device Tree.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index e299a95..b092af5 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
 obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
+obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 16f9385..9c5e45f 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
 
 dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
+dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
+dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
new file mode 100644
index 0000000..7cb7f6a
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
+ *
+ * arch/arm/mach-kirkwood/board-dnskw.c
+ *
+ * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
+ * flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/of.h>
+#include <linux/gpio.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/gpio-fan.h>
+#include <linux/leds.h>
+#include <linux/mtd/physmap.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/kirkwood.h>
+#include <mach/bridge-regs.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mtd_partition dnskw_nand_parts[] = {
+	{
+		.name		= "u-boot",
+		.offset		= 0,
+		.size		= SZ_1M,
+		.mask_flags	= MTD_WRITEABLE
+	}, {
+		.name		= "uImage",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	}, {
+		.name		= "ramdisk",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	}, {
+		.name		= "image",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 102 * SZ_1M
+	}, {
+		.name		= "mini firmware",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 10 * SZ_1M
+	}, {
+		.name		= "config",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	},
+};
+
+static struct mv643xx_eth_platform_data dnskw_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static struct mv_sata_platform_data dnskw_sata_data = {
+	.n_ports	= 2,
+};
+
+static unsigned int dnskw_mpp_config[] __initdata = {
+	MPP13_UART1_TXD,	/* Custom ... */
+	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
+	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
+	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
+	MPP24_GPIO,
+	MPP25_GPIO,
+	MPP26_GPIO,	/* LED: Power */
+	MPP27_GPIO,	/* LED: Red Right HDD */
+	MPP28_GPIO,	/* LED: Red Left HDD */
+	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
+	MPP30_GPIO,
+	MPP31_GPIO,
+	MPP32_GPIO,
+	MPP33_GPO,
+	MPP34_GPIO,	/* Button: Front power */
+	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
+	MPP36_GPIO,	/* Power: Turn off board */
+	MPP37_GPIO,	/* Power: Turn back on after power failure */
+	MPP38_GPIO,
+	MPP39_GPIO,	/* Power: SATA0 */
+	MPP40_GPIO,	/* Power: SATA1 */
+	MPP41_GPIO,
+	MPP42_GPIO,
+	MPP43_GPIO,	/* LED: White USB */
+	MPP44_GPIO,	/* Fan: Tachometer Pin */
+	MPP45_GPIO,	/* Fan: high speed */
+	MPP46_GPIO,	/* Fan: low speed */
+	MPP47_GPIO,	/* Button: Back unmount */
+	MPP48_GPIO,	/* Button: Back reset */
+	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
+	0
+};
+
+static struct gpio_led dns325_led_pins[] = {
+	{
+		.name	= "dns325:white:power",
+		.gpio	= 26,
+		.active_low = 1,
+		.default_trigger = "default-on",
+	},
+	{
+		.name	= "dns325:white:usb",
+		.gpio	= 43,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:l_hdd",
+		.gpio	= 28,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:r_hdd",
+		.gpio	= 27,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:usb",
+		.gpio	= 29,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_led_platform_data dns325_led_data = {
+	.num_leds	= ARRAY_SIZE(dns325_led_pins),
+	.leds		= dns325_led_pins,
+};
+
+static struct platform_device dns325_led_device = {
+	.name		= "leds-gpio",
+	.id		= -1,
+	.dev		= {
+		.platform_data	= &dns325_led_data,
+	},
+};
+
+static struct gpio_led dns320_led_pins[] = {
+	{
+		.name	= "dns320:blue:power",
+		.gpio	= 26,
+		.active_low = 1,
+		.default_trigger = "default-on",
+	},
+	{
+		.name	= "dns320:blue:usb",
+		.gpio	= 43,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:l_hdd",
+		.gpio	= 28,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:r_hdd",
+		.gpio	= 27,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:usb",
+		.gpio	= 35,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_led_platform_data dns320_led_data = {
+	.num_leds	= ARRAY_SIZE(dns320_led_pins),
+	.leds		= dns320_led_pins,
+};
+
+static struct platform_device dns320_led_device = {
+	.name		= "leds-gpio",
+	.id		= -1,
+	.dev		= {
+		.platform_data	= &dns320_led_data,
+	},
+};
+
+static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
+	{
+		I2C_BOARD_INFO("lm75", 0x48),
+	},
+	/* Something at 0x0c also */
+};
+
+static struct gpio_keys_button dnskw_button_pins[] = {
+	{
+		.code		= KEY_POWER,
+		.gpio		= 34,
+		.desc		= "Power button",
+		.active_low	= 1,
+	},
+	{
+		.code		= KEY_EJECTCD,
+		.gpio		= 47,
+		.desc		= "USB unmount button",
+		.active_low	= 1,
+	},
+	{
+		.code		= KEY_RESTART,
+		.gpio		= 48,
+		.desc		= "Reset button",
+		.active_low	= 1,
+	},
+};
+
+static struct gpio_keys_platform_data dnskw_button_data = {
+	.buttons	= dnskw_button_pins,
+	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
+};
+
+static struct platform_device dnskw_button_device = {
+	.name		= "gpio-keys",
+	.id		= -1,
+	.num_resources	= 0,
+	.dev		= {
+		.platform_data	= &dnskw_button_data,
+	}
+};
+
+/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
+static struct gpio_fan_speed dnskw_fan_speed[] = {
+	{    0,  0 },
+	{ 3000,	 1 },
+	{ 6000,	 2 },
+};
+static unsigned dnskw_fan_pins[] = {46, 45};
+
+static struct gpio_fan_platform_data dnskw_fan_data = {
+	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
+	.ctrl		= dnskw_fan_pins,
+	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
+	.speed		= dnskw_fan_speed,
+};
+
+static struct platform_device dnskw_fan_device = {
+	.name	= "gpio-fan",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &dnskw_fan_data,
+	},
+};
+
+static void dnskw_power_off(void)
+{
+	gpio_set_value(36, 1);
+}
+
+/* Register any GPIO for output and set the value */
+static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
+{
+	if (gpio_request(gpio, name) == 0 &&
+	    gpio_direction_output(gpio, 0) == 0) {
+		gpio_set_value(gpio, def);
+		if (gpio_export(gpio, 0) != 0)
+			pr_err("dnskw: Failed to export GPIO %s\n", name);
+	} else
+		pr_err("dnskw: Failed to register %s\n", name);
+}
+
+void __init dnskw_init(void)
+{
+	kirkwood_mpp_conf(dnskw_mpp_config);
+	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
+
+	kirkwood_ehci_init();
+	kirkwood_ge00_init(&dnskw_ge00_data);
+	kirkwood_sata_init(&dnskw_sata_data);
+	kirkwood_i2c_init();
+
+	platform_device_register(&dnskw_button_device);
+	platform_device_register(&dnskw_fan_device);
+
+	if (of_machine_is_compatible("dlink,dns-325")) {
+		i2c_register_board_info(0, dns325_i2c_board_info,
+					ARRAY_SIZE(dns325_i2c_board_info));
+		platform_device_register(&dns325_led_device);
+
+	} else if (of_machine_is_compatible("dlink,dns-320"))
+		platform_device_register(&dns320_led_device);
+
+	/* Register power-off GPIO. */
+	if (gpio_request(36, "dnskw:power:off") == 0
+	    && gpio_direction_output(36, 0) == 0)
+		pm_power_off = dnskw_power_off;
+	else
+		pr_err("dnskw: failed to configure power-off GPIO\n");
+
+	/* Ensure power is supplied to both HDDs */
+	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
+	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
+
+	/* Set NAS to turn back on after a power failure */
+	dnskw_gpio_register(37, "dnskw:power:recover", 1);
+}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 1c672d9..eadc4d7 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("globalscale,dreamplug"))
 		dreamplug_init();
 
+	if (of_machine_is_compatible("dlink,dns-kirkwood"))
+		dnskw_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
 static const char *kirkwood_dt_board_compat[] = {
 	"globalscale,dreamplug",
+	"dlink,dns-320",
+	"dlink,dns-325",
 	NULL
 };
 
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index fa8e768..8c8c733 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,12 @@ void dreamplug_init(void);
 static inline void dreamplug_init(void) {};
 #endif
 
+#ifdef CONFIG_MACH_DNSKW_DT
+void dnskw_init(void);
+#else
+static inline void dnskw_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
-- 
1.7.9.1

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-03-27 21:54   ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for the DNS-320 and DNS-325. Describe as much as currently possible
in the devicetree files, create a board-dnskw.c for everything else.

Use IEEE-compliant "okay", rather than "ok"

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
 arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
 arch/arm/mach-kirkwood/Kconfig        |   23 +++
 arch/arm/mach-kirkwood/Makefile       |    1 +
 arch/arm/mach-kirkwood/Makefile.boot  |    2 +
 arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dt.c     |    5 +
 arch/arm/mach-kirkwood/common.h       |    6 +
 8 files changed, 396 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
new file mode 100644
index 0000000..78c834f
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -0,0 +1,29 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "D-Link DNS-320 NAS (Rev A1)";
+	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+
+		serial at 12100 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
new file mode 100644
index 0000000..23241ab
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -0,0 +1,24 @@
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "D-Link DNS-325 NAS (Rev A1)";
+	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <200000000>;
+			status = "okay";
+		};
+	};
+};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 90ceab7..d594b6e 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell DreamPlug (Flattened Device Tree).
 
+config MACH_DNSKW_DT
+        bool
+
+config MACH_DNS320_DT
+	bool "D-Link DNS-320 (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	select MACH_DNSKW_DT
+	select CONFIG_MTD_OF_PARTS
+	select CONFIG_SERIAL_OF_PLATFORM
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  D-Link DNS-320 NAS, using Flattened Device Tree.
+
+config MACH_DNS325_DT
+	bool "D-Link DNS-325 (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	select MACH_DNSKW_DT
+	select CONFIG_MTD_OF_PARTS
+	select CONFIG_SERIAL_OF_PLATFORM
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  D-Link DNS-325 NAS, using Flattened Device Tree.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index e299a95..b092af5 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
 obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
 obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
+obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 16f9385..9c5e45f 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
 initrd_phys-y	:= 0x00800000
 
 dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
+dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
+dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
new file mode 100644
index 0000000..7cb7f6a
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
+ *
+ * arch/arm/mach-kirkwood/board-dnskw.c
+ *
+ * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
+ * flattened device tree yet.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/of.h>
+#include <linux/gpio.h>
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+#include <linux/gpio-fan.h>
+#include <linux/leds.h>
+#include <linux/mtd/physmap.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <mach/kirkwood.h>
+#include <mach/bridge-regs.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mtd_partition dnskw_nand_parts[] = {
+	{
+		.name		= "u-boot",
+		.offset		= 0,
+		.size		= SZ_1M,
+		.mask_flags	= MTD_WRITEABLE
+	}, {
+		.name		= "uImage",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	}, {
+		.name		= "ramdisk",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	}, {
+		.name		= "image",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 102 * SZ_1M
+	}, {
+		.name		= "mini firmware",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 10 * SZ_1M
+	}, {
+		.name		= "config",
+		.offset		= MTDPART_OFS_NXTBLK,
+		.size		= 5 * SZ_1M
+	},
+};
+
+static struct mv643xx_eth_platform_data dnskw_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static struct mv_sata_platform_data dnskw_sata_data = {
+	.n_ports	= 2,
+};
+
+static unsigned int dnskw_mpp_config[] __initdata = {
+	MPP13_UART1_TXD,	/* Custom ... */
+	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
+	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
+	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
+	MPP24_GPIO,
+	MPP25_GPIO,
+	MPP26_GPIO,	/* LED: Power */
+	MPP27_GPIO,	/* LED: Red Right HDD */
+	MPP28_GPIO,	/* LED: Red Left HDD */
+	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
+	MPP30_GPIO,
+	MPP31_GPIO,
+	MPP32_GPIO,
+	MPP33_GPO,
+	MPP34_GPIO,	/* Button: Front power */
+	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
+	MPP36_GPIO,	/* Power: Turn off board */
+	MPP37_GPIO,	/* Power: Turn back on after power failure */
+	MPP38_GPIO,
+	MPP39_GPIO,	/* Power: SATA0 */
+	MPP40_GPIO,	/* Power: SATA1 */
+	MPP41_GPIO,
+	MPP42_GPIO,
+	MPP43_GPIO,	/* LED: White USB */
+	MPP44_GPIO,	/* Fan: Tachometer Pin */
+	MPP45_GPIO,	/* Fan: high speed */
+	MPP46_GPIO,	/* Fan: low speed */
+	MPP47_GPIO,	/* Button: Back unmount */
+	MPP48_GPIO,	/* Button: Back reset */
+	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
+	0
+};
+
+static struct gpio_led dns325_led_pins[] = {
+	{
+		.name	= "dns325:white:power",
+		.gpio	= 26,
+		.active_low = 1,
+		.default_trigger = "default-on",
+	},
+	{
+		.name	= "dns325:white:usb",
+		.gpio	= 43,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:l_hdd",
+		.gpio	= 28,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:r_hdd",
+		.gpio	= 27,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns325:red:usb",
+		.gpio	= 29,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_led_platform_data dns325_led_data = {
+	.num_leds	= ARRAY_SIZE(dns325_led_pins),
+	.leds		= dns325_led_pins,
+};
+
+static struct platform_device dns325_led_device = {
+	.name		= "leds-gpio",
+	.id		= -1,
+	.dev		= {
+		.platform_data	= &dns325_led_data,
+	},
+};
+
+static struct gpio_led dns320_led_pins[] = {
+	{
+		.name	= "dns320:blue:power",
+		.gpio	= 26,
+		.active_low = 1,
+		.default_trigger = "default-on",
+	},
+	{
+		.name	= "dns320:blue:usb",
+		.gpio	= 43,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:l_hdd",
+		.gpio	= 28,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:r_hdd",
+		.gpio	= 27,
+		.active_low = 1,
+	},
+	{
+		.name	= "dns320:orange:usb",
+		.gpio	= 35,
+		.active_low = 1,
+	},
+};
+
+static struct gpio_led_platform_data dns320_led_data = {
+	.num_leds	= ARRAY_SIZE(dns320_led_pins),
+	.leds		= dns320_led_pins,
+};
+
+static struct platform_device dns320_led_device = {
+	.name		= "leds-gpio",
+	.id		= -1,
+	.dev		= {
+		.platform_data	= &dns320_led_data,
+	},
+};
+
+static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
+	{
+		I2C_BOARD_INFO("lm75", 0x48),
+	},
+	/* Something at 0x0c also */
+};
+
+static struct gpio_keys_button dnskw_button_pins[] = {
+	{
+		.code		= KEY_POWER,
+		.gpio		= 34,
+		.desc		= "Power button",
+		.active_low	= 1,
+	},
+	{
+		.code		= KEY_EJECTCD,
+		.gpio		= 47,
+		.desc		= "USB unmount button",
+		.active_low	= 1,
+	},
+	{
+		.code		= KEY_RESTART,
+		.gpio		= 48,
+		.desc		= "Reset button",
+		.active_low	= 1,
+	},
+};
+
+static struct gpio_keys_platform_data dnskw_button_data = {
+	.buttons	= dnskw_button_pins,
+	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
+};
+
+static struct platform_device dnskw_button_device = {
+	.name		= "gpio-keys",
+	.id		= -1,
+	.num_resources	= 0,
+	.dev		= {
+		.platform_data	= &dnskw_button_data,
+	}
+};
+
+/* Fan: ADDA AD045HB-G73 40mm 6000rpm at 5v */
+static struct gpio_fan_speed dnskw_fan_speed[] = {
+	{    0,  0 },
+	{ 3000,	 1 },
+	{ 6000,	 2 },
+};
+static unsigned dnskw_fan_pins[] = {46, 45};
+
+static struct gpio_fan_platform_data dnskw_fan_data = {
+	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
+	.ctrl		= dnskw_fan_pins,
+	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
+	.speed		= dnskw_fan_speed,
+};
+
+static struct platform_device dnskw_fan_device = {
+	.name	= "gpio-fan",
+	.id	= -1,
+	.dev	= {
+		.platform_data	= &dnskw_fan_data,
+	},
+};
+
+static void dnskw_power_off(void)
+{
+	gpio_set_value(36, 1);
+}
+
+/* Register any GPIO for output and set the value */
+static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
+{
+	if (gpio_request(gpio, name) == 0 &&
+	    gpio_direction_output(gpio, 0) == 0) {
+		gpio_set_value(gpio, def);
+		if (gpio_export(gpio, 0) != 0)
+			pr_err("dnskw: Failed to export GPIO %s\n", name);
+	} else
+		pr_err("dnskw: Failed to register %s\n", name);
+}
+
+void __init dnskw_init(void)
+{
+	kirkwood_mpp_conf(dnskw_mpp_config);
+	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
+
+	kirkwood_ehci_init();
+	kirkwood_ge00_init(&dnskw_ge00_data);
+	kirkwood_sata_init(&dnskw_sata_data);
+	kirkwood_i2c_init();
+
+	platform_device_register(&dnskw_button_device);
+	platform_device_register(&dnskw_fan_device);
+
+	if (of_machine_is_compatible("dlink,dns-325")) {
+		i2c_register_board_info(0, dns325_i2c_board_info,
+					ARRAY_SIZE(dns325_i2c_board_info));
+		platform_device_register(&dns325_led_device);
+
+	} else if (of_machine_is_compatible("dlink,dns-320"))
+		platform_device_register(&dns320_led_device);
+
+	/* Register power-off GPIO. */
+	if (gpio_request(36, "dnskw:power:off") == 0
+	    && gpio_direction_output(36, 0) == 0)
+		pm_power_off = dnskw_power_off;
+	else
+		pr_err("dnskw: failed to configure power-off GPIO\n");
+
+	/* Ensure power is supplied to both HDDs */
+	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
+	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
+
+	/* Set NAS to turn back on after a power failure */
+	dnskw_gpio_register(37, "dnskw:power:recover", 1);
+}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 1c672d9..eadc4d7 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("globalscale,dreamplug"))
 		dreamplug_init();
 
+	if (of_machine_is_compatible("dlink,dns-kirkwood"))
+		dnskw_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
 }
 
 static const char *kirkwood_dt_board_compat[] = {
 	"globalscale,dreamplug",
+	"dlink,dns-320",
+	"dlink,dns-325",
 	NULL
 };
 
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index fa8e768..8c8c733 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -58,6 +58,12 @@ void dreamplug_init(void);
 static inline void dreamplug_init(void) {};
 #endif
 
+#ifdef CONFIG_MACH_DNSKW_DT
+void dnskw_init(void);
+#else
+static inline void dnskw_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
-- 
1.7.9.1

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

* [PATCH V3 2/5] mtd: Add orion_nand devicetree bindings
  2012-03-27 21:54 ` Jamie Lentin
@ 2012-03-27 21:54   ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

Allow a NAND chip using the orion_nand driver to be described using devicetree.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 .../devicetree/bindings/mtd/orion-nand.txt         |   46 ++++++++++++++++++++
 drivers/mtd/nand/orion_nand.c                      |   35 ++++++++++++++-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt

diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
new file mode 100644
index 0000000..22c7438
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
@@ -0,0 +1,46 @@
+NAND support for Marvell Orion SoC platforms
+
+Required properties:
+- compatible : "mrvl,orion-nand".
+- reg : Base physical address of the NAND and length of memory mapped
+	region
+
+Optional properties:
+- cle :
+- ale :
+- bank-width :
+- chip-delay :
+
+Examples:
+
+nand@f4000000 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	cle = <0>;
+	ale = <1>;
+	bank-width = <8>;
+	chip-delay = <25>;
+	compatible = "mrvl,orion-nand";
+	reg = <0xf4000000 0x400>;
+
+	partition@0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+		read-only;
+	};
+
+	partition@100000 {
+		label = "uImage";
+		reg = <0x0100000 0x200000>;
+	};
+
+	partition@300000 {
+		label = "dtb";
+		reg = <0x0300000 0x100000>;
+	};
+
+	partition@400000 {
+		label = "root";
+		reg = <0x0400000 0x7d00000>;
+	};
+};
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 29f505a..3b7c82f 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -74,11 +75,13 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 static int __init orion_nand_probe(struct platform_device *pdev)
 {
 	struct mtd_info *mtd;
+	struct mtd_part_parser_data ppdata = {};
 	struct nand_chip *nc;
 	struct orion_nand_data *board;
 	struct resource *res;
 	void __iomem *io_base;
 	int ret = 0;
+	u32 val = 0;
 
 	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
 	if (!nc) {
@@ -101,7 +104,26 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		goto no_res;
 	}
 
-	board = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
+					GFP_KERNEL);
+		if (!board) {
+			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
+			ret = -ENOMEM;
+			goto no_res;
+		}
+		if (!of_property_read_u32(pdev->dev.of_node, "cle", &val))
+			board->cle = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node, "ale", &val))
+			board->ale = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node,
+						"bank-width", &val))
+			board->width = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node,
+						"chip-delay", &val))
+			board->chip_delay = (u8)val;
+	} else
+		board = pdev->dev.platform_data;
 
 	mtd->priv = nc;
 	mtd->owner = THIS_MODULE;
@@ -129,7 +151,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	}
 
 	mtd->name = "orion_nand";
-	ret = mtd_device_parse_register(mtd, NULL, 0,
+	ppdata.of_node = pdev->dev.of_node;
+	ret = mtd_device_parse_register(mtd, NULL, &ppdata,
 			board->parts, board->nr_parts);
 	if (ret) {
 		nand_release(mtd);
@@ -161,11 +184,19 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id orion_nand_of_match_table[] = {
+	{ .compatible = "mrvl,orion-nand", },
+	{},
+};
+#endif
+
 static struct platform_driver orion_nand_driver = {
 	.remove		= __devexit_p(orion_nand_remove),
 	.driver		= {
 		.name	= "orion_nand",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(orion_nand_of_match_table),
 	},
 };
 
-- 
1.7.9.1

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

* [PATCH V3 2/5] mtd: Add orion_nand devicetree bindings
@ 2012-03-27 21:54   ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Allow a NAND chip using the orion_nand driver to be described using devicetree.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 .../devicetree/bindings/mtd/orion-nand.txt         |   46 ++++++++++++++++++++
 drivers/mtd/nand/orion_nand.c                      |   35 ++++++++++++++-
 2 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt

diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
new file mode 100644
index 0000000..22c7438
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
@@ -0,0 +1,46 @@
+NAND support for Marvell Orion SoC platforms
+
+Required properties:
+- compatible : "mrvl,orion-nand".
+- reg : Base physical address of the NAND and length of memory mapped
+	region
+
+Optional properties:
+- cle :
+- ale :
+- bank-width :
+- chip-delay :
+
+Examples:
+
+nand at f4000000 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	cle = <0>;
+	ale = <1>;
+	bank-width = <8>;
+	chip-delay = <25>;
+	compatible = "mrvl,orion-nand";
+	reg = <0xf4000000 0x400>;
+
+	partition at 0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+		read-only;
+	};
+
+	partition at 100000 {
+		label = "uImage";
+		reg = <0x0100000 0x200000>;
+	};
+
+	partition at 300000 {
+		label = "dtb";
+		reg = <0x0300000 0x100000>;
+	};
+
+	partition at 400000 {
+		label = "root";
+		reg = <0x0400000 0x7d00000>;
+	};
+};
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 29f505a..3b7c82f 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -13,6 +13,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/of.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
@@ -74,11 +75,13 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
 static int __init orion_nand_probe(struct platform_device *pdev)
 {
 	struct mtd_info *mtd;
+	struct mtd_part_parser_data ppdata = {};
 	struct nand_chip *nc;
 	struct orion_nand_data *board;
 	struct resource *res;
 	void __iomem *io_base;
 	int ret = 0;
+	u32 val = 0;
 
 	nc = kzalloc(sizeof(struct nand_chip) + sizeof(struct mtd_info), GFP_KERNEL);
 	if (!nc) {
@@ -101,7 +104,26 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 		goto no_res;
 	}
 
-	board = pdev->dev.platform_data;
+	if (pdev->dev.of_node) {
+		board = devm_kzalloc(&pdev->dev, sizeof(struct orion_nand_data),
+					GFP_KERNEL);
+		if (!board) {
+			printk(KERN_ERR "orion_nand: failed to allocate board structure.\n");
+			ret = -ENOMEM;
+			goto no_res;
+		}
+		if (!of_property_read_u32(pdev->dev.of_node, "cle", &val))
+			board->cle = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node, "ale", &val))
+			board->ale = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node,
+						"bank-width", &val))
+			board->width = (u8)val;
+		if (!of_property_read_u32(pdev->dev.of_node,
+						"chip-delay", &val))
+			board->chip_delay = (u8)val;
+	} else
+		board = pdev->dev.platform_data;
 
 	mtd->priv = nc;
 	mtd->owner = THIS_MODULE;
@@ -129,7 +151,8 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	}
 
 	mtd->name = "orion_nand";
-	ret = mtd_device_parse_register(mtd, NULL, 0,
+	ppdata.of_node = pdev->dev.of_node;
+	ret = mtd_device_parse_register(mtd, NULL, &ppdata,
 			board->parts, board->nr_parts);
 	if (ret) {
 		nand_release(mtd);
@@ -161,11 +184,19 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id orion_nand_of_match_table[] = {
+	{ .compatible = "mrvl,orion-nand", },
+	{},
+};
+#endif
+
 static struct platform_driver orion_nand_driver = {
 	.remove		= __devexit_p(orion_nand_remove),
 	.driver		= {
 		.name	= "orion_nand",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(orion_nand_of_match_table),
 	},
 };
 
-- 
1.7.9.1

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

* [PATCH V3 3/5] ARM: kirkwood: Allow nand to be configured via. devicetree
  2012-03-27 21:54 ` Jamie Lentin
@ 2012-03-27 21:54     ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jamie Lentin,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Add default configuration for NAND, to be enabled in your board config. Ensure
clock gating is set appropriately when the NAND is enabled.

Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
---
 arch/arm/boot/dts/kirkwood.dtsi |   15 ++++++++++++++-
 arch/arm/mach-kirkwood/common.c |   12 ++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 3474ef8..6b80374 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -5,7 +5,7 @@
 
 	ocp@f1000000 {
 		compatible = "simple-bus";
-		ranges = <0 0xf1000000 0x1000000>;
+		ranges = <0 0xf1000000 0x4000000>;
 		#address-cells = <1>;
 		#size-cells = <1>;
 
@@ -32,5 +32,18 @@
 			reg = <0x10300 0x20>;
 			interrupts = <53>;
 		};
+
+		nand@3000000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cle = <0>;
+			ale = <1>;
+			bank-width = <8>;
+			compatible = "mrvl,orion-nand";
+			reg = <0x3000000 0x400>;
+			chip-delay = <25>;
+			/* set partition map and/or chip-delay in board dts */
+			status = "disabled";
+		};
 	};
 };
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index a02cae8..3ad0373 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -15,6 +15,7 @@
 #include <linux/ata_platform.h>
 #include <linux/mtd/nand.h>
 #include <linux/dma-mapping.h>
+#include <linux/of.h>
 #include <net/dsa.h>
 #include <asm/page.h>
 #include <asm/timex.h>
@@ -482,6 +483,9 @@ static int __init kirkwood_clock_gate(void)
 	unsigned int curr = readl(CLOCK_GATING_CTRL);
 	u32 dev, rev;
 
+#ifdef CONFIG_OF
+	struct device_node *np;
+#endif
 	kirkwood_pcie_id(&dev, &rev);
 	printk(KERN_DEBUG "Gating clock of unused units\n");
 	printk(KERN_DEBUG "before: 0x%08x\n", curr);
@@ -489,6 +493,14 @@ static int __init kirkwood_clock_gate(void)
 	/* Make sure those units are accessible */
 	writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
 
+#ifdef CONFIG_OF
+	np = of_find_compatible_node(NULL, NULL, "mrvl,orion-nand");
+	if (np && of_device_is_available(np)) {
+		kirkwood_clk_ctrl |= CGC_RUNIT;
+		of_node_put(np);
+	}
+#endif
+
 	/* For SATA: first shutdown the phy */
 	if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
 		/* Disable PLL and IVREF */
-- 
1.7.9.1

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

* [PATCH V3 3/5] ARM: kirkwood: Allow nand to be configured via. devicetree
@ 2012-03-27 21:54     ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Add default configuration for NAND, to be enabled in your board config. Ensure
clock gating is set appropriately when the NAND is enabled.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood.dtsi |   15 ++++++++++++++-
 arch/arm/mach-kirkwood/common.c |   12 ++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
index 3474ef8..6b80374 100644
--- a/arch/arm/boot/dts/kirkwood.dtsi
+++ b/arch/arm/boot/dts/kirkwood.dtsi
@@ -5,7 +5,7 @@
 
 	ocp at f1000000 {
 		compatible = "simple-bus";
-		ranges = <0 0xf1000000 0x1000000>;
+		ranges = <0 0xf1000000 0x4000000>;
 		#address-cells = <1>;
 		#size-cells = <1>;
 
@@ -32,5 +32,18 @@
 			reg = <0x10300 0x20>;
 			interrupts = <53>;
 		};
+
+		nand at 3000000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			cle = <0>;
+			ale = <1>;
+			bank-width = <8>;
+			compatible = "mrvl,orion-nand";
+			reg = <0x3000000 0x400>;
+			chip-delay = <25>;
+			/* set partition map and/or chip-delay in board dts */
+			status = "disabled";
+		};
 	};
 };
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index a02cae8..3ad0373 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -15,6 +15,7 @@
 #include <linux/ata_platform.h>
 #include <linux/mtd/nand.h>
 #include <linux/dma-mapping.h>
+#include <linux/of.h>
 #include <net/dsa.h>
 #include <asm/page.h>
 #include <asm/timex.h>
@@ -482,6 +483,9 @@ static int __init kirkwood_clock_gate(void)
 	unsigned int curr = readl(CLOCK_GATING_CTRL);
 	u32 dev, rev;
 
+#ifdef CONFIG_OF
+	struct device_node *np;
+#endif
 	kirkwood_pcie_id(&dev, &rev);
 	printk(KERN_DEBUG "Gating clock of unused units\n");
 	printk(KERN_DEBUG "before: 0x%08x\n", curr);
@@ -489,6 +493,14 @@ static int __init kirkwood_clock_gate(void)
 	/* Make sure those units are accessible */
 	writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
 
+#ifdef CONFIG_OF
+	np = of_find_compatible_node(NULL, NULL, "mrvl,orion-nand");
+	if (np && of_device_is_available(np)) {
+		kirkwood_clk_ctrl |= CGC_RUNIT;
+		of_node_put(np);
+	}
+#endif
+
 	/* For SATA: first shutdown the phy */
 	if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
 		/* Disable PLL and IVREF */
-- 
1.7.9.1

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

* [PATCH V3 4/5] ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
  2012-03-27 21:54 ` Jamie Lentin
@ 2012-03-27 21:54   ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

Use devicetree to define NAND partitions. Use D-link partition scheme by
default, to be vaguely compatible with their userland.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dns320.dts |   35 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-dns325.dts |   35 +++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dnskw.c  |   31 -----------------------------
 3 files changed, 70 insertions(+), 31 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index 78c834f..dc09a73 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -25,5 +25,40 @@
 			clock-frequency = <166666667>;
 			status = "okay";
 		};
+
+		nand@3000000 {
+			status = "okay";
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0000000 0x100000>;
+				read-only;
+			};
+
+			partition@100000 {
+				label = "uImage";
+				reg = <0x0100000 0x500000>;
+			};
+
+			partition@600000 {
+				label = "ramdisk";
+				reg = <0x0600000 0x500000>;
+			};
+
+			partition@b00000 {
+				label = "image";
+				reg = <0x0b00000 0x6600000>;
+			};
+
+			partition@7100000 {
+				label = "mini firmware";
+				reg = <0x7100000 0xa00000>;
+			};
+
+			partition@7b00000 {
+				label = "config";
+				reg = <0x7b00000 0x500000>;
+			};
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index 23241ab..c2a5562 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -20,5 +20,40 @@
 			clock-frequency = <200000000>;
 			status = "okay";
 		};
+
+		nand@3000000 {
+			status = "okay";
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0000000 0x100000>;
+				read-only;
+			};
+
+			partition@100000 {
+				label = "uImage";
+				reg = <0x0100000 0x500000>;
+			};
+
+			partition@600000 {
+				label = "ramdisk";
+				reg = <0x0600000 0x500000>;
+			};
+
+			partition@b00000 {
+				label = "image";
+				reg = <0x0b00000 0x6600000>;
+			};
+
+			partition@7100000 {
+				label = "mini firmware";
+				reg = <0x7100000 0xa00000>;
+			};
+
+			partition@7b00000 {
+				label = "config";
+				reg = <0x7b00000 0x500000>;
+			};
+		};
 	};
 };
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 7cb7f6a..dc4e80a 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -23,7 +23,6 @@
 #include <linux/gpio_keys.h>
 #include <linux/gpio-fan.h>
 #include <linux/leds.h>
-#include <linux/mtd/physmap.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -32,35 +31,6 @@
 #include "common.h"
 #include "mpp.h"
 
-static struct mtd_partition dnskw_nand_parts[] = {
-	{
-		.name		= "u-boot",
-		.offset		= 0,
-		.size		= SZ_1M,
-		.mask_flags	= MTD_WRITEABLE
-	}, {
-		.name		= "uImage",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	}, {
-		.name		= "ramdisk",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	}, {
-		.name		= "image",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 102 * SZ_1M
-	}, {
-		.name		= "mini firmware",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 10 * SZ_1M
-	}, {
-		.name		= "config",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	},
-};
-
 static struct mv643xx_eth_platform_data dnskw_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
 };
@@ -272,7 +242,6 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
 void __init dnskw_init(void)
 {
 	kirkwood_mpp_conf(dnskw_mpp_config);
-	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
 
 	kirkwood_ehci_init();
 	kirkwood_ge00_init(&dnskw_ge00_data);
-- 
1.7.9.1

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

* [PATCH V3 4/5] ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
@ 2012-03-27 21:54   ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Use devicetree to define NAND partitions. Use D-link partition scheme by
default, to be vaguely compatible with their userland.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dns320.dts |   35 +++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-dns325.dts |   35 +++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dnskw.c  |   31 -----------------------------
 3 files changed, 70 insertions(+), 31 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
index 78c834f..dc09a73 100644
--- a/arch/arm/boot/dts/kirkwood-dns320.dts
+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
@@ -25,5 +25,40 @@
 			clock-frequency = <166666667>;
 			status = "okay";
 		};
+
+		nand at 3000000 {
+			status = "okay";
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x0000000 0x100000>;
+				read-only;
+			};
+
+			partition at 100000 {
+				label = "uImage";
+				reg = <0x0100000 0x500000>;
+			};
+
+			partition at 600000 {
+				label = "ramdisk";
+				reg = <0x0600000 0x500000>;
+			};
+
+			partition at b00000 {
+				label = "image";
+				reg = <0x0b00000 0x6600000>;
+			};
+
+			partition at 7100000 {
+				label = "mini firmware";
+				reg = <0x7100000 0xa00000>;
+			};
+
+			partition at 7b00000 {
+				label = "config";
+				reg = <0x7b00000 0x500000>;
+			};
+		};
 	};
 };
diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
index 23241ab..c2a5562 100644
--- a/arch/arm/boot/dts/kirkwood-dns325.dts
+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
@@ -20,5 +20,40 @@
 			clock-frequency = <200000000>;
 			status = "okay";
 		};
+
+		nand at 3000000 {
+			status = "okay";
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x0000000 0x100000>;
+				read-only;
+			};
+
+			partition at 100000 {
+				label = "uImage";
+				reg = <0x0100000 0x500000>;
+			};
+
+			partition at 600000 {
+				label = "ramdisk";
+				reg = <0x0600000 0x500000>;
+			};
+
+			partition at b00000 {
+				label = "image";
+				reg = <0x0b00000 0x6600000>;
+			};
+
+			partition at 7100000 {
+				label = "mini firmware";
+				reg = <0x7100000 0xa00000>;
+			};
+
+			partition at 7b00000 {
+				label = "config";
+				reg = <0x7b00000 0x500000>;
+			};
+		};
 	};
 };
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 7cb7f6a..dc4e80a 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -23,7 +23,6 @@
 #include <linux/gpio_keys.h>
 #include <linux/gpio-fan.h>
 #include <linux/leds.h>
-#include <linux/mtd/physmap.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -32,35 +31,6 @@
 #include "common.h"
 #include "mpp.h"
 
-static struct mtd_partition dnskw_nand_parts[] = {
-	{
-		.name		= "u-boot",
-		.offset		= 0,
-		.size		= SZ_1M,
-		.mask_flags	= MTD_WRITEABLE
-	}, {
-		.name		= "uImage",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	}, {
-		.name		= "ramdisk",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	}, {
-		.name		= "image",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 102 * SZ_1M
-	}, {
-		.name		= "mini firmware",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 10 * SZ_1M
-	}, {
-		.name		= "config",
-		.offset		= MTDPART_OFS_NXTBLK,
-		.size		= 5 * SZ_1M
-	},
-};
-
 static struct mv643xx_eth_platform_data dnskw_ge00_data = {
 	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
 };
@@ -272,7 +242,6 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
 void __init dnskw_init(void)
 {
 	kirkwood_mpp_conf(dnskw_mpp_config);
-	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
 
 	kirkwood_ehci_init();
 	kirkwood_ge00_init(&dnskw_ge00_data);
-- 
1.7.9.1

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

* [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
  2012-03-27 21:54 ` Jamie Lentin
@ 2012-03-27 21:54   ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

Partitions are described in the same way for all mtd devices when using
devicetree, move the documentation to a separate file and add references
to it.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
 .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
 .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
 .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
 .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
 .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
 .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
 7 files changed, 55 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt

diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
index 476845d..beace4b 100644
--- a/Documentation/devicetree/bindings/mtd/arm-versatile.txt
+++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
@@ -4,5 +4,5 @@ Required properties:
 - compatible : must be "arm,versatile-flash";
 - bank-width : width in bytes of flash interface.
 
-Optional properties:
-- Subnode partition map from mtd flash binding
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
diff --git a/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
index ef66ddd..1889a4d 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
@@ -3,6 +3,9 @@
 Required properties:
 - compatible : "atmel,<model>", "atmel,<series>", "atmel,dataflash".
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Example:
 
 flash@1 {
diff --git a/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
index 00f1f54..fce4894 100644
--- a/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
@@ -19,6 +19,10 @@ Optional properties:
 	read registers (tR). Required if property "gpios" is not used
 	(R/B# pins not connected).
 
+Each flash chip described may optionally contain additional sub-nodes
+describing partitions of the address space. See partition.txt for more
+detail.
+
 Examples:
 
 upm@1,0 {
diff --git a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt b/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
index 719f4dc..36ef07d 100644
--- a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
@@ -25,6 +25,9 @@ Optional properties:
   GPIO state and before and after command byte writes, this register will be
   read to ensure that the GPIO accesses have completed.
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Examples:
 
 gpio-nand@1,0 {
diff --git a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
index 80152cb..a63c2bd7 100644
--- a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
+++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
@@ -23,27 +23,8 @@ are defined:
  - vendor-id : Contains the flash chip's vendor id (1 byte).
  - device-id : Contains the flash chip's device id (1 byte).
 
-In addition to the information on the mtd bank itself, the
-device tree may optionally contain additional information
-describing partitions of the address space.  This can be
-used on platforms which have strong conventions about which
-portions of a flash are used for what purposes, but which don't
-use an on-flash partition table such as RedBoot.
-
-Each partition is represented as a sub-node of the mtd device.
-Each node's name represents the name of the corresponding
-partition of the mtd device.
-
-Flash partitions
- - reg : The partition's offset and size within the mtd bank.
- - label : (optional) The label / name for this partition.
-   If omitted, the label is taken from the node name (excluding
-   the unit address).
- - read-only : (optional) This parameter, if present, is a hint to
-   Linux that this partition should only be mounted
-   read-only.  This is usually used for flash partitions
-   containing early-boot firmware images or data which should not
-   be clobbered.
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
 
 Example:
 
diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
index 22c7438..d606009 100644
--- a/Documentation/devicetree/bindings/mtd/orion-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
@@ -11,6 +11,9 @@ Optional properties:
 - bank-width :
 - chip-delay :
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Examples:
 
 nand@f4000000 {
diff --git a/Documentation/devicetree/bindings/mtd/partition.txt b/Documentation/devicetree/bindings/mtd/partition.txt
new file mode 100644
index 0000000..f114ce1
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partition.txt
@@ -0,0 +1,38 @@
+Representing flash partitions in devicetree
+
+Partitions can be represented by sub-nodes of an mtd device. This can be used
+on platforms which have strong conventions about which portions of a flash are
+used for what purposes, but which don't use an on-flash partition table such
+as RedBoot.
+
+#address-cells & #size-cells must both be present in the mtd device and be
+equal to 1.
+
+Required properties:
+- reg : The partition's offset and size within the mtd bank.
+
+Optional properties:
+- label : The label / name for this partition.  If omitted, the label is taken
+  from the node name (excluding the unit address).
+- read-only : This parameter, if present, is a hint to Linux that this
+  partition should only be mounted read-only. This is usually used for flash
+  partitions containing early-boot firmware images or data which should not be
+  clobbered.
+
+Examples:
+
+
+flash@0 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+		read-only;
+	};
+
+	uimage@100000 {
+		reg = <0x0100000 0x200000>;
+	};
+];
-- 
1.7.9.1

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

* [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
@ 2012-03-27 21:54   ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-03-27 21:54 UTC (permalink / raw)
  To: linux-arm-kernel

Partitions are described in the same way for all mtd devices when using
devicetree, move the documentation to a separate file and add references
to it.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
 .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
 .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
 .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
 .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
 .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
 .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
 7 files changed, 55 insertions(+), 23 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt

diff --git a/Documentation/devicetree/bindings/mtd/arm-versatile.txt b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
index 476845d..beace4b 100644
--- a/Documentation/devicetree/bindings/mtd/arm-versatile.txt
+++ b/Documentation/devicetree/bindings/mtd/arm-versatile.txt
@@ -4,5 +4,5 @@ Required properties:
 - compatible : must be "arm,versatile-flash";
 - bank-width : width in bytes of flash interface.
 
-Optional properties:
-- Subnode partition map from mtd flash binding
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
diff --git a/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
index ef66ddd..1889a4d 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-dataflash.txt
@@ -3,6 +3,9 @@
 Required properties:
 - compatible : "atmel,<model>", "atmel,<series>", "atmel,dataflash".
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Example:
 
 flash at 1 {
diff --git a/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
index 00f1f54..fce4894 100644
--- a/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt
@@ -19,6 +19,10 @@ Optional properties:
 	read registers (tR). Required if property "gpios" is not used
 	(R/B# pins not connected).
 
+Each flash chip described may optionally contain additional sub-nodes
+describing partitions of the address space. See partition.txt for more
+detail.
+
 Examples:
 
 upm at 1,0 {
diff --git a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt b/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
index 719f4dc..36ef07d 100644
--- a/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/gpio-control-nand.txt
@@ -25,6 +25,9 @@ Optional properties:
   GPIO state and before and after command byte writes, this register will be
   read to ensure that the GPIO accesses have completed.
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Examples:
 
 gpio-nand at 1,0 {
diff --git a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
index 80152cb..a63c2bd7 100644
--- a/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
+++ b/Documentation/devicetree/bindings/mtd/mtd-physmap.txt
@@ -23,27 +23,8 @@ are defined:
  - vendor-id : Contains the flash chip's vendor id (1 byte).
  - device-id : Contains the flash chip's device id (1 byte).
 
-In addition to the information on the mtd bank itself, the
-device tree may optionally contain additional information
-describing partitions of the address space.  This can be
-used on platforms which have strong conventions about which
-portions of a flash are used for what purposes, but which don't
-use an on-flash partition table such as RedBoot.
-
-Each partition is represented as a sub-node of the mtd device.
-Each node's name represents the name of the corresponding
-partition of the mtd device.
-
-Flash partitions
- - reg : The partition's offset and size within the mtd bank.
- - label : (optional) The label / name for this partition.
-   If omitted, the label is taken from the node name (excluding
-   the unit address).
- - read-only : (optional) This parameter, if present, is a hint to
-   Linux that this partition should only be mounted
-   read-only.  This is usually used for flash partitions
-   containing early-boot firmware images or data which should not
-   be clobbered.
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
 
 Example:
 
diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
index 22c7438..d606009 100644
--- a/Documentation/devicetree/bindings/mtd/orion-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
@@ -11,6 +11,9 @@ Optional properties:
 - bank-width :
 - chip-delay :
 
+The device tree may optionally contain sub-nodes describing partitions of the
+address space. See partition.txt for more detail.
+
 Examples:
 
 nand at f4000000 {
diff --git a/Documentation/devicetree/bindings/mtd/partition.txt b/Documentation/devicetree/bindings/mtd/partition.txt
new file mode 100644
index 0000000..f114ce1
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/partition.txt
@@ -0,0 +1,38 @@
+Representing flash partitions in devicetree
+
+Partitions can be represented by sub-nodes of an mtd device. This can be used
+on platforms which have strong conventions about which portions of a flash are
+used for what purposes, but which don't use an on-flash partition table such
+as RedBoot.
+
+#address-cells & #size-cells must both be present in the mtd device and be
+equal to 1.
+
+Required properties:
+- reg : The partition's offset and size within the mtd bank.
+
+Optional properties:
+- label : The label / name for this partition.  If omitted, the label is taken
+  from the node name (excluding the unit address).
+- read-only : This parameter, if present, is a hint to Linux that this
+  partition should only be mounted read-only. This is usually used for flash
+  partitions containing early-boot firmware images or data which should not be
+  clobbered.
+
+Examples:
+
+
+flash at 0 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition at 0 {
+		label = "u-boot";
+		reg = <0x0000000 0x100000>;
+		read-only;
+	};
+
+	uimage at 100000 {
+		reg = <0x0100000 0x200000>;
+	};
+];
-- 
1.7.9.1

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

* Re: [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-03-28  8:17     ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-03-28  8:17 UTC (permalink / raw)
  To: Jamie Lentin; +Cc: devicetree-discuss, Jason, linux-arm-kernel

On Tuesday 27 March 2012, Jamie Lentin wrote:
> 
> Partitions are described in the same way for all mtd devices when using
> devicetree, move the documentation to a separate file and add references
> to it.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

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

> ---
>  .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
>  .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
>  .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
>  .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
>  .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
>  .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
>  .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
>  7 files changed, 55 insertions(+), 23 deletions(-)

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

* [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
@ 2012-03-28  8:17     ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-03-28  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 27 March 2012, Jamie Lentin wrote:
> 
> Partitions are described in the same way for all mtd devices when using
> devicetree, move the documentation to a separate file and add references
> to it.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

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

> ---
>  .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
>  .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
>  .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
>  .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
>  .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
>  .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
>  .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
>  7 files changed, 55 insertions(+), 23 deletions(-)

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-03-28  8:19       ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-03-28  8:19 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tuesday 27 March 2012, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
> Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> ---

One small note about changeset comments: The part about differences from the previous
version of the same patch normally goes below the '---' line, in front of the diffstat,
to prevent it from going into the git changelog. Otherwise people will have no idea
what it's about.

	Arnd

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-03-28  8:19       ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-03-28  8:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 27 March 2012, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---

One small note about changeset comments: The part about differences from the previous
version of the same patch normally goes below the '---' line, in front of the diffstat,
to prevent it from going into the git changelog. Otherwise people will have no idea
what it's about.

	Arnd

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

* Re: [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-03-28 14:41       ` Jason Cooper
  -1 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-03-28 14:41 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Mar 27, 2012 at 10:54:15PM +0100, Jamie Lentin wrote:
> Partitions are described in the same way for all mtd devices when using
> devicetree, move the documentation to a separate file and add references
> to it.
> 
> Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>

Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>

> ---
>  .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
>  .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
>  .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
>  .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
>  .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
>  .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
>  .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
>  7 files changed, 55 insertions(+), 23 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt

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

* [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
@ 2012-03-28 14:41       ` Jason Cooper
  0 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-03-28 14:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2012 at 10:54:15PM +0100, Jamie Lentin wrote:
> Partitions are described in the same way for all mtd devices when using
> devicetree, move the documentation to a separate file and add references
> to it.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>

Acked-by: Jason Cooper <jason@lakedaemon.net>

> ---
>  .../devicetree/bindings/mtd/arm-versatile.txt      |    4 +-
>  .../devicetree/bindings/mtd/atmel-dataflash.txt    |    3 ++
>  .../devicetree/bindings/mtd/fsl-upm-nand.txt       |    4 ++
>  .../devicetree/bindings/mtd/gpio-control-nand.txt  |    3 ++
>  .../devicetree/bindings/mtd/mtd-physmap.txt        |   23 +-----------
>  .../devicetree/bindings/mtd/orion-nand.txt         |    3 ++
>  .../devicetree/bindings/mtd/partition.txt          |   38 ++++++++++++++++++++
>  7 files changed, 55 insertions(+), 23 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt

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

* Re: [PATCH V3 2/5] mtd: Add orion_nand devicetree bindings
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-03-28 23:04     ` Grant Likely
  -1 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-03-28 23:04 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

On Tue, 27 Mar 2012 22:54:12 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> Allow a NAND chip using the orion_nand driver to be described using devicetree.
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  .../devicetree/bindings/mtd/orion-nand.txt         |   46 ++++++++++++++++++++
>  drivers/mtd/nand/orion_nand.c                      |   35 ++++++++++++++-
>  2 files changed, 79 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
> 
> diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
> new file mode 100644
> index 0000000..22c7438
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
> @@ -0,0 +1,46 @@
> +NAND support for Marvell Orion SoC platforms
> +
> +Required properties:
> +- compatible : "mrvl,orion-nand".
> +- reg : Base physical address of the NAND and length of memory mapped
> +	region
> +
> +Optional properties:
> +- cle :
> +- ale :
> +- bank-width :
> +- chip-delay :

Please state what data these properties contain.  :-)

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

* [PATCH V3 2/5] mtd: Add orion_nand devicetree bindings
@ 2012-03-28 23:04     ` Grant Likely
  0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-03-28 23:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 27 Mar 2012 22:54:12 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> Allow a NAND chip using the orion_nand driver to be described using devicetree.
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  .../devicetree/bindings/mtd/orion-nand.txt         |   46 ++++++++++++++++++++
>  drivers/mtd/nand/orion_nand.c                      |   35 ++++++++++++++-
>  2 files changed, 79 insertions(+), 2 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
> 
> diff --git a/Documentation/devicetree/bindings/mtd/orion-nand.txt b/Documentation/devicetree/bindings/mtd/orion-nand.txt
> new file mode 100644
> index 0000000..22c7438
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mtd/orion-nand.txt
> @@ -0,0 +1,46 @@
> +NAND support for Marvell Orion SoC platforms
> +
> +Required properties:
> +- compatible : "mrvl,orion-nand".
> +- reg : Base physical address of the NAND and length of memory mapped
> +	region
> +
> +Optional properties:
> +- cle :
> +- ale :
> +- bank-width :
> +- chip-delay :

Please state what data these properties contain.  :-)

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

* Re: [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
  2012-03-28  8:17     ` Arnd Bergmann
@ 2012-03-28 23:08       ` Grant Likely
  -1 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-03-28 23:08 UTC (permalink / raw)
  To: Arnd Bergmann, Jamie Lentin; +Cc: devicetree-discuss, Jason, linux-arm-kernel

On Wed, 28 Mar 2012 08:17:12 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 27 March 2012, Jamie Lentin wrote:
> > 
> > Partitions are described in the same way for all mtd devices when using
> > devicetree, move the documentation to a separate file and add references
> > to it.
> > 
> > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Merged, thanks (dropping the orion-nand.txt hunk) because I'm not
applying the rest of the series!)

g.

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

* [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file
@ 2012-03-28 23:08       ` Grant Likely
  0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-03-28 23:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 28 Mar 2012 08:17:12 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 27 March 2012, Jamie Lentin wrote:
> > 
> > Partitions are described in the same way for all mtd devices when using
> > devicetree, move the documentation to a separate file and add references
> > to it.
> > 
> > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>

Merged, thanks (dropping the orion-nand.txt hunk) because I'm not
applying the rest of the series!)

g.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-03-31  1:30       ` Jason Cooper
  -1 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-03-31  1:30 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Tue, Mar 27, 2012 at 10:54:11PM +0100, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
> Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> ---
>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>  arch/arm/mach-kirkwood/Makefile       |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>  arch/arm/mach-kirkwood/common.h       |    6 +
>  8 files changed, 396 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

Jamie,

I've applied this locally, thanks.  Looks like Grant took #5 through his
tree.  As #3 and #4 depend on #2, I'll wait for the next version of #2
incorporating Grant's comments before I apply #2-#4.

thx,

Jason.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-03-31  1:30       ` Jason Cooper
  0 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-03-31  1:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 27, 2012 at 10:54:11PM +0100, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>  arch/arm/mach-kirkwood/Makefile       |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>  arch/arm/mach-kirkwood/common.h       |    6 +
>  8 files changed, 396 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

Jamie,

I've applied this locally, thanks.  Looks like Grant took #5 through his
tree.  As #3 and #4 depend on #2, I'll wait for the next version of #2
incorporating Grant's comments before I apply #2-#4.

thx,

Jason.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-03-28  8:19       ` Arnd Bergmann
@ 2012-04-06 23:43         ` Grant Likely
  -1 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-04-06 23:43 UTC (permalink / raw)
  To: Arnd Bergmann, Jamie Lentin; +Cc: devicetree-discuss, Jason, linux-arm-kernel

On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 27 March 2012, Jamie Lentin wrote:
> > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > in the devicetree files, create a board-dnskw.c for everything else.
> > 
> > Use IEEE-compliant "okay", rather than "ok"
> > 
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > Acked-by: Jason Cooper <jason@lakedaemon.net>
> > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> > ---
> 
> One small note about changeset comments: The part about differences from the previous
> version of the same patch normally goes below the '---' line, in front of the diffstat,
> to prevent it from going into the git changelog. Otherwise people will have no idea
> what it's about.

Counter point on that.  I ask submitters to put the changelog before
the --- because I want it in the commit text.  It is actually helpful
when trying to determine exactly which iteration of a patch series got
committed.

But, different maintainers have different policies so there really
isn't much submitters can do here except ask the maintainer they are
submitting to which approach they prefer.

g.

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-06 23:43         ` Grant Likely
  0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-04-06 23:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 27 March 2012, Jamie Lentin wrote:
> > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > in the devicetree files, create a board-dnskw.c for everything else.
> > 
> > Use IEEE-compliant "okay", rather than "ok"
> > 
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > Acked-by: Jason Cooper <jason@lakedaemon.net>
> > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> > ---
> 
> One small note about changeset comments: The part about differences from the previous
> version of the same patch normally goes below the '---' line, in front of the diffstat,
> to prevent it from going into the git changelog. Otherwise people will have no idea
> what it's about.

Counter point on that.  I ask submitters to put the changelog before
the --- because I want it in the commit text.  It is actually helpful
when trying to determine exactly which iteration of a patch series got
committed.

But, different maintainers have different policies so there really
isn't much submitters can do here except ask the maintainer they are
submitting to which approach they prefer.

g.

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-03-27 21:54   ` Jamie Lentin
@ 2012-04-06 23:49     ` Grant Likely
  -1 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-04-06 23:49 UTC (permalink / raw)
  To: Arnd Bergmann, Jason; +Cc: devicetree-discuss, Jamie Lentin, linux-arm-kernel

On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>  arch/arm/mach-kirkwood/Makefile       |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>  arch/arm/mach-kirkwood/common.h       |    6 +
>  8 files changed, 396 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> 
> diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> new file mode 100644
> index 0000000..78c834f
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> @@ -0,0 +1,29 @@
> +/dts-v1/;
> +
> +/include/ "kirkwood.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-320 NAS (Rev A1)";
> +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +	};
> +
> +	ocp@f1000000 {
> +		serial@12000 {
> +			clock-frequency = <166666667>;
> +			status = "okay";
> +		};
> +
> +		serial@12100 {
> +			clock-frequency = <166666667>;
> +			status = "okay";
> +		};
> +	};
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> new file mode 100644
> index 0000000..23241ab
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> @@ -0,0 +1,24 @@
> +/dts-v1/;
> +
> +/include/ "kirkwood.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-325 NAS (Rev A1)";
> +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x10000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +	};
> +
> +	ocp@f1000000 {
> +		serial@12000 {
> +			clock-frequency = <200000000>;
> +			status = "okay";
> +		};
> +	};
> +};
> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> index 90ceab7..d594b6e 100644
> --- a/arch/arm/mach-kirkwood/Kconfig
> +++ b/arch/arm/mach-kirkwood/Kconfig
> @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
>  	  Say 'Y' here if you want your kernel to support the
>  	  Marvell DreamPlug (Flattened Device Tree).
>  
> +config MACH_DNSKW_DT
> +        bool
> +
> +config MACH_DNS320_DT
> +	bool "D-Link DNS-320 (Flattened Device Tree)"
> +	select ARCH_KIRKWOOD_DT
> +	select MACH_DNSKW_DT
> +	select CONFIG_MTD_OF_PARTS
> +	select CONFIG_SERIAL_OF_PLATFORM

These two lines are dangerous.  It is not safe to 'select' Kconfig
symbols that have 'depends' constraints.  Otherwise, the symbol will
get forced on without it's dependencies.

Typically other code handles this by creating blank "HAVE_*" symbols
that the needed symbol can do something like "default y if HAVE_*"

> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  D-Link DNS-320 NAS, using Flattened Device Tree.
> +
> +config MACH_DNS325_DT
> +	bool "D-Link DNS-325 (Flattened Device Tree)"
> +	select ARCH_KIRKWOOD_DT
> +	select MACH_DNSKW_DT
> +	select CONFIG_MTD_OF_PARTS
> +	select CONFIG_SERIAL_OF_PLATFORM
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  D-Link DNS-325 NAS, using Flattened Device Tree.
> +

The *only* difference between these two configs is the .dtb file that
gets built.  Don't create a separate Kconfig entry for each dnskw
board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
selected.  Building .dtb files is cheap.

>  config MACH_TS219
>  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
>  	help
> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> index e299a95..b092af5 100644
> --- a/arch/arm/mach-kirkwood/Makefile
> +++ b/arch/arm/mach-kirkwood/Makefile
> @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
>  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
>  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
>  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> index 16f9385..9c5e45f 100644
> --- a/arch/arm/mach-kirkwood/Makefile.boot
> +++ b/arch/arm/mach-kirkwood/Makefile.boot
> @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
>  initrd_phys-y	:= 0x00800000
>  
>  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> new file mode 100644
> index 0000000..7cb7f6a
> --- /dev/null
> +++ b/arch/arm/mach-kirkwood/board-dnskw.c
> @@ -0,0 +1,306 @@
> +/*
> + * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
> + *
> + * arch/arm/mach-kirkwood/board-dnskw.c
> + *
> + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> + * flattened device tree yet.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/i2c.h>
> +#include <linux/ata_platform.h>
> +#include <linux/mv643xx_eth.h>
> +#include <linux/of.h>
> +#include <linux/gpio.h>
> +#include <linux/input.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/gpio-fan.h>
> +#include <linux/leds.h>
> +#include <linux/mtd/physmap.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <mach/kirkwood.h>
> +#include <mach/bridge-regs.h>
> +#include "common.h"
> +#include "mpp.h"
> +
> +static struct mtd_partition dnskw_nand_parts[] = {
> +	{
> +		.name		= "u-boot",
> +		.offset		= 0,
> +		.size		= SZ_1M,
> +		.mask_flags	= MTD_WRITEABLE
> +	}, {
> +		.name		= "uImage",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	}, {
> +		.name		= "ramdisk",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	}, {
> +		.name		= "image",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 102 * SZ_1M
> +	}, {
> +		.name		= "mini firmware",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 10 * SZ_1M
> +	}, {
> +		.name		= "config",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	},
> +};

This patch adds a static partition mapping, and then a later patch in
this same series removes it again.  Please don't do that.  Just squash
the patches together.  Or, if sqashing is not appropriate, then just
omit the partitions.

I also suggest omiting similar data when there are patches already in
progess to do it properly.  It is okay for the inital support to go in
to be incomplete when enhancements will be ready soon.

g.

> +
> +static struct mv643xx_eth_platform_data dnskw_ge00_data = {
> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
> +};
> +
> +static struct mv_sata_platform_data dnskw_sata_data = {
> +	.n_ports	= 2,
> +};
> +
> +static unsigned int dnskw_mpp_config[] __initdata = {
> +	MPP13_UART1_TXD,	/* Custom ... */
> +	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
> +	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
> +	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
> +	MPP24_GPIO,
> +	MPP25_GPIO,
> +	MPP26_GPIO,	/* LED: Power */
> +	MPP27_GPIO,	/* LED: Red Right HDD */
> +	MPP28_GPIO,	/* LED: Red Left HDD */
> +	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
> +	MPP30_GPIO,
> +	MPP31_GPIO,
> +	MPP32_GPIO,
> +	MPP33_GPO,
> +	MPP34_GPIO,	/* Button: Front power */
> +	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
> +	MPP36_GPIO,	/* Power: Turn off board */
> +	MPP37_GPIO,	/* Power: Turn back on after power failure */
> +	MPP38_GPIO,
> +	MPP39_GPIO,	/* Power: SATA0 */
> +	MPP40_GPIO,	/* Power: SATA1 */
> +	MPP41_GPIO,
> +	MPP42_GPIO,
> +	MPP43_GPIO,	/* LED: White USB */
> +	MPP44_GPIO,	/* Fan: Tachometer Pin */
> +	MPP45_GPIO,	/* Fan: high speed */
> +	MPP46_GPIO,	/* Fan: low speed */
> +	MPP47_GPIO,	/* Button: Back unmount */
> +	MPP48_GPIO,	/* Button: Back reset */
> +	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
> +	0
> +};
> +
> +static struct gpio_led dns325_led_pins[] = {
> +	{
> +		.name	= "dns325:white:power",
> +		.gpio	= 26,
> +		.active_low = 1,
> +		.default_trigger = "default-on",
> +	},
> +	{
> +		.name	= "dns325:white:usb",
> +		.gpio	= 43,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:l_hdd",
> +		.gpio	= 28,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:r_hdd",
> +		.gpio	= 27,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:usb",
> +		.gpio	= 29,
> +		.active_low = 1,
> +	},
> +};
> +
> +static struct gpio_led_platform_data dns325_led_data = {
> +	.num_leds	= ARRAY_SIZE(dns325_led_pins),
> +	.leds		= dns325_led_pins,
> +};
> +
> +static struct platform_device dns325_led_device = {
> +	.name		= "leds-gpio",
> +	.id		= -1,
> +	.dev		= {
> +		.platform_data	= &dns325_led_data,
> +	},
> +};
> +
> +static struct gpio_led dns320_led_pins[] = {
> +	{
> +		.name	= "dns320:blue:power",
> +		.gpio	= 26,
> +		.active_low = 1,
> +		.default_trigger = "default-on",
> +	},
> +	{
> +		.name	= "dns320:blue:usb",
> +		.gpio	= 43,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:l_hdd",
> +		.gpio	= 28,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:r_hdd",
> +		.gpio	= 27,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:usb",
> +		.gpio	= 35,
> +		.active_low = 1,
> +	},
> +};
> +
> +static struct gpio_led_platform_data dns320_led_data = {
> +	.num_leds	= ARRAY_SIZE(dns320_led_pins),
> +	.leds		= dns320_led_pins,
> +};
> +
> +static struct platform_device dns320_led_device = {
> +	.name		= "leds-gpio",
> +	.id		= -1,
> +	.dev		= {
> +		.platform_data	= &dns320_led_data,
> +	},
> +};
> +
> +static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
> +	{
> +		I2C_BOARD_INFO("lm75", 0x48),
> +	},
> +	/* Something at 0x0c also */
> +};
> +
> +static struct gpio_keys_button dnskw_button_pins[] = {
> +	{
> +		.code		= KEY_POWER,
> +		.gpio		= 34,
> +		.desc		= "Power button",
> +		.active_low	= 1,
> +	},
> +	{
> +		.code		= KEY_EJECTCD,
> +		.gpio		= 47,
> +		.desc		= "USB unmount button",
> +		.active_low	= 1,
> +	},
> +	{
> +		.code		= KEY_RESTART,
> +		.gpio		= 48,
> +		.desc		= "Reset button",
> +		.active_low	= 1,
> +	},
> +};
> +
> +static struct gpio_keys_platform_data dnskw_button_data = {
> +	.buttons	= dnskw_button_pins,
> +	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
> +};
> +
> +static struct platform_device dnskw_button_device = {
> +	.name		= "gpio-keys",
> +	.id		= -1,
> +	.num_resources	= 0,
> +	.dev		= {
> +		.platform_data	= &dnskw_button_data,
> +	}
> +};
> +
> +/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
> +static struct gpio_fan_speed dnskw_fan_speed[] = {
> +	{    0,  0 },
> +	{ 3000,	 1 },
> +	{ 6000,	 2 },
> +};
> +static unsigned dnskw_fan_pins[] = {46, 45};
> +
> +static struct gpio_fan_platform_data dnskw_fan_data = {
> +	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
> +	.ctrl		= dnskw_fan_pins,
> +	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
> +	.speed		= dnskw_fan_speed,
> +};
> +
> +static struct platform_device dnskw_fan_device = {
> +	.name	= "gpio-fan",
> +	.id	= -1,
> +	.dev	= {
> +		.platform_data	= &dnskw_fan_data,
> +	},
> +};
> +
> +static void dnskw_power_off(void)
> +{
> +	gpio_set_value(36, 1);
> +}
> +
> +/* Register any GPIO for output and set the value */
> +static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
> +{
> +	if (gpio_request(gpio, name) == 0 &&
> +	    gpio_direction_output(gpio, 0) == 0) {
> +		gpio_set_value(gpio, def);
> +		if (gpio_export(gpio, 0) != 0)
> +			pr_err("dnskw: Failed to export GPIO %s\n", name);
> +	} else
> +		pr_err("dnskw: Failed to register %s\n", name);
> +}
> +
> +void __init dnskw_init(void)
> +{
> +	kirkwood_mpp_conf(dnskw_mpp_config);
> +	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
> +
> +	kirkwood_ehci_init();
> +	kirkwood_ge00_init(&dnskw_ge00_data);
> +	kirkwood_sata_init(&dnskw_sata_data);
> +	kirkwood_i2c_init();
> +
> +	platform_device_register(&dnskw_button_device);
> +	platform_device_register(&dnskw_fan_device);
> +
> +	if (of_machine_is_compatible("dlink,dns-325")) {
> +		i2c_register_board_info(0, dns325_i2c_board_info,
> +					ARRAY_SIZE(dns325_i2c_board_info));
> +		platform_device_register(&dns325_led_device);
> +
> +	} else if (of_machine_is_compatible("dlink,dns-320"))
> +		platform_device_register(&dns320_led_device);
> +
> +	/* Register power-off GPIO. */
> +	if (gpio_request(36, "dnskw:power:off") == 0
> +	    && gpio_direction_output(36, 0) == 0)
> +		pm_power_off = dnskw_power_off;
> +	else
> +		pr_err("dnskw: failed to configure power-off GPIO\n");
> +
> +	/* Ensure power is supplied to both HDDs */
> +	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
> +	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
> +
> +	/* Set NAS to turn back on after a power failure */
> +	dnskw_gpio_register(37, "dnskw:power:recover", 1);
> +}
> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
> index 1c672d9..eadc4d7 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
>  	if (of_machine_is_compatible("globalscale,dreamplug"))
>  		dreamplug_init();
>  
> +	if (of_machine_is_compatible("dlink,dns-kirkwood"))
> +		dnskw_init();
> +
>  	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
>  }
>  
>  static const char *kirkwood_dt_board_compat[] = {
>  	"globalscale,dreamplug",
> +	"dlink,dns-320",
> +	"dlink,dns-325",
>  	NULL
>  };
>  
> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
> index fa8e768..8c8c733 100644
> --- a/arch/arm/mach-kirkwood/common.h
> +++ b/arch/arm/mach-kirkwood/common.h
> @@ -58,6 +58,12 @@ void dreamplug_init(void);
>  static inline void dreamplug_init(void) {};
>  #endif
>  
> +#ifdef CONFIG_MACH_DNSKW_DT
> +void dnskw_init(void);
> +#else
> +static inline void dnskw_init(void) {};
> +#endif
> +
>  /* early init functions not converted to fdt yet */
>  char *kirkwood_id(void);
>  void kirkwood_l2_init(void);
> -- 
> 1.7.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-06 23:49     ` Grant Likely
  0 siblings, 0 replies; 50+ messages in thread
From: Grant Likely @ 2012-04-06 23:49 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> in the devicetree files, create a board-dnskw.c for everything else.
> 
> Use IEEE-compliant "okay", rather than "ok"
> 
> Acked-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>  arch/arm/mach-kirkwood/Makefile       |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>  arch/arm/mach-kirkwood/common.h       |    6 +
>  8 files changed, 396 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> 
> diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> new file mode 100644
> index 0000000..78c834f
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> @@ -0,0 +1,29 @@
> +/dts-v1/;
> +
> +/include/ "kirkwood.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-320 NAS (Rev A1)";
> +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x8000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +	};
> +
> +	ocp at f1000000 {
> +		serial at 12000 {
> +			clock-frequency = <166666667>;
> +			status = "okay";
> +		};
> +
> +		serial at 12100 {
> +			clock-frequency = <166666667>;
> +			status = "okay";
> +		};
> +	};
> +};
> diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> new file mode 100644
> index 0000000..23241ab
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> @@ -0,0 +1,24 @@
> +/dts-v1/;
> +
> +/include/ "kirkwood.dtsi"
> +
> +/ {
> +	model = "D-Link DNS-325 NAS (Rev A1)";
> +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x10000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +	};
> +
> +	ocp at f1000000 {
> +		serial at 12000 {
> +			clock-frequency = <200000000>;
> +			status = "okay";
> +		};
> +	};
> +};
> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> index 90ceab7..d594b6e 100644
> --- a/arch/arm/mach-kirkwood/Kconfig
> +++ b/arch/arm/mach-kirkwood/Kconfig
> @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
>  	  Say 'Y' here if you want your kernel to support the
>  	  Marvell DreamPlug (Flattened Device Tree).
>  
> +config MACH_DNSKW_DT
> +        bool
> +
> +config MACH_DNS320_DT
> +	bool "D-Link DNS-320 (Flattened Device Tree)"
> +	select ARCH_KIRKWOOD_DT
> +	select MACH_DNSKW_DT
> +	select CONFIG_MTD_OF_PARTS
> +	select CONFIG_SERIAL_OF_PLATFORM

These two lines are dangerous.  It is not safe to 'select' Kconfig
symbols that have 'depends' constraints.  Otherwise, the symbol will
get forced on without it's dependencies.

Typically other code handles this by creating blank "HAVE_*" symbols
that the needed symbol can do something like "default y if HAVE_*"

> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  D-Link DNS-320 NAS, using Flattened Device Tree.
> +
> +config MACH_DNS325_DT
> +	bool "D-Link DNS-325 (Flattened Device Tree)"
> +	select ARCH_KIRKWOOD_DT
> +	select MACH_DNSKW_DT
> +	select CONFIG_MTD_OF_PARTS
> +	select CONFIG_SERIAL_OF_PLATFORM
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  D-Link DNS-325 NAS, using Flattened Device Tree.
> +

The *only* difference between these two configs is the .dtb file that
gets built.  Don't create a separate Kconfig entry for each dnskw
board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
selected.  Building .dtb files is cheap.

>  config MACH_TS219
>  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
>  	help
> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> index e299a95..b092af5 100644
> --- a/arch/arm/mach-kirkwood/Makefile
> +++ b/arch/arm/mach-kirkwood/Makefile
> @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
>  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
>  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
>  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> index 16f9385..9c5e45f 100644
> --- a/arch/arm/mach-kirkwood/Makefile.boot
> +++ b/arch/arm/mach-kirkwood/Makefile.boot
> @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
>  initrd_phys-y	:= 0x00800000
>  
>  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> new file mode 100644
> index 0000000..7cb7f6a
> --- /dev/null
> +++ b/arch/arm/mach-kirkwood/board-dnskw.c
> @@ -0,0 +1,306 @@
> +/*
> + * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
> + *
> + * arch/arm/mach-kirkwood/board-dnskw.c
> + *
> + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> + * flattened device tree yet.
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/platform_device.h>
> +#include <linux/i2c.h>
> +#include <linux/ata_platform.h>
> +#include <linux/mv643xx_eth.h>
> +#include <linux/of.h>
> +#include <linux/gpio.h>
> +#include <linux/input.h>
> +#include <linux/gpio_keys.h>
> +#include <linux/gpio-fan.h>
> +#include <linux/leds.h>
> +#include <linux/mtd/physmap.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <mach/kirkwood.h>
> +#include <mach/bridge-regs.h>
> +#include "common.h"
> +#include "mpp.h"
> +
> +static struct mtd_partition dnskw_nand_parts[] = {
> +	{
> +		.name		= "u-boot",
> +		.offset		= 0,
> +		.size		= SZ_1M,
> +		.mask_flags	= MTD_WRITEABLE
> +	}, {
> +		.name		= "uImage",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	}, {
> +		.name		= "ramdisk",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	}, {
> +		.name		= "image",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 102 * SZ_1M
> +	}, {
> +		.name		= "mini firmware",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 10 * SZ_1M
> +	}, {
> +		.name		= "config",
> +		.offset		= MTDPART_OFS_NXTBLK,
> +		.size		= 5 * SZ_1M
> +	},
> +};

This patch adds a static partition mapping, and then a later patch in
this same series removes it again.  Please don't do that.  Just squash
the patches together.  Or, if sqashing is not appropriate, then just
omit the partitions.

I also suggest omiting similar data when there are patches already in
progess to do it properly.  It is okay for the inital support to go in
to be incomplete when enhancements will be ready soon.

g.

> +
> +static struct mv643xx_eth_platform_data dnskw_ge00_data = {
> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
> +};
> +
> +static struct mv_sata_platform_data dnskw_sata_data = {
> +	.n_ports	= 2,
> +};
> +
> +static unsigned int dnskw_mpp_config[] __initdata = {
> +	MPP13_UART1_TXD,	/* Custom ... */
> +	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
> +	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
> +	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
> +	MPP24_GPIO,
> +	MPP25_GPIO,
> +	MPP26_GPIO,	/* LED: Power */
> +	MPP27_GPIO,	/* LED: Red Right HDD */
> +	MPP28_GPIO,	/* LED: Red Left HDD */
> +	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
> +	MPP30_GPIO,
> +	MPP31_GPIO,
> +	MPP32_GPIO,
> +	MPP33_GPO,
> +	MPP34_GPIO,	/* Button: Front power */
> +	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
> +	MPP36_GPIO,	/* Power: Turn off board */
> +	MPP37_GPIO,	/* Power: Turn back on after power failure */
> +	MPP38_GPIO,
> +	MPP39_GPIO,	/* Power: SATA0 */
> +	MPP40_GPIO,	/* Power: SATA1 */
> +	MPP41_GPIO,
> +	MPP42_GPIO,
> +	MPP43_GPIO,	/* LED: White USB */
> +	MPP44_GPIO,	/* Fan: Tachometer Pin */
> +	MPP45_GPIO,	/* Fan: high speed */
> +	MPP46_GPIO,	/* Fan: low speed */
> +	MPP47_GPIO,	/* Button: Back unmount */
> +	MPP48_GPIO,	/* Button: Back reset */
> +	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
> +	0
> +};
> +
> +static struct gpio_led dns325_led_pins[] = {
> +	{
> +		.name	= "dns325:white:power",
> +		.gpio	= 26,
> +		.active_low = 1,
> +		.default_trigger = "default-on",
> +	},
> +	{
> +		.name	= "dns325:white:usb",
> +		.gpio	= 43,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:l_hdd",
> +		.gpio	= 28,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:r_hdd",
> +		.gpio	= 27,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns325:red:usb",
> +		.gpio	= 29,
> +		.active_low = 1,
> +	},
> +};
> +
> +static struct gpio_led_platform_data dns325_led_data = {
> +	.num_leds	= ARRAY_SIZE(dns325_led_pins),
> +	.leds		= dns325_led_pins,
> +};
> +
> +static struct platform_device dns325_led_device = {
> +	.name		= "leds-gpio",
> +	.id		= -1,
> +	.dev		= {
> +		.platform_data	= &dns325_led_data,
> +	},
> +};
> +
> +static struct gpio_led dns320_led_pins[] = {
> +	{
> +		.name	= "dns320:blue:power",
> +		.gpio	= 26,
> +		.active_low = 1,
> +		.default_trigger = "default-on",
> +	},
> +	{
> +		.name	= "dns320:blue:usb",
> +		.gpio	= 43,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:l_hdd",
> +		.gpio	= 28,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:r_hdd",
> +		.gpio	= 27,
> +		.active_low = 1,
> +	},
> +	{
> +		.name	= "dns320:orange:usb",
> +		.gpio	= 35,
> +		.active_low = 1,
> +	},
> +};
> +
> +static struct gpio_led_platform_data dns320_led_data = {
> +	.num_leds	= ARRAY_SIZE(dns320_led_pins),
> +	.leds		= dns320_led_pins,
> +};
> +
> +static struct platform_device dns320_led_device = {
> +	.name		= "leds-gpio",
> +	.id		= -1,
> +	.dev		= {
> +		.platform_data	= &dns320_led_data,
> +	},
> +};
> +
> +static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
> +	{
> +		I2C_BOARD_INFO("lm75", 0x48),
> +	},
> +	/* Something at 0x0c also */
> +};
> +
> +static struct gpio_keys_button dnskw_button_pins[] = {
> +	{
> +		.code		= KEY_POWER,
> +		.gpio		= 34,
> +		.desc		= "Power button",
> +		.active_low	= 1,
> +	},
> +	{
> +		.code		= KEY_EJECTCD,
> +		.gpio		= 47,
> +		.desc		= "USB unmount button",
> +		.active_low	= 1,
> +	},
> +	{
> +		.code		= KEY_RESTART,
> +		.gpio		= 48,
> +		.desc		= "Reset button",
> +		.active_low	= 1,
> +	},
> +};
> +
> +static struct gpio_keys_platform_data dnskw_button_data = {
> +	.buttons	= dnskw_button_pins,
> +	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
> +};
> +
> +static struct platform_device dnskw_button_device = {
> +	.name		= "gpio-keys",
> +	.id		= -1,
> +	.num_resources	= 0,
> +	.dev		= {
> +		.platform_data	= &dnskw_button_data,
> +	}
> +};
> +
> +/* Fan: ADDA AD045HB-G73 40mm 6000rpm at 5v */
> +static struct gpio_fan_speed dnskw_fan_speed[] = {
> +	{    0,  0 },
> +	{ 3000,	 1 },
> +	{ 6000,	 2 },
> +};
> +static unsigned dnskw_fan_pins[] = {46, 45};
> +
> +static struct gpio_fan_platform_data dnskw_fan_data = {
> +	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
> +	.ctrl		= dnskw_fan_pins,
> +	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
> +	.speed		= dnskw_fan_speed,
> +};
> +
> +static struct platform_device dnskw_fan_device = {
> +	.name	= "gpio-fan",
> +	.id	= -1,
> +	.dev	= {
> +		.platform_data	= &dnskw_fan_data,
> +	},
> +};
> +
> +static void dnskw_power_off(void)
> +{
> +	gpio_set_value(36, 1);
> +}
> +
> +/* Register any GPIO for output and set the value */
> +static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
> +{
> +	if (gpio_request(gpio, name) == 0 &&
> +	    gpio_direction_output(gpio, 0) == 0) {
> +		gpio_set_value(gpio, def);
> +		if (gpio_export(gpio, 0) != 0)
> +			pr_err("dnskw: Failed to export GPIO %s\n", name);
> +	} else
> +		pr_err("dnskw: Failed to register %s\n", name);
> +}
> +
> +void __init dnskw_init(void)
> +{
> +	kirkwood_mpp_conf(dnskw_mpp_config);
> +	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
> +
> +	kirkwood_ehci_init();
> +	kirkwood_ge00_init(&dnskw_ge00_data);
> +	kirkwood_sata_init(&dnskw_sata_data);
> +	kirkwood_i2c_init();
> +
> +	platform_device_register(&dnskw_button_device);
> +	platform_device_register(&dnskw_fan_device);
> +
> +	if (of_machine_is_compatible("dlink,dns-325")) {
> +		i2c_register_board_info(0, dns325_i2c_board_info,
> +					ARRAY_SIZE(dns325_i2c_board_info));
> +		platform_device_register(&dns325_led_device);
> +
> +	} else if (of_machine_is_compatible("dlink,dns-320"))
> +		platform_device_register(&dns320_led_device);
> +
> +	/* Register power-off GPIO. */
> +	if (gpio_request(36, "dnskw:power:off") == 0
> +	    && gpio_direction_output(36, 0) == 0)
> +		pm_power_off = dnskw_power_off;
> +	else
> +		pr_err("dnskw: failed to configure power-off GPIO\n");
> +
> +	/* Ensure power is supplied to both HDDs */
> +	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
> +	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
> +
> +	/* Set NAS to turn back on after a power failure */
> +	dnskw_gpio_register(37, "dnskw:power:recover", 1);
> +}
> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
> index 1c672d9..eadc4d7 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
>  	if (of_machine_is_compatible("globalscale,dreamplug"))
>  		dreamplug_init();
>  
> +	if (of_machine_is_compatible("dlink,dns-kirkwood"))
> +		dnskw_init();
> +
>  	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
>  }
>  
>  static const char *kirkwood_dt_board_compat[] = {
>  	"globalscale,dreamplug",
> +	"dlink,dns-320",
> +	"dlink,dns-325",
>  	NULL
>  };
>  
> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
> index fa8e768..8c8c733 100644
> --- a/arch/arm/mach-kirkwood/common.h
> +++ b/arch/arm/mach-kirkwood/common.h
> @@ -58,6 +58,12 @@ void dreamplug_init(void);
>  static inline void dreamplug_init(void) {};
>  #endif
>  
> +#ifdef CONFIG_MACH_DNSKW_DT
> +void dnskw_init(void);
> +#else
> +static inline void dnskw_init(void) {};
> +#endif
> +
>  /* early init functions not converted to fdt yet */
>  char *kirkwood_id(void);
>  void kirkwood_l2_init(void);
> -- 
> 1.7.9.1
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-06 23:49     ` Grant Likely
@ 2012-04-09 13:20       ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-09 13:20 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason

On Fri, 6 Apr 2012, Grant Likely wrote:

> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org> wrote:
>> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
>> in the devicetree files, create a board-dnskw.c for everything else.
>>
>> Use IEEE-compliant "okay", rather than "ok"
>>
>> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
>> Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
>> Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
>> ---
>>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>>  arch/arm/mach-kirkwood/Makefile       |    1 +
>>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>>  arch/arm/mach-kirkwood/common.h       |    6 +
>>  8 files changed, 396 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
>>
>> diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
>> new file mode 100644
>> index 0000000..78c834f
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
>> @@ -0,0 +1,29 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +	model = "D-Link DNS-320 NAS (Rev A1)";
>> +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
>> +
>> +	memory {
>> +		device_type = "memory";
>> +		reg = <0x00000000 0x8000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +	};
>> +
>> +	ocp@f1000000 {
>> +		serial@12000 {
>> +			clock-frequency = <166666667>;
>> +			status = "okay";
>> +		};
>> +
>> +		serial@12100 {
>> +			clock-frequency = <166666667>;
>> +			status = "okay";
>> +		};
>> +	};
>> +};
>> diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
>> new file mode 100644
>> index 0000000..23241ab
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
>> @@ -0,0 +1,24 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +	model = "D-Link DNS-325 NAS (Rev A1)";
>> +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
>> +
>> +	memory {
>> +		device_type = "memory";
>> +		reg = <0x00000000 0x10000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +	};
>> +
>> +	ocp@f1000000 {
>> +		serial@12000 {
>> +			clock-frequency = <200000000>;
>> +			status = "okay";
>> +		};
>> +	};
>> +};
>> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
>> index 90ceab7..d594b6e 100644
>> --- a/arch/arm/mach-kirkwood/Kconfig
>> +++ b/arch/arm/mach-kirkwood/Kconfig
>> @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
>>  	  Say 'Y' here if you want your kernel to support the
>>  	  Marvell DreamPlug (Flattened Device Tree).
>>
>> +config MACH_DNSKW_DT
>> +        bool
>> +
>> +config MACH_DNS320_DT
>> +	bool "D-Link DNS-320 (Flattened Device Tree)"
>> +	select ARCH_KIRKWOOD_DT
>> +	select MACH_DNSKW_DT
>> +	select CONFIG_MTD_OF_PARTS
>> +	select CONFIG_SERIAL_OF_PLATFORM
>
> These two lines are dangerous.  It is not safe to 'select' Kconfig
> symbols that have 'depends' constraints.  Otherwise, the symbol will
> get forced on without it's dependencies.
>
> Typically other code handles this by creating blank "HAVE_*" symbols
> that the needed symbol can do something like "default y if HAVE_*"
>

Okay I didn't realise this, thanks. The options in question aren't
hard dependencies per-se, but no serial or NAND support is probably a
mistake, so added them here to avoid a certain amount of shooting in foot.

What's the etiquette in this situation? Adding HAVE_* seems excessive,
would selecting them in kirkwood_defconfig make more sense? Or would it
simply be covered by having a reasonable config on my website or suchlike?

Jason, given you've already applied this patch, would you rather me
submit something else to ditch these, or resumbit the entire series,
combining feedback?

>> +	help
>> +	  Say 'Y' here if you want your kernel to support the
>> +	  D-Link DNS-320 NAS, using Flattened Device Tree.
>> +
>> +config MACH_DNS325_DT
>> +	bool "D-Link DNS-325 (Flattened Device Tree)"
>> +	select ARCH_KIRKWOOD_DT
>> +	select MACH_DNSKW_DT
>> +	select CONFIG_MTD_OF_PARTS
>> +	select CONFIG_SERIAL_OF_PLATFORM
>> +	help
>> +	  Say 'Y' here if you want your kernel to support the
>> +	  D-Link DNS-325 NAS, using Flattened Device Tree.
>> +
>
> The *only* difference between these two configs is the .dtb file that
> gets built.  Don't create a separate Kconfig entry for each dnskw
> board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> selected.  Building .dtb files is cheap.
>

The rationale for this is the code in dnskw.c is (hopefully!) temporary,
and when it goes there isn't any need for MACH_DNSKW_DT either.

In a future land where everything has been converted to devicetree, what
would be best? An option to "Build all kirkwood-based .dtb's", an option
to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
board? I've not got any strong opinion, so will reformat the above to
whatever is considered best.

>>  config MACH_TS219
>>  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
>>  	help
>> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
>> index e299a95..b092af5 100644
>> --- a/arch/arm/mach-kirkwood/Makefile
>> +++ b/arch/arm/mach-kirkwood/Makefile
>> @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
>>  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
>>  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
>>  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
>> +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
>> diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
>> index 16f9385..9c5e45f 100644
>> --- a/arch/arm/mach-kirkwood/Makefile.boot
>> +++ b/arch/arm/mach-kirkwood/Makefile.boot
>> @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
>>  initrd_phys-y	:= 0x00800000
>>
>>  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
>> +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
>> +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
>> diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
>> new file mode 100644
>> index 0000000..7cb7f6a
>> --- /dev/null
>> +++ b/arch/arm/mach-kirkwood/board-dnskw.c
>> @@ -0,0 +1,306 @@
>> +/*
>> + * Copyright 2012 (C), Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
>> + *
>> + * arch/arm/mach-kirkwood/board-dnskw.c
>> + *
>> + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
>> + * flattened device tree yet.
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2.  This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/i2c.h>
>> +#include <linux/ata_platform.h>
>> +#include <linux/mv643xx_eth.h>
>> +#include <linux/of.h>
>> +#include <linux/gpio.h>
>> +#include <linux/input.h>
>> +#include <linux/gpio_keys.h>
>> +#include <linux/gpio-fan.h>
>> +#include <linux/leds.h>
>> +#include <linux/mtd/physmap.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +#include <asm/mach/map.h>
>> +#include <mach/kirkwood.h>
>> +#include <mach/bridge-regs.h>
>> +#include "common.h"
>> +#include "mpp.h"
>> +
>> +static struct mtd_partition dnskw_nand_parts[] = {
>> +	{
>> +		.name		= "u-boot",
>> +		.offset		= 0,
>> +		.size		= SZ_1M,
>> +		.mask_flags	= MTD_WRITEABLE
>> +	}, {
>> +		.name		= "uImage",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	}, {
>> +		.name		= "ramdisk",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	}, {
>> +		.name		= "image",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 102 * SZ_1M
>> +	}, {
>> +		.name		= "mini firmware",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 10 * SZ_1M
>> +	}, {
>> +		.name		= "config",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	},
>> +};
>
> This patch adds a static partition mapping, and then a later patch in
> this same series removes it again.  Please don't do that.  Just squash
> the patches together.  Or, if sqashing is not appropriate, then just
> omit the partitions.
>
> I also suggest omiting similar data when there are patches already in
> progess to do it properly.  It is okay for the inital support to go in
> to be incomplete when enhancements will be ready soon.
>

Noted. If the entire patchset needs resubmitting, I'll combine the patch
that moves this definition to the .dtb

> g.
>
>> +
>> +static struct mv643xx_eth_platform_data dnskw_ge00_data = {
>> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
>> +};
>> +
>> +static struct mv_sata_platform_data dnskw_sata_data = {
>> +	.n_ports	= 2,
>> +};
>> +
>> +static unsigned int dnskw_mpp_config[] __initdata = {
>> +	MPP13_UART1_TXD,	/* Custom ... */
>> +	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
>> +	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
>> +	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
>> +	MPP24_GPIO,
>> +	MPP25_GPIO,
>> +	MPP26_GPIO,	/* LED: Power */
>> +	MPP27_GPIO,	/* LED: Red Right HDD */
>> +	MPP28_GPIO,	/* LED: Red Left HDD */
>> +	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
>> +	MPP30_GPIO,
>> +	MPP31_GPIO,
>> +	MPP32_GPIO,
>> +	MPP33_GPO,
>> +	MPP34_GPIO,	/* Button: Front power */
>> +	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
>> +	MPP36_GPIO,	/* Power: Turn off board */
>> +	MPP37_GPIO,	/* Power: Turn back on after power failure */
>> +	MPP38_GPIO,
>> +	MPP39_GPIO,	/* Power: SATA0 */
>> +	MPP40_GPIO,	/* Power: SATA1 */
>> +	MPP41_GPIO,
>> +	MPP42_GPIO,
>> +	MPP43_GPIO,	/* LED: White USB */
>> +	MPP44_GPIO,	/* Fan: Tachometer Pin */
>> +	MPP45_GPIO,	/* Fan: high speed */
>> +	MPP46_GPIO,	/* Fan: low speed */
>> +	MPP47_GPIO,	/* Button: Back unmount */
>> +	MPP48_GPIO,	/* Button: Back reset */
>> +	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
>> +	0
>> +};
>> +
>> +static struct gpio_led dns325_led_pins[] = {
>> +	{
>> +		.name	= "dns325:white:power",
>> +		.gpio	= 26,
>> +		.active_low = 1,
>> +		.default_trigger = "default-on",
>> +	},
>> +	{
>> +		.name	= "dns325:white:usb",
>> +		.gpio	= 43,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:l_hdd",
>> +		.gpio	= 28,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:r_hdd",
>> +		.gpio	= 27,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:usb",
>> +		.gpio	= 29,
>> +		.active_low = 1,
>> +	},
>> +};
>> +
>> +static struct gpio_led_platform_data dns325_led_data = {
>> +	.num_leds	= ARRAY_SIZE(dns325_led_pins),
>> +	.leds		= dns325_led_pins,
>> +};
>> +
>> +static struct platform_device dns325_led_device = {
>> +	.name		= "leds-gpio",
>> +	.id		= -1,
>> +	.dev		= {
>> +		.platform_data	= &dns325_led_data,
>> +	},
>> +};
>> +
>> +static struct gpio_led dns320_led_pins[] = {
>> +	{
>> +		.name	= "dns320:blue:power",
>> +		.gpio	= 26,
>> +		.active_low = 1,
>> +		.default_trigger = "default-on",
>> +	},
>> +	{
>> +		.name	= "dns320:blue:usb",
>> +		.gpio	= 43,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:l_hdd",
>> +		.gpio	= 28,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:r_hdd",
>> +		.gpio	= 27,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:usb",
>> +		.gpio	= 35,
>> +		.active_low = 1,
>> +	},
>> +};
>> +
>> +static struct gpio_led_platform_data dns320_led_data = {
>> +	.num_leds	= ARRAY_SIZE(dns320_led_pins),
>> +	.leds		= dns320_led_pins,
>> +};
>> +
>> +static struct platform_device dns320_led_device = {
>> +	.name		= "leds-gpio",
>> +	.id		= -1,
>> +	.dev		= {
>> +		.platform_data	= &dns320_led_data,
>> +	},
>> +};
>> +
>> +static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
>> +	{
>> +		I2C_BOARD_INFO("lm75", 0x48),
>> +	},
>> +	/* Something at 0x0c also */
>> +};
>> +
>> +static struct gpio_keys_button dnskw_button_pins[] = {
>> +	{
>> +		.code		= KEY_POWER,
>> +		.gpio		= 34,
>> +		.desc		= "Power button",
>> +		.active_low	= 1,
>> +	},
>> +	{
>> +		.code		= KEY_EJECTCD,
>> +		.gpio		= 47,
>> +		.desc		= "USB unmount button",
>> +		.active_low	= 1,
>> +	},
>> +	{
>> +		.code		= KEY_RESTART,
>> +		.gpio		= 48,
>> +		.desc		= "Reset button",
>> +		.active_low	= 1,
>> +	},
>> +};
>> +
>> +static struct gpio_keys_platform_data dnskw_button_data = {
>> +	.buttons	= dnskw_button_pins,
>> +	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
>> +};
>> +
>> +static struct platform_device dnskw_button_device = {
>> +	.name		= "gpio-keys",
>> +	.id		= -1,
>> +	.num_resources	= 0,
>> +	.dev		= {
>> +		.platform_data	= &dnskw_button_data,
>> +	}
>> +};
>> +
>> +/* Fan: ADDA AD045HB-G73 40mm 6000rpm@5v */
>> +static struct gpio_fan_speed dnskw_fan_speed[] = {
>> +	{    0,  0 },
>> +	{ 3000,	 1 },
>> +	{ 6000,	 2 },
>> +};
>> +static unsigned dnskw_fan_pins[] = {46, 45};
>> +
>> +static struct gpio_fan_platform_data dnskw_fan_data = {
>> +	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
>> +	.ctrl		= dnskw_fan_pins,
>> +	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
>> +	.speed		= dnskw_fan_speed,
>> +};
>> +
>> +static struct platform_device dnskw_fan_device = {
>> +	.name	= "gpio-fan",
>> +	.id	= -1,
>> +	.dev	= {
>> +		.platform_data	= &dnskw_fan_data,
>> +	},
>> +};
>> +
>> +static void dnskw_power_off(void)
>> +{
>> +	gpio_set_value(36, 1);
>> +}
>> +
>> +/* Register any GPIO for output and set the value */
>> +static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
>> +{
>> +	if (gpio_request(gpio, name) == 0 &&
>> +	    gpio_direction_output(gpio, 0) == 0) {
>> +		gpio_set_value(gpio, def);
>> +		if (gpio_export(gpio, 0) != 0)
>> +			pr_err("dnskw: Failed to export GPIO %s\n", name);
>> +	} else
>> +		pr_err("dnskw: Failed to register %s\n", name);
>> +}
>> +
>> +void __init dnskw_init(void)
>> +{
>> +	kirkwood_mpp_conf(dnskw_mpp_config);
>> +	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
>> +
>> +	kirkwood_ehci_init();
>> +	kirkwood_ge00_init(&dnskw_ge00_data);
>> +	kirkwood_sata_init(&dnskw_sata_data);
>> +	kirkwood_i2c_init();
>> +
>> +	platform_device_register(&dnskw_button_device);
>> +	platform_device_register(&dnskw_fan_device);
>> +
>> +	if (of_machine_is_compatible("dlink,dns-325")) {
>> +		i2c_register_board_info(0, dns325_i2c_board_info,
>> +					ARRAY_SIZE(dns325_i2c_board_info));
>> +		platform_device_register(&dns325_led_device);
>> +
>> +	} else if (of_machine_is_compatible("dlink,dns-320"))
>> +		platform_device_register(&dns320_led_device);
>> +
>> +	/* Register power-off GPIO. */
>> +	if (gpio_request(36, "dnskw:power:off") == 0
>> +	    && gpio_direction_output(36, 0) == 0)
>> +		pm_power_off = dnskw_power_off;
>> +	else
>> +		pr_err("dnskw: failed to configure power-off GPIO\n");
>> +
>> +	/* Ensure power is supplied to both HDDs */
>> +	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
>> +	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
>> +
>> +	/* Set NAS to turn back on after a power failure */
>> +	dnskw_gpio_register(37, "dnskw:power:recover", 1);
>> +}
>> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
>> index 1c672d9..eadc4d7 100644
>> --- a/arch/arm/mach-kirkwood/board-dt.c
>> +++ b/arch/arm/mach-kirkwood/board-dt.c
>> @@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
>>  	if (of_machine_is_compatible("globalscale,dreamplug"))
>>  		dreamplug_init();
>>
>> +	if (of_machine_is_compatible("dlink,dns-kirkwood"))
>> +		dnskw_init();
>> +
>>  	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
>>  }
>>
>>  static const char *kirkwood_dt_board_compat[] = {
>>  	"globalscale,dreamplug",
>> +	"dlink,dns-320",
>> +	"dlink,dns-325",
>>  	NULL
>>  };
>>
>> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
>> index fa8e768..8c8c733 100644
>> --- a/arch/arm/mach-kirkwood/common.h
>> +++ b/arch/arm/mach-kirkwood/common.h
>> @@ -58,6 +58,12 @@ void dreamplug_init(void);
>>  static inline void dreamplug_init(void) {};
>>  #endif
>>
>> +#ifdef CONFIG_MACH_DNSKW_DT
>> +void dnskw_init(void);
>> +#else
>> +static inline void dnskw_init(void) {};
>> +#endif
>> +
>>  /* early init functions not converted to fdt yet */
>>  char *kirkwood_id(void);
>>  void kirkwood_l2_init(void);
>> --
>> 1.7.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>

-- 
Jamie Lentin

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 13:20       ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-09 13:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 6 Apr 2012, Grant Likely wrote:

> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
>> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
>> in the devicetree files, create a board-dnskw.c for everything else.
>>
>> Use IEEE-compliant "okay", rather than "ok"
>>
>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>> Acked-by: Jason Cooper <jason@lakedaemon.net>
>> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
>> ---
>>  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
>>  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
>>  arch/arm/mach-kirkwood/Kconfig        |   23 +++
>>  arch/arm/mach-kirkwood/Makefile       |    1 +
>>  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
>>  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
>>  arch/arm/mach-kirkwood/board-dt.c     |    5 +
>>  arch/arm/mach-kirkwood/common.h       |    6 +
>>  8 files changed, 396 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
>>  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
>>  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
>>
>> diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
>> new file mode 100644
>> index 0000000..78c834f
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
>> @@ -0,0 +1,29 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +	model = "D-Link DNS-320 NAS (Rev A1)";
>> +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
>> +
>> +	memory {
>> +		device_type = "memory";
>> +		reg = <0x00000000 0x8000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +	};
>> +
>> +	ocp at f1000000 {
>> +		serial at 12000 {
>> +			clock-frequency = <166666667>;
>> +			status = "okay";
>> +		};
>> +
>> +		serial at 12100 {
>> +			clock-frequency = <166666667>;
>> +			status = "okay";
>> +		};
>> +	};
>> +};
>> diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
>> new file mode 100644
>> index 0000000..23241ab
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
>> @@ -0,0 +1,24 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +	model = "D-Link DNS-325 NAS (Rev A1)";
>> +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
>> +
>> +	memory {
>> +		device_type = "memory";
>> +		reg = <0x00000000 0x10000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +	};
>> +
>> +	ocp at f1000000 {
>> +		serial at 12000 {
>> +			clock-frequency = <200000000>;
>> +			status = "okay";
>> +		};
>> +	};
>> +};
>> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
>> index 90ceab7..d594b6e 100644
>> --- a/arch/arm/mach-kirkwood/Kconfig
>> +++ b/arch/arm/mach-kirkwood/Kconfig
>> @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
>>  	  Say 'Y' here if you want your kernel to support the
>>  	  Marvell DreamPlug (Flattened Device Tree).
>>
>> +config MACH_DNSKW_DT
>> +        bool
>> +
>> +config MACH_DNS320_DT
>> +	bool "D-Link DNS-320 (Flattened Device Tree)"
>> +	select ARCH_KIRKWOOD_DT
>> +	select MACH_DNSKW_DT
>> +	select CONFIG_MTD_OF_PARTS
>> +	select CONFIG_SERIAL_OF_PLATFORM
>
> These two lines are dangerous.  It is not safe to 'select' Kconfig
> symbols that have 'depends' constraints.  Otherwise, the symbol will
> get forced on without it's dependencies.
>
> Typically other code handles this by creating blank "HAVE_*" symbols
> that the needed symbol can do something like "default y if HAVE_*"
>

Okay I didn't realise this, thanks. The options in question aren't
hard dependencies per-se, but no serial or NAND support is probably a
mistake, so added them here to avoid a certain amount of shooting in foot.

What's the etiquette in this situation? Adding HAVE_* seems excessive,
would selecting them in kirkwood_defconfig make more sense? Or would it
simply be covered by having a reasonable config on my website or suchlike?

Jason, given you've already applied this patch, would you rather me
submit something else to ditch these, or resumbit the entire series,
combining feedback?

>> +	help
>> +	  Say 'Y' here if you want your kernel to support the
>> +	  D-Link DNS-320 NAS, using Flattened Device Tree.
>> +
>> +config MACH_DNS325_DT
>> +	bool "D-Link DNS-325 (Flattened Device Tree)"
>> +	select ARCH_KIRKWOOD_DT
>> +	select MACH_DNSKW_DT
>> +	select CONFIG_MTD_OF_PARTS
>> +	select CONFIG_SERIAL_OF_PLATFORM
>> +	help
>> +	  Say 'Y' here if you want your kernel to support the
>> +	  D-Link DNS-325 NAS, using Flattened Device Tree.
>> +
>
> The *only* difference between these two configs is the .dtb file that
> gets built.  Don't create a separate Kconfig entry for each dnskw
> board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> selected.  Building .dtb files is cheap.
>

The rationale for this is the code in dnskw.c is (hopefully!) temporary,
and when it goes there isn't any need for MACH_DNSKW_DT either.

In a future land where everything has been converted to devicetree, what
would be best? An option to "Build all kirkwood-based .dtb's", an option
to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
board? I've not got any strong opinion, so will reformat the above to
whatever is considered best.

>>  config MACH_TS219
>>  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
>>  	help
>> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
>> index e299a95..b092af5 100644
>> --- a/arch/arm/mach-kirkwood/Makefile
>> +++ b/arch/arm/mach-kirkwood/Makefile
>> @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
>>  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
>>  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
>>  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
>> +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
>> diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
>> index 16f9385..9c5e45f 100644
>> --- a/arch/arm/mach-kirkwood/Makefile.boot
>> +++ b/arch/arm/mach-kirkwood/Makefile.boot
>> @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
>>  initrd_phys-y	:= 0x00800000
>>
>>  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
>> +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
>> +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
>> diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
>> new file mode 100644
>> index 0000000..7cb7f6a
>> --- /dev/null
>> +++ b/arch/arm/mach-kirkwood/board-dnskw.c
>> @@ -0,0 +1,306 @@
>> +/*
>> + * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
>> + *
>> + * arch/arm/mach-kirkwood/board-dnskw.c
>> + *
>> + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
>> + * flattened device tree yet.
>> + *
>> + * This file is licensed under the terms of the GNU General Public
>> + * License version 2.  This program is licensed "as is" without any
>> + * warranty of any kind, whether express or implied.
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/i2c.h>
>> +#include <linux/ata_platform.h>
>> +#include <linux/mv643xx_eth.h>
>> +#include <linux/of.h>
>> +#include <linux/gpio.h>
>> +#include <linux/input.h>
>> +#include <linux/gpio_keys.h>
>> +#include <linux/gpio-fan.h>
>> +#include <linux/leds.h>
>> +#include <linux/mtd/physmap.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +#include <asm/mach/map.h>
>> +#include <mach/kirkwood.h>
>> +#include <mach/bridge-regs.h>
>> +#include "common.h"
>> +#include "mpp.h"
>> +
>> +static struct mtd_partition dnskw_nand_parts[] = {
>> +	{
>> +		.name		= "u-boot",
>> +		.offset		= 0,
>> +		.size		= SZ_1M,
>> +		.mask_flags	= MTD_WRITEABLE
>> +	}, {
>> +		.name		= "uImage",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	}, {
>> +		.name		= "ramdisk",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	}, {
>> +		.name		= "image",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 102 * SZ_1M
>> +	}, {
>> +		.name		= "mini firmware",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 10 * SZ_1M
>> +	}, {
>> +		.name		= "config",
>> +		.offset		= MTDPART_OFS_NXTBLK,
>> +		.size		= 5 * SZ_1M
>> +	},
>> +};
>
> This patch adds a static partition mapping, and then a later patch in
> this same series removes it again.  Please don't do that.  Just squash
> the patches together.  Or, if sqashing is not appropriate, then just
> omit the partitions.
>
> I also suggest omiting similar data when there are patches already in
> progess to do it properly.  It is okay for the inital support to go in
> to be incomplete when enhancements will be ready soon.
>

Noted. If the entire patchset needs resubmitting, I'll combine the patch
that moves this definition to the .dtb

> g.
>
>> +
>> +static struct mv643xx_eth_platform_data dnskw_ge00_data = {
>> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
>> +};
>> +
>> +static struct mv_sata_platform_data dnskw_sata_data = {
>> +	.n_ports	= 2,
>> +};
>> +
>> +static unsigned int dnskw_mpp_config[] __initdata = {
>> +	MPP13_UART1_TXD,	/* Custom ... */
>> +	MPP14_UART1_RXD,	/* ... Controller (DNS-320 only) */
>> +	MPP20_SATA1_ACTn,	/* LED: White Right HDD */
>> +	MPP21_SATA0_ACTn,	/* LED: White Left HDD */
>> +	MPP24_GPIO,
>> +	MPP25_GPIO,
>> +	MPP26_GPIO,	/* LED: Power */
>> +	MPP27_GPIO,	/* LED: Red Right HDD */
>> +	MPP28_GPIO,	/* LED: Red Left HDD */
>> +	MPP29_GPIO,	/* LED: Red USB (DNS-325 only) */
>> +	MPP30_GPIO,
>> +	MPP31_GPIO,
>> +	MPP32_GPIO,
>> +	MPP33_GPO,
>> +	MPP34_GPIO,	/* Button: Front power */
>> +	MPP35_GPIO,	/* LED: Red USB (DNS-320 only) */
>> +	MPP36_GPIO,	/* Power: Turn off board */
>> +	MPP37_GPIO,	/* Power: Turn back on after power failure */
>> +	MPP38_GPIO,
>> +	MPP39_GPIO,	/* Power: SATA0 */
>> +	MPP40_GPIO,	/* Power: SATA1 */
>> +	MPP41_GPIO,
>> +	MPP42_GPIO,
>> +	MPP43_GPIO,	/* LED: White USB */
>> +	MPP44_GPIO,	/* Fan: Tachometer Pin */
>> +	MPP45_GPIO,	/* Fan: high speed */
>> +	MPP46_GPIO,	/* Fan: low speed */
>> +	MPP47_GPIO,	/* Button: Back unmount */
>> +	MPP48_GPIO,	/* Button: Back reset */
>> +	MPP49_GPIO,	/* Pin of unused U5 (DNS-320 only) */
>> +	0
>> +};
>> +
>> +static struct gpio_led dns325_led_pins[] = {
>> +	{
>> +		.name	= "dns325:white:power",
>> +		.gpio	= 26,
>> +		.active_low = 1,
>> +		.default_trigger = "default-on",
>> +	},
>> +	{
>> +		.name	= "dns325:white:usb",
>> +		.gpio	= 43,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:l_hdd",
>> +		.gpio	= 28,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:r_hdd",
>> +		.gpio	= 27,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns325:red:usb",
>> +		.gpio	= 29,
>> +		.active_low = 1,
>> +	},
>> +};
>> +
>> +static struct gpio_led_platform_data dns325_led_data = {
>> +	.num_leds	= ARRAY_SIZE(dns325_led_pins),
>> +	.leds		= dns325_led_pins,
>> +};
>> +
>> +static struct platform_device dns325_led_device = {
>> +	.name		= "leds-gpio",
>> +	.id		= -1,
>> +	.dev		= {
>> +		.platform_data	= &dns325_led_data,
>> +	},
>> +};
>> +
>> +static struct gpio_led dns320_led_pins[] = {
>> +	{
>> +		.name	= "dns320:blue:power",
>> +		.gpio	= 26,
>> +		.active_low = 1,
>> +		.default_trigger = "default-on",
>> +	},
>> +	{
>> +		.name	= "dns320:blue:usb",
>> +		.gpio	= 43,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:l_hdd",
>> +		.gpio	= 28,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:r_hdd",
>> +		.gpio	= 27,
>> +		.active_low = 1,
>> +	},
>> +	{
>> +		.name	= "dns320:orange:usb",
>> +		.gpio	= 35,
>> +		.active_low = 1,
>> +	},
>> +};
>> +
>> +static struct gpio_led_platform_data dns320_led_data = {
>> +	.num_leds	= ARRAY_SIZE(dns320_led_pins),
>> +	.leds		= dns320_led_pins,
>> +};
>> +
>> +static struct platform_device dns320_led_device = {
>> +	.name		= "leds-gpio",
>> +	.id		= -1,
>> +	.dev		= {
>> +		.platform_data	= &dns320_led_data,
>> +	},
>> +};
>> +
>> +static struct i2c_board_info dns325_i2c_board_info[] __initdata = {
>> +	{
>> +		I2C_BOARD_INFO("lm75", 0x48),
>> +	},
>> +	/* Something at 0x0c also */
>> +};
>> +
>> +static struct gpio_keys_button dnskw_button_pins[] = {
>> +	{
>> +		.code		= KEY_POWER,
>> +		.gpio		= 34,
>> +		.desc		= "Power button",
>> +		.active_low	= 1,
>> +	},
>> +	{
>> +		.code		= KEY_EJECTCD,
>> +		.gpio		= 47,
>> +		.desc		= "USB unmount button",
>> +		.active_low	= 1,
>> +	},
>> +	{
>> +		.code		= KEY_RESTART,
>> +		.gpio		= 48,
>> +		.desc		= "Reset button",
>> +		.active_low	= 1,
>> +	},
>> +};
>> +
>> +static struct gpio_keys_platform_data dnskw_button_data = {
>> +	.buttons	= dnskw_button_pins,
>> +	.nbuttons	= ARRAY_SIZE(dnskw_button_pins),
>> +};
>> +
>> +static struct platform_device dnskw_button_device = {
>> +	.name		= "gpio-keys",
>> +	.id		= -1,
>> +	.num_resources	= 0,
>> +	.dev		= {
>> +		.platform_data	= &dnskw_button_data,
>> +	}
>> +};
>> +
>> +/* Fan: ADDA AD045HB-G73 40mm 6000rpm at 5v */
>> +static struct gpio_fan_speed dnskw_fan_speed[] = {
>> +	{    0,  0 },
>> +	{ 3000,	 1 },
>> +	{ 6000,	 2 },
>> +};
>> +static unsigned dnskw_fan_pins[] = {46, 45};
>> +
>> +static struct gpio_fan_platform_data dnskw_fan_data = {
>> +	.num_ctrl	= ARRAY_SIZE(dnskw_fan_pins),
>> +	.ctrl		= dnskw_fan_pins,
>> +	.num_speed	= ARRAY_SIZE(dnskw_fan_speed),
>> +	.speed		= dnskw_fan_speed,
>> +};
>> +
>> +static struct platform_device dnskw_fan_device = {
>> +	.name	= "gpio-fan",
>> +	.id	= -1,
>> +	.dev	= {
>> +		.platform_data	= &dnskw_fan_data,
>> +	},
>> +};
>> +
>> +static void dnskw_power_off(void)
>> +{
>> +	gpio_set_value(36, 1);
>> +}
>> +
>> +/* Register any GPIO for output and set the value */
>> +static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
>> +{
>> +	if (gpio_request(gpio, name) == 0 &&
>> +	    gpio_direction_output(gpio, 0) == 0) {
>> +		gpio_set_value(gpio, def);
>> +		if (gpio_export(gpio, 0) != 0)
>> +			pr_err("dnskw: Failed to export GPIO %s\n", name);
>> +	} else
>> +		pr_err("dnskw: Failed to register %s\n", name);
>> +}
>> +
>> +void __init dnskw_init(void)
>> +{
>> +	kirkwood_mpp_conf(dnskw_mpp_config);
>> +	kirkwood_nand_init(ARRAY_AND_SIZE(dnskw_nand_parts), 25);
>> +
>> +	kirkwood_ehci_init();
>> +	kirkwood_ge00_init(&dnskw_ge00_data);
>> +	kirkwood_sata_init(&dnskw_sata_data);
>> +	kirkwood_i2c_init();
>> +
>> +	platform_device_register(&dnskw_button_device);
>> +	platform_device_register(&dnskw_fan_device);
>> +
>> +	if (of_machine_is_compatible("dlink,dns-325")) {
>> +		i2c_register_board_info(0, dns325_i2c_board_info,
>> +					ARRAY_SIZE(dns325_i2c_board_info));
>> +		platform_device_register(&dns325_led_device);
>> +
>> +	} else if (of_machine_is_compatible("dlink,dns-320"))
>> +		platform_device_register(&dns320_led_device);
>> +
>> +	/* Register power-off GPIO. */
>> +	if (gpio_request(36, "dnskw:power:off") == 0
>> +	    && gpio_direction_output(36, 0) == 0)
>> +		pm_power_off = dnskw_power_off;
>> +	else
>> +		pr_err("dnskw: failed to configure power-off GPIO\n");
>> +
>> +	/* Ensure power is supplied to both HDDs */
>> +	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
>> +	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
>> +
>> +	/* Set NAS to turn back on after a power failure */
>> +	dnskw_gpio_register(37, "dnskw:power:recover", 1);
>> +}
>> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
>> index 1c672d9..eadc4d7 100644
>> --- a/arch/arm/mach-kirkwood/board-dt.c
>> +++ b/arch/arm/mach-kirkwood/board-dt.c
>> @@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)
>>  	if (of_machine_is_compatible("globalscale,dreamplug"))
>>  		dreamplug_init();
>>
>> +	if (of_machine_is_compatible("dlink,dns-kirkwood"))
>> +		dnskw_init();
>> +
>>  	of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
>>  }
>>
>>  static const char *kirkwood_dt_board_compat[] = {
>>  	"globalscale,dreamplug",
>> +	"dlink,dns-320",
>> +	"dlink,dns-325",
>>  	NULL
>>  };
>>
>> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
>> index fa8e768..8c8c733 100644
>> --- a/arch/arm/mach-kirkwood/common.h
>> +++ b/arch/arm/mach-kirkwood/common.h
>> @@ -58,6 +58,12 @@ void dreamplug_init(void);
>>  static inline void dreamplug_init(void) {};
>>  #endif
>>
>> +#ifdef CONFIG_MACH_DNSKW_DT
>> +void dnskw_init(void);
>> +#else
>> +static inline void dnskw_init(void) {};
>> +#endif
>> +
>>  /* early init functions not converted to fdt yet */
>>  char *kirkwood_id(void);
>>  void kirkwood_l2_init(void);
>> --
>> 1.7.9.1
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>

-- 
Jamie Lentin

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-06 23:43         ` Grant Likely
@ 2012-04-09 14:09           ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 14:09 UTC (permalink / raw)
  To: Grant Likely
  Cc: Jamie Lentin, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jason

On Friday 06 April 2012, Grant Likely wrote:
> On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
> > On Tuesday 27 March 2012, Jamie Lentin wrote:
> > > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > > in the devicetree files, create a board-dnskw.c for everything else.
> > > 
> > > Use IEEE-compliant "okay", rather than "ok"
> > > 
> > > Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> > > Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
> > > Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> > > ---
> > 
> > One small note about changeset comments: The part about differences from the previous
> > version of the same patch normally goes below the '---' line, in front of the diffstat,
> > to prevent it from going into the git changelog. Otherwise people will have no idea
> > what it's about.
> 
> Counter point on that.  I ask submitters to put the changelog before
> the --- because I want it in the commit text.  It is actually helpful
> when trying to determine exactly which iteration of a patch series got
> committed.

Fair enough, but I think in this case it was written in a confusing way. I don't
mind if a list of review comments are included and more text is usally better
in the changeset comment, but it would be nice to give some background, either
by prefixing it with something "Addressed review comments from xxx:" or changing
it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.

	Arnd

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 14:09           ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 14:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday 06 April 2012, Grant Likely wrote:
> On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
> > On Tuesday 27 March 2012, Jamie Lentin wrote:
> > > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > > in the devicetree files, create a board-dnskw.c for everything else.
> > > 
> > > Use IEEE-compliant "okay", rather than "ok"
> > > 
> > > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > > Acked-by: Jason Cooper <jason@lakedaemon.net>
> > > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> > > ---
> > 
> > One small note about changeset comments: The part about differences from the previous
> > version of the same patch normally goes below the '---' line, in front of the diffstat,
> > to prevent it from going into the git changelog. Otherwise people will have no idea
> > what it's about.
> 
> Counter point on that.  I ask submitters to put the changelog before
> the --- because I want it in the commit text.  It is actually helpful
> when trying to determine exactly which iteration of a patch series got
> committed.

Fair enough, but I think in this case it was written in a confusing way. I don't
mind if a list of review comments are included and more text is usally better
in the changeset comment, but it would be nice to give some background, either
by prefixing it with something "Addressed review comments from xxx:" or changing
it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.

	Arnd

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-09 13:20       ` Jamie Lentin
@ 2012-04-09 14:14           ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 14:14 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Monday 09 April 2012, Jamie Lentin wrote:
> On Fri, 6 Apr 2012, Grant Likely wrote:
> > These two lines are dangerous.  It is not safe to 'select' Kconfig
> > symbols that have 'depends' constraints.  Otherwise, the symbol will
> > get forced on without it's dependencies.
> >
> > Typically other code handles this by creating blank "HAVE_*" symbols
> > that the needed symbol can do something like "default y if HAVE_*"
> >
> 
> Okay I didn't realise this, thanks. The options in question aren't
> hard dependencies per-se, but no serial or NAND support is probably a
> mistake, so added them here to avoid a certain amount of shooting in foot.
> 
> What's the etiquette in this situation? Adding HAVE_* seems excessive,
> would selecting them in kirkwood_defconfig make more sense? Or would it
> simply be covered by having a reasonable config on my website or suchlike?

Either way works. We don't prevent people from shooting themselves in the
foot in Kconfig, there are plenty of ways to do that already (e.g. disabling
network support on a headless system). There should be a defconfig
for each platform, so just make sure 'make kirkwood_defconfig' enables
everything you need and works on your system, it should be the
superset of all kirkwood based systems and users can disable the
stuff they don't need.

	Arnd

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 14:14           ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 09 April 2012, Jamie Lentin wrote:
> On Fri, 6 Apr 2012, Grant Likely wrote:
> > These two lines are dangerous.  It is not safe to 'select' Kconfig
> > symbols that have 'depends' constraints.  Otherwise, the symbol will
> > get forced on without it's dependencies.
> >
> > Typically other code handles this by creating blank "HAVE_*" symbols
> > that the needed symbol can do something like "default y if HAVE_*"
> >
> 
> Okay I didn't realise this, thanks. The options in question aren't
> hard dependencies per-se, but no serial or NAND support is probably a
> mistake, so added them here to avoid a certain amount of shooting in foot.
> 
> What's the etiquette in this situation? Adding HAVE_* seems excessive,
> would selecting them in kirkwood_defconfig make more sense? Or would it
> simply be covered by having a reasonable config on my website or suchlike?

Either way works. We don't prevent people from shooting themselves in the
foot in Kconfig, there are plenty of ways to do that already (e.g. disabling
network support on a headless system). There should be a defconfig
for each platform, so just make sure 'make kirkwood_defconfig' enables
everything you need and works on your system, it should be the
superset of all kirkwood based systems and users can disable the
stuff they don't need.

	Arnd

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-09 14:09           ` Arnd Bergmann
@ 2012-04-09 14:20               ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-09 14:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, 9 Apr 2012, Arnd Bergmann wrote:

> On Friday 06 April 2012, Grant Likely wrote:
>> On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org> wrote:
>>> On Tuesday 27 March 2012, Jamie Lentin wrote:
>>>> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
>>>> in the devicetree files, create a board-dnskw.c for everything else.
>>>>
>>>> Use IEEE-compliant "okay", rather than "ok"
>>>>
>>>> Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
>>>> Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
>>>> Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
>>>> ---
>>>
>>> One small note about changeset comments: The part about differences from the previous
>>> version of the same patch normally goes below the '---' line, in front of the diffstat,
>>> to prevent it from going into the git changelog. Otherwise people will have no idea
>>> what it's about.
>>
>> Counter point on that.  I ask submitters to put the changelog before
>> the --- because I want it in the commit text.  It is actually helpful
>> when trying to determine exactly which iteration of a patch series got
>> committed.
>
> Fair enough, but I think in this case it was written in a confusing way. I don't
> mind if a list of review comments are included and more text is usally better
> in the changeset comment, but it would be nice to give some background, either
> by prefixing it with something "Addressed review comments from xxx:" or changing
> it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.
>

Re-reading, it really isn't obvious I meant "Use IEEE-compliant..." as a 
changelog of sorts. Maybe this would have been a better commit message?

---------

Add support for the DNS-320 and DNS-325. Describe as much as currently 
possible in the devicetree files, create a board-dnskw.c for everything 
else.

Changes since last submission (V2):-

* Use IEEE-compliant "okay", rather than "ok" (adressing comments from 
Scott Wood)

---------

> 	Arnd
>

-- 
Jamie Lentin

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 14:20               ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-09 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 9 Apr 2012, Arnd Bergmann wrote:

> On Friday 06 April 2012, Grant Likely wrote:
>> On Wed, 28 Mar 2012 08:19:59 +0000, Arnd Bergmann <arnd@arndb.de> wrote:
>>> On Tuesday 27 March 2012, Jamie Lentin wrote:
>>>> Add support for the DNS-320 and DNS-325. Describe as much as currently possible
>>>> in the devicetree files, create a board-dnskw.c for everything else.
>>>>
>>>> Use IEEE-compliant "okay", rather than "ok"
>>>>
>>>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>>> Acked-by: Jason Cooper <jason@lakedaemon.net>
>>>> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
>>>> ---
>>>
>>> One small note about changeset comments: The part about differences from the previous
>>> version of the same patch normally goes below the '---' line, in front of the diffstat,
>>> to prevent it from going into the git changelog. Otherwise people will have no idea
>>> what it's about.
>>
>> Counter point on that.  I ask submitters to put the changelog before
>> the --- because I want it in the commit text.  It is actually helpful
>> when trying to determine exactly which iteration of a patch series got
>> committed.
>
> Fair enough, but I think in this case it was written in a confusing way. I don't
> mind if a list of review comments are included and more text is usally better
> in the changeset comment, but it would be nice to give some background, either
> by prefixing it with something "Addressed review comments from xxx:" or changing
> it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.
>

Re-reading, it really isn't obvious I meant "Use IEEE-compliant..." as a 
changelog of sorts. Maybe this would have been a better commit message?

---------

Add support for the DNS-320 and DNS-325. Describe as much as currently 
possible in the devicetree files, create a board-dnskw.c for everything 
else.

Changes since last submission (V2):-

* Use IEEE-compliant "okay", rather than "ok" (adressing comments from 
Scott Wood)

---------

> 	Arnd
>

-- 
Jamie Lentin

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-09 14:20               ` Jamie Lentin
@ 2012-04-09 15:01                   ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 15:01 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jason,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Monday 09 April 2012, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently 
> possible in the devicetree files, create a board-dnskw.c for everything 
> else.
> 
> Changes since last submission (V2):-
> 
> * Use IEEE-compliant "okay", rather than "ok" (adressing comments from 
> Scott Wood)
> 

Looks great, yes.

	Arnd

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 15:01                   ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-09 15:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Monday 09 April 2012, Jamie Lentin wrote:
> Add support for the DNS-320 and DNS-325. Describe as much as currently 
> possible in the devicetree files, create a board-dnskw.c for everything 
> else.
> 
> Changes since last submission (V2):-
> 
> * Use IEEE-compliant "okay", rather than "ok" (adressing comments from 
> Scott Wood)
> 

Looks great, yes.

	Arnd

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-06 23:49     ` Grant Likely
@ 2012-04-09 21:27       ` Russell King - ARM Linux
  -1 siblings, 0 replies; 50+ messages in thread
From: Russell King - ARM Linux @ 2012-04-09 21:27 UTC (permalink / raw)
  To: Grant Likely
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Jamie Lentin, Jason,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Fri, Apr 06, 2012 at 04:49:55PM -0700, Grant Likely wrote:
> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org> wrote:
> > +config MACH_DNS320_DT
> > +	bool "D-Link DNS-320 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> 
> These two lines are dangerous.

No they aren't - at least not as the above patch is written.  There are
no configuration variables called CONFIG_CONFIG_MTD_OF_PARTS nor
CONFIG_CONFIG_SERIAL_OF_PLATFORM.

Kconfig won't warn about that, and if we assume that this patch has been
properly tested, it would appear that these two select statements just
aren't required (because they're effective no-ops as they currently stand).

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-09 21:27       ` Russell King - ARM Linux
  0 siblings, 0 replies; 50+ messages in thread
From: Russell King - ARM Linux @ 2012-04-09 21:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 06, 2012 at 04:49:55PM -0700, Grant Likely wrote:
> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> > +config MACH_DNS320_DT
> > +	bool "D-Link DNS-320 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> 
> These two lines are dangerous.

No they aren't - at least not as the above patch is written.  There are
no configuration variables called CONFIG_CONFIG_MTD_OF_PARTS nor
CONFIG_CONFIG_SERIAL_OF_PLATFORM.

Kconfig won't warn about that, and if we assume that this patch has been
properly tested, it would appear that these two select statements just
aren't required (because they're effective no-ops as they currently stand).

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-06 23:49     ` Grant Likely
@ 2012-04-11  0:35       ` Jason Cooper
  -1 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11  0:35 UTC (permalink / raw)
  To: Grant Likely
  Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Jamie Lentin,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ

On Fri, Apr 06, 2012 at 04:49:55PM -0700, Grant Likely wrote:
> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org> wrote:
> > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > in the devicetree files, create a board-dnskw.c for everything else.
> > 
> > Use IEEE-compliant "okay", rather than "ok"
> > 
> > Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> > Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
> > Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> > ---
> >  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
> >  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
> >  arch/arm/mach-kirkwood/Kconfig        |   23 +++
> >  arch/arm/mach-kirkwood/Makefile       |    1 +
> >  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
> >  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
> >  arch/arm/mach-kirkwood/board-dt.c     |    5 +
> >  arch/arm/mach-kirkwood/common.h       |    6 +
> >  8 files changed, 396 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
> >  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
> >  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> > 
> > diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> > new file mode 100644
> > index 0000000..78c834f
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> > @@ -0,0 +1,29 @@
> > +/dts-v1/;
> > +
> > +/include/ "kirkwood.dtsi"
> > +
> > +/ {
> > +	model = "D-Link DNS-320 NAS (Rev A1)";
> > +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x00000000 0x8000000>;
> > +	};
> > +
> > +	chosen {
> > +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> > +	};
> > +
> > +	ocp@f1000000 {
> > +		serial@12000 {
> > +			clock-frequency = <166666667>;
> > +			status = "okay";
> > +		};
> > +
> > +		serial@12100 {
> > +			clock-frequency = <166666667>;
> > +			status = "okay";
> > +		};
> > +	};
> > +};
> > diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> > new file mode 100644
> > index 0000000..23241ab
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> > @@ -0,0 +1,24 @@
> > +/dts-v1/;
> > +
> > +/include/ "kirkwood.dtsi"
> > +
> > +/ {
> > +	model = "D-Link DNS-325 NAS (Rev A1)";
> > +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x00000000 0x10000000>;
> > +	};
> > +
> > +	chosen {
> > +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> > +	};
> > +
> > +	ocp@f1000000 {
> > +		serial@12000 {
> > +			clock-frequency = <200000000>;
> > +			status = "okay";
> > +		};
> > +	};
> > +};
> > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> > index 90ceab7..d594b6e 100644
> > --- a/arch/arm/mach-kirkwood/Kconfig
> > +++ b/arch/arm/mach-kirkwood/Kconfig
> > @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
> >  	  Say 'Y' here if you want your kernel to support the
> >  	  Marvell DreamPlug (Flattened Device Tree).
> >  
> > +config MACH_DNSKW_DT
> > +        bool
> > +
> > +config MACH_DNS320_DT
> > +	bool "D-Link DNS-320 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> 
> These two lines are dangerous.  It is not safe to 'select' Kconfig
> symbols that have 'depends' constraints.  Otherwise, the symbol will
> get forced on without it's dependencies.
> 
> Typically other code handles this by creating blank "HAVE_*" symbols
> that the needed symbol can do something like "default y if HAVE_*"

I'm in favor of just omitting these two lines.  I think it's a bad habit
to presume what features a user may want.  This should be handled by
*_defconfig, if anywhere.

> > +	help
> > +	  Say 'Y' here if you want your kernel to support the
> > +	  D-Link DNS-320 NAS, using Flattened Device Tree.
> > +
> > +config MACH_DNS325_DT
> > +	bool "D-Link DNS-325 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> > +	help
> > +	  Say 'Y' here if you want your kernel to support the
> > +	  D-Link DNS-325 NAS, using Flattened Device Tree.
> > +
> 
> The *only* difference between these two configs is the .dtb file that
> gets built.  Don't create a separate Kconfig entry for each dnskw
> board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> selected.  Building .dtb files is cheap.

Ack.

> >  config MACH_TS219
> >  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
> >  	help
> > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> > index e299a95..b092af5 100644
> > --- a/arch/arm/mach-kirkwood/Makefile
> > +++ b/arch/arm/mach-kirkwood/Makefile
> > @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
> >  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
> >  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
> >  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> > +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> > diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> > index 16f9385..9c5e45f 100644
> > --- a/arch/arm/mach-kirkwood/Makefile.boot
> > +++ b/arch/arm/mach-kirkwood/Makefile.boot
> > @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
> >  initrd_phys-y	:= 0x00800000
> >  
> >  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> > +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> > +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> > diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> > new file mode 100644
> > index 0000000..7cb7f6a
> > --- /dev/null
> > +++ b/arch/arm/mach-kirkwood/board-dnskw.c
> > @@ -0,0 +1,306 @@
> > +/*
> > + * Copyright 2012 (C), Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> > + *
> > + * arch/arm/mach-kirkwood/board-dnskw.c
> > + *
> > + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> > + * flattened device tree yet.
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2.  This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/i2c.h>
> > +#include <linux/ata_platform.h>
> > +#include <linux/mv643xx_eth.h>
> > +#include <linux/of.h>
> > +#include <linux/gpio.h>
> > +#include <linux/input.h>
> > +#include <linux/gpio_keys.h>
> > +#include <linux/gpio-fan.h>
> > +#include <linux/leds.h>
> > +#include <linux/mtd/physmap.h>
> > +#include <asm/mach-types.h>
> > +#include <asm/mach/arch.h>
> > +#include <asm/mach/map.h>
> > +#include <mach/kirkwood.h>
> > +#include <mach/bridge-regs.h>
> > +#include "common.h"
> > +#include "mpp.h"
> > +
> > +static struct mtd_partition dnskw_nand_parts[] = {
> > +	{
> > +		.name		= "u-boot",
> > +		.offset		= 0,
> > +		.size		= SZ_1M,
> > +		.mask_flags	= MTD_WRITEABLE
> > +	}, {
> > +		.name		= "uImage",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	}, {
> > +		.name		= "ramdisk",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	}, {
> > +		.name		= "image",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 102 * SZ_1M
> > +	}, {
> > +		.name		= "mini firmware",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 10 * SZ_1M
> > +	}, {
> > +		.name		= "config",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	},
> > +};
> 
> This patch adds a static partition mapping, and then a later patch in
> this same series removes it again.  Please don't do that.  Just squash
> the patches together.  Or, if sqashing is not appropriate, then just
> omit the partitions.
> 
> I also suggest omiting similar data when there are patches already in
> progess to do it properly.  It is okay for the inital support to go in
> to be incomplete when enhancements will be ready soon.

This is my doing.  He was basing this off of dreamplug, which has SPI
NOR flash and partitions specified in the board file because the spi
driver is waiting for kirkwood to be converted to common clock.  Jamie,
go ahead and drop the above in the initial board-dnskw.c patch and just
add support for nand/partitions in the last patch (fdt).

thx,

Jason.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-11  0:35       ` Jason Cooper
  0 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11  0:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 06, 2012 at 04:49:55PM -0700, Grant Likely wrote:
> On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> > Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> > in the devicetree files, create a board-dnskw.c for everything else.
> > 
> > Use IEEE-compliant "okay", rather than "ok"
> > 
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> > Acked-by: Jason Cooper <jason@lakedaemon.net>
> > Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> > ---
> >  arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
> >  arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
> >  arch/arm/mach-kirkwood/Kconfig        |   23 +++
> >  arch/arm/mach-kirkwood/Makefile       |    1 +
> >  arch/arm/mach-kirkwood/Makefile.boot  |    2 +
> >  arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
> >  arch/arm/mach-kirkwood/board-dt.c     |    5 +
> >  arch/arm/mach-kirkwood/common.h       |    6 +
> >  8 files changed, 396 insertions(+), 0 deletions(-)
> >  create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
> >  create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
> >  create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> > 
> > diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> > new file mode 100644
> > index 0000000..78c834f
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> > @@ -0,0 +1,29 @@
> > +/dts-v1/;
> > +
> > +/include/ "kirkwood.dtsi"
> > +
> > +/ {
> > +	model = "D-Link DNS-320 NAS (Rev A1)";
> > +	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x00000000 0x8000000>;
> > +	};
> > +
> > +	chosen {
> > +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> > +	};
> > +
> > +	ocp at f1000000 {
> > +		serial at 12000 {
> > +			clock-frequency = <166666667>;
> > +			status = "okay";
> > +		};
> > +
> > +		serial at 12100 {
> > +			clock-frequency = <166666667>;
> > +			status = "okay";
> > +		};
> > +	};
> > +};
> > diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> > new file mode 100644
> > index 0000000..23241ab
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> > @@ -0,0 +1,24 @@
> > +/dts-v1/;
> > +
> > +/include/ "kirkwood.dtsi"
> > +
> > +/ {
> > +	model = "D-Link DNS-325 NAS (Rev A1)";
> > +	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> > +
> > +	memory {
> > +		device_type = "memory";
> > +		reg = <0x00000000 0x10000000>;
> > +	};
> > +
> > +	chosen {
> > +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> > +	};
> > +
> > +	ocp at f1000000 {
> > +		serial at 12000 {
> > +			clock-frequency = <200000000>;
> > +			status = "okay";
> > +		};
> > +	};
> > +};
> > diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> > index 90ceab7..d594b6e 100644
> > --- a/arch/arm/mach-kirkwood/Kconfig
> > +++ b/arch/arm/mach-kirkwood/Kconfig
> > @@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
> >  	  Say 'Y' here if you want your kernel to support the
> >  	  Marvell DreamPlug (Flattened Device Tree).
> >  
> > +config MACH_DNSKW_DT
> > +        bool
> > +
> > +config MACH_DNS320_DT
> > +	bool "D-Link DNS-320 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> 
> These two lines are dangerous.  It is not safe to 'select' Kconfig
> symbols that have 'depends' constraints.  Otherwise, the symbol will
> get forced on without it's dependencies.
> 
> Typically other code handles this by creating blank "HAVE_*" symbols
> that the needed symbol can do something like "default y if HAVE_*"

I'm in favor of just omitting these two lines.  I think it's a bad habit
to presume what features a user may want.  This should be handled by
*_defconfig, if anywhere.

> > +	help
> > +	  Say 'Y' here if you want your kernel to support the
> > +	  D-Link DNS-320 NAS, using Flattened Device Tree.
> > +
> > +config MACH_DNS325_DT
> > +	bool "D-Link DNS-325 (Flattened Device Tree)"
> > +	select ARCH_KIRKWOOD_DT
> > +	select MACH_DNSKW_DT
> > +	select CONFIG_MTD_OF_PARTS
> > +	select CONFIG_SERIAL_OF_PLATFORM
> > +	help
> > +	  Say 'Y' here if you want your kernel to support the
> > +	  D-Link DNS-325 NAS, using Flattened Device Tree.
> > +
> 
> The *only* difference between these two configs is the .dtb file that
> gets built.  Don't create a separate Kconfig entry for each dnskw
> board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> selected.  Building .dtb files is cheap.

Ack.

> >  config MACH_TS219
> >  	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
> >  	help
> > diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> > index e299a95..b092af5 100644
> > --- a/arch/arm/mach-kirkwood/Makefile
> > +++ b/arch/arm/mach-kirkwood/Makefile
> > @@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
> >  obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
> >  obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
> >  obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> > +obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> > diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> > index 16f9385..9c5e45f 100644
> > --- a/arch/arm/mach-kirkwood/Makefile.boot
> > +++ b/arch/arm/mach-kirkwood/Makefile.boot
> > @@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
> >  initrd_phys-y	:= 0x00800000
> >  
> >  dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> > +dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> > +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> > diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> > new file mode 100644
> > index 0000000..7cb7f6a
> > --- /dev/null
> > +++ b/arch/arm/mach-kirkwood/board-dnskw.c
> > @@ -0,0 +1,306 @@
> > +/*
> > + * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
> > + *
> > + * arch/arm/mach-kirkwood/board-dnskw.c
> > + *
> > + * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> > + * flattened device tree yet.
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2.  This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/kernel.h>
> > +#include <linux/init.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/i2c.h>
> > +#include <linux/ata_platform.h>
> > +#include <linux/mv643xx_eth.h>
> > +#include <linux/of.h>
> > +#include <linux/gpio.h>
> > +#include <linux/input.h>
> > +#include <linux/gpio_keys.h>
> > +#include <linux/gpio-fan.h>
> > +#include <linux/leds.h>
> > +#include <linux/mtd/physmap.h>
> > +#include <asm/mach-types.h>
> > +#include <asm/mach/arch.h>
> > +#include <asm/mach/map.h>
> > +#include <mach/kirkwood.h>
> > +#include <mach/bridge-regs.h>
> > +#include "common.h"
> > +#include "mpp.h"
> > +
> > +static struct mtd_partition dnskw_nand_parts[] = {
> > +	{
> > +		.name		= "u-boot",
> > +		.offset		= 0,
> > +		.size		= SZ_1M,
> > +		.mask_flags	= MTD_WRITEABLE
> > +	}, {
> > +		.name		= "uImage",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	}, {
> > +		.name		= "ramdisk",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	}, {
> > +		.name		= "image",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 102 * SZ_1M
> > +	}, {
> > +		.name		= "mini firmware",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 10 * SZ_1M
> > +	}, {
> > +		.name		= "config",
> > +		.offset		= MTDPART_OFS_NXTBLK,
> > +		.size		= 5 * SZ_1M
> > +	},
> > +};
> 
> This patch adds a static partition mapping, and then a later patch in
> this same series removes it again.  Please don't do that.  Just squash
> the patches together.  Or, if sqashing is not appropriate, then just
> omit the partitions.
> 
> I also suggest omiting similar data when there are patches already in
> progess to do it properly.  It is okay for the inital support to go in
> to be incomplete when enhancements will be ready soon.

This is my doing.  He was basing this off of dreamplug, which has SPI
NOR flash and partitions specified in the board file because the spi
driver is waiting for kirkwood to be converted to common clock.  Jamie,
go ahead and drop the above in the initial board-dnskw.c patch and just
add support for nand/partitions in the last patch (fdt).

thx,

Jason.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-09 13:20       ` Jamie Lentin
@ 2012-04-11  0:43           ` Jason Cooper
  -1 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11  0:43 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Mon, Apr 09, 2012 at 02:20:26PM +0100, Jamie Lentin wrote:
> On Fri, 6 Apr 2012, Grant Likely wrote:
> 
> >On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org> wrote:
> >>Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> >>in the devicetree files, create a board-dnskw.c for everything else.
> >>
> >>Use IEEE-compliant "okay", rather than "ok"
> >>
> >>Acked-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> >>Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
> >>Signed-off-by: Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> >>---
> >> arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
> >> arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
> >> arch/arm/mach-kirkwood/Kconfig        |   23 +++
> >> arch/arm/mach-kirkwood/Makefile       |    1 +
> >> arch/arm/mach-kirkwood/Makefile.boot  |    2 +
> >> arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
> >> arch/arm/mach-kirkwood/board-dt.c     |    5 +
> >> arch/arm/mach-kirkwood/common.h       |    6 +
> >> 8 files changed, 396 insertions(+), 0 deletions(-)
> >> create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
> >> create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
> >> create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> >>
> >>diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> >>new file mode 100644
> >>index 0000000..78c834f
> >>--- /dev/null
> >>+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> >>@@ -0,0 +1,29 @@
> >>+/dts-v1/;
> >>+
> >>+/include/ "kirkwood.dtsi"
> >>+
> >>+/ {
> >>+	model = "D-Link DNS-320 NAS (Rev A1)";
> >>+	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> >>+
> >>+	memory {
> >>+		device_type = "memory";
> >>+		reg = <0x00000000 0x8000000>;
> >>+	};
> >>+
> >>+	chosen {
> >>+		bootargs = "console=ttyS0,115200n8 earlyprintk";
> >>+	};
> >>+
> >>+	ocp@f1000000 {
> >>+		serial@12000 {
> >>+			clock-frequency = <166666667>;
> >>+			status = "okay";
> >>+		};
> >>+
> >>+		serial@12100 {
> >>+			clock-frequency = <166666667>;
> >>+			status = "okay";
> >>+		};
> >>+	};
> >>+};
> >>diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> >>new file mode 100644
> >>index 0000000..23241ab
> >>--- /dev/null
> >>+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> >>@@ -0,0 +1,24 @@
> >>+/dts-v1/;
> >>+
> >>+/include/ "kirkwood.dtsi"
> >>+
> >>+/ {
> >>+	model = "D-Link DNS-325 NAS (Rev A1)";
> >>+	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> >>+
> >>+	memory {
> >>+		device_type = "memory";
> >>+		reg = <0x00000000 0x10000000>;
> >>+	};
> >>+
> >>+	chosen {
> >>+		bootargs = "console=ttyS0,115200n8 earlyprintk";
> >>+	};
> >>+
> >>+	ocp@f1000000 {
> >>+		serial@12000 {
> >>+			clock-frequency = <200000000>;
> >>+			status = "okay";
> >>+		};
> >>+	};
> >>+};
> >>diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> >>index 90ceab7..d594b6e 100644
> >>--- a/arch/arm/mach-kirkwood/Kconfig
> >>+++ b/arch/arm/mach-kirkwood/Kconfig
> >>@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
> >> 	  Say 'Y' here if you want your kernel to support the
> >> 	  Marvell DreamPlug (Flattened Device Tree).
> >>
> >>+config MACH_DNSKW_DT
> >>+        bool
> >>+
> >>+config MACH_DNS320_DT
> >>+	bool "D-Link DNS-320 (Flattened Device Tree)"
> >>+	select ARCH_KIRKWOOD_DT
> >>+	select MACH_DNSKW_DT
> >>+	select CONFIG_MTD_OF_PARTS
> >>+	select CONFIG_SERIAL_OF_PLATFORM
> >
> >These two lines are dangerous.  It is not safe to 'select' Kconfig
> >symbols that have 'depends' constraints.  Otherwise, the symbol will
> >get forced on without it's dependencies.
> >
> >Typically other code handles this by creating blank "HAVE_*" symbols
> >that the needed symbol can do something like "default y if HAVE_*"
> >
> 
> Okay I didn't realise this, thanks. The options in question aren't
> hard dependencies per-se, but no serial or NAND support is probably a
> mistake, so added them here to avoid a certain amount of shooting in foot.
> 
> What's the etiquette in this situation? Adding HAVE_* seems excessive,
> would selecting them in kirkwood_defconfig make more sense? Or would it
> simply be covered by having a reasonable config on my website or suchlike?

The latter sounds good.  kirkwood_defconfig is in need of some love, and
I haven't had time to get to it.

> Jason, given you've already applied this patch, would you rather me
> submit something else to ditch these, or resumbit the entire series,
> combining feedback?

I only applied it locally, I was waiting for comments like this before
doing a pull request.  Go ahead and redo the series based on the input
and repost.  I'll replace what I have.

> 
> >>+	help
> >>+	  Say 'Y' here if you want your kernel to support the
> >>+	  D-Link DNS-320 NAS, using Flattened Device Tree.
> >>+
> >>+config MACH_DNS325_DT
> >>+	bool "D-Link DNS-325 (Flattened Device Tree)"
> >>+	select ARCH_KIRKWOOD_DT
> >>+	select MACH_DNSKW_DT
> >>+	select CONFIG_MTD_OF_PARTS
> >>+	select CONFIG_SERIAL_OF_PLATFORM
> >>+	help
> >>+	  Say 'Y' here if you want your kernel to support the
> >>+	  D-Link DNS-325 NAS, using Flattened Device Tree.
> >>+
> >
> >The *only* difference between these two configs is the .dtb file that
> >gets built.  Don't create a separate Kconfig entry for each dnskw
> >board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> >selected.  Building .dtb files is cheap.
> >
> 
> The rationale for this is the code in dnskw.c is (hopefully!) temporary,
> and when it goes there isn't any need for MACH_DNSKW_DT either.
> 
> In a future land where everything has been converted to devicetree, what
> would be best? An option to "Build all kirkwood-based .dtb's", an option
> to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
> board? I've not got any strong opinion, so will reformat the above to
> whatever is considered best.

Based on Grant's comment, I'll probably be working towards a
MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
Perhaps this should be MACH_BUFFALO_DT?

> >> config MACH_TS219
> >> 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
> >> 	help
> >>diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> >>index e299a95..b092af5 100644
> >>--- a/arch/arm/mach-kirkwood/Makefile
> >>+++ b/arch/arm/mach-kirkwood/Makefile
> >>@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
> >> obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
> >> obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
> >> obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> >>+obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> >>diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> >>index 16f9385..9c5e45f 100644
> >>--- a/arch/arm/mach-kirkwood/Makefile.boot
> >>+++ b/arch/arm/mach-kirkwood/Makefile.boot
> >>@@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
> >> initrd_phys-y	:= 0x00800000
> >>
> >> dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> >>+dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> >>+dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> >>diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> >>new file mode 100644
> >>index 0000000..7cb7f6a
> >>--- /dev/null
> >>+++ b/arch/arm/mach-kirkwood/board-dnskw.c
> >>@@ -0,0 +1,306 @@
> >>+/*
> >>+ * Copyright 2012 (C), Jamie Lentin <jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
> >>+ *
> >>+ * arch/arm/mach-kirkwood/board-dnskw.c
> >>+ *
> >>+ * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> >>+ * flattened device tree yet.
> >>+ *
> >>+ * This file is licensed under the terms of the GNU General Public
> >>+ * License version 2.  This program is licensed "as is" without any
> >>+ * warranty of any kind, whether express or implied.
> >>+ */
> >>+
> >>+#include <linux/kernel.h>
> >>+#include <linux/init.h>
> >>+#include <linux/platform_device.h>
> >>+#include <linux/i2c.h>
> >>+#include <linux/ata_platform.h>
> >>+#include <linux/mv643xx_eth.h>
> >>+#include <linux/of.h>
> >>+#include <linux/gpio.h>
> >>+#include <linux/input.h>
> >>+#include <linux/gpio_keys.h>
> >>+#include <linux/gpio-fan.h>
> >>+#include <linux/leds.h>
> >>+#include <linux/mtd/physmap.h>
> >>+#include <asm/mach-types.h>
> >>+#include <asm/mach/arch.h>
> >>+#include <asm/mach/map.h>
> >>+#include <mach/kirkwood.h>
> >>+#include <mach/bridge-regs.h>
> >>+#include "common.h"
> >>+#include "mpp.h"
> >>+
> >>+static struct mtd_partition dnskw_nand_parts[] = {
> >>+	{
> >>+		.name		= "u-boot",
> >>+		.offset		= 0,
> >>+		.size		= SZ_1M,
> >>+		.mask_flags	= MTD_WRITEABLE
> >>+	}, {
> >>+		.name		= "uImage",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	}, {
> >>+		.name		= "ramdisk",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	}, {
> >>+		.name		= "image",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 102 * SZ_1M
> >>+	}, {
> >>+		.name		= "mini firmware",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 10 * SZ_1M
> >>+	}, {
> >>+		.name		= "config",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	},
> >>+};
> >
> >This patch adds a static partition mapping, and then a later patch in
> >this same series removes it again.  Please don't do that.  Just squash
> >the patches together.  Or, if sqashing is not appropriate, then just
> >omit the partitions.
> >
> >I also suggest omiting similar data when there are patches already in
> >progess to do it properly.  It is okay for the inital support to go in
> >to be incomplete when enhancements will be ready soon.
> >
> 
> Noted. If the entire patchset needs resubmitting, I'll combine the patch
> that moves this definition to the .dtb

See my comment in my other reply, just don't add nand/partition support
in the beginning.

thx,

Jason.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-11  0:43           ` Jason Cooper
  0 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11  0:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Apr 09, 2012 at 02:20:26PM +0100, Jamie Lentin wrote:
> On Fri, 6 Apr 2012, Grant Likely wrote:
> 
> >On Tue, 27 Mar 2012 22:54:11 +0100, Jamie Lentin <jm@lentin.co.uk> wrote:
> >>Add support for the DNS-320 and DNS-325. Describe as much as currently possible
> >>in the devicetree files, create a board-dnskw.c for everything else.
> >>
> >>Use IEEE-compliant "okay", rather than "ok"
> >>
> >>Acked-by: Arnd Bergmann <arnd@arndb.de>
> >>Acked-by: Jason Cooper <jason@lakedaemon.net>
> >>Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> >>---
> >> arch/arm/boot/dts/kirkwood-dns320.dts |   29 +++
> >> arch/arm/boot/dts/kirkwood-dns325.dts |   24 +++
> >> arch/arm/mach-kirkwood/Kconfig        |   23 +++
> >> arch/arm/mach-kirkwood/Makefile       |    1 +
> >> arch/arm/mach-kirkwood/Makefile.boot  |    2 +
> >> arch/arm/mach-kirkwood/board-dnskw.c  |  306 +++++++++++++++++++++++++++++++++
> >> arch/arm/mach-kirkwood/board-dt.c     |    5 +
> >> arch/arm/mach-kirkwood/common.h       |    6 +
> >> 8 files changed, 396 insertions(+), 0 deletions(-)
> >> create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts
> >> create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts
> >> create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
> >>
> >>diff --git a/arch/arm/boot/dts/kirkwood-dns320.dts b/arch/arm/boot/dts/kirkwood-dns320.dts
> >>new file mode 100644
> >>index 0000000..78c834f
> >>--- /dev/null
> >>+++ b/arch/arm/boot/dts/kirkwood-dns320.dts
> >>@@ -0,0 +1,29 @@
> >>+/dts-v1/;
> >>+
> >>+/include/ "kirkwood.dtsi"
> >>+
> >>+/ {
> >>+	model = "D-Link DNS-320 NAS (Rev A1)";
> >>+	compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> >>+
> >>+	memory {
> >>+		device_type = "memory";
> >>+		reg = <0x00000000 0x8000000>;
> >>+	};
> >>+
> >>+	chosen {
> >>+		bootargs = "console=ttyS0,115200n8 earlyprintk";
> >>+	};
> >>+
> >>+	ocp at f1000000 {
> >>+		serial at 12000 {
> >>+			clock-frequency = <166666667>;
> >>+			status = "okay";
> >>+		};
> >>+
> >>+		serial at 12100 {
> >>+			clock-frequency = <166666667>;
> >>+			status = "okay";
> >>+		};
> >>+	};
> >>+};
> >>diff --git a/arch/arm/boot/dts/kirkwood-dns325.dts b/arch/arm/boot/dts/kirkwood-dns325.dts
> >>new file mode 100644
> >>index 0000000..23241ab
> >>--- /dev/null
> >>+++ b/arch/arm/boot/dts/kirkwood-dns325.dts
> >>@@ -0,0 +1,24 @@
> >>+/dts-v1/;
> >>+
> >>+/include/ "kirkwood.dtsi"
> >>+
> >>+/ {
> >>+	model = "D-Link DNS-325 NAS (Rev A1)";
> >>+	compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood";
> >>+
> >>+	memory {
> >>+		device_type = "memory";
> >>+		reg = <0x00000000 0x10000000>;
> >>+	};
> >>+
> >>+	chosen {
> >>+		bootargs = "console=ttyS0,115200n8 earlyprintk";
> >>+	};
> >>+
> >>+	ocp at f1000000 {
> >>+		serial at 12000 {
> >>+			clock-frequency = <200000000>;
> >>+			status = "okay";
> >>+		};
> >>+	};
> >>+};
> >>diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> >>index 90ceab7..d594b6e 100644
> >>--- a/arch/arm/mach-kirkwood/Kconfig
> >>+++ b/arch/arm/mach-kirkwood/Kconfig
> >>@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT
> >> 	  Say 'Y' here if you want your kernel to support the
> >> 	  Marvell DreamPlug (Flattened Device Tree).
> >>
> >>+config MACH_DNSKW_DT
> >>+        bool
> >>+
> >>+config MACH_DNS320_DT
> >>+	bool "D-Link DNS-320 (Flattened Device Tree)"
> >>+	select ARCH_KIRKWOOD_DT
> >>+	select MACH_DNSKW_DT
> >>+	select CONFIG_MTD_OF_PARTS
> >>+	select CONFIG_SERIAL_OF_PLATFORM
> >
> >These two lines are dangerous.  It is not safe to 'select' Kconfig
> >symbols that have 'depends' constraints.  Otherwise, the symbol will
> >get forced on without it's dependencies.
> >
> >Typically other code handles this by creating blank "HAVE_*" symbols
> >that the needed symbol can do something like "default y if HAVE_*"
> >
> 
> Okay I didn't realise this, thanks. The options in question aren't
> hard dependencies per-se, but no serial or NAND support is probably a
> mistake, so added them here to avoid a certain amount of shooting in foot.
> 
> What's the etiquette in this situation? Adding HAVE_* seems excessive,
> would selecting them in kirkwood_defconfig make more sense? Or would it
> simply be covered by having a reasonable config on my website or suchlike?

The latter sounds good.  kirkwood_defconfig is in need of some love, and
I haven't had time to get to it.

> Jason, given you've already applied this patch, would you rather me
> submit something else to ditch these, or resumbit the entire series,
> combining feedback?

I only applied it locally, I was waiting for comments like this before
doing a pull request.  Go ahead and redo the series based on the input
and repost.  I'll replace what I have.

> 
> >>+	help
> >>+	  Say 'Y' here if you want your kernel to support the
> >>+	  D-Link DNS-320 NAS, using Flattened Device Tree.
> >>+
> >>+config MACH_DNS325_DT
> >>+	bool "D-Link DNS-325 (Flattened Device Tree)"
> >>+	select ARCH_KIRKWOOD_DT
> >>+	select MACH_DNSKW_DT
> >>+	select CONFIG_MTD_OF_PARTS
> >>+	select CONFIG_SERIAL_OF_PLATFORM
> >>+	help
> >>+	  Say 'Y' here if you want your kernel to support the
> >>+	  D-Link DNS-325 NAS, using Flattened Device Tree.
> >>+
> >
> >The *only* difference between these two configs is the .dtb file that
> >gets built.  Don't create a separate Kconfig entry for each dnskw
> >board.  Just build all the dnskw dtb files when MACH_DNSKW_DT is
> >selected.  Building .dtb files is cheap.
> >
> 
> The rationale for this is the code in dnskw.c is (hopefully!) temporary,
> and when it goes there isn't any need for MACH_DNSKW_DT either.
> 
> In a future land where everything has been converted to devicetree, what
> would be best? An option to "Build all kirkwood-based .dtb's", an option
> to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
> board? I've not got any strong opinion, so will reformat the above to
> whatever is considered best.

Based on Grant's comment, I'll probably be working towards a
MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
Perhaps this should be MACH_BUFFALO_DT?

> >> config MACH_TS219
> >> 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
> >> 	help
> >>diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> >>index e299a95..b092af5 100644
> >>--- a/arch/arm/mach-kirkwood/Makefile
> >>+++ b/arch/arm/mach-kirkwood/Makefile
> >>@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325)		+= t5325-setup.o
> >> obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
> >> obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
> >> obj-$(CONFIG_MACH_DREAMPLUG_DT)		+= board-dreamplug.o
> >>+obj-$(CONFIG_MACH_DNSKW_DT)		+= board-dnskw.o
> >>diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
> >>index 16f9385..9c5e45f 100644
> >>--- a/arch/arm/mach-kirkwood/Makefile.boot
> >>+++ b/arch/arm/mach-kirkwood/Makefile.boot
> >>@@ -3,3 +3,5 @@ params_phys-y	:= 0x00000100
> >> initrd_phys-y	:= 0x00800000
> >>
> >> dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
> >>+dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb
> >>+dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
> >>diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
> >>new file mode 100644
> >>index 0000000..7cb7f6a
> >>--- /dev/null
> >>+++ b/arch/arm/mach-kirkwood/board-dnskw.c
> >>@@ -0,0 +1,306 @@
> >>+/*
> >>+ * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
> >>+ *
> >>+ * arch/arm/mach-kirkwood/board-dnskw.c
> >>+ *
> >>+ * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
> >>+ * flattened device tree yet.
> >>+ *
> >>+ * This file is licensed under the terms of the GNU General Public
> >>+ * License version 2.  This program is licensed "as is" without any
> >>+ * warranty of any kind, whether express or implied.
> >>+ */
> >>+
> >>+#include <linux/kernel.h>
> >>+#include <linux/init.h>
> >>+#include <linux/platform_device.h>
> >>+#include <linux/i2c.h>
> >>+#include <linux/ata_platform.h>
> >>+#include <linux/mv643xx_eth.h>
> >>+#include <linux/of.h>
> >>+#include <linux/gpio.h>
> >>+#include <linux/input.h>
> >>+#include <linux/gpio_keys.h>
> >>+#include <linux/gpio-fan.h>
> >>+#include <linux/leds.h>
> >>+#include <linux/mtd/physmap.h>
> >>+#include <asm/mach-types.h>
> >>+#include <asm/mach/arch.h>
> >>+#include <asm/mach/map.h>
> >>+#include <mach/kirkwood.h>
> >>+#include <mach/bridge-regs.h>
> >>+#include "common.h"
> >>+#include "mpp.h"
> >>+
> >>+static struct mtd_partition dnskw_nand_parts[] = {
> >>+	{
> >>+		.name		= "u-boot",
> >>+		.offset		= 0,
> >>+		.size		= SZ_1M,
> >>+		.mask_flags	= MTD_WRITEABLE
> >>+	}, {
> >>+		.name		= "uImage",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	}, {
> >>+		.name		= "ramdisk",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	}, {
> >>+		.name		= "image",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 102 * SZ_1M
> >>+	}, {
> >>+		.name		= "mini firmware",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 10 * SZ_1M
> >>+	}, {
> >>+		.name		= "config",
> >>+		.offset		= MTDPART_OFS_NXTBLK,
> >>+		.size		= 5 * SZ_1M
> >>+	},
> >>+};
> >
> >This patch adds a static partition mapping, and then a later patch in
> >this same series removes it again.  Please don't do that.  Just squash
> >the patches together.  Or, if sqashing is not appropriate, then just
> >omit the partitions.
> >
> >I also suggest omiting similar data when there are patches already in
> >progess to do it properly.  It is okay for the inital support to go in
> >to be incomplete when enhancements will be ready soon.
> >
> 
> Noted. If the entire patchset needs resubmitting, I'll combine the patch
> that moves this definition to the .dtb

See my comment in my other reply, just don't add nand/partition support
in the beginning.

thx,

Jason.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-11  0:43           ` Jason Cooper
@ 2012-04-11 13:32               ` Jamie Lentin
  -1 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-11 13:32 UTC (permalink / raw)
  To: Jason Cooper
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, 11 Apr 2012 01:43:24 +0100, Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>  
wrote:

>> In a future land where everything has been converted to devicetree, what
>> would be best? An option to "Build all kirkwood-based .dtb's", an option
>> to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
>> board? I've not got any strong opinion, so will reformat the above to
>> whatever is considered best.
>
> Based on Grant's comment, I'll probably be working towards a
> MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
> Perhaps this should be MACH_BUFFALO_DT?
>

Thinking about it, MACH_DNSKW_DT would probably be best. Anything more  
general, e.g. MACH_DLINK_DNS_DT, would also cover the orion-based  
DNS-313/323/343. Presumably there will always be differences between  
kirkwood and orion5x?

Did you mean D-Link, or is there some relationship between Buffalo and  
D-link I'm not aware of? I know Conceptronic sold a ~identical device to  
the DNS-323, but not aware of anything else. You never know who truly  
makes the devices nowadays anyway.

-- 
Jamie Lentin

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-11 13:32               ` Jamie Lentin
  0 siblings, 0 replies; 50+ messages in thread
From: Jamie Lentin @ 2012-04-11 13:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 11 Apr 2012 01:43:24 +0100, Jason Cooper <jason@lakedaemon.net>  
wrote:

>> In a future land where everything has been converted to devicetree, what
>> would be best? An option to "Build all kirkwood-based .dtb's", an option
>> to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
>> board? I've not got any strong opinion, so will reformat the above to
>> whatever is considered best.
>
> Based on Grant's comment, I'll probably be working towards a
> MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
> Perhaps this should be MACH_BUFFALO_DT?
>

Thinking about it, MACH_DNSKW_DT would probably be best. Anything more  
general, e.g. MACH_DLINK_DNS_DT, would also cover the orion-based  
DNS-313/323/343. Presumably there will always be differences between  
kirkwood and orion5x?

Did you mean D-Link, or is there some relationship between Buffalo and  
D-link I'm not aware of? I know Conceptronic sold a ~identical device to  
the DNS-323, but not aware of anything else. You never know who truly  
makes the devices nowadays anyway.

-- 
Jamie Lentin

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-11 13:32               ` Jamie Lentin
@ 2012-04-11 14:11                   ` Jason Cooper
  -1 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11 14:11 UTC (permalink / raw)
  To: Jamie Lentin
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wed, Apr 11, 2012 at 02:32:34PM +0100, Jamie Lentin wrote:
> On Wed, 11 Apr 2012 01:43:24 +0100, Jason Cooper
> <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org> wrote:
> 
> >>In a future land where everything has been converted to devicetree, what
> >>would be best? An option to "Build all kirkwood-based .dtb's", an option
> >>to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
> >>board? I've not got any strong opinion, so will reformat the above to
> >>whatever is considered best.
> >
> >Based on Grant's comment, I'll probably be working towards a
> >MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
> >Perhaps this should be MACH_BUFFALO_DT?
> >
> 
> Thinking about it, MACH_DNSKW_DT would probably be best. Anything
> more general, e.g. MACH_DLINK_DNS_DT, would also cover the
> orion-based DNS-313/323/343. Presumably there will always be
> differences between kirkwood and orion5x?

Hmm, Well, I think I would prefer MACH_DLINK_KIRKWOOD_DT,
MACH_DLINK_ORION5X_DT.  This way, all the dtb's for a given manf/SoC are
built in one go, and the correct board-dt file is built as well.

So, in my case, I would do MACH_GLOBALSCALE_KIRKWOOD_DT, and
MACH_GLOBALSCALE_ARMADA_DT.

Grant, Arnd, sound sensible?

> Did you mean D-Link, or is there some relationship between Buffalo
> and D-link I'm not aware of? I know Conceptronic sold a ~identical
> device to the DNS-323, but not aware of anything else. You never
> know who truly makes the devices nowadays anyway.

Nope, just a momentary symlink'd /dev/brain -> /dev/random.  Fixed now,
thanks.

thx,

Jason.

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-11 14:11                   ` Jason Cooper
  0 siblings, 0 replies; 50+ messages in thread
From: Jason Cooper @ 2012-04-11 14:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 11, 2012 at 02:32:34PM +0100, Jamie Lentin wrote:
> On Wed, 11 Apr 2012 01:43:24 +0100, Jason Cooper
> <jason@lakedaemon.net> wrote:
> 
> >>In a future land where everything has been converted to devicetree, what
> >>would be best? An option to "Build all kirkwood-based .dtb's", an option
> >>to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each
> >>board? I've not got any strong opinion, so will reformat the above to
> >>whatever is considered best.
> >
> >Based on Grant's comment, I'll probably be working towards a
> >MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc.
> >Perhaps this should be MACH_BUFFALO_DT?
> >
> 
> Thinking about it, MACH_DNSKW_DT would probably be best. Anything
> more general, e.g. MACH_DLINK_DNS_DT, would also cover the
> orion-based DNS-313/323/343. Presumably there will always be
> differences between kirkwood and orion5x?

Hmm, Well, I think I would prefer MACH_DLINK_KIRKWOOD_DT,
MACH_DLINK_ORION5X_DT.  This way, all the dtb's for a given manf/SoC are
built in one go, and the correct board-dt file is built as well.

So, in my case, I would do MACH_GLOBALSCALE_KIRKWOOD_DT, and
MACH_GLOBALSCALE_ARMADA_DT.

Grant, Arnd, sound sensible?

> Did you mean D-Link, or is there some relationship between Buffalo
> and D-link I'm not aware of? I know Conceptronic sold a ~identical
> device to the DNS-323, but not aware of anything else. You never
> know who truly makes the devices nowadays anyway.

Nope, just a momentary symlink'd /dev/brain -> /dev/random.  Fixed now,
thanks.

thx,

Jason.

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

* Re: [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
  2012-04-11 14:11                   ` Jason Cooper
@ 2012-04-11 15:08                       ` Arnd Bergmann
  -1 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-11 15:08 UTC (permalink / raw)
  To: Jason Cooper
  Cc: Jamie Lentin, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

On Wednesday 11 April 2012, Jason Cooper wrote:
> > Thinking about it, MACH_DNSKW_DT would probably be best. Anything
> > more general, e.g. MACH_DLINK_DNS_DT, would also cover the
> > orion-based DNS-313/323/343. Presumably there will always be
> > differences between kirkwood and orion5x?
> 
> Hmm, Well, I think I would prefer MACH_DLINK_KIRKWOOD_DT,
> MACH_DLINK_ORION5X_DT.  This way, all the dtb's for a given manf/SoC are
> built in one go, and the correct board-dt file is built as well.
> 
> So, in my case, I would do MACH_GLOBALSCALE_KIRKWOOD_DT, and
> MACH_GLOBALSCALE_ARMADA_DT.
> 
> Grant, Arnd, sound sensible?

I think it's fine, I just don't spend too much time on the naming
when the goal is to eventually just have one config option for
all manufacturers.

	Arnd

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

* [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325
@ 2012-04-11 15:08                       ` Arnd Bergmann
  0 siblings, 0 replies; 50+ messages in thread
From: Arnd Bergmann @ 2012-04-11 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 11 April 2012, Jason Cooper wrote:
> > Thinking about it, MACH_DNSKW_DT would probably be best. Anything
> > more general, e.g. MACH_DLINK_DNS_DT, would also cover the
> > orion-based DNS-313/323/343. Presumably there will always be
> > differences between kirkwood and orion5x?
> 
> Hmm, Well, I think I would prefer MACH_DLINK_KIRKWOOD_DT,
> MACH_DLINK_ORION5X_DT.  This way, all the dtb's for a given manf/SoC are
> built in one go, and the correct board-dt file is built as well.
> 
> So, in my case, I would do MACH_GLOBALSCALE_KIRKWOOD_DT, and
> MACH_GLOBALSCALE_ARMADA_DT.
> 
> Grant, Arnd, sound sensible?

I think it's fine, I just don't spend too much time on the naming
when the goal is to eventually just have one config option for
all manufacturers.

	Arnd

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

end of thread, other threads:[~2012-04-11 15:08 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-27 21:54 [PATCH V3 0/5] Add support for DNS-320 and DNS-325 using devicetree Jamie Lentin
2012-03-27 21:54 ` Jamie Lentin
2012-03-27 21:54 ` [PATCH V3 1/5] ARM: kirkwood: Basic support for DNS-320 and DNS-325 Jamie Lentin
2012-03-27 21:54   ` Jamie Lentin
     [not found]   ` <1332885255-8304-2-git-send-email-jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
2012-03-28  8:19     ` Arnd Bergmann
2012-03-28  8:19       ` Arnd Bergmann
2012-04-06 23:43       ` Grant Likely
2012-04-06 23:43         ` Grant Likely
2012-04-09 14:09         ` Arnd Bergmann
2012-04-09 14:09           ` Arnd Bergmann
     [not found]           ` <201204091409.04927.arnd-r2nGTMty4D4@public.gmane.org>
2012-04-09 14:20             ` Jamie Lentin
2012-04-09 14:20               ` Jamie Lentin
     [not found]               ` <alpine.DEB.2.00.1204091513250.23719-5X291BYdrx55rAo4AelP/Ydd74u8MsAO@public.gmane.org>
2012-04-09 15:01                 ` Arnd Bergmann
2012-04-09 15:01                   ` Arnd Bergmann
2012-03-31  1:30     ` Jason Cooper
2012-03-31  1:30       ` Jason Cooper
2012-04-06 23:49   ` Grant Likely
2012-04-06 23:49     ` Grant Likely
2012-04-09 13:20     ` Jamie Lentin
2012-04-09 13:20       ` Jamie Lentin
     [not found]       ` <alpine.DEB.2.00.1204091418400.23719-5X291BYdrx55rAo4AelP/Ydd74u8MsAO@public.gmane.org>
2012-04-09 14:14         ` Arnd Bergmann
2012-04-09 14:14           ` Arnd Bergmann
2012-04-11  0:43         ` Jason Cooper
2012-04-11  0:43           ` Jason Cooper
     [not found]           ` <20120411004324.GB14790-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2012-04-11 13:32             ` Jamie Lentin
2012-04-11 13:32               ` Jamie Lentin
     [not found]               ` <op.wclrwkqi4cuzmg-x9DHNcFvAEtNwP/n92qj9LVCufUGDwFn@public.gmane.org>
2012-04-11 14:11                 ` Jason Cooper
2012-04-11 14:11                   ` Jason Cooper
     [not found]                   ` <20120411141118.GG14790-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2012-04-11 15:08                     ` Arnd Bergmann
2012-04-11 15:08                       ` Arnd Bergmann
2012-04-09 21:27     ` Russell King - ARM Linux
2012-04-09 21:27       ` Russell King - ARM Linux
2012-04-11  0:35     ` Jason Cooper
2012-04-11  0:35       ` Jason Cooper
2012-03-27 21:54 ` [PATCH V3 2/5] mtd: Add orion_nand devicetree bindings Jamie Lentin
2012-03-27 21:54   ` Jamie Lentin
2012-03-28 23:04   ` Grant Likely
2012-03-28 23:04     ` Grant Likely
     [not found] ` <1332885255-8304-1-git-send-email-jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
2012-03-27 21:54   ` [PATCH V3 3/5] ARM: kirkwood: Allow nand to be configured via. devicetree Jamie Lentin
2012-03-27 21:54     ` Jamie Lentin
2012-03-27 21:54 ` [PATCH V3 4/5] ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt Jamie Lentin
2012-03-27 21:54   ` Jamie Lentin
2012-03-27 21:54 ` [PATCH V3 5/5] mtd: Move fdt partition documentation to a seperate file Jamie Lentin
2012-03-27 21:54   ` Jamie Lentin
2012-03-28  8:17   ` Arnd Bergmann
2012-03-28  8:17     ` Arnd Bergmann
2012-03-28 23:08     ` Grant Likely
2012-03-28 23:08       ` Grant Likely
     [not found]   ` <1332885255-8304-6-git-send-email-jm-Pj/HzkgeCk7QXOPxS62xeg@public.gmane.org>
2012-03-28 14:41     ` Jason Cooper
2012-03-28 14:41       ` Jason Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.