Skip to contentSkip to conversation

Add DT support for Network Space v2 and parents

PATCH New Simon Guinot 4 participants 20 messages Oct 15, 2012 – Oct 16, 2012

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

cover Add DT support for Network Space v2 and parents

This patch series provides DT support for LaCie NAS Network Space v2 and parents. This includes the following machines:
- Internet Space v2
- Network Space v2
- Network Space Max v2
- Network Space Lite v2
- Network Space Mini v2

Note that the three first boards are already supported by the Linux kernel via an "old-fashion" board setup. The two lasts (Lite and Mini) are new boards.

Also note that the first patch of the series is related with the LED subsystem. It adds device tree binding to the driver leds-ns2.

Simon Guinot (4):
leds: leds-ns2: add device tree binding
ARM: kirkwood: DT board setup for Network Space v2 and parents
ARM: kirkwood: DT board setup for Network Space Lite v2
ARM: kirkwood: DT board setup for Network Space Mini v2

 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 arch/arm/boot/dts/Makefile                         |    5 ++
 arch/arm/boot/dts/kirkwood-is2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   63 ++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts              |   49 +++++++++++
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   49 +++++++++++
 arch/arm/mach-kirkwood/Kconfig                     |   36 ++++++++
 arch/arm/mach-kirkwood/Makefile                    |    5 ++
 arch/arm/mach-kirkwood/board-dt.c                  |   12 +++
 arch/arm/mach-kirkwood/board-ns2.c                 |   87 ++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h                    |   10 +++
 drivers/leds/Kconfig                               |    4 +-
 drivers/leds/leds-ns2.c                            |   84 ++++++++++++++++++-
 15 files changed, 516 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2lite.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2mini.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

---
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 drivers/leds/leds-ns2.c                            |   84 +++++++++++++++++++-
 2 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +26 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.
+
+Example:
+
+ns2-leds {
+	compatible = "ns2-leds";
+
+	blue-sata {
+		label = "ns2:blue:sata";
+		slow-gpio = <&gpio0 29 0>;
+		cmd-gpio = <&gpio0 30 0>;
+	};
+};
drivers/leds/leds-ns2.c +81 -3

112 lines not on this page · raw message

Signature · 1 line
1.7.10
#2 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 74 lines · Simon Guinot
---
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 drivers/leds/leds-ns2.c                            |   84 +++++++++++++++++++-
 2 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +26 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.
+
+Example:
+
+ns2-leds {
+	compatible = "ns2-leds";
+
+	blue-sata {
+		label = "ns2:blue:sata";
+		slow-gpio = <&gpio0 29 0>;
+		cmd-gpio = <&gpio0 30 0>;
+	};
+};
drivers/leds/leds-ns2.c +20 -0
index d176ec8..55d199b 100644
@@ -30,6 +30,7 @@
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/platform_data/leds-kirkwood-ns2.h>
+#include <linux/of_gpio.h>
 
 /*
  * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in
@@ -263,6 +264,68 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
 	gpio_free(led_dat->slow);
 }
 
+#ifdef CONFIG_OF_GPIO
+/*
+ * Translate OpenFirmware node properties into platform_data.
+ */
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	struct ns2_led *leds;
+	int num_leds = 0;
+	int i = 0;
+
+	num_leds = of_get_child_count(np);
+	if (!num_leds)
+		return -ENODEV;
+
+	leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led),
+			    GFP_KERNEL);

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 295

Quoted 10 lines
drivers/leds/leds-ns2.c +10 -0
+	if (!leds)
+		return -ENOMEM;
+
+	for_each_child_of_node(np, child) {
+		const char *string;
+		int ret;
+
+		ret = of_get_named_gpio(child, "cmd-gpio", 0);
+		if (ret < 0)
+			return ret;

free leds?

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 299

Quoted 4 lines
drivers/leds/leds-ns2.c +4 -0
+		leds[i].cmd = ret;
+		ret = of_get_named_gpio(child, "slow-gpio", 0);
+		if (ret < 0)
+			return ret;

same here.

Quoted 9 lines
drivers/leds/leds-ns2.c +9 -0
+		leds[i].slow = ret;
+		ret = of_property_read_string(child, "label", &string);
+		leds[i].name = (ret == 0) ? string : child->name;
+		ret = of_property_read_string(child, "linux,default-trigger",
+					      &string);
+		if (ret == 0)
+			leds[i].default_trigger = string;
+
+		i++;

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 318

Quoted 10 lines
drivers/leds/leds-ns2.c +10 -0
+	}
+
+	pdata->leds = leds;
+	pdata->num_leds = num_leds;
+
+	return 0;
+}
+
+static const struct of_device_id of_ns2_leds_match[] = {
+	{ .compatible = "ns2-leds", },

Is this LaCie-specific? eg "lacie,ns2-leds"?

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 327

Quoted 9 lines
drivers/leds/leds-ns2.c +9 -0
+	{},
+};
+#else
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_OF_GPIO */

The above doesn't look right to me. The only time ns2_leds_get_of_pdata() gets called is when OF_GPIO is enabled. You should be able to remove the #else block.

Quoted 32 lines
drivers/leds/leds-ns2.c +16 -1
+
 static int __devinit ns2_led_probe(struct platform_device *pdev)
 {
 	struct ns2_led_platform_data *pdata = pdev->dev.platform_data;
@@ -270,11 +333,25 @@ static int __devinit ns2_led_probe(struct platform_device *pdev)
 	int i;
 	int ret;
 
+#ifdef CONFIG_OF_GPIO
+	if (!pdata) {
+		pdata = devm_kzalloc(&pdev->dev,
+				     sizeof(struct ns2_led_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+
+		ret = ns2_leds_get_of_pdata(&pdev->dev, pdata);
+		if (ret)
+			return ret;
+	}
+#else
 	if (!pdata)
 		return -EINVAL;
+#endif /* CONFIG_OF_GPIO */
 
 	leds_data = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_data) *
-			    pdata->num_leds, GFP_KERNEL);
+				 pdata->num_leds, GFP_KERNEL);
 	if (!leds_data)
 		return -ENOMEM;
 

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 393

Quoted 7 lines
drivers/leds/leds-ns2.c +2 -2
@@ -312,8 +389,9 @@ static struct platform_driver ns2_led_driver = {
 	.probe		= ns2_led_probe,
 	.remove		= __devexit_p(ns2_led_remove),
 	.driver		= {
-		.name	= "leds-ns2",
-		.owner	= THIS_MODULE,
+		.name		= "leds-ns2",
+		.owner		= THIS_MODULE,

nit. whitespace before '=', above two lines.

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 394

Quoted 1 line
drivers/leds/leds-ns2.c +1 -0
+		.of_match_table	= of_match_ptr(of_ns2_leds_match),

Have you tried this with OF_GPIO=n? of_match_ptr() handles CONFIG_OF being enabled/disabled. Which means the case of CONFIG_OF=y, CONFIG_OF_GPIO=n appears to be unhandled.

thx,

Jason.

Quoted 6 lines
drivers/leds/leds-ns2.c +0 -0
 	},
 };
 
Signature · 1 line
1.7.10
#3 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 79 lines · Jason Cooper
Quoted 78 lines · Simon Guinot
---
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 drivers/leds/leds-ns2.c                            |   84 +++++++++++++++++++-
 2 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +26 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.
+
+Example:
+
+ns2-leds {
+	compatible = "ns2-leds";
+
+	blue-sata {
+		label = "ns2:blue:sata";
+		slow-gpio = <&gpio0 29 0>;
+		cmd-gpio = <&gpio0 30 0>;
+	};
+};
drivers/leds/leds-ns2.c +24 -0
index d176ec8..55d199b 100644
@@ -30,6 +30,7 @@
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/platform_data/leds-kirkwood-ns2.h>
+#include <linux/of_gpio.h>
 
 /*
  * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in
@@ -263,6 +264,68 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
 	gpio_free(led_dat->slow);
 }
 
+#ifdef CONFIG_OF_GPIO
+/*
+ * Translate OpenFirmware node properties into platform_data.
+ */
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	struct ns2_led *leds;
+	int num_leds = 0;
+	int i = 0;
+
+	num_leds = of_get_child_count(np);
+	if (!num_leds)
+		return -ENODEV;
+
+	leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led),
+			    GFP_KERNEL);
+	if (!leds)
+		return -ENOMEM;
+
+	for_each_child_of_node(np, child) {
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 295

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+		const char *string;
+		int ret;
+
+		ret = of_get_named_gpio(child, "cmd-gpio", 0);
+		if (ret < 0)
+			return ret;

free leds?

Maybe I missed something but I though it was the purpose of using devres function as devm_kzalloc.

Quoted 21 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 299

Quoted 5 lines
drivers/leds/leds-ns2.c +4 -0
+		leds[i].cmd = ret;
+		ret = of_get_named_gpio(child, "slow-gpio", 0);
+		if (ret < 0)
+			return ret;

same here.

Quoted 13 lines
drivers/leds/leds-ns2.c +13 -0
+		leds[i].slow = ret;
+		ret = of_property_read_string(child, "label", &string);
+		leds[i].name = (ret == 0) ? string : child->name;
+		ret = of_property_read_string(child, "linux,default-trigger",
+					      &string);
+		if (ret == 0)
+			leds[i].default_trigger = string;
+
+		i++;
+	}
+
+	pdata->leds = leds;
+	pdata->num_leds = num_leds;
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 318

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+
+	return 0;
+}
+
+static const struct of_device_id of_ns2_leds_match[] = {
+	{ .compatible = "ns2-leds", },

Is this LaCie-specific? eg "lacie,ns2-leds"?

Yes I think it is LaCie specific.

Quoted 14 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 327

Quoted 10 lines
drivers/leds/leds-ns2.c +9 -0
+	{},
+};
+#else
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_OF_GPIO */

The above doesn't look right to me. The only time ns2_leds_get_of_pdata() gets called is when OF_GPIO is enabled. You should be able to remove the #else block.

Yes you are right.

Quoted 32 lines
Quoted 32 lines
drivers/leds/leds-ns2.c +16 -1
+
 static int __devinit ns2_led_probe(struct platform_device *pdev)
 {
 	struct ns2_led_platform_data *pdata = pdev->dev.platform_data;
@@ -270,11 +333,25 @@ static int __devinit ns2_led_probe(struct platform_device *pdev)
 	int i;
 	int ret;
 
+#ifdef CONFIG_OF_GPIO
+	if (!pdata) {
+		pdata = devm_kzalloc(&pdev->dev,
+				     sizeof(struct ns2_led_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+
+		ret = ns2_leds_get_of_pdata(&pdev->dev, pdata);
+		if (ret)
+			return ret;
+	}
+#else
 	if (!pdata)
 		return -EINVAL;
+#endif /* CONFIG_OF_GPIO */
 
 	leds_data = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_data) *
-			    pdata->num_leds, GFP_KERNEL);
+				 pdata->num_leds, GFP_KERNEL);
 	if (!leds_data)
 		return -ENOMEM;
 
Quoted 10 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 393

Quoted 8 lines
drivers/leds/leds-ns2.c +2 -2
@@ -312,8 +389,9 @@ static struct platform_driver ns2_led_driver = {
 	.probe		= ns2_led_probe,
 	.remove		= __devexit_p(ns2_led_remove),
 	.driver		= {
-		.name	= "leds-ns2",
-		.owner	= THIS_MODULE,
+		.name		= "leds-ns2",
+		.owner		= THIS_MODULE,

nit. whitespace before '=', above two lines.

Sorry I don't get it. For the two lines before, I used two tabs before '='. As a result, this lines are aligned with the next one. I got no warnings and no errors from checkpatch.pl.

Quoted 6 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 394

Quoted 2 lines
drivers/leds/leds-ns2.c +1 -0
+		.of_match_table	= of_match_ptr(of_ns2_leds_match),

Have you tried this with OF_GPIO=n? of_match_ptr() handles CONFIG_OF being enabled/disabled. Which means the case of CONFIG_OF=y, CONFIG_OF_GPIO=n appears to be unhandled.

Good caught. I guess I have just copied a bug from the driver gpio-fan.

Thank you for the review.

Simon

Quoted 8 lines

thx,

Jason.

Quoted 3 lines
drivers/leds/leds-ns2.c +0 -0
 	},
 };
 
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
1.7.10

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121015/f4add623/attachment.sig>

#4 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 89 lines · Simon Guinot
Quoted 79 lines · Jason Cooper
Quoted 78 lines · Simon Guinot
---
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 drivers/leds/leds-ns2.c                            |   84 +++++++++++++++++++-
 2 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +26 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.
+
+Example:
+
+ns2-leds {
+	compatible = "ns2-leds";
+
+	blue-sata {
+		label = "ns2:blue:sata";
+		slow-gpio = <&gpio0 29 0>;
+		cmd-gpio = <&gpio0 30 0>;
+	};
+};
drivers/leds/leds-ns2.c +24 -0
index d176ec8..55d199b 100644
@@ -30,6 +30,7 @@
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/platform_data/leds-kirkwood-ns2.h>
+#include <linux/of_gpio.h>
 
 /*
  * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in
@@ -263,6 +264,68 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
 	gpio_free(led_dat->slow);
 }
 
+#ifdef CONFIG_OF_GPIO
+/*
+ * Translate OpenFirmware node properties into platform_data.
+ */
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	struct ns2_led *leds;
+	int num_leds = 0;
+	int i = 0;
+
+	num_leds = of_get_child_count(np);
+	if (!num_leds)
+		return -ENODEV;
+
+	leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led),
+			    GFP_KERNEL);
+	if (!leds)
+		return -ENOMEM;
+
+	for_each_child_of_node(np, child) {
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 295

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+		const char *string;
+		int ret;
+
+		ret = of_get_named_gpio(child, "cmd-gpio", 0);
+		if (ret < 0)
+			return ret;

free leds?

Quoted 2 lines

Maybe I missed something but I though it was the purpose of using devres function as devm_kzalloc.

You are correct. alloc/return involks a visceral reaction, akin to a bull seeing red, my mistake. :-)

Quoted 31 lines
Quoted 22 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 299

Quoted 6 lines
drivers/leds/leds-ns2.c +4 -0
+		leds[i].cmd = ret;
+		ret = of_get_named_gpio(child, "slow-gpio", 0);
+		if (ret < 0)
+			return ret;

same here.

Quoted 13 lines
drivers/leds/leds-ns2.c +13 -0
+		leds[i].slow = ret;
+		ret = of_property_read_string(child, "label", &string);
+		leds[i].name = (ret == 0) ? string : child->name;
+		ret = of_property_read_string(child, "linux,default-trigger",
+					      &string);
+		if (ret == 0)
+			leds[i].default_trigger = string;
+
+		i++;
+	}
+
+	pdata->leds = leds;
+	pdata->num_leds = num_leds;
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 318

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+
+	return 0;
+}
+
+static const struct of_device_id of_ns2_leds_match[] = {
+	{ .compatible = "ns2-leds", },

Is this LaCie-specific? eg "lacie,ns2-leds"?

Quoted 1 line

Yes I think it is LaCie specific.

Ok, please change.

Quoted 61 lines
Quoted 15 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 327

Quoted 11 lines
drivers/leds/leds-ns2.c +9 -0
+	{},
+};
+#else
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_OF_GPIO */

The above doesn't look right to me. The only time ns2_leds_get_of_pdata() gets called is when OF_GPIO is enabled. You should be able to remove the #else block.

Yes you are right.

Quoted 32 lines
Quoted 32 lines
drivers/leds/leds-ns2.c +16 -1
+
 static int __devinit ns2_led_probe(struct platform_device *pdev)
 {
 	struct ns2_led_platform_data *pdata = pdev->dev.platform_data;
@@ -270,11 +333,25 @@ static int __devinit ns2_led_probe(struct platform_device *pdev)
 	int i;
 	int ret;
 
+#ifdef CONFIG_OF_GPIO
+	if (!pdata) {
+		pdata = devm_kzalloc(&pdev->dev,
+				     sizeof(struct ns2_led_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+
+		ret = ns2_leds_get_of_pdata(&pdev->dev, pdata);
+		if (ret)
+			return ret;
+	}
+#else
 	if (!pdata)
 		return -EINVAL;
+#endif /* CONFIG_OF_GPIO */
 
 	leds_data = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_data) *
-			    pdata->num_leds, GFP_KERNEL);
+				 pdata->num_leds, GFP_KERNEL);
 	if (!leds_data)
 		return -ENOMEM;
 
Quoted 10 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 393

Quoted 8 lines
drivers/leds/leds-ns2.c +2 -2
@@ -312,8 +389,9 @@ static struct platform_driver ns2_led_driver = {
 	.probe		= ns2_led_probe,
 	.remove		= __devexit_p(ns2_led_remove),
 	.driver		= {
-		.name	= "leds-ns2",
-		.owner	= THIS_MODULE,
+		.name		= "leds-ns2",
+		.owner		= THIS_MODULE,

nit. whitespace before '=', above two lines.

Quoted 3 lines

Sorry I don't get it. For the two lines before, I used two tabs before '='. As a result, this lines are aligned with the next one. I got no warnings and no errors from checkpatch.pl.

It's not a checkpatch problem. It's that before your patch, the equals signs were lined up. Afterwards, they aren't. In either case, if you would like to fix the whitespace (line up all struct elements and the equals signs), that should be a separate patch.

Quoted 9 lines
Quoted 7 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 394

Quoted 3 lines
drivers/leds/leds-ns2.c +1 -0
+		.of_match_table	= of_match_ptr(of_ns2_leds_match),

Have you tried this with OF_GPIO=n? of_match_ptr() handles CONFIG_OF being enabled/disabled. Which means the case of CONFIG_OF=y, CONFIG_OF_GPIO=n appears to be unhandled.

Good caught. I guess I have just copied a bug from the driver gpio-fan.

On the next round, please add a separate patch fixing gpio-fan.c.

There shouldn't be any harm in moving the struct of_device_id {} outside of the #ifdef and just above the struct platform_driver {} declaration. That would maintain the convention. _probe() will just return -EINVAL if OF_GPIO isn't enabled (without pdata, of course).

thx,

Jason.

#5 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 192 lines · Jason Cooper
Quoted 89 lines · Simon Guinot
Quoted 79 lines · Jason Cooper
Quoted 78 lines · Simon Guinot
---
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 drivers/leds/leds-ns2.c                            |   84 +++++++++++++++++++-
 2 files changed, 107 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +26 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.
+
+Example:
+
+ns2-leds {
+	compatible = "ns2-leds";
+
+	blue-sata {
+		label = "ns2:blue:sata";
+		slow-gpio = <&gpio0 29 0>;
+		cmd-gpio = <&gpio0 30 0>;
+	};
+};
drivers/leds/leds-ns2.c +24 -0
index d176ec8..55d199b 100644
@@ -30,6 +30,7 @@
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/platform_data/leds-kirkwood-ns2.h>
+#include <linux/of_gpio.h>
 
 /*
  * The Network Space v2 dual-GPIO LED is wired to a CPLD and can blink in
@@ -263,6 +264,68 @@ static void delete_ns2_led(struct ns2_led_data *led_dat)
 	gpio_free(led_dat->slow);
 }
 
+#ifdef CONFIG_OF_GPIO
+/*
+ * Translate OpenFirmware node properties into platform_data.
+ */
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	struct ns2_led *leds;
+	int num_leds = 0;
+	int i = 0;
+
+	num_leds = of_get_child_count(np);
+	if (!num_leds)
+		return -ENODEV;
+
+	leds = devm_kzalloc(dev, num_leds * sizeof(struct ns2_led),
+			    GFP_KERNEL);
+	if (!leds)
+		return -ENOMEM;
+
+	for_each_child_of_node(np, child) {
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 295

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+		const char *string;
+		int ret;
+
+		ret = of_get_named_gpio(child, "cmd-gpio", 0);
+		if (ret < 0)
+			return ret;

free leds?

Quoted 2 lines

Maybe I missed something but I though it was the purpose of using devres function as devm_kzalloc.

You are correct. alloc/return involks a visceral reaction, akin to a bull seeing red, my mistake. :-)

Quoted 31 lines
Quoted 22 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 299

Quoted 6 lines
drivers/leds/leds-ns2.c +4 -0
+		leds[i].cmd = ret;
+		ret = of_get_named_gpio(child, "slow-gpio", 0);
+		if (ret < 0)
+			return ret;

same here.

Quoted 13 lines
drivers/leds/leds-ns2.c +13 -0
+		leds[i].slow = ret;
+		ret = of_property_read_string(child, "label", &string);
+		leds[i].name = (ret == 0) ? string : child->name;
+		ret = of_property_read_string(child, "linux,default-trigger",
+					      &string);
+		if (ret == 0)
+			leds[i].default_trigger = string;
+
+		i++;
+	}
+
+	pdata->leds = leds;
+	pdata->num_leds = num_leds;
Quoted 8 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 318

Quoted 6 lines
drivers/leds/leds-ns2.c +6 -0
+
+	return 0;
+}
+
+static const struct of_device_id of_ns2_leds_match[] = {
+	{ .compatible = "ns2-leds", },

Is this LaCie-specific? eg "lacie,ns2-leds"?

Quoted 1 line

Yes I think it is LaCie specific.

Ok, please change.

Quoted 61 lines
Quoted 15 lines

drivers/leds/leds-ns2.c static void delete_ns2_led(struct ns2_led_data *led_dat) · line 327

Quoted 11 lines
drivers/leds/leds-ns2.c +9 -0
+	{},
+};
+#else
+static int __devinit
+ns2_leds_get_of_pdata(struct device *dev, struct ns2_led_platform_data *pdata)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_OF_GPIO */

The above doesn't look right to me. The only time ns2_leds_get_of_pdata() gets called is when OF_GPIO is enabled. You should be able to remove the #else block.

Yes you are right.

Quoted 42 lines
Quoted 33 lines
drivers/leds/leds-ns2.c +16 -1
+
 static int __devinit ns2_led_probe(struct platform_device *pdev)
 {
 	struct ns2_led_platform_data *pdata = pdev->dev.platform_data;
@@ -270,11 +333,25 @@ static int __devinit ns2_led_probe(struct platform_device *pdev)
 	int i;
 	int ret;
 
+#ifdef CONFIG_OF_GPIO
+	if (!pdata) {
+		pdata = devm_kzalloc(&pdev->dev,
+				     sizeof(struct ns2_led_platform_data),
+				     GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+
+		ret = ns2_leds_get_of_pdata(&pdev->dev, pdata);
+		if (ret)
+			return ret;
+	}
+#else
 	if (!pdata)
 		return -EINVAL;
+#endif /* CONFIG_OF_GPIO */
 
 	leds_data = devm_kzalloc(&pdev->dev, sizeof(struct ns2_led_data) *
-			    pdata->num_leds, GFP_KERNEL);
+				 pdata->num_leds, GFP_KERNEL);
 	if (!leds_data)
 		return -ENOMEM;
 

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 393

Quoted 7 lines
drivers/leds/leds-ns2.c +2 -2
@@ -312,8 +389,9 @@ static struct platform_driver ns2_led_driver = {
 	.probe		= ns2_led_probe,
 	.remove		= __devexit_p(ns2_led_remove),
 	.driver		= {
-		.name	= "leds-ns2",
-		.owner	= THIS_MODULE,
+		.name		= "leds-ns2",
+		.owner		= THIS_MODULE,

nit. whitespace before '=', above two lines.

Quoted 8 lines
Quoted 3 lines

Sorry I don't get it. For the two lines before, I used two tabs before '='. As a result, this lines are aligned with the next one. I got no warnings and no errors from checkpatch.pl.

It's not a checkpatch problem. It's that before your patch, the equals signs were lined up. Afterwards, they aren't. In either case, if you would like to fix the whitespace (line up all struct elements and the equals signs), that should be a separate patch.

The current patch inserts a new field (of_match_table) in the structure. This new field breaks the equals signs alignment. I think it is correct to restore the alignment broken by a patch in the same patch context.

Do you really want me to put this in a separate patch ?

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 394

Quoted 4 lines
drivers/leds/leds-ns2.c +1 -0
+		.of_match_table	= of_match_ptr(of_ns2_leds_match),

Have you tried this with OF_GPIO=n? of_match_ptr() handles CONFIG_OF being enabled/disabled. Which means the case of CONFIG_OF=y, CONFIG_OF_GPIO=n appears to be unhandled.

Quoted 3 lines
Quoted 1 line

Good caught. I guess I have just copied a bug from the driver gpio-fan.

On the next round, please add a separate patch fixing gpio-fan.c.

After a second look, I noticed that several drivers are also mixing up CONFIG_OF and CONFIG_OF_GPIO checks: gpio-fan, leds-gpio, gpio_keys.c, i2c-gpio.c, spi-s3c64xx.c, ...

I also noticed that CONFIG_OF_GPIO can't be selected separately from CONFIG_OF. From Kconfig, CONFIG_OF implies CONFIG_OF_GPIO.

So, I am no longer convinced we have a bug here. But if there is, we will need more than a single patch to fix it :)

Let me know your advice about that.

Simon

Quoted 8 lines

There shouldn't be any harm in moving the struct of_device_id {} outside of the #ifdef and just above the struct platform_driver {} declaration. That would maintain the convention. _probe() will just return -EINVAL if OF_GPIO isn't enabled (without pdata, of course).

thx,

Quoted 7 lines

Jason.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121016/2ce47165/attachment-0001.sig>

#6 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 4 lines · Simon Guinot
Quoted 3 lines · Jason Cooper
Quoted 2 lines · Simon Guinot
Quoted 1 line · Jason Cooper

On Mon, Oct 15, 2012 at 05:34:52PM +0200, Simon Guinot wrote:

...

Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 393

Quoted 8 lines
drivers/leds/leds-ns2.c +2 -2
@@ -312,8 +389,9 @@ static struct platform_driver ns2_led_driver = {
 	.probe		= ns2_led_probe,
 	.remove		= __devexit_p(ns2_led_remove),
 	.driver		= {
-		.name	= "leds-ns2",
-		.owner	= THIS_MODULE,
+		.name		= "leds-ns2",
+		.owner		= THIS_MODULE,

nit. whitespace before '=', above two lines.

Quoted 8 lines
Quoted 3 lines

Sorry I don't get it. For the two lines before, I used two tabs before '='. As a result, this lines are aligned with the next one. I got no warnings and no errors from checkpatch.pl.

It's not a checkpatch problem. It's that before your patch, the equals signs were lined up. Afterwards, they aren't. In either case, if you would like to fix the whitespace (line up all struct elements and the equals signs), that should be a separate patch.

Quoted 5 lines

The current patch inserts a new field (of_match_table) in the structure. This new field breaks the equals signs alignment. I think it is correct to restore the alignment broken by a patch in the same patch context.

Do you really want me to put this in a separate patch ?

Ok, I see what you were doing. No need for a separate patch.

Quoted 14 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

drivers/leds/leds-ns2.c static struct platform_driver ns2_led_driver = { · line 394

Quoted 1 line
drivers/leds/leds-ns2.c +1 -0
+		.of_match_table	= of_match_ptr(of_ns2_leds_match),

Have you tried this with OF_GPIO=n? of_match_ptr() handles CONFIG_OF being enabled/disabled. Which means the case of CONFIG_OF=y, CONFIG_OF_GPIO=n appears to be unhandled.

Good caught. I guess I have just copied a bug from the driver gpio-fan.

On the next round, please add a separate patch fixing gpio-fan.c.

After a second look, I noticed that several drivers are also mixing up CONFIG_OF and CONFIG_OF_GPIO checks: gpio-fan, leds-gpio, gpio_keys.c, i2c-gpio.c, spi-s3c64xx.c, ...

Quoted 5 lines

I also noticed that CONFIG_OF_GPIO can't be selected separately from CONFIG_OF. From Kconfig, CONFIG_OF implies CONFIG_OF_GPIO.

So, I am no longer convinced we have a bug here. But if there is, we will need more than a single patch to fix it :)

Agreed. I'd hate to see what happens if CONFIG_OF_GPIO was decoupled from CONFIG_OF. :-/ Once DT conversion has settled down, we'll have to look at removing it.

thx,

Jason.

maintainer
#7 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

In reply to Simon Guinot
Quoted 10 lines · Simon Guinot
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +4 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".

Documentation/devicetree/bindings/gpio/leds-ns2.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +10 -0
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.

Hi Simon,

I'm not overly familiar with the LED subsystem, but isn't this something that could be done with the generic gpio-led driver?

If not, is it possible to extend that driver in a way to make it possible and remove the leds-ns2 driver?

Arnd

#8 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · Simon Guinot
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +8 -0
new file mode 100644
index 0000000..1a84969
@@ -0,0 +1,26 @@
+Binding for dual-GPIO LED found on Network Space v2 (and parents).
+
+Required properties:
+- compatible: "ns2-leds".
+
+Each LED is represented as a sub-node of the ns2-leds device.
+
+Required sub-node properties:
Quoted 8 lines

Documentation/devicetree/bindings/gpio/leds-ns2.txt line 14

Quoted 6 lines
Documentation/devicetree/bindings/gpio/leds-ns2.txt new file +6 -0
+- cmd-gpio: Command LED GPIO. See OF device-tree GPIO specification.
+- slow-gpio: Slow LED GPIO. See OF device-tree GPIO specification.
+
+Optional sub-node properties:
+- label: Name for this LED. If omitted, the label is taken from the node name.
+- linux,default-trigger: Trigger assigned to the LED.

Hi Simon,

Hi Arnd,

Quoted 3 lines

I'm not overly familiar with the LED subsystem, but isn't this something that could be done with the generic gpio-led driver?

Basically, the leds-gpio driver allows to associate one pin to one LED. It is simple and efficient. The LED can be turned on or off. And using a platform callback (gpio_blink_set), some hardware timer blink can be enabled. A very few platforms are using this last callback.

On the ns2 (and other lacie machines), there is three different modes for the front blue LED: on, off and SATA activity blink. Three different pins are used to configure the LED. Definitively it is not compatible with the leds-gpio driver.

Quoted 3 lines

If not, is it possible to extend that driver in a way to make it possible and remove the leds-ns2 driver?

At the time I have written the leds-ns2 driver, I have failed to figure out how to merge it with the leds-gpio driver. I remember I thought that the best alternative was to add a new platform callback (maybe sata_blink_set). It _should_ be possible to control "on" and "off" with a single pin. The other pins could be contained inside the callback.

But there is a problem with this method. It is probably not DT compliant. Add a new platform or machine hook doesn't fit very well with the DT target on ARM. I mean remove the board setup files.

Please, let me know your advice.

Simon

Quoted 7 lines

Arnd

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121016/e63b6c2c/attachment.sig>

maintainer
#9 lore raw

PATCH 1/4 leds: leds-ns2: add device tree binding

Quoted 10 lines · Simon Guinot
Quoted 3 lines · Arnd Bergmann

I'm not overly familiar with the LED subsystem, but isn't this something that could be done with the generic gpio-led driver?

Basically, the leds-gpio driver allows to associate one pin to one LED. It is simple and efficient. The LED can be turned on or off. And using a platform callback (gpio_blink_set), some hardware timer blink can be enabled. A very few platforms are using this last callback.

Quoted 4 lines

On the ns2 (and other lacie machines), there is three different modes for the front blue LED: on, off and SATA activity blink. Three different pins are used to configure the LED. Definitively it is not compatible with the leds-gpio driver.

Ok, thanks for the explantion. I think your approach is fine then.

Arnd

#10 lore raw

PATCH 2/4 ARM: kirkwood: DT board setup for Network Space v2 and parents

In reply to Simon Guinot

This patch adds DT board setup for LaCie Network Space v2 and parents, based on the Marvell Kirkwood 6281 SoC. This includes Network Space v2 (Max) and Internet Space v2.

---
 arch/arm/boot/dts/Makefile                 |    3 +
 arch/arm/boot/dts/kirkwood-is2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   63 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts      |   49 ++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig             |   21 +++++++
 arch/arm/mach-kirkwood/Makefile            |    3 +
 arch/arm/mach-kirkwood/board-dt.c          |    8 +++
 arch/arm/mach-kirkwood/board-ns2.c         |   83 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    8 +++
 drivers/leds/Kconfig                       |    4 +-
 11 files changed, 301 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
arch/arm/boot/dts/Makefile +3 -0
index c1ce813..e6201b6 100644
@@ -34,9 +34,12 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-ib62x0.dtb \
 	kirkwood-iconnect.dtb \
 	kirkwood-iomega_ix2_200.dtb \
+	kirkwood-is2.dtb \
 	kirkwood-km_kirkwood.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
+	kirkwood-ns2.dtb \
+	kirkwood-ns2max.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
arch/arm/boot/dts/kirkwood-is2.dts new file +30 -0
new file mode 100644
index 0000000..7bc4677
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Internet Space v2";
+	compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2-common.dtsi new file +63 -0

63 lines not on this page · raw message

arch/arm/boot/dts/kirkwood-ns2.dts new file +30 -0
new file mode 100644
index 0000000..d018213
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space v2";
+	compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2max.dts new file +49 -0

49 lines not on this page · raw message

arch/arm/mach-kirkwood/Kconfig +21 -0
index 50bca50..847e0c2 100644
@@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
 
+config MACH_INETSPACE_V2_DT
+	bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Internet Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_V2_DT
+	bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_MAX_V2_DT
+	bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space Max v2 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
arch/arm/mach-kirkwood/Makefile +3 -0
index 294779f..1f63d80 100644
@@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
 obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
 obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
+obj-$(CONFIG_MACH_INETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
arch/arm/mach-kirkwood/board-dt.c +8 -0
index 70c5a28..b3e0519 100644
@@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("keymile,km_kirkwood"))
 		km_kirkwood_init();
 
+	if (of_machine_is_compatible("lacie,inetspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_max_v2"))
+		ns2_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = {
 	"buffalo,lsxl",
 	"iom,ix2-200",
 	"keymile,km_kirkwood",
+	"lacie,inetspace_v2",
+	"lacie,netspace_max_v2",
+	"lacie,netspace_v2",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-ns2.c new file +83 -0

83 lines not on this page · raw message

arch/arm/mach-kirkwood/common.h +8 -0
index bcffd7c..2f75f3f 100644
@@ -112,6 +112,14 @@ void km_kirkwood_init(void);
 static inline void km_kirkwood_init(void) {};
 #endif
 
+#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT)
+void ns2_init(void);
+#else
+static inline void ns2_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
drivers/leds/Kconfig +3 -1
index f508def..e455c08 100644
@@ -379,7 +379,9 @@ config LEDS_NS2
 	tristate "LED support for Network Space v2 GPIO LEDs"
 	depends on LEDS_CLASS
 	depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \
-		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2
+		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \
+		   MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \
+		   MACH_NETSPACE_MAX_V2_DT
 	default y
 	help
 	  This option enable support for the dual-GPIO LED found on the
Signature · 1 line
1.7.10
#11 lore raw

PATCH 2/4 ARM: kirkwood: DT board setup for Network Space v2 and parents

Quoted 6 lines · Simon Guinot

This patch adds DT board setup for LaCie Network Space v2 and parents, based on the Marvell Kirkwood 6281 SoC. This includes Network Space v2 (Max) and Internet Space v2.

---

It is not mentioned in the title but this patch is a v2. Here are the differences with v1:

- Rebased against Linux 3.7-rc1.
- Add missing Kconfig options MACH_INETSPACE_V2_DT and MACH_NETSPACE_MAX_V2_DT.
- Use ns2-leds DT binding.
- Move gpio-leds definition out from kirkwood-ns2-common.dtsi. The ns2 lite board (patch 3/4) uses a different configuration for GPIO LEDs.

Quoted 431 lines
 arch/arm/boot/dts/Makefile                 |    3 +
 arch/arm/boot/dts/kirkwood-is2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   63 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts      |   49 ++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig             |   21 +++++++
 arch/arm/mach-kirkwood/Makefile            |    3 +
 arch/arm/mach-kirkwood/board-dt.c          |    8 +++
 arch/arm/mach-kirkwood/board-ns2.c         |   83 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    8 +++
 drivers/leds/Kconfig                       |    4 +-
 11 files changed, 301 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
arch/arm/boot/dts/Makefile +3 -0
index c1ce813..e6201b6 100644
@@ -34,9 +34,12 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-ib62x0.dtb \
 	kirkwood-iconnect.dtb \
 	kirkwood-iomega_ix2_200.dtb \
+	kirkwood-is2.dtb \
 	kirkwood-km_kirkwood.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
+	kirkwood-ns2.dtb \
+	kirkwood-ns2max.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
arch/arm/boot/dts/kirkwood-is2.dts new file +30 -0
new file mode 100644
index 0000000..7bc4677
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Internet Space v2";
+	compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2-common.dtsi new file +63 -0
new file mode 100644
index 0000000..9bc6785
@@ -0,0 +1,63 @@
+/include/ "kirkwood.dtsi"
+
+/ {
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+
+		spi at 10600 {
+			status = "okay";
+
+			flash at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "mx25l4005a";
+				reg = <0>;
+				spi-max-frequency = <20000000>;
+				mode = <0>;
+
+				partition at 0 {
+					reg = <0x0 0x80000>;
+					label = "u-boot";
+				};
+			};
+		};
+
+		i2c at 11000 {
+			status = "okay";
+
+			eeprom at 50 {
+				compatible = "at,24c04";
+				pagesize = <16>;
+				reg = <0x50>;
+			};
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		button at 1 {
+			label = "Power push button";
+			linux,code = <116>;
+			gpios = <&gpio1 0 0>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		red-fail {
+			label = "ns2:red:fail";
+			gpios = <&gpio0 12 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2.dts new file +30 -0
new file mode 100644
index 0000000..d018213
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space v2";
+	compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2max.dts new file +49 -0
new file mode 100644
index 0000000..82156e2
@@ -0,0 +1,49 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space Max v2";
+	compatible = "lacie,netspace_max_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <2>;
+		};
+	};
+
+	gpio_fan {
+		compatible = "gpio-fan";
+		gpios = <&gpio0 22 1
+			 &gpio0  7 1
+			 &gpio1  1 1
+			 &gpio0 23 1>;
+		gpio-fan,speed-map =
+			<   0  0
+			 1500 15
+			 1700 14
+			 1800 13
+			 2100 12
+			 3100 11
+			 3300 10
+			 4300  9
+			 5500  8>;
+		alarm-gpios = <&gpio0 25 1>;
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/mach-kirkwood/Kconfig +21 -0
index 50bca50..847e0c2 100644
@@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
 
+config MACH_INETSPACE_V2_DT
+	bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Internet Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_V2_DT
+	bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_MAX_V2_DT
+	bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space Max v2 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
arch/arm/mach-kirkwood/Makefile +3 -0
index 294779f..1f63d80 100644
@@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
 obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
 obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
+obj-$(CONFIG_MACH_INETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
arch/arm/mach-kirkwood/board-dt.c +8 -0
index 70c5a28..b3e0519 100644
@@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("keymile,km_kirkwood"))
 		km_kirkwood_init();
 
+	if (of_machine_is_compatible("lacie,inetspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_max_v2"))
+		ns2_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = {
 	"buffalo,lsxl",
 	"iom,ix2-200",
 	"keymile,km_kirkwood",
+	"lacie,inetspace_v2",
+	"lacie,netspace_max_v2",
+	"lacie,netspace_v2",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-ns2.c new file +83 -0
new file mode 100644
index 0000000..b36c55c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2012 (C), Simon Guinot <[email protected]>
+ *
+ * arch/arm/mach-kirkwood/board-ns2.c
+ *
+ * LaCie Network Space v2 board (and parents) initialization 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/mv643xx_eth.h>
+#include <linux/gpio.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mv643xx_eth_platform_data ns2_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static unsigned int ns2_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
+	MPP3_SPI_MISO,
+	MPP4_NF_IO6,
+	MPP5_NF_IO7,
+	MPP6_SYSRST_OUTn,
+	MPP7_GPO,		/* Fan speed (bit 1) */
+	MPP8_TW0_SDA,
+	MPP9_TW0_SCK,
+	MPP10_UART0_TXD,
+	MPP11_UART0_RXD,
+	MPP12_GPO,		/* Red led */
+	MPP14_GPIO,		/* USB fuse */
+	MPP16_GPIO,		/* SATA 0 power */
+	MPP17_GPIO,		/* SATA 1 power */
+	MPP18_NF_IO0,
+	MPP19_NF_IO1,
+	MPP20_SATA1_ACTn,
+	MPP21_SATA0_ACTn,
+	MPP22_GPIO,		/* Fan speed (bit 0) */
+	MPP23_GPIO,		/* Fan power */
+	MPP24_GPIO,		/* USB mode select */
+	MPP25_GPIO,		/* Fan rotation fail */
+	MPP26_GPIO,		/* USB device vbus */
+	MPP28_GPIO,		/* USB enable host vbus */
+	MPP29_GPIO,		/* Blue led (slow register) */
+	MPP30_GPIO,		/* Blue led (command register) */
+	MPP31_GPIO,		/* Board power off */
+	MPP32_GPIO,		/* Power button (0 = Released, 1 = Pushed) */
+	MPP33_GPO,		/* Fan speed (bit 2) */
+	0
+};
+
+#define NS2_GPIO_POWER_OFF	31
+
+static void ns2_power_off(void)
+{
+	gpio_set_value(NS2_GPIO_POWER_OFF, 1);
+}
+
+void __init ns2_init(void)
+{
+	/*
+	 * Basic setup. Needs to be called early.
+	 */
+	kirkwood_mpp_conf(ns2_mpp_config);
+
+	kirkwood_ehci_init();
+	kirkwood_ge00_init(&ns2_ge00_data);
+
+	if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
+	    gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
+		pm_power_off = ns2_power_off;
+	else
+		pr_err("ns2: failed to configure power-off GPIO\n");
+}
arch/arm/mach-kirkwood/common.h +8 -0
index bcffd7c..2f75f3f 100644
@@ -112,6 +112,14 @@ void km_kirkwood_init(void);
 static inline void km_kirkwood_init(void) {};
 #endif
 
+#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT)
+void ns2_init(void);
+#else
+static inline void ns2_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
drivers/leds/Kconfig +3 -1
index f508def..e455c08 100644
@@ -379,7 +379,9 @@ config LEDS_NS2
 	tristate "LED support for Network Space v2 GPIO LEDs"
 	depends on LEDS_CLASS
 	depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \
-		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2
+		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \
+		   MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \
+		   MACH_NETSPACE_MAX_V2_DT
 	default y
 	help
 	  This option enable support for the dual-GPIO LED found on the
Signature · 7 lines
1.7.10


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121015/4bc4b331/attachment-0001.sig>

#12 lore raw

PATCH 2/4 ARM: kirkwood: DT board setup for Network Space v2 and parents

In reply to Simon Guinot
Quoted 47 lines · Simon Guinot

This patch adds DT board setup for LaCie Network Space v2 and parents, based on the Marvell Kirkwood 6281 SoC. This includes Network Space v2 (Max) and Internet Space v2.

---
 arch/arm/boot/dts/Makefile                 |    3 +
 arch/arm/boot/dts/kirkwood-is2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   63 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts      |   49 ++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig             |   21 +++++++
 arch/arm/mach-kirkwood/Makefile            |    3 +
 arch/arm/mach-kirkwood/board-dt.c          |    8 +++
 arch/arm/mach-kirkwood/board-ns2.c         |   83 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    8 +++
 drivers/leds/Kconfig                       |    4 +-
 11 files changed, 301 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
arch/arm/boot/dts/Makefile +3 -0
index c1ce813..e6201b6 100644
@@ -34,9 +34,12 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-ib62x0.dtb \
 	kirkwood-iconnect.dtb \
 	kirkwood-iomega_ix2_200.dtb \
+	kirkwood-is2.dtb \
 	kirkwood-km_kirkwood.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
+	kirkwood-ns2.dtb \
+	kirkwood-ns2max.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
arch/arm/boot/dts/kirkwood-is2.dts new file +0 -0
new file mode 100644
index 0000000..7bc4677

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

Quoted 7 lines
arch/arm/boot/dts/kirkwood-is2.dts new file +7 -0
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Internet Space v2";
+	compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";

Compatible strings must be documented.

Rob

Quoted 376 lines
arch/arm/boot/dts/kirkwood-is2.dts new file +23 -0
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2-common.dtsi new file +63 -0
new file mode 100644
index 0000000..9bc6785
@@ -0,0 +1,63 @@
+/include/ "kirkwood.dtsi"
+
+/ {
+	chosen {
+		bootargs = "console=ttyS0,115200n8";
+	};
+
+	ocp at f1000000 {
+		serial at 12000 {
+			clock-frequency = <166666667>;
+			status = "okay";
+		};
+
+		spi at 10600 {
+			status = "okay";
+
+			flash at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "mx25l4005a";
+				reg = <0>;
+				spi-max-frequency = <20000000>;
+				mode = <0>;
+
+				partition at 0 {
+					reg = <0x0 0x80000>;
+					label = "u-boot";
+				};
+			};
+		};
+
+		i2c at 11000 {
+			status = "okay";
+
+			eeprom at 50 {
+				compatible = "at,24c04";
+				pagesize = <16>;
+				reg = <0x50>;
+			};
+		};
+	};
+
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		button at 1 {
+			label = "Power push button";
+			linux,code = <116>;
+			gpios = <&gpio1 0 0>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		red-fail {
+			label = "ns2:red:fail";
+			gpios = <&gpio0 12 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2.dts new file +30 -0
new file mode 100644
index 0000000..d018213
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space v2";
+	compatible = "lacie,netspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/boot/dts/kirkwood-ns2max.dts new file +49 -0
new file mode 100644
index 0000000..82156e2
@@ -0,0 +1,49 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space Max v2";
+	compatible = "lacie,netspace_max_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <2>;
+		};
+	};
+
+	gpio_fan {
+		compatible = "gpio-fan";
+		gpios = <&gpio0 22 1
+			 &gpio0  7 1
+			 &gpio1  1 1
+			 &gpio0 23 1>;
+		gpio-fan,speed-map =
+			<   0  0
+			 1500 15
+			 1700 14
+			 1800 13
+			 2100 12
+			 3100 11
+			 3300 10
+			 4300  9
+			 5500  8>;
+		alarm-gpios = <&gpio0 25 1>;
+	};
+
+	ns2-leds {
+		compatible = "ns2-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			slow-gpio = <&gpio0 29 0>;
+			cmd-gpio = <&gpio0 30 0>;
+		};
+	};
+};
arch/arm/mach-kirkwood/Kconfig +21 -0
index 50bca50..847e0c2 100644
@@ -130,6 +130,27 @@ config MACH_KM_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Keymile Kirkwood Reference Desgin, using Flattened Device Tree.
 
+config MACH_INETSPACE_V2_DT
+	bool "LaCie Internet Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Internet Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_V2_DT
+	bool "LaCie Network Space v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space v2 NAS, using Flattened Device Tree.
+
+config MACH_NETSPACE_MAX_V2_DT
+	bool "LaCie Network Space Max v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space Max v2 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
arch/arm/mach-kirkwood/Makefile +3 -0
index 294779f..1f63d80 100644
@@ -31,3 +31,6 @@ obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
 obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
 obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
+obj-$(CONFIG_MACH_INETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
arch/arm/mach-kirkwood/board-dt.c +8 -0
index 70c5a28..b3e0519 100644
@@ -96,6 +96,11 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("keymile,km_kirkwood"))
 		km_kirkwood_init();
 
+	if (of_machine_is_compatible("lacie,inetspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_v2") ||
+	    of_machine_is_compatible("lacie,netspace_max_v2"))
+		ns2_init();
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -112,6 +117,9 @@ static const char *kirkwood_dt_board_compat[] = {
 	"buffalo,lsxl",
 	"iom,ix2-200",
 	"keymile,km_kirkwood",
+	"lacie,inetspace_v2",
+	"lacie,netspace_max_v2",
+	"lacie,netspace_v2",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-ns2.c new file +83 -0
new file mode 100644
index 0000000..b36c55c
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2012 (C), Simon Guinot <[email protected]>
+ *
+ * arch/arm/mach-kirkwood/board-ns2.c
+ *
+ * LaCie Network Space v2 board (and parents) initialization 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/mv643xx_eth.h>
+#include <linux/gpio.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mv643xx_eth_platform_data ns2_ge00_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(8),
+};
+
+static unsigned int ns2_mpp_config[] __initdata = {
+	MPP0_SPI_SCn,
+	MPP1_SPI_MOSI,
+	MPP2_SPI_SCK,
+	MPP3_SPI_MISO,
+	MPP4_NF_IO6,
+	MPP5_NF_IO7,
+	MPP6_SYSRST_OUTn,
+	MPP7_GPO,		/* Fan speed (bit 1) */
+	MPP8_TW0_SDA,
+	MPP9_TW0_SCK,
+	MPP10_UART0_TXD,
+	MPP11_UART0_RXD,
+	MPP12_GPO,		/* Red led */
+	MPP14_GPIO,		/* USB fuse */
+	MPP16_GPIO,		/* SATA 0 power */
+	MPP17_GPIO,		/* SATA 1 power */
+	MPP18_NF_IO0,
+	MPP19_NF_IO1,
+	MPP20_SATA1_ACTn,
+	MPP21_SATA0_ACTn,
+	MPP22_GPIO,		/* Fan speed (bit 0) */
+	MPP23_GPIO,		/* Fan power */
+	MPP24_GPIO,		/* USB mode select */
+	MPP25_GPIO,		/* Fan rotation fail */
+	MPP26_GPIO,		/* USB device vbus */
+	MPP28_GPIO,		/* USB enable host vbus */
+	MPP29_GPIO,		/* Blue led (slow register) */
+	MPP30_GPIO,		/* Blue led (command register) */
+	MPP31_GPIO,		/* Board power off */
+	MPP32_GPIO,		/* Power button (0 = Released, 1 = Pushed) */
+	MPP33_GPO,		/* Fan speed (bit 2) */
+	0
+};
+
+#define NS2_GPIO_POWER_OFF	31
+
+static void ns2_power_off(void)
+{
+	gpio_set_value(NS2_GPIO_POWER_OFF, 1);
+}
+
+void __init ns2_init(void)
+{
+	/*
+	 * Basic setup. Needs to be called early.
+	 */
+	kirkwood_mpp_conf(ns2_mpp_config);
+
+	kirkwood_ehci_init();
+	kirkwood_ge00_init(&ns2_ge00_data);
+
+	if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
+	    gpio_direction_output(NS2_GPIO_POWER_OFF, 0) == 0)
+		pm_power_off = ns2_power_off;
+	else
+		pr_err("ns2: failed to configure power-off GPIO\n");
+}
arch/arm/mach-kirkwood/common.h +8 -0
index bcffd7c..2f75f3f 100644
@@ -112,6 +112,14 @@ void km_kirkwood_init(void);
 static inline void km_kirkwood_init(void) {};
 #endif
 
+#if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT)
+void ns2_init(void);
+#else
+static inline void ns2_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);
drivers/leds/Kconfig +3 -1
index f508def..e455c08 100644
@@ -379,7 +379,9 @@ config LEDS_NS2
 	tristate "LED support for Network Space v2 GPIO LEDs"
 	depends on LEDS_CLASS
 	depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \
-		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2
+		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \
+		   MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \
+		   MACH_NETSPACE_MAX_V2_DT
 	default y
 	help
 	  This option enable support for the dual-GPIO LED found on the
#13 lore raw

PATCH 1/1 ARM: mach-kirkwood: add documentation for device tree bindings

---
 Documentation/devicetree/bindings/arm/kirkwood.txt |   37 ++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/kirkwood.txt
Documentation/devicetree/bindings/arm/kirkwood.txt new file +37 -0
new file mode 100644
index 0000000..14fb6b9
@@ -0,0 +1,37 @@
+Marvell Kirkwood Platforms Device Tree Bindings
+-----------------------------------------------
+
+Boards with a SoC of the Marvell Kirkwood family shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,kirkwood"
+
+In addition, boards with a Kirkwood SoC 88F6192 shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,kirkwood-88f6192"
+
+In addition, boards with a Kirkwood SoC 88F6281 shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,kirkwood-88f6281"
+
+In addition, boards with a Kirkwood SoC 88F6702 shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,kirkwood-88f6702"
+
+Board with a SoC of the Marvell Armada 300 family (Kirkwood compatible)
+shall have the following property:
+Required root node property:
+compatible: must contain "marvell,armada300", "marvell,kirkwood"
+
+In addition, boards with an Armada 300 SoC 88F6282 shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,armada300-88f6282"
+
+In addition, boards with an Armada 300 SoC 88F6283 shall have the
+following property:
+Required root node property:
+compatible: must contain "marvell,armada300-88f6283"
Signature · 1 line
1.7.10
#14 lore raw

PATCH 2/4 ARM: kirkwood: DT board setup for Network Space v2 and parents

In reply to Rob Herring
Quoted 49 lines · Rob Herring
Quoted 48 lines · Simon Guinot

This patch adds DT board setup for LaCie Network Space v2 and parents, based on the Marvell Kirkwood 6281 SoC. This includes Network Space v2 (Max) and Internet Space v2.

---
 arch/arm/boot/dts/Makefile                 |    3 +
 arch/arm/boot/dts/kirkwood-is2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi |   63 +++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts         |   30 ++++++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts      |   49 ++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig             |   21 +++++++
 arch/arm/mach-kirkwood/Makefile            |    3 +
 arch/arm/mach-kirkwood/board-dt.c          |    8 +++
 arch/arm/mach-kirkwood/board-ns2.c         |   83 ++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h            |    8 +++
 drivers/leds/Kconfig                       |    4 +-
 11 files changed, 301 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
arch/arm/boot/dts/Makefile +3 -0
index c1ce813..e6201b6 100644
@@ -34,9 +34,12 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-ib62x0.dtb \
 	kirkwood-iconnect.dtb \
 	kirkwood-iomega_ix2_200.dtb \
+	kirkwood-is2.dtb \
 	kirkwood-km_kirkwood.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
+	kirkwood-ns2.dtb \
+	kirkwood-ns2max.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
arch/arm/boot/dts/kirkwood-is2.dts new file +1 -0
new file mode 100644
index 0000000..7bc4677
@@ -0,0 +1,30 @@
+/dts-v1/;
Quoted 8 lines

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

Quoted 6 lines
arch/arm/boot/dts/kirkwood-is2.dts new file +6 -0
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Internet Space v2";
+	compatible = "lacie,inetspace_v2", "marvell,kirkwood-88f6281", "marvell,kirkwood";

Compatible strings must be documented.

Hi Rob,

I have sent a patch to document the compatible strings used with the Marvell Kirkwood SoCs. Do you also want me to document the compatible strings for the LaCie machines ? Looking at the devicetree/bindings/arm directory, it doesn't seems to be a common practice.

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121016/0c50619b/attachment.sig>

#15 lore raw

PATCH 3/4 ARM: kirkwood: DT board setup for Network Space Lite v2

In reply to Simon Guinot

This patch adds DT board setup for the LaCie NAS Network Space Lite v2. This board is derived from the Network Space v2 and a lot of hardware characteristics are shared.

- CPU: Marvell 88F6192 800Mhz
- SDRAM memory: 128MB DDR2 200Mhz
- 1 SATA port: internal
- Gigabit ethernet: PHY Marvell 88E1318
- Flash memory: SPI NOR 512KB (Macronix MX25L4005A)
- i2c EEPROM: 512 bytes (24C04 type)
- 2 USB2 ports: host and host/device
- 1 push button
- 1 SATA LED (bi-color, blue and red)

Note that the SATA LED is not compatible with the driver leds-ns2. The LED behaviour ("on", "off" or "SATA activity blink") is controlled via a single MPP (21).

---
 arch/arm/boot/dts/Makefile             |    1 +
 arch/arm/boot/dts/kirkwood-ns2lite.dts |   30 ++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig         |    7 +++++++
 arch/arm/mach-kirkwood/Makefile        |    1 +
 arch/arm/mach-kirkwood/board-dt.c      |    4 +++-
 arch/arm/mach-kirkwood/board-ns2.c     |    3 +++
 arch/arm/mach-kirkwood/common.h        |    3 ++-
 7 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2lite.dts
arch/arm/boot/dts/Makefile +1 -0
index e6201b6..42b3e90 100644
@@ -39,6 +39,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-lschlv2.dtb \
 	kirkwood-lsxhl.dtb \
 	kirkwood-ns2.dtb \
+	kirkwood-ns2lite.dtb \
 	kirkwood-ns2max.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
arch/arm/boot/dts/kirkwood-ns2lite.dts new file +30 -0
new file mode 100644
index 0000000..b02eb4e
@@ -0,0 +1,30 @@
+/dts-v1/;
+
+/include/ "kirkwood-ns2-common.dtsi"
+
+/ {
+	model = "LaCie Network Space Lite v2";
+	compatible = "lacie,netspace_lite_v2", "marvell,kirkwood-88f6192", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+
+	ocp at f1000000 {
+		sata at 80000 {
+			status = "okay";
+			nr-ports = <1>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		blue-sata {
+			label = "ns2:blue:sata";
+			gpios = <&gpio0 30 1>;
+			linux,default-trigger = "default-on";
+		};
+	};
+};
arch/arm/mach-kirkwood/Kconfig +7 -0
index 847e0c2..83df331 100644
@@ -151,6 +151,13 @@ config MACH_NETSPACE_MAX_V2_DT
 	  Say 'Y' here if you want your kernel to support the LaCie
 	  Network Space Max v2 NAS, using Flattened Device Tree.
 
+config MACH_NETSPACE_LITE_V2_DT
+	bool "LaCie Network Space Lite v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space Lite v2 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
arch/arm/mach-kirkwood/Makefile +1 -0
index 1f63d80..4d4b7d4 100644
@@ -34,3 +34,4 @@ obj-$(CONFIG_MACH_KM_KIRKWOOD_DT)	+= board-km_kirkwood.o
 obj-$(CONFIG_MACH_INETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
arch/arm/mach-kirkwood/board-dt.c +3 -1
index b3e0519..ab7595e 100644
@@ -98,7 +98,8 @@ static void __init kirkwood_dt_init(void)
 
 	if (of_machine_is_compatible("lacie,inetspace_v2") ||
 	    of_machine_is_compatible("lacie,netspace_v2") ||
-	    of_machine_is_compatible("lacie,netspace_max_v2"))
+	    of_machine_is_compatible("lacie,netspace_max_v2") ||
+	    of_machine_is_compatible("lacie,netspace_lite_v2"))
 		ns2_init();
 
 	of_platform_populate(NULL, kirkwood_dt_match_table,
@@ -120,6 +121,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"lacie,inetspace_v2",
 	"lacie,netspace_max_v2",
 	"lacie,netspace_v2",
+	"lacie,netspace_lite_v2",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-ns2.c +3 -0
index b36c55c..da8c4c5 100644
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/gpio.h>
+#include <linux/of.h>
 #include "common.h"
 #include "mpp.h"
 
@@ -73,6 +74,8 @@ void __init ns2_init(void)
 	kirkwood_mpp_conf(ns2_mpp_config);
 
 	kirkwood_ehci_init();
+	if (of_machine_is_compatible("lacie,netspace_lite_v2"))
+		ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
 	kirkwood_ge00_init(&ns2_ge00_data);
 
 	if (gpio_request(NS2_GPIO_POWER_OFF, "power-off") == 0 &&
arch/arm/mach-kirkwood/common.h +2 -1
index 2f75f3f..6949d81 100644
@@ -114,7 +114,8 @@ static inline void km_kirkwood_init(void) {};
 
 #if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
 	defined(CONFIG_MACH_NETSPACE_V2_DT) || \
-	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT)
+	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_LITE_V2_DT)
 void ns2_init(void);
 #else
 static inline void ns2_init(void) {};
Signature · 1 line
1.7.10
#16 lore raw

PATCH 4/4 ARM: kirkwood: DT board setup for Network Space Mini v2

In reply to Simon Guinot

This patch adds DT board setup for the LaCie NAS Network Space Mini v2 (aka SafeBox). The hardware characteristics are very close to those of the Network Space Lite v2. The main difference are:
- A GPIO fan which is only available on the NS2 Mini.
- A single USB host port is wired on the NS2 Mini. The NS2 Lite provides an additional dual-mode USB port (host/device).

---
 arch/arm/boot/dts/Makefile             |    1 +
 arch/arm/boot/dts/kirkwood-ns2mini.dts |   49 ++++++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig         |    8 ++++++
 arch/arm/mach-kirkwood/Makefile        |    1 +
 arch/arm/mach-kirkwood/board-dt.c      |    4 ++-
 arch/arm/mach-kirkwood/board-ns2.c     |    3 +-
 arch/arm/mach-kirkwood/common.h        |    3 +-
 drivers/leds/Kconfig                   |    2 +-
 8 files changed, 67 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2mini.dts
arch/arm/boot/dts/Makefile +1 -0
index 42b3e90..f2af858 100644
@@ -41,6 +41,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += kirkwood-dns320.dtb \
 	kirkwood-ns2.dtb \
 	kirkwood-ns2lite.dtb \
 	kirkwood-ns2max.dtb \
+	kirkwood-ns2mini.dtb \
 	kirkwood-ts219-6281.dtb \
 	kirkwood-ts219-6282.dtb
 dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
arch/arm/boot/dts/kirkwood-ns2mini.dts new file +49 -0

49 lines not on this page · raw message

arch/arm/mach-kirkwood/Kconfig +8 -0
index 83df331..757bdb3 100644
@@ -158,6 +158,14 @@ config MACH_NETSPACE_LITE_V2_DT
 	  Say 'Y' here if you want your kernel to support the LaCie
 	  Network Space Lite v2 NAS, using Flattened Device Tree.
 
+config MACH_NETSPACE_MINI_V2_DT
+	bool "LaCie Network Space Mini v2 NAS (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the LaCie
+	  Network Space Mini v2 NAS (aka SafeBox), using Flattened
+	  Device Tree.
+
 config MACH_TS219
 	bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS"
 	help
arch/arm/mach-kirkwood/Makefile +1 -0
index 4d4b7d4..3ff4aa1 100644
@@ -35,3 +35,4 @@ obj-$(CONFIG_MACH_INETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_MAX_V2_DT)	+= board-ns2.o
 obj-$(CONFIG_MACH_NETSPACE_LITE_V2_DT)	+= board-ns2.o
+obj-$(CONFIG_MACH_NETSPACE_MINI_V2_DT)	+= board-ns2.o
arch/arm/mach-kirkwood/board-dt.c +3 -1
index ab7595e..c3dd5d2 100644
@@ -99,7 +99,8 @@ static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("lacie,inetspace_v2") ||
 	    of_machine_is_compatible("lacie,netspace_v2") ||
 	    of_machine_is_compatible("lacie,netspace_max_v2") ||
-	    of_machine_is_compatible("lacie,netspace_lite_v2"))
+	    of_machine_is_compatible("lacie,netspace_lite_v2") ||
+	    of_machine_is_compatible("lacie,netspace_mini_v2"))
 		ns2_init();
 
 	of_platform_populate(NULL, kirkwood_dt_match_table,
@@ -122,6 +123,7 @@ static const char *kirkwood_dt_board_compat[] = {
 	"lacie,netspace_max_v2",
 	"lacie,netspace_v2",
 	"lacie,netspace_lite_v2",
+	"lacie,netspace_mini_v2",
 	NULL
 };
 
arch/arm/mach-kirkwood/board-ns2.c +2 -1
index da8c4c5..78596c4 100644
@@ -74,7 +74,8 @@ void __init ns2_init(void)
 	kirkwood_mpp_conf(ns2_mpp_config);
 
 	kirkwood_ehci_init();
-	if (of_machine_is_compatible("lacie,netspace_lite_v2"))
+	if (of_machine_is_compatible("lacie,netspace_lite_v2") ||
+	    of_machine_is_compatible("lacie,netspace_mini_v2"))
 		ns2_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
 	kirkwood_ge00_init(&ns2_ge00_data);
 
arch/arm/mach-kirkwood/common.h +2 -1
index 6949d81..95eb69b 100644
@@ -115,7 +115,8 @@ static inline void km_kirkwood_init(void) {};
 #if defined(CONFIG_MACH_INETSPACE_V2_DT) || \
 	defined(CONFIG_MACH_NETSPACE_V2_DT) || \
 	defined(CONFIG_MACH_NETSPACE_MAX_V2_DT) || \
-	defined(CONFIG_MACH_NETSPACE_LITE_V2_DT)
+	defined(CONFIG_MACH_NETSPACE_LITE_V2_DT) || \
+	defined(CONFIG_MACH_NETSPACE_MINI_V2_DT)
 void ns2_init(void);
 #else
 static inline void ns2_init(void) {};
drivers/leds/Kconfig +1 -1
index e455c08..b58bc8a 100644
@@ -381,7 +381,7 @@ config LEDS_NS2
 	depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || \
 		   MACH_NETSPACE_MAX_V2 || MACH_D2NET_V2 || \
 		   MACH_NETSPACE_V2_DT || MACH_INETSPACE_V2_DT || \
-		   MACH_NETSPACE_MAX_V2_DT
+		   MACH_NETSPACE_MAX_V2_DT || MACH_NETSPACE_MINI_V2_DT
 	default y
 	help
 	  This option enable support for the dual-GPIO LED found on the
Signature · 1 line
1.7.10
#17 lore raw

cover Add DT support for Network Space v2 and parents

In reply to Simon Guinot

Hey Simon,

Quoted 11 lines · Simon Guinot

This patch series provides DT support for LaCie NAS Network Space v2 and parents. This includes the following machines:
- Internet Space v2
- Network Space v2
- Network Space Max v2
- Network Space Lite v2
- Network Space Mini v2

Note that the three first boards are already supported by the Linux kernel via an "old-fashion" board setup. The two lasts (Lite and Mini) are new boards.

Have you checked building support for the old and new in one kernel? On a quick check, it looks okay, but I only checked that ns2_init() wasn't the _init function for the legacy board files.

Quoted 8 lines

Also note that the first patch of the series is related with the LED subsystem. It adds device tree binding to the driver leds-ns2.

Simon Guinot (4):
leds: leds-ns2: add device tree binding
ARM: kirkwood: DT board setup for Network Space v2 and parents
ARM: kirkwood: DT board setup for Network Space Lite v2
ARM: kirkwood: DT board setup for Network Space Mini v2

I'm pretty sure this isn't the first version of this patch series ;-) No need to resend, but could you attach a version number and changelog?

thx,

Jason.

Quoted 29 lines
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 arch/arm/boot/dts/Makefile                         |    5 ++
 arch/arm/boot/dts/kirkwood-is2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   63 ++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts              |   49 +++++++++++
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   49 +++++++++++
 arch/arm/mach-kirkwood/Kconfig                     |   36 ++++++++
 arch/arm/mach-kirkwood/Makefile                    |    5 ++
 arch/arm/mach-kirkwood/board-dt.c                  |   12 +++
 arch/arm/mach-kirkwood/board-ns2.c                 |   87 ++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h                    |   10 +++
 drivers/leds/Kconfig                               |    4 +-
 drivers/leds/leds-ns2.c                            |   84 ++++++++++++++++++-
 15 files changed, 516 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2lite.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2mini.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
Signature · 1 line
1.7.10
#18 lore raw

cover Add DT support for Network Space v2 and parents

Quoted 1 line · Jason Cooper

Hey Simon,

Hi Jason,

Quoted 10 lines · Simon Guinot
Quoted 8 lines

This patch series provides DT support for LaCie NAS Network Space v2 and parents. This includes the following machines:
- Internet Space v2
- Network Space v2
- Network Space Max v2
- Network Space Lite v2
- Network Space Mini v2

Quoted 7 lines
Quoted 3 lines

Note that the three first boards are already supported by the Linux kernel via an "old-fashion" board setup. The two lasts (Lite and Mini) are new boards.

Have you checked building support for the old and new in one kernel? On a quick check, it looks okay, but I only checked that ns2_init() wasn't the _init function for the legacy board files.

Yes, I have checked building with both old and DT board setups.

Quoted 4 lines
Quoted 4 lines

Also note that the first patch of the series is related with the LED subsystem. It adds device tree binding to the driver leds-ns2.

Quoted 8 lines
Quoted 5 lines

Simon Guinot (4):
leds: leds-ns2: add device tree binding
ARM: kirkwood: DT board setup for Network Space v2 and parents
ARM: kirkwood: DT board setup for Network Space Lite v2
ARM: kirkwood: DT board setup for Network Space Mini v2

I'm pretty sure this isn't the first version of this patch series ;-) No need to resend, but could you attach a version number and changelog?

Yes, you are right. For the second patch, it is the second version. But all the other patches are at their first version. Then the whole patch series is more a v1 than a v2. I am always embarrassed when the patches versions are not the same within a series...

If you agree, I will reply against the second patch in order to underline the changes.

Thanks,

Simon

Quoted 31 lines

thx,

Jason.

Quoted 26 lines
 .../devicetree/bindings/gpio/leds-ns2.txt          |   26 ++++++
 arch/arm/boot/dts/Makefile                         |    5 ++
 arch/arm/boot/dts/kirkwood-is2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2-common.dtsi         |   63 ++++++++++++++
 arch/arm/boot/dts/kirkwood-ns2.dts                 |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2lite.dts             |   30 +++++++
 arch/arm/boot/dts/kirkwood-ns2max.dts              |   49 +++++++++++
 arch/arm/boot/dts/kirkwood-ns2mini.dts             |   49 +++++++++++
 arch/arm/mach-kirkwood/Kconfig                     |   36 ++++++++
 arch/arm/mach-kirkwood/Makefile                    |    5 ++
 arch/arm/mach-kirkwood/board-dt.c                  |   12 +++
 arch/arm/mach-kirkwood/board-ns2.c                 |   87 ++++++++++++++++++++
 arch/arm/mach-kirkwood/common.h                    |   10 +++
 drivers/leds/Kconfig                               |    4 +-
 drivers/leds/leds-ns2.c                            |   84 ++++++++++++++++++-
 15 files changed, 516 insertions(+), 4 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/leds-ns2.txt
 create mode 100644 arch/arm/boot/dts/kirkwood-is2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2-common.dtsi
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2lite.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2max.dts
 create mode 100644 arch/arm/boot/dts/kirkwood-ns2mini.dts
 create mode 100644 arch/arm/mach-kirkwood/board-ns2.c
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
1.7.10

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121015/db3504ec/attachment.sig>

#19 lore raw

cover Add DT support for Network Space v2 and parents

Quoted 8 lines · Simon Guinot
Quoted 2 lines · Jason Cooper

I'm pretty sure this isn't the first version of this patch series ;-) No need to resend, but could you attach a version number and changelog?

Yes, you are right. For the second patch, it is the second version. But all the other patches are at their first version. Then the whole patch series is more a v1 than a v2. I am always embarrassed when the patches versions are not the same within a series...

Yes, it makes my skin crawl when I send something out like that as well.

My rule of thumb is that if the patch subject matter is still identical to the previous version, then I only increment that patch. If suggested changes cause a reshuffle of the whole series, then I just increment the version number across the board.

In this case, incrementing the first patch would have been fine.

Quoted 2 lines

If you agree, I will reply against the second patch in order to underline the changes.

Perfect.

thx,

Jason.