Skip to contentSkip to conversation

reset driver for NXP LPC18xx family

PATCH Superseded Joachim Eastwood 2 participants 7 messages Apr 27, 2015 – May 4, 2015

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover reset driver for NXP LPC18xx family

This patch set adds a reset driver for NXP LPC18xx/43xx devices.

There are no dependencies in this patch set. The DTS changes will be sent separately to arm-soc once this patch set goes upstream.

Base support for the NXP LPC18xx family can be found here:
http://marc.info/?l=linux-arm-kernel&m=143016894704253&w=2

Joachim Eastwood (2):
reset: add driver for lpc18xx rgu
doc: dt: add documentation for lpc1850-rgu reset driver

 .../devicetree/bindings/reset/nxp,lpc1850-rgu.txt  |  38 +++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-lpc18xx.c                      | 260 +++++++++++++++++++++
 3 files changed, 299 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt
 create mode 100644 drivers/reset/reset-lpc18xx.c
Signature · 1 line
1.8.0
#1 lore raw

PATCH 1/2 reset: add driver for lpc18xx rgu

---
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-lpc18xx.c | 260 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 261 insertions(+)
 create mode 100644 drivers/reset/reset-lpc18xx.c
drivers/reset/Makefile +1 -0
index 157d421f755b..1d41feeb2dce 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
drivers/reset/reset-lpc18xx.c new file +260 -0

260 lines not on this page · raw message

Signature · 1 line
1.8.0
maintainer
#2 lore raw

PATCH 1/2 reset: add driver for lpc18xx rgu

Hi Joachim,

thank you for the patch! Some comments below:

Am Dienstag, den 28.04.2015, 00:30 +0200 schrieb Joachim Eastwood:

Quoted 38 lines
---
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-lpc18xx.c | 260 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 261 insertions(+)
 create mode 100644 drivers/reset/reset-lpc18xx.c
drivers/reset/Makefile +1 -0
index 157d421f755b..1d41feeb2dce 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
drivers/reset/reset-lpc18xx.c new file +15 -0
new file mode 100644
index 000000000000..9564d78ab9d2
@@ -0,0 +1,260 @@
+/*
+ * Reset driver for NXP LPC18xx/43xx Reset Generation Unit (RGU).
+ *
+ * Copyright (C) 2014 Joachim Eastwood <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>

drivers/reset/reset-lpc18xx.c line 25

Quoted 10 lines
drivers/reset/reset-lpc18xx.c new file +10 -0
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#include <asm/system_misc.h>

Are all of these necessary? I don't see why of_address.h and system_misc.h are included, for example.

drivers/reset/reset-lpc18xx.c line 38

Quoted 12 lines
drivers/reset/reset-lpc18xx.c new file +12 -0
+/* LPC18xx RGU registers */
+#define LPC18XX_RGU_CTRL0		0x100
+#define LPC18XX_RGU_CTRL1		0x104
+#define LPC18XX_RGU_ACTIVE_STATUS0	0x150
+#define LPC18XX_RGU_ACTIVE_STATUS1	0x154
+
+#define LPC18XX_RGU_RESETS_PER_REG	32
+
+/* Internal reset outputs */
+#define LPC18XX_RGU_CORE_RST	0
+#define LPC18XX_RGU_M0SUB_RST	12
+#define LPC18XX_RGU_M0APP_RST	56

In the LPC18xx User Manual these are marked as reserved, I think using the LPC43XX_ prefix here could avoid confusion. Or are there also LPC18xx that have these reset lines?

Quoted 25 lines
drivers/reset/reset-lpc18xx.c new file +25 -0
+
+struct lpc18xx_rgu_data {
+	struct reset_controller_dev rcdev;
+	struct clk *clk_delay;
+	struct clk *clk_reg;
+	void __iomem *base;
+	spinlock_t lock;
+	u32 delay_us;
+};
+
+#define to_rgu_data(rcdev) container_of(rcdev, struct lpc18xx_rgu_data, rcdev)
+
+static void __iomem *rgu_base;
+
+static int lpc18xx_rgu_restart(struct notifier_block *this, unsigned long mode,
+			       void *cmd)
+{
+	writel(BIT(LPC18XX_RGU_CORE_RST), rgu_base + LPC18XX_RGU_CTRL0);
+	mdelay(2000);
+
+	pr_emerg("%s: unable to restart system\n", __func__);
+
+	return NOTIFY_DONE;
+}
+

drivers/reset/reset-lpc18xx.c line 73

Quoted 10 lines
drivers/reset/reset-lpc18xx.c new file +10 -0
+static struct notifier_block lpc18xx_rgu_restart_nb = {
+	.notifier_call = lpc18xx_rgu_restart,
+	.priority = 192,
+};
+
+/*
+ * The LPC18xx RGU has mostly self-deasserting resets except for the
+ * two reset lines going to the internal Cortex-M0 cores.
+ *
+ * To prevent the M0 cores from accidentally getting deasserting the

"To prevent the M0 core resets from accidentally getting deasserted" ?

Quoted 25 lines
drivers/reset/reset-lpc18xx.c new file +25 -0
+ * status register must be check and bits in control register set to
+ * preserve the state.
+ */
+static void lpc18xx_rgu_setclear_reset(struct reset_controller_dev *rcdev,
+				       unsigned long id, bool set)
+{
+	struct lpc18xx_rgu_data *rc = to_rgu_data(rcdev);
+	u32 stat_offset = LPC18XX_RGU_ACTIVE_STATUS0;
+	u32 ctrl_offset = LPC18XX_RGU_CTRL0;
+	unsigned long flags;
+	u32 stat, rst_bit;
+
+	stat_offset += (id / LPC18XX_RGU_RESETS_PER_REG) * sizeof(u32);
+	ctrl_offset += (id / LPC18XX_RGU_RESETS_PER_REG) * sizeof(u32);
+	rst_bit = 1 << (id % LPC18XX_RGU_RESETS_PER_REG);
+
+	spin_lock_irqsave(&rc->lock, flags);
+	stat = ~readl(rc->base + stat_offset);
+	if (set)
+		writel(stat | rst_bit, rc->base + ctrl_offset);
+	else
+		writel(stat & ~rst_bit, rc->base + ctrl_offset);
+	spin_unlock_irqrestore(&rc->lock, flags);
+}
+

drivers/reset/reset-lpc18xx.c line 108

Quoted 10 lines
drivers/reset/reset-lpc18xx.c new file +10 -0
+static int lpc18xx_rgu_reset(struct reset_controller_dev *rcdev,
+			     unsigned long id)
+{
+	struct lpc18xx_rgu_data *rc = to_rgu_data(rcdev);
+
+	lpc18xx_rgu_setclear_reset(rcdev, id, true);
+	udelay(rc->delay_us);
+
+	return 0;
+}

This is missing a deassert for the M0 resets, see below.

drivers/reset/reset-lpc18xx.c line 114

Quoted 6 lines
drivers/reset/reset-lpc18xx.c new file +6 -0
+
+static int lpc18xx_rgu_assert(struct reset_controller_dev *rcdev,
+			      unsigned long id)
+{
+	return lpc18xx_rgu_reset(rcdev, id);
+}

lpc18xx_rgu_assert shouldn't include the delay. Could you have lpc18xx_rgu_assert call lpc18xx_rgu_setclear_reset directly?

Let lpc18xx_rgu_reset then call lpc18xx_rgu_assert, udelay, and lpc18xx_rgu_deassert. Or could you wait for the active status bit to clear instead of the fixed delay for the self-clearing resets?

drivers/reset/reset-lpc18xx.c line 127

Quoted 12 lines
drivers/reset/reset-lpc18xx.c new file +12 -0
+/* Only M0 cores require explicit reset deassert */
+static int lpc18xx_rgu_deassert(struct reset_controller_dev *rcdev,
+				unsigned long id)
+{
+	switch (id) {
+	case LPC18XX_RGU_M0SUB_RST:
+	case LPC18XX_RGU_M0APP_RST:
+		lpc18xx_rgu_setclear_reset(rcdev, id, false);
+	}
+
+	return 0;
+}

If writing 0 to the self-clearing reset bits does nothing, lpc18xx_rgu_setclear_reset(... false) could be called unconditionally.

[...]

regards
Philipp

#3 lore raw

PATCH 1/2 reset: add driver for lpc18xx rgu

Quoted 48 lines · Philipp Zabel

Hi Joachim,

thank you for the patch! Some comments below:

Am Dienstag, den 28.04.2015, 00:30 +0200 schrieb Joachim Eastwood:

Quoted 43 lines
---
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-lpc18xx.c | 260 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 261 insertions(+)
 create mode 100644 drivers/reset/reset-lpc18xx.c
drivers/reset/Makefile +1 -0
index 157d421f755b..1d41feeb2dce 100644
@@ -1,4 +1,5 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
drivers/reset/reset-lpc18xx.c new file +20 -0
new file mode 100644
index 000000000000..9564d78ab9d2
@@ -0,0 +1,260 @@
+/*
+ * Reset driver for NXP LPC18xx/43xx Reset Generation Unit (RGU).
+ *
+ * Copyright (C) 2014 Joachim Eastwood <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
Quoted 8 lines

drivers/reset/reset-lpc18xx.c line 25

Quoted 5 lines
drivers/reset/reset-lpc18xx.c new file +5 -0
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#include <asm/system_misc.h>

Are all of these necessary? I don't see why of_address.h and system_misc.h are included, for example.

You are right, I'll clean them up.

Quoted 8 lines
Quoted 8 lines
drivers/reset/reset-lpc18xx.c new file +8 -0
+/* LPC18xx RGU registers */
+#define LPC18XX_RGU_CTRL0            0x100
+#define LPC18XX_RGU_CTRL1            0x104
+#define LPC18XX_RGU_ACTIVE_STATUS0   0x150
+#define LPC18XX_RGU_ACTIVE_STATUS1   0x154
+
+#define LPC18XX_RGU_RESETS_PER_REG   32
+
Quoted 8 lines

drivers/reset/reset-lpc18xx.c line 38

Quoted 4 lines
drivers/reset/reset-lpc18xx.c new file +4 -0
+/* Internal reset outputs */
+#define LPC18XX_RGU_CORE_RST 0
+#define LPC18XX_RGU_M0SUB_RST        12
+#define LPC18XX_RGU_M0APP_RST        56

In the LPC18xx User Manual these are marked as reserved, I think using the LPC43XX_ prefix here could avoid confusion. Or are there also LPC18xx that have these reset lines?

No, they are only used on the 43xx series. I'll change the prefix.

I'll also add some comments in the DT doc on which reset lines that are available on the different devices.

Quoted 29 lines
Quoted 29 lines
drivers/reset/reset-lpc18xx.c new file +29 -0
+
+struct lpc18xx_rgu_data {
+     struct reset_controller_dev rcdev;
+     struct clk *clk_delay;
+     struct clk *clk_reg;
+     void __iomem *base;
+     spinlock_t lock;
+     u32 delay_us;
+};
+
+#define to_rgu_data(rcdev) container_of(rcdev, struct lpc18xx_rgu_data, rcdev)
+
+static void __iomem *rgu_base;
+
+static int lpc18xx_rgu_restart(struct notifier_block *this, unsigned long mode,
+                            void *cmd)
+{
+     writel(BIT(LPC18XX_RGU_CORE_RST), rgu_base + LPC18XX_RGU_CTRL0);
+     mdelay(2000);
+
+     pr_emerg("%s: unable to restart system\n", __func__);
+
+     return NOTIFY_DONE;
+}
+
+static struct notifier_block lpc18xx_rgu_restart_nb = {
+     .notifier_call = lpc18xx_rgu_restart,
+     .priority = 192,
+};
Quoted 8 lines

drivers/reset/reset-lpc18xx.c line 73

Quoted 6 lines
drivers/reset/reset-lpc18xx.c new file +6 -0
+
+/*
+ * The LPC18xx RGU has mostly self-deasserting resets except for the
+ * two reset lines going to the internal Cortex-M0 cores.
+ *
+ * To prevent the M0 cores from accidentally getting deasserting the

"To prevent the M0 core resets from accidentally getting deasserted" ?

That sounds better. I'll use it in the next version.

Quoted 38 lines
Quoted 25 lines
drivers/reset/reset-lpc18xx.c new file +25 -0
+ * status register must be check and bits in control register set to
+ * preserve the state.
+ */
+static void lpc18xx_rgu_setclear_reset(struct reset_controller_dev *rcdev,
+                                    unsigned long id, bool set)
+{
+     struct lpc18xx_rgu_data *rc = to_rgu_data(rcdev);
+     u32 stat_offset = LPC18XX_RGU_ACTIVE_STATUS0;
+     u32 ctrl_offset = LPC18XX_RGU_CTRL0;
+     unsigned long flags;
+     u32 stat, rst_bit;
+
+     stat_offset += (id / LPC18XX_RGU_RESETS_PER_REG) * sizeof(u32);
+     ctrl_offset += (id / LPC18XX_RGU_RESETS_PER_REG) * sizeof(u32);
+     rst_bit = 1 << (id % LPC18XX_RGU_RESETS_PER_REG);
+
+     spin_lock_irqsave(&rc->lock, flags);
+     stat = ~readl(rc->base + stat_offset);
+     if (set)
+             writel(stat | rst_bit, rc->base + ctrl_offset);
+     else
+             writel(stat & ~rst_bit, rc->base + ctrl_offset);
+     spin_unlock_irqrestore(&rc->lock, flags);
+}
+

drivers/reset/reset-lpc18xx.c line 108

Quoted 10 lines
drivers/reset/reset-lpc18xx.c new file +10 -0
+static int lpc18xx_rgu_reset(struct reset_controller_dev *rcdev,
+                          unsigned long id)
+{
+     struct lpc18xx_rgu_data *rc = to_rgu_data(rcdev);
+
+     lpc18xx_rgu_setclear_reset(rcdev, id, true);
+     udelay(rc->delay_us);
+
+     return 0;
+}

This is missing a deassert for the M0 resets, see below.

Quoted 9 lines

drivers/reset/reset-lpc18xx.c line 114

Quoted 6 lines
drivers/reset/reset-lpc18xx.c new file +6 -0
+
+static int lpc18xx_rgu_assert(struct reset_controller_dev *rcdev,
+                           unsigned long id)
+{
+     return lpc18xx_rgu_reset(rcdev, id);
+}

lpc18xx_rgu_assert shouldn't include the delay. Could you have lpc18xx_rgu_assert call lpc18xx_rgu_setclear_reset directly?

I agree. I'll change it.

Quoted 2 lines

Let lpc18xx_rgu_reset then call lpc18xx_rgu_assert, udelay, and lpc18xx_rgu_deassert.

Ok, that does indeed sound like a better call chain. I'll reorganize the code a bit.

Quoted 2 lines

Or could you wait for the active status bit to
clear instead of the fixed delay for the self-clearing resets?

I am not sure. The manual explicitly mentions a software delay.

Quoted 1 line

From manual:

Remark: The reset delay is counted in IRC clock cycles. If the core frequency CCLK is much higher than the IRC frequency, add a software delay of fCCLK/fIRC clock cycles between resetting and accessing any of the peripheral blocks.

So I think it's best to keep using the delay.

Quoted 7 lines
Quoted 7 lines
drivers/reset/reset-lpc18xx.c new file +7 -0
+/* Only M0 cores require explicit reset deassert */
+static int lpc18xx_rgu_deassert(struct reset_controller_dev *rcdev,
+                             unsigned long id)
+{
+     switch (id) {
+     case LPC18XX_RGU_M0SUB_RST:
+     case LPC18XX_RGU_M0APP_RST:
Quoted 8 lines

drivers/reset/reset-lpc18xx.c line 127

Quoted 5 lines
drivers/reset/reset-lpc18xx.c new file +5 -0
+             lpc18xx_rgu_setclear_reset(rcdev, id, false);
+     }
+
+     return 0;
+}

If writing 0 to the self-clearing reset bits does nothing, lpc18xx_rgu_setclear_reset(... false) could be called unconditionally.

I added the check to document that the M0 reset are special. The next version of the patch set will move it around a bit. If you still don't like it can remove it then.

Thanks for your time reviewing.

regards,
Joachim Eastwood

#4 lore raw

PATCH 2/2 doc: dt: add documentation for lpc1850-rgu reset driver

In reply to Joachim Eastwood
---
 .../devicetree/bindings/reset/nxp,lpc1850-rgu.txt  | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +38 -0
new file mode 100644
index 000000000000..45dbd6087731
@@ -0,0 +1,38 @@
+NXP LPC1850  Reset Generation Unit (RGU)
+========================================
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "nxp,lpc1850-rgu"
+- reg: register base and length
+- clocks: phandle and clock specifier to RGU clocks
+- clock-names: should contain "delay" and "reg"
+- #reset-cells: should be 1
+
+Refer to NXP LPC18xx or LPC43xx user manual for a description of the
+reset signals and the connected block/peripheral.
+
+Reset provider example:
+rgu: reset-controller at 40053000 {
+	compatible = "nxp,lpc1850-rgu";
+	reg = <0x40053000 0x1000>;
+	clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_BUS>;
+	clock-names = "delay", "reg";
+	#reset-cells = <1>;
+};
+
+Reset consumer example:
+mac: ethernet at 40010000 {
+	compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
+	reg = <0x40010000 0x2000>;
+	interrupts = <5>;
+	interrupt-names = "macirq";
+	clocks = <&ccu1 CLK_CPU_ETHERNET>;
+	clock-names = "stmmaceth";
+	resets = <&rgu 22>;
+	reset-names = "stmmaceth";
+	status = "disabled";
+};
+
Signature · 1 line
1.8.0
maintainer
#5 lore raw

PATCH 2/2 doc: dt: add documentation for lpc1850-rgu reset driver

Hi Joachim,

please Cc: devicetree at vger.kernel.org for new device tree binding documentation.

Am Dienstag, den 28.04.2015, 00:30 +0200 schrieb Joachim Eastwood:

Quoted 36 lines
---
 .../devicetree/bindings/reset/nxp,lpc1850-rgu.txt  | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +24 -0
new file mode 100644
index 000000000000..45dbd6087731
@@ -0,0 +1,38 @@
+NXP LPC1850  Reset Generation Unit (RGU)
+========================================
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "nxp,lpc1850-rgu"
+- reg: register base and length
+- clocks: phandle and clock specifier to RGU clocks
+- clock-names: should contain "delay" and "reg"
+- #reset-cells: should be 1
+
+Refer to NXP LPC18xx or LPC43xx user manual for a description of the
+reset signals and the connected block/peripheral.
+
+Reset provider example:
+rgu: reset-controller at 40053000 {
+	compatible = "nxp,lpc1850-rgu";
+	reg = <0x40053000 0x1000>;
+	clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_BUS>;
+	clock-names = "delay", "reg";
+	#reset-cells = <1>;
+};

Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt line 34

Quoted 10 lines
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +10 -0
+
+Reset consumer example:
+mac: ethernet at 40010000 {
+	compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
+	reg = <0x40010000 0x2000>;
+	interrupts = <5>;
+	interrupt-names = "macirq";
+	clocks = <&ccu1 CLK_CPU_ETHERNET>;
+	clock-names = "stmmaceth";
+	resets = <&rgu 22>;

I'd like the reset numbers to be documented in the binding docs. The reset ordering seems to be the same across all users of this core?

Personally, I'd even prefer #defines like you have for the clock indices. I know others dislike this, though.

Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt line 38

Quoted 4 lines
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +4 -0
+	reset-names = "stmmaceth";
+	status = "disabled";
+};
+

^^
Superfluous whitespace.

regards
Philipp

#6 lore raw

PATCH 2/2 doc: dt: add documentation for lpc1850-rgu reset driver

Quoted 4 lines · Philipp Zabel

Hi Joachim,

please Cc: devicetree at vger.kernel.org for new device tree binding documentation.

okey, sorry about that. Will do for the next version.

Quoted 41 lines

Am Dienstag, den 28.04.2015, 00:30 +0200 schrieb Joachim Eastwood:

Quoted 40 lines
---
 .../devicetree/bindings/reset/nxp,lpc1850-rgu.txt  | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +28 -0
new file mode 100644
index 000000000000..45dbd6087731
@@ -0,0 +1,38 @@
+NXP LPC1850  Reset Generation Unit (RGU)
+========================================
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "nxp,lpc1850-rgu"
+- reg: register base and length
+- clocks: phandle and clock specifier to RGU clocks
+- clock-names: should contain "delay" and "reg"
+- #reset-cells: should be 1
+
+Refer to NXP LPC18xx or LPC43xx user manual for a description of the
+reset signals and the connected block/peripheral.
+
+Reset provider example:
+rgu: reset-controller at 40053000 {
+     compatible = "nxp,lpc1850-rgu";
+     reg = <0x40053000 0x1000>;
+     clocks = <&cgu BASE_SAFE_CLK>, <&ccu1 CLK_CPU_BUS>;
+     clock-names = "delay", "reg";
+     #reset-cells = <1>;
+};
+
+Reset consumer example:
+mac: ethernet at 40010000 {
+     compatible = "nxp,lpc1850-dwmac", "snps,dwmac-3.611", "snps,dwmac";
Quoted 8 lines

Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt line 34

Quoted 6 lines
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +6 -0
+     reg = <0x40010000 0x2000>;
+     interrupts = <5>;
+     interrupt-names = "macirq";
+     clocks = <&ccu1 CLK_CPU_ETHERNET>;
+     clock-names = "stmmaceth";
+     resets = <&rgu 22>;

I'd like the reset numbers to be documented in the binding docs.

Yes, that is good idea. I'll add it.

Quoted 2 lines

The reset ordering seems to be the same across all users of this core?

Yes, there are no overlapping reset numbers between the LPC18xx and LPC43xx. The new lines that were added on LPC43xx used reserved numbers on the LPC18xx.

Quoted 2 lines

Personally, I'd even prefer #defines like you have for the clock indices. I know others dislike this, though.

Like Arnd I prefer the raw numbers in DT. At least for this controller where the number are consistent between the parts and there is a nice table in the data sheet.

So if you don't mind I would like to keep using the raw numbers.

Quoted 6 lines

Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt line 38

Quoted 4 lines
Documentation/devicetree/bindings/reset/nxp,lpc1850-rgu.txt new file +4 -0
+     reset-names = "stmmaceth";
+     status = "disabled";
+};
+

^^
Superfluous whitespace.

I'll remove it.

Thanks for reviewing.

regards,
Joachim Eastwood