Skip to contentSkip to conversation

Add Reset Controller for MediaTek SoC

PATCH Superseded Flora Fu 1 participant 4 messages Nov 5, 2014

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Flora Fu

author
#0 lore raw

v3 cover Add Reset Controller for MediaTek SoC

Hi,
The patch is based on https://lkml.org/lkml/2014/5/27/422

Changes since v2
================
- Correct #size-cell to be 1.
- Add header file "mt8135-resets.h" for supported resets in MT8135.

Changes since v1
================
(1) Patch 1/3: Update reset controller driver's implementation.
- rename mt_ prefixes to the prefix mtk_
- use module_platform_driver() macro for driver init.
- clean up includes of header files.
- reset controll is a child of syscon. Get regamp through its parent node.
- rename data->size to data->num_regs. It is number of registers in syscon for reset usage.
(2) Patch 2/3: update bindings document according to new dts layout of reset-controller.
(3) Patch 3/3: change reset-controller device node as child of syscon.

This driver is based on 3.18-rc1.

Flora Fu (3):
ARM: mediatek: Add Reset Controller for MediaTek SoC
dt-bindings: Add Reset Controller for MediaTek SoC
ARM: dts: mt8135: Add Reset Controller for MediaTek SoC

 .../devicetree/bindings/reset/mediatek,reset.txt   |  50 ++++++++
 arch/arm/boot/dts/mt8135.dtsi                      |  27 +++++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-mtk.c                          | 131 +++++++++++++++++++++
 .../dt-bindings/reset-controller/mt8135-resets.h   |  64 ++++++++++
 5 files changed, 273 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/mediatek,reset.txt
 create mode 100644 drivers/reset/reset-mtk.c
 create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h

--
1.8.1.1.dirty

author
#1 lore raw

PATCH v3 1/3 ARM: mediatek: Add Reset Controller for MediaTek SoC

Add a driver in reset controller.

---
 drivers/reset/Makefile    |   1 +
 drivers/reset/reset-mtk.c | 131 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 132 insertions(+)
 create mode 100644 drivers/reset/reset-mtk.c
drivers/reset/Makefile +1 -0
index 60fed3d..adcebdf 100644
@@ -2,3 +2,4 @@ obj-$(CONFIG_RESET_CONTROLLER) += core.o
 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_ARCH_STI) += sti/
+obj-$(CONFIG_ARCH_MEDIATEK) += reset-mtk.o
drivers/reset/reset-mtk.c new file +131 -0

131 lines not on this page · raw message

Signature · 1 line
1.8.1.1.dirty
author
#2 lore raw

PATCH v3 2/3 dt-bindings: Add Reset Controller for MediaTek SoC

In reply to Flora Fu

Add device tree bindings.

---
 .../devicetree/bindings/reset/mediatek,reset.txt   | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/mediatek,reset.txt
Documentation/devicetree/bindings/reset/mediatek,reset.txt new file +50 -0
new file mode 100644
index 0000000..a876407
@@ -0,0 +1,50 @@
+MediaTek SoC Reset Controller
+======================================
+The reset controller driver accesses registers through the syscon regmap. It
+is a child node of syscon.
+
+Required properties:
+- compatible : "mediatek,reset"
+- #reset-cells: 1
+- reg: The register region can be accessed from syscon. The first parameter is
+  reset base address offset. The second parameter is byte width of reset registers.
+
+example:
+infracfg: syscon at 10001000 {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	compatible = "mediatek,mt8135-infracfg", "syscon";
+	reg = <0 0x10001000 0 0x1000>;
+
+	infrarst: reset-controller at 30 {
+		#reset-cells = <1>;
+		compatible = "mediatek,mt8135-infracfg-reset", "mediatek,reset";
+		reg = <0x30 0x8>;
+	};
+};
+
+Specifying reset lines connected to IP modules
+==============================================
+
+The reset controller(mtk-reset) manages various reset sources. Those device nodes should
+specify the reset line on the rstc in their resets property, containing a phandle to the
+rstc device node and a RESET_INDEX specifying which module to reset, as described in
+reset.txt.
+
+For MediaTek SoC, RESET_INDEX is reset bit defined in INFRACFG or PERICFG registers.
+
+example:
+pwrap: pwrap at 1000f000 {
+	compatible = "mediatek,mt8135-pwrap";
+	reg = <0 0x1000f000 0 0x1000>,
+		<0 0x11017000 0 0x1000>;
+	reg-names = "pwrap-base",
+		"pwrap-bridge-base";
+	resets = <&infrarst MT8135_INFRA_PMIC_WRAP_RST>,
+		<&perirst MT8135_PERI_PWRAP_BRIDGE_SW_RST>;
+	reset-names = "infrarst", "perirst";
+};
+
+Definitions for the supported resets by IC:
+MT8135:
+include/dt-bindings/reset-controller/mt8135-resets.h
Signature · 1 line
1.8.1.1.dirty
author
#3 lore raw

PATCH v3 3/3 ARM: dts: mt8135: Add Reset Controller for MediaTek SoC

In reply to Flora Fu

Add reset controller to MT8135 board dts.

---
 arch/arm/boot/dts/mt8135.dtsi                      | 27 +++++++++
 .../dt-bindings/reset-controller/mt8135-resets.h   | 64 ++++++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h
arch/arm/boot/dts/mt8135.dtsi +27 -0
index 90a56ad..370c8fc 100644
@@ -14,6 +14,7 @@
 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/reset-controller/mt8135-resets.h>
 #include "skeleton64.dtsi"
 
 / {
@@ -102,6 +103,32 @@
 			clock-names = "system-clk", "rtc-clk";
 		};
 
+		infracfg: syscon at 10001000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "mediatek,mt8135-infracfg", "syscon";
+			reg = <0 0x10001000 0 0x1000>;
+
+			infrarst: reset-controller at 30 {
+				#reset-cells = <1>;
+				compatible = "mediatek,mt8135-infracfg-reset", "mediatek,reset";
+				reg = <0x30 0x8>;
+			};
+		};
+
+		pericfg: syscon at 10003000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "mediatek,mt8135-pericfg", "syscon";
+			reg = <0 0x10003000 0 0x1000>;
+
+			perirst: reset-controller at 00 {
+				#reset-cells = <1>;
+				compatible = "mediatek,mt8135-pericfg-reset", "mediatek,reset";
+				reg = <0x00 0x8>;
+			};
+		};
+
 		gic: interrupt-controller at 10211000 {
 			compatible = "arm,cortex-a15-gic";
 			interrupt-controller;
include/dt-bindings/reset-controller/mt8135-resets.h new file +64 -0

65 lines not on this page · raw message

Signature · 1 line
1.8.1.1.dirty