Skip to contentSkip to conversation

Reset controller API to reset IP modules on i.MX5 and i.MX6

PATCH New Philipp Zabel 8 participants 20 messages Mar 28, 2013 – Apr 11, 2013

Subsystems (6)
lore
Share & tools
lore

Philipp Zabel

author maintainer
#0 lore raw

v6 cover Reset controller API to reset IP modules on i.MX5 and i.MX6

[Added Arnd and Greg to the recipients] I think the first three patches of this series are candidates to go through Arnd's tree. Arnd, would you take those patches?
[PATCH v6 1/8] dt: describe base reset signal binding [PATCH v6 2/8] reset: Add reset controller API [PATCH v6 3/8] reset: Add driver for gpio-controlled reset pins

The system reset controller (SRC) on i.MX51, i.MX53, and i.MX6q controls reset lines to the GPU, VPU, IPU, and OpenVG IP modules.

The following patches add a simple API for devices to request being reset by separate reset controller hardware and implements the reset signal device tree binding proposed by Stephen Warren. Contrary to Tegra hardware, the i.MX SRC contains self-deasserting reset registers, so I've included both ops to manually assert/deassert a reset line, as well as a "reset" operation that is supposed to assert the reset line and wait for it to deassert.

The i.MX SRC is enhanced to provide a reset controller and the IPU driver is made to request being reset by calling the device_reset(&pdev->dev) convenience wrapper during probing.

No changes since v5, I just reordered the series.

regards
Philipp

---
 .../devicetree/bindings/reset/fsl,imx-src.txt      |  49 ++++
 .../devicetree/bindings/reset/gpio-reset.txt       |  37 +++
 Documentation/devicetree/bindings/reset/reset.txt  |  75 ++++++
 .../bindings/staging/imx-drm/fsl-imx-drm.txt       |   3 +
 arch/arm/boot/dts/imx51.dtsi                       |   7 +
 arch/arm/boot/dts/imx53.dtsi                       |   7 +
 arch/arm/boot/dts/imx6q.dtsi                       |   1 +
 arch/arm/boot/dts/imx6qdl.dtsi                     |   4 +-
 arch/arm/mach-imx/Kconfig                          |   3 +
 arch/arm/mach-imx/mm-imx5.c                        |   2 +
 arch/arm/mach-imx/src.c                            |  69 ++++-
 drivers/Kconfig                                    |   2 +
 drivers/Makefile                                   |   3 +
 drivers/reset/Kconfig                              |  26 ++
 drivers/reset/Makefile                             |   2 +
 drivers/reset/core.c                               | 297 +++++++++++++++++++++
 drivers/reset/gpio-reset.c                         | 208 +++++++++++++++
 drivers/staging/imx-drm/ipu-v3/ipu-common.c        |  12 +-
 include/linux/reset-controller.h                   |  51 ++++
 include/linux/reset.h                              |  17 ++
 20 files changed, 870 insertions(+), 5 deletions(-)
author maintainer
#1 lore raw

PATCH v6 1/8 dt: describe base reset signal binding

From: Stephen Warren <[email protected]>

This binding is intended to represent the hardware reset signals present internally in most IC (SoC, FPGA, ...) designs.
It consists of a binding for a reset controller device (provider), and a pair of properties, "resets" and "reset-names", to link a device node (consumer) to its reset controller via phandle, similarly to the clock and interrupt bindings.

The reset controller has all information necessary to reset the consumer device. That could be provided via device tree, or it could be implemented in hardware.
The aim is to enable device drivers to request a framework API to issue a reset simply by providing their struct device pointer as the most common case.

---
 Documentation/devicetree/bindings/reset/reset.txt | 75 +++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/reset.txt
Documentation/devicetree/bindings/reset/reset.txt new file +75 -0
new file mode 100644
index 0000000..31db6ff
@@ -0,0 +1,75 @@
+= Reset Signal Device Tree Bindings =
+
+This binding is intended to represent the hardware reset signals present
+internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole
+standalone chips are most likely better represented as GPIOs, although there
+are likely to be exceptions to this rule.
+
+Hardware blocks typically receive a reset signal. This signal is generated by
+a reset provider (e.g. power management or clock module) and received by a
+reset consumer (the module being reset, or a module managing when a sub-
+ordinate module is reset). This binding exists to represent the provider and
+consumer, and provide a way to couple the two together.
+
+A reset signal is represented by the phandle of the provider, plus a reset
+specifier - a list of DT cells that represents the reset signal within the
+provider. The length (number of cells) and semantics of the reset specifier
+are dictated by the binding of the reset provider, although common schemes
+are described below.
+
+A word on where to place reset signal consumers in device tree: It is possible
+in hardware for a reset signal to affect multiple logically separate HW blocks
+at once. In this case, it would be unwise to represent this reset signal in
+the DT node of each affected HW block, since if activated, an unrelated block
+may be reset. Instead, reset signals should be represented in the DT node
+where it makes most sense to control it; this may be a bus node if all
+children of the bus are affected by the reset signal, or an individual HW
+block node for dedicated reset signals. The intent of this binding is to give
+appropriate software access to the reset signals in order to manage the HW,
+rather than to slavishly enumerate the reset signal that affects each HW
+block.
+
+= Reset providers =
+
+Required properties:
+#reset-cells:	Number of cells in a reset specifier; Typically 0 for nodes
+		with a single reset output and 1 for nodes with multiple
+		reset outputs.
+
+For example:
+
+	rst: reset-controller {
+		#reset-cells = <1>;
+	};
+
+= Reset consumers =
+
+Required properties:
+resets:		List of phandle and reset specifier pairs, one pair
+		for each reset signal that affects the device, or that the
+		device manages. Note: if the reset provider specifies '0' for
+		#reset-cells, then only the phandle portion of the pair will
+		appear.
+
+Optional properties:
+reset-names:	List of reset signal name strings sorted in the same order as
+		the resets property. Consumers drivers will use reset-names to
+		match reset signal names with reset specifiers.
+
+For example:
+
+	device {
+		resets = <&rst 20>;
+		reset-names = "reset";
+	};
+
+This represents a device with a single reset signal named "reset".
+
+	bus {
+		resets = <&rst 10> <&rst 11> <&rst 12> <&rst 11>;
+		reset-names = "i2s1", "i2s2", "dma", "mixer";
+	};
+
+This represents a bus that controls the reset signal of each of four sub-
+ordinate devices. Consider for example a bus that fails to operate unless no
+child device has reset asserted.
Signature · 1 line
1.8.2.rc2
#2 lore raw

PATCH v6 1/8 dt: describe base reset signal binding

Quoted 16 lines · Philipp Zabel

From: Stephen Warren <[email protected]>

This binding is intended to represent the hardware reset signals present internally in most IC (SoC, FPGA, ...) designs.
It consists of a binding for a reset controller device (provider), and a pair of properties, "resets" and "reset-names", to link a device node (consumer) to its reset controller via phandle, similarly to the clock and interrupt bindings.

The reset controller has all information necessary to reset the consumer device. That could be provided via device tree, or it could be implemented in hardware.
The aim is to enable device drivers to request a framework API to issue a reset simply by providing their struct device pointer as the most common case.

Quoted 4 lines

Looks good.

Rob

Quoted 87 lines
---
 Documentation/devicetree/bindings/reset/reset.txt | 75 +++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/reset.txt
Documentation/devicetree/bindings/reset/reset.txt new file +75 -0
new file mode 100644
index 0000000..31db6ff
@@ -0,0 +1,75 @@
+= Reset Signal Device Tree Bindings =
+
+This binding is intended to represent the hardware reset signals present
+internally in most IC (SoC, FPGA, ...) designs. Reset signals for whole
+standalone chips are most likely better represented as GPIOs, although there
+are likely to be exceptions to this rule.
+
+Hardware blocks typically receive a reset signal. This signal is generated by
+a reset provider (e.g. power management or clock module) and received by a
+reset consumer (the module being reset, or a module managing when a sub-
+ordinate module is reset). This binding exists to represent the provider and
+consumer, and provide a way to couple the two together.
+
+A reset signal is represented by the phandle of the provider, plus a reset
+specifier - a list of DT cells that represents the reset signal within the
+provider. The length (number of cells) and semantics of the reset specifier
+are dictated by the binding of the reset provider, although common schemes
+are described below.
+
+A word on where to place reset signal consumers in device tree: It is possible
+in hardware for a reset signal to affect multiple logically separate HW blocks
+at once. In this case, it would be unwise to represent this reset signal in
+the DT node of each affected HW block, since if activated, an unrelated block
+may be reset. Instead, reset signals should be represented in the DT node
+where it makes most sense to control it; this may be a bus node if all
+children of the bus are affected by the reset signal, or an individual HW
+block node for dedicated reset signals. The intent of this binding is to give
+appropriate software access to the reset signals in order to manage the HW,
+rather than to slavishly enumerate the reset signal that affects each HW
+block.
+
+= Reset providers =
+
+Required properties:
+#reset-cells:	Number of cells in a reset specifier; Typically 0 for nodes
+		with a single reset output and 1 for nodes with multiple
+		reset outputs.
+
+For example:
+
+	rst: reset-controller {
+		#reset-cells = <1>;
+	};
+
+= Reset consumers =
+
+Required properties:
+resets:		List of phandle and reset specifier pairs, one pair
+		for each reset signal that affects the device, or that the
+		device manages. Note: if the reset provider specifies '0' for
+		#reset-cells, then only the phandle portion of the pair will
+		appear.
+
+Optional properties:
+reset-names:	List of reset signal name strings sorted in the same order as
+		the resets property. Consumers drivers will use reset-names to
+		match reset signal names with reset specifiers.
+
+For example:
+
+	device {
+		resets = <&rst 20>;
+		reset-names = "reset";
+	};
+
+This represents a device with a single reset signal named "reset".
+
+	bus {
+		resets = <&rst 10> <&rst 11> <&rst 12> <&rst 11>;
+		reset-names = "i2s1", "i2s2", "dma", "mixer";
+	};
+
+This represents a bus that controls the reset signal of each of four sub-
+ordinate devices. Consider for example a bus that fails to operate unless no
+child device has reset asserted.
author maintainer
#3 lore raw

PATCH v6 1/8 dt: describe base reset signal binding

Hi Rob,

Am Donnerstag, den 04.04.2013, 08:49 -0500 schrieb Rob Herring:

Quoted 17 lines · Philipp Zabel
Quoted 16 lines

From: Stephen Warren <[email protected]>

This binding is intended to represent the hardware reset signals present internally in most IC (SoC, FPGA, ...) designs.
It consists of a binding for a reset controller device (provider), and a pair of properties, "resets" and "reset-names", to link a device node (consumer) to its reset controller via phandle, similarly to the clock and interrupt bindings.

The reset controller has all information necessary to reset the consumer device. That could be provided via device tree, or it could be implemented in hardware.
The aim is to enable device drivers to request a framework API to issue a reset simply by providing their struct device pointer as the most common case.

Quoted 8 lines
Quoted 4 lines

Looks good.

Thank you. I'll not add the Acked-by: line to the patch itself, if that's ok, since Shawn already pulled it into his imx/soc branch.

regards
Philipp

author maintainer
#4 lore raw

PATCH v6 2/8 reset: Add reset controller API

In reply to Philipp Zabel

This adds a simple API for devices to request being reset by separate reset controller hardware and implements the reset signal device tree binding.

---
 drivers/Kconfig                  |   2 +
 drivers/Makefile                 |   3 +
 drivers/reset/Kconfig            |  13 ++
 drivers/reset/Makefile           |   1 +
 drivers/reset/core.c             | 297 +++++++++++++++++++++++++++++++++++++++
 include/linux/reset-controller.h |  51 +++++++
 include/linux/reset.h            |  17 +++
 7 files changed, 384 insertions(+)
 create mode 100644 drivers/reset/Kconfig
 create mode 100644 drivers/reset/Makefile
 create mode 100644 drivers/reset/core.c
 create mode 100644 include/linux/reset-controller.h
 create mode 100644 include/linux/reset.h
drivers/Kconfig +2 -0
index 202fa6d..847f8e3 100644
@@ -162,4 +162,6 @@ source "drivers/irqchip/Kconfig"
 
 source "drivers/ipack/Kconfig"
 
+source "drivers/reset/Kconfig"
+
 endmenu
drivers/Makefile +3 -0
index dce39a9..1a64c4c 100644
@@ -37,6 +37,9 @@ obj-$(CONFIG_XEN)		+= xen/
 # regulators early, since some subsystems rely on them to initialize
 obj-$(CONFIG_REGULATOR)		+= regulator/
 
+# reset controllers early, since gpu drivers might rely on them to initialize
+obj-$(CONFIG_RESET_CONTROLLER)	+= reset/
+
 # tty/ comes before char/ so that the VT console is the boot-time
 # default.
 obj-y				+= tty/
drivers/reset/Kconfig new file +13 -0
new file mode 100644
index 0000000..c9d04f7
@@ -0,0 +1,13 @@
+config ARCH_HAS_RESET_CONTROLLER
+	bool
+
+menuconfig RESET_CONTROLLER
+	bool "Reset Controller Support"
+	default y if ARCH_HAS_RESET_CONTROLLER
+	help
+	  Generic Reset Controller support.
+
+	  This framework is designed to abstract reset handling of devices
+	  via GPIOs or SoC-internal reset controller modules.
+
+	  If unsure, say no.
drivers/reset/Makefile new file +1 -0
new file mode 100644
index 0000000..1e2d83f
@@ -0,0 +1 @@
+obj-$(CONFIG_RESET_CONTROLLER) += core.o
drivers/reset/core.c new file +297 -0

297 lines not on this page · raw message

include/linux/reset-controller.h new file +51 -0

51 lines not on this page · raw message

include/linux/reset.h new file +17 -0
new file mode 100644
index 0000000..6082247
@@ -0,0 +1,17 @@
+#ifndef _LINUX_RESET_H_
+#define _LINUX_RESET_H_
+
+struct device;
+struct reset_control;
+
+int reset_control_reset(struct reset_control *rstc);
+int reset_control_assert(struct reset_control *rstc);
+int reset_control_deassert(struct reset_control *rstc);
+
+struct reset_control *reset_control_get(struct device *dev, const char *id);
+void reset_control_put(struct reset_control *rstc);
+struct reset_control *devm_reset_control_get(struct device *dev, const char *id);
+
+int device_reset(struct device *dev);
+
+#endif
Signature · 1 line
1.8.2.rc2
author maintainer
#5 lore raw

PATCH v6 3/8 reset: Add driver for gpio-controlled reset pins

In reply to Philipp Zabel

This driver implements a reset controller device that toggles gpios connected to reset pins of peripheral ICs. The delay between assertion and de-assertion of the reset signal can be configured.

---
 .../devicetree/bindings/reset/gpio-reset.txt       |  37 ++++
 drivers/reset/Kconfig                              |  13 ++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/gpio-reset.c                         | 208 +++++++++++++++++++++
 4 files changed, 259 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt
 create mode 100644 drivers/reset/gpio-reset.c
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +37 -0
new file mode 100644
index 0000000..1f203eb
@@ -0,0 +1,37 @@
+GPIO reset controller
+=====================
+
+A GPIO reset controller controls a number of GPIOs that are connected
+to reset pins of peripheral ICs.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "gpio-reset"
+- reset-gpios: List of gpios used as reset lines. The gpio specifier for this
+               property depends on the gpio controller that provides the gpio.
+- #reset-cells: 1, see below
+
+Optional properties:
+- reset-delays: List of delays in microseconds. The corresponding gpio reset
+                line should be asserted for this duration to reset.
+- initially-in-reset: List of integers. Zero if the initial state should be
+                      a deasserted reset line, nonzero if the line should be
+                      kept in reset.
+
+example:
+
+gpio_reset: gpio-reset {
+	compatible = "gpio-reset";
+	reset-gpios = <&gpio5 0 1>; /* active-low */
+	reset-delays = <10000>; /* 10 ms */
+	initially-in-reset: <1>;
+	#reset-cells = <1>;
+};
+
+/* Device with nRESET pin connected to GPIO5_0 */
+sii902x at 39 {
+	/* ... */
+	resets = <&gpio_reset 0>; /* active-low GPIO5_0, 10 ms reset delay */
+};
drivers/reset/Kconfig +13 -0
index c9d04f7..e728d36 100644
@@ -11,3 +11,16 @@ menuconfig RESET_CONTROLLER
 	  via GPIOs or SoC-internal reset controller modules.
 
 	  If unsure, say no.
+
+if RESET_CONTROLLER
+
+config RESET_GPIO
+	tristate "GPIO reset controller support"
+	depends on GENERIC_GPIO
+	help
+	  This driver provides support for reset lines that are controlled
+	  directly by GPIOs.
+	  The delay between assertion and de-assertion of the reset signal
+	  can be configured.
+
+endif
drivers/reset/Makefile +1 -0
index 1e2d83f..b854f20 100644
@@ -1 +1,2 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
+obj-$(CONFIG_RESET_GPIO) += gpio-reset.o
drivers/reset/gpio-reset.c new file +208 -0

208 lines not on this page · raw message

Signature · 1 line
1.8.2.rc2
#6 lore raw

PATCH v6 3/8 reset: Add driver for gpio-controlled reset pins

Hi,

Quoted 44 lines · Philipp Zabel

This driver implements a reset controller device that toggles gpios connected to reset pins of peripheral ICs. The delay between assertion and de-assertion of the reset signal can be configured.

---
 .../devicetree/bindings/reset/gpio-reset.txt       |  37 ++++
 drivers/reset/Kconfig                              |  13 ++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/gpio-reset.c                         | 208 +++++++++++++++++++++
 4 files changed, 259 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt
 create mode 100644 drivers/reset/gpio-reset.c
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +21 -0
new file mode 100644
index 0000000..1f203eb
@@ -0,0 +1,37 @@
+GPIO reset controller
+=====================
+
+A GPIO reset controller controls a number of GPIOs that are connected
+to reset pins of peripheral ICs.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "gpio-reset"
+- reset-gpios: List of gpios used as reset lines. The gpio specifier for this
+               property depends on the gpio controller that provides the gpio.
+- #reset-cells: 1, see below
+
+Optional properties:
+- reset-delays: List of delays in microseconds. The corresponding gpio reset
+                line should be asserted for this duration to reset.
+- initially-in-reset: List of integers. Zero if the initial state should be
+                      a deasserted reset line, nonzero if the line should be
+                      kept in reset.

Documentation/devicetree/bindings/reset/gpio-reset.txt line 31

Quoted 10 lines
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +10 -0
+
+example:
+
+gpio_reset: gpio-reset {
+       compatible = "gpio-reset";
+       reset-gpios = <&gpio5 0 1>; /* active-low */
+       reset-delays = <10000>; /* 10 ms */
+       initially-in-reset: <1>;
+       #reset-cells = <1>;
+};

I find this binding that uses an array of GPIOs and their state to be a bit awkward, especially if you compare it to something like the simple gpio regulators that have a simpler one-to-one mapping.

Also, if you did one node per gpio you'd have a boolean property for "initially-in-reset" which seems much more logical (i.e. the property is either there, or it's not).

A couple of more comments:

Documentation/devicetree/bindings/reset/gpio-reset.txt

Quoted 8 lines
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +8 -0
+config RESET_GPIO
+       tristate "GPIO reset controller support"
+       depends on GENERIC_GPIO
+       help
+         This driver provides support for reset lines that are controlled
+         directly by GPIOs.
+         The delay between assertion and de-assertion of the reset signal
+         can be configured.

Can be configured how? And why would I care about that when I'm trying to decide if I need to include this driver in my kernel configuration or not? Seems like misplaced information.

Since this is a platform driver and not just an OF driver, shouldn't you provide a way to specify the same configuration data through a platform_data structure as well?

-Olof

author maintainer
#7 lore raw

PATCH v6 3/8 reset: Add driver for gpio-controlled reset pins

Hi Olof,

Am Donnerstag, den 11.04.2013, 03:35 -0700 schrieb Olof Johansson:

Quoted 62 lines

Hi,

Quoted 44 lines · Philipp Zabel

This driver implements a reset controller device that toggles gpios connected to reset pins of peripheral ICs. The delay between assertion and de-assertion of the reset signal can be configured.

---
 .../devicetree/bindings/reset/gpio-reset.txt       |  37 ++++
 drivers/reset/Kconfig                              |  13 ++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/gpio-reset.c                         | 208 +++++++++++++++++++++
 4 files changed, 259 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/gpio-reset.txt
 create mode 100644 drivers/reset/gpio-reset.c
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +21 -0
new file mode 100644
index 0000000..1f203eb
@@ -0,0 +1,37 @@
+GPIO reset controller
+=====================
+
+A GPIO reset controller controls a number of GPIOs that are connected
+to reset pins of peripheral ICs.
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "gpio-reset"
+- reset-gpios: List of gpios used as reset lines. The gpio specifier for this
+               property depends on the gpio controller that provides the gpio.
+- #reset-cells: 1, see below
+
+Optional properties:
+- reset-delays: List of delays in microseconds. The corresponding gpio reset
+                line should be asserted for this duration to reset.
+- initially-in-reset: List of integers. Zero if the initial state should be
+                      a deasserted reset line, nonzero if the line should be
+                      kept in reset.

Documentation/devicetree/bindings/reset/gpio-reset.txt line 31

Quoted 10 lines
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +10 -0
+
+example:
+
+gpio_reset: gpio-reset {
+       compatible = "gpio-reset";
+       reset-gpios = <&gpio5 0 1>; /* active-low */
+       reset-delays = <10000>; /* 10 ms */
+       initially-in-reset: <1>;
+       #reset-cells = <1>;
+};

I find this binding that uses an array of GPIOs and their state to be a bit awkward, especially if you compare it to something like the simple gpio regulators that have a simpler one-to-one mapping.

Quoted 3 lines

Also, if you did one node per gpio you'd have a boolean property for "initially-in-reset" which seems much more logical (i.e. the property is either there, or it's not).

Thank you for your comments. I agree, to a degree.
The initially-in-reset array is a bit weird, and in principle, there is no reason to group different reset gpios into the same platform device. The main difference to the gpio regulator is that that one registers multiple gpios per regulator, but only one regulator per platform device. Do you propose to make the reset-gpio driver strictly control only one reset gpio per platform device? In that case, the fixed-regulator probably is a better example. How about this:

    resets {
        compatible = "simple-bus";

        reset1: gpio-reset {
            compatible = "gpio-reset";
            reset-gpio = <&gpio5 0 1>; /* active-low */
            reset-delay = <10000>; /* 10 ms */
            initially-in-reset;
            #reset-cells = <0>;
        };

        reset2: gpio-reset {
            compatible = "gpio-reset";
            reset-gpio = <&gpio3 5 0>;
            /* no reset delay, consumer has to (de)assert manually */
            #reset-cells = <0>;
        };
    };
Quoted 11 lines

A couple of more comments:

Documentation/devicetree/bindings/reset/gpio-reset.txt

Quoted 8 lines
Documentation/devicetree/bindings/reset/gpio-reset.txt new file +8 -0
+config RESET_GPIO
+       tristate "GPIO reset controller support"
+       depends on GENERIC_GPIO
+       help
+         This driver provides support for reset lines that are controlled
+         directly by GPIOs.
+         The delay between assertion and de-assertion of the reset signal
+         can be configured.
Quoted 3 lines

Can be configured how? And why would I care about that when I'm trying to decide if I need to include this driver in my kernel configuration or not? Seems like misplaced information.

Configured via device tree. I'll just drop the second sentence. The idea was to point out once more that it's the reset driver that carries the timing information, but this really isn't the best place.

Quoted 3 lines

Since this is a platform driver and not just an OF driver, shouldn't you provide a way to specify the same configuration data through a platform_data structure as well?

Will there be new non-OF platforms for which this is even useful? I can add platform data support, if you like.

regards
Philipp

#8 lore raw

PATCH v6 3/8 reset: Add driver for gpio-controlled reset pins

In reply to Olof Johansson
Quoted 4 lines · Olof Johansson
Quoted 3 lines · Philipp Zabel

This driver implements a reset controller device that toggles gpios connected to reset pins of peripheral ICs. The delay between assertion and de-assertion of the reset signal can be configured.

...

Quoted 3 lines

Since this is a platform driver and not just an OF driver, shouldn't you provide a way to specify the same configuration data through a platform_data structure as well?

I believe the only practical use-cases for this driver are /currently/ for device-tree platforms. Shouldn't we add the platform_data support only when some platform actively uses it?

In the past when reviewing new drivers, I pushed for platform drivers to always implement the platform_data structure up-front, and support using that if present rather than "falling back" to DT. However, Grant then shot that down saying that there was no point adding dead code...

(this will also feed into the discussion about simple-framebuffer, which also only needs DT support right now, but could in theory be extended to support platform_data in the future if somebody wants).

#9 lore raw

PATCH v6 3/8 reset: Add driver for gpio-controlled reset pins

Quoted 5 lines · Stephen Warren
Quoted 4 lines · Olof Johansson
Quoted 3 lines · Philipp Zabel

This driver implements a reset controller device that toggles gpios connected to reset pins of peripheral ICs. The delay between assertion and de-assertion of the reset signal can be configured.

Quoted 8 lines

...

Quoted 3 lines

Since this is a platform driver and not just an OF driver, shouldn't you provide a way to specify the same configuration data through a platform_data structure as well?

I believe the only practical use-cases for this driver are /currently/ for device-tree platforms. Shouldn't we add the platform_data support only when some platform actively uses it?

Then the Kconfig needs to depend on OF in this case.

Quoted 4 lines

In the past when reviewing new drivers, I pushed for platform drivers to always implement the platform_data structure up-front, and support using that if present rather than "falling back" to DT. However, Grant then shot that down saying that there was no point adding dead code...

Uh, ok. I don't care much either way but it somehow seems like it'll be impopular to start adding a lot of new "depends on OF" drivers. I might be wrong though.

Quoted 3 lines

(this will also feed into the discussion about simple-framebuffer, which also only needs DT support right now, but could in theory be extended to support platform_data in the future if somebody wants).

Yeah, that's turning out to be a color preference discussion for sheds, not very surprising.

-Olof

author maintainer
#10 lore raw

PATCH v6 4/8 ARM i.MX6q: Add GPU, VPU, IPU, and OpenVG resets to System Reset Controller (SRC)

In reply to Philipp Zabel

The SRC has auto-deasserting reset bits that control reset lines to the GPU, VPU, IPU, and OpenVG IP modules. This patch adds a reset controller that can be controlled by those devices using the reset controller API.

---
 .../devicetree/bindings/reset/fsl,imx-src.txt      | 49 ++++++++++++++++
 arch/arm/mach-imx/Kconfig                          |  1 +
 arch/arm/mach-imx/src.c                            | 65 ++++++++++++++++++++++
 3 files changed, 115 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/fsl,imx-src.txt
Documentation/devicetree/bindings/reset/fsl,imx-src.txt new file +49 -0
new file mode 100644
index 0000000..1330177
@@ -0,0 +1,49 @@
+Freescale i.MX System Reset Controller
+======================================
+
+Please also refer to reset.txt in this directory for common reset
+controller binding usage.
+
+Required properties:
+- compatible: Should be "fsl,<chip>-src"
+- reg: should be register base and length as documented in the
+  datasheet
+- interrupts: Should contain SRC interrupt and CPU WDOG interrupt,
+  in this order.
+- #reset-cells: 1, see below
+
+example:
+
+src: src at 020d8000 {
+        compatible = "fsl,imx6q-src";
+        reg = <0x020d8000 0x4000>;
+        interrupts = <0 91 0x04 0 96 0x04>;
+        #reset-cells = <1>;
+};
+
+Specifying reset lines connected to IP modules
+==============================================
+
+The system reset controller can be used to reset the GPU, VPU,
+IPU, and OpenVG IP modules on i.MX5 and i.MX6 ICs. Those device
+nodes should specify the reset line on the SRC in their resets
+property, containing a phandle to the SRC device node and a
+RESET_INDEX specifying which module to reset, as described in
+reset.txt
+
+example:
+
+        ipu1: ipu at 02400000 {
+                resets = <&src 2>;
+        };
+        ipu2: ipu at 02800000 {
+                resets = <&src 4>;
+        };
+
+The following RESET_INDEX values are valid for i.MX5:
+GPU_RESET     0
+VPU_RESET     1
+IPU1_RESET    2
+OPEN_VG_RESET 3
+The following additional RESET_INDEX value is valid for i.MX6:
+IPU2_RESET    4
arch/arm/mach-imx/Kconfig +1 -0
index 4c9c6f9..5052e31 100644
@@ -73,6 +73,7 @@ config HAVE_IMX_MMDC
 
 config HAVE_IMX_SRC
 	def_bool y if SMP
+	select ARCH_HAS_RESET_CONTROLLER
 
 config IMX_HAVE_IOMUX_V1
 	bool
arch/arm/mach-imx/src.c +65 -0

110 lines not on this page · raw message

Signature · 1 line
1.8.2.rc2
author maintainer
#11 lore raw

PATCH v6 5/8 ARM i.MX6q: Link system reset controller (SRC) to IPU in DT

In reply to Philipp Zabel
---
 arch/arm/boot/dts/imx6q.dtsi   | 1 +
 arch/arm/boot/dts/imx6qdl.dtsi | 2 ++
 2 files changed, 3 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +1 -0
index cba021e..4cd4f8d 100644
@@ -291,6 +291,7 @@
 			interrupts = <0 8 0x4 0 7 0x4>;
 			clocks = <&clks 133>, <&clks 134>, <&clks 137>;
 			clock-names = "bus", "di0", "di1";
+			resets = <&src 4>;
 		};
 	};
 };
arch/arm/boot/dts/imx6qdl.dtsi +2 -0
index 06ec460..3e21e92 100644
@@ -516,6 +516,7 @@
 				compatible = "fsl,imx6q-src";
 				reg = <0x020d8000 0x4000>;
 				interrupts = <0 91 0x04 0 96 0x04>;
+				#reset-cells = <1>;
 			};
 
 			gpc: gpc at 020dc000 {
@@ -795,6 +796,7 @@
 			interrupts = <0 6 0x4 0 5 0x4>;
 			clocks = <&clks 130>, <&clks 131>, <&clks 132>;
 			clock-names = "bus", "di0", "di1";
+			resets = <&src 2>;
 		};
 	};
 };
Signature · 1 line
1.8.2.rc2
author maintainer
#12 lore raw

PATCH v6 6/8 staging: drm/imx: Use SRC to reset IPU

In reply to Philipp Zabel

Request the System Reset Controller to reset the IPU if specified via device tree phandle.

---
 .../devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt      |  3 +++
 drivers/staging/imx-drm/ipu-v3/ipu-common.c                  | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt +3 -0
index 07654f0..f769857 100644
@@ -8,6 +8,8 @@ Required properties:
 - interrupts: Should contain sync interrupt and error interrupt,
   in this order.
 - #crtc-cells: 1, See below
+- resets: phandle pointing to the system reset controller and
+          reset line index, see reset/fsl,imx-src.txt for details
 
 example:
 
@@ -16,6 +18,7 @@ ipu: ipu at 18000000 {
 	compatible = "fsl,imx53-ipu";
 	reg = <0x18000000 0x080000000>;
 	interrupts = <11 10>;
+	resets = <&src 2>;
 };
 
 Parallel display support
drivers/staging/imx-drm/ipu-v3/ipu-common.c +9 -3
index 366f259..04b8320 100644
@@ -16,6 +16,7 @@
 #include <linux/export.h>
 #include <linux/types.h>
 #include <linux/init.h>
+#include <linux/reset.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
 #include <linux/spinlock.h>
@@ -660,7 +661,7 @@ int ipu_idmac_disable_channel(struct ipuv3_channel *channel)
 }
 EXPORT_SYMBOL_GPL(ipu_idmac_disable_channel);
 
-static int ipu_reset(struct ipu_soc *ipu)
+static int ipu_memory_reset(struct ipu_soc *ipu)
 {
 	unsigned long timeout;
 
@@ -1104,7 +1105,12 @@ static int ipu_probe(struct platform_device *pdev)
 	if (ret)
 		goto out_failed_irq;
 
-	ret = ipu_reset(ipu);
+	ret = device_reset(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "failed to reset: %d\n", ret);
+		goto out_failed_reset;
+	}
+	ret = ipu_memory_reset(ipu);
 	if (ret)
 		goto out_failed_reset;
 
@@ -1130,8 +1136,8 @@ static int ipu_probe(struct platform_device *pdev)
 failed_add_clients:
 	ipu_submodules_exit(ipu);
 failed_submodules_init:
-	ipu_irq_exit(ipu);
 out_failed_reset:
+	ipu_irq_exit(ipu);
 out_failed_irq:
 	clk_disable_unprepare(ipu->clk);
 failed_clk_get:
Signature · 1 line
1.8.2.rc2
#13 lore raw

PATCH v6 6/8 staging: drm/imx: Use SRC to reset IPU

Quoted 11 lines · Philipp Zabel

Request the System Reset Controller to reset the IPU if specified via device tree phandle.

---
 .../devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt      |  3 +++
 drivers/staging/imx-drm/ipu-v3/ipu-common.c                  | 12 +++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)
author maintainer
#14 lore raw

PATCH v6 7/8 ARM i.MX5: Add System Reset Controller (SRC) support for i.MX51 and i.MX53

In reply to Philipp Zabel

The SRC in i.MX51 and i.MX53 is similar to the one in i.MX6q minus the IPU2 reset line and multi core CPU reset/enable bits.

---
 arch/arm/boot/dts/imx6qdl.dtsi | 2 +-
 arch/arm/mach-imx/Kconfig      | 2 ++
 arch/arm/mach-imx/mm-imx5.c    | 2 ++
 arch/arm/mach-imx/src.c        | 4 +++-
 4 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx6qdl.dtsi +1 -1
index 3e21e92..fb71499 100644
@@ -513,7 +513,7 @@
 			};
 
 			src: src at 020d8000 {
-				compatible = "fsl,imx6q-src";
+				compatible = "fsl,imx6q-src", "fsl,imx51-src";
 				reg = <0x020d8000 0x4000>;
 				interrupts = <0 91 0x04 0 96 0x04>;
 				#reset-cells = <1>;
arch/arm/mach-imx/Kconfig +2 -0
index 5052e31..857c1fb 100644
@@ -166,6 +166,7 @@ config	SOC_IMX51
 	bool
 	select ARCH_MX5
 	select ARCH_MX51
+	select HAVE_IMX_SRC
 	select PINCTRL
 	select PINCTRL_IMX51
 	select SOC_IMX5
@@ -793,6 +794,7 @@ config	SOC_IMX53
 	select ARCH_MX5
 	select ARCH_MX53
 	select HAVE_CAN_FLEXCAN if CAN
+	select HAVE_IMX_SRC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select PINCTRL
 	select PINCTRL_IMX53
arch/arm/mach-imx/mm-imx5.c +2 -0
index cf34994..b7c4e70 100644
@@ -84,6 +84,7 @@ void __init imx51_init_early(void)
 	mxc_set_cpu_type(MXC_CPU_MX51);
 	mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
+	imx_src_init();
 }
 
 void __init imx53_init_early(void)
@@ -91,6 +92,7 @@ void __init imx53_init_early(void)
 	mxc_set_cpu_type(MXC_CPU_MX53);
 	mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR));
 	mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
+	imx_src_init();
 }
 
 void __init mx51_init_irq(void)
arch/arm/mach-imx/src.c +3 -1
index b50eee0..bc4d2c7 100644
@@ -121,7 +121,9 @@ void __init imx_src_init(void)
 	struct device_node *np;
 	u32 val;
 
-	np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-src");
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx51-src");
+	if (!np)
+		return;
 	src_base = of_iomap(np, 0);
 	WARN_ON(!src_base);
 
Signature · 1 line
1.8.2.rc2
author maintainer
#15 lore raw

PATCH v6 8/8 ARM i.MX5: Add system reset controller (SRC) to i.MX51 and i.MX53 device tree

In reply to Philipp Zabel

Also, link SRC to IPU via phandle.

---
 arch/arm/boot/dts/imx51.dtsi | 7 +++++++
 arch/arm/boot/dts/imx53.dtsi | 7 +++++++
 2 files changed, 14 insertions(+)
arch/arm/boot/dts/imx51.dtsi +7 -0
index fcf035b..cfe4e92 100644
@@ -67,6 +67,7 @@
 			compatible = "fsl,imx51-ipu";
 			reg = <0x40000000 0x20000000>;
 			interrupts = <11 10>;
+			resets = <&src 2>;
 		};
 
 		aips at 70000000 { /* AIPS1 */
@@ -501,6 +502,12 @@
 				status = "disabled";
 			};
 
+			src: src at 73fd0000 {
+				compatible = "fsl,imx51-src";
+				reg = <0x73fd0000 0x4000>;
+				#reset-cells = <1>;
+			};
+
 			clks: ccm at 73fd4000{
 				compatible = "fsl,imx51-ccm";
 				reg = <0x73fd4000 0x4000>;
arch/arm/boot/dts/imx53.dtsi +7 -0
index d05aa21..9e1348d 100644
@@ -72,6 +72,7 @@
 			compatible = "fsl,imx53-ipu";
 			reg = <0x18000000 0x080000000>;
 			interrupts = <11 10>;
+			resets = <&src 2>;
 		};
 
 		aips at 50000000 { /* AIPS1 */
@@ -558,6 +559,12 @@
 				status = "disabled";
 			};
 
+			src: src at 53fd0000 {
+				compatible = "fsl,imx53-src", "fsl,imx51-src";
+				reg = <0x53fd0000 0x4000>;
+				#reset-cells = <1>;
+			};
+
 			clks: ccm at 53fd4000{
 				compatible = "fsl,imx53-ccm";
 				reg = <0x53fd4000 0x4000>;
Signature · 1 line
1.8.2.rc2
#16 lore raw

v6 cover Reset controller API to reset IP modules on i.MX5 and i.MX6

In reply to Philipp Zabel
Quoted 6 lines · Philipp Zabel

[Added Arnd and Greg to the recipients] I think the first three patches of this series are candidates to go through Arnd's tree. Arnd, would you take those patches?
[PATCH v6 1/8] dt: describe base reset signal binding [PATCH v6 2/8] reset: Add reset controller API [PATCH v6 3/8] reset: Add driver for gpio-controlled reset pins

Wow, very nice work. I had completely missed the series so far, as I'm quite behind on reading mailing lists.

Yes, I can certainly take the three patches through arm-soc. Actually I just handed over to Olof for now, but I'm assume he will also take them when you send a pull request.

We also have at least one other platform (sirf/prima2) that will need the subsystem in the near future. I'm probably stating the obvious here, but please make sure that the pull request you send for arm-soc uses the exact git sha1 IDs that will be used for the follow-on patches going through the platform trees.

Arnd

#17 lore raw

v6 cover Reset controller API to reset IP modules on i.MX5 and i.MX6

Quoted 15 lines · Arnd Bergmann
Quoted 6 lines · Philipp Zabel

[Added Arnd and Greg to the recipients] I think the first three patches of this series are candidates to go through Arnd's tree. Arnd, would you take those patches?
[PATCH v6 1/8] dt: describe base reset signal binding [PATCH v6 2/8] reset: Add reset controller API [PATCH v6 3/8] reset: Add driver for gpio-controlled reset pins

Wow, very nice work. I had completely missed the series so far, as I'm quite behind on reading mailing lists.

Yes, I can certainly take the three patches through arm-soc. Actually I just handed over to Olof for now, but I'm assume he will also take them when you send a pull request.

Quoted 5 lines

We also have at least one other platform (sirf/prima2) that will need the subsystem in the near future. I'm probably stating the obvious here, but please make sure that the pull request you send for arm-soc uses the exact git sha1 IDs that will be used for the follow-on patches going through the platform trees.

Ok, let me maintain a stable branch on IMX tree and forward the patches to arm-soc, since the other patches in the series that I need to handle will depend on the branch anyway.

Shawn

#18 lore raw

v6 cover Reset controller API to reset IP modules on i.MX5 and i.MX6

In reply to Philipp Zabel
Quoted 18 lines · Philipp Zabel

[Added Arnd and Greg to the recipients] I think the first three patches of this series are candidates to go through Arnd's tree. Arnd, would you take those patches?
[PATCH v6 1/8] dt: describe base reset signal binding [PATCH v6 2/8] reset: Add reset controller API [PATCH v6 3/8] reset: Add driver for gpio-controlled reset pins

The system reset controller (SRC) on i.MX51, i.MX53, and i.MX6q controls reset lines to the GPU, VPU, IPU, and OpenVG IP modules.

The following patches add a simple API for devices to request being reset by separate reset controller hardware and implements the reset signal device tree binding proposed by Stephen Warren. Contrary to Tegra hardware, the i.MX SRC contains self-deasserting reset registers, so I've included both ops to manually assert/deassert a reset line, as well as a "reset" operation that is supposed to assert the reset line and wait for it to deassert.

Quoted 5 lines

The i.MX SRC is enhanced to provide a reset controller and the IPU driver is made to request being reset by calling the device_reset(&pdev->dev) convenience wrapper during probing.

No changes since v5, I just reordered the series.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#19 lore raw

v6 cover Reset controller API to reset IP modules on i.MX5 and i.MX6

In reply to Philipp Zabel
Quoted 11 lines · Philipp Zabel

The system reset controller (SRC) on i.MX51, i.MX53, and i.MX6q controls reset lines to the GPU, VPU, IPU, and OpenVG IP modules.

The following patches add a simple API for devices to request being reset by separate reset controller hardware and implements the reset signal device tree binding proposed by Stephen Warren. Contrary to Tegra hardware, the i.MX SRC contains self-deasserting reset registers, so I've included both ops to manually assert/deassert a reset line, as well as a "reset" operation that is supposed to assert the reset line and wait for it to deassert.

Quoted 5 lines

The i.MX SRC is enhanced to provide a reset controller and the IPU driver is made to request being reset by calling the device_reset(&pdev->dev) convenience wrapper during probing.

No changes since v5, I just reordered the series.

All applied, thanks.