ARM: meson: Add reset controller
v3 cover ARM: meson: Add reset controller
Apparently several IPs found in the MesonX SoCs can be reset by programming a specific bit in a register in the so called AO (Always-On) domain. From the documentation released by Amlogic under NDA it is not clear which devices can be reset acting on this register. So far from the sources release by Amlogic it seems that at least two IPs use this register for reset: RTC and UART. Since I need it to reset the RTC, I wrote this small driver.
v3:
* few changes at comments
* removed register offset
v2:
* removed useless comment
* added platform_get_drvdata
* removed owner field
Carlo Caione (3):
ARM: meson: reset: Add reset controller for MesonX SoCs
ARM: meson: DTSI: Enable reset controller
ARM: meson: docs: Add docs for MesonX reset controller
.../bindings/reset/amlogic,meson6-rst-mgr-ao.txt | 14 +++ arch/arm/boot/dts/meson.dtsi | 6 + drivers/reset/Makefile | 1 + drivers/reset/reset-meson.c | 138 +++++++++++++++++++++ 4 files changed, 159 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amlogic,meson6-rst-mgr-ao.txt create mode 100644 drivers/reset/reset-meson.c
Signature · 1 line
1.9.1
PATCH v3 1/3 ARM: meson: reset: Add reset controller for MesonX SoCs
This patch adds support for the reset controller found on the Amlogic MesonX SoCs. For several devices in the AO (Always-On) power domain, it is possible to reset them by programming a specific bit in a register.
---
Hi Philipp,
from the documentation and the sources I have, it seems that in the register together with the bits for resetting the ICs there are also bits for turning the ICs on and off. I really wanted to avoid create a new of_xlate function just to map the reset IDs to the correct bit in the register so I left the nr_resets to BITS_PER_LONG and I'm using the default of_xlate. This way I can also avoid to use obscure reset IDs to be remapped when I can use directly the bit number in the register as reset ID.
--- drivers/reset/Makefile | 1 + drivers/reset/reset-meson.c | 138 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 drivers/reset/reset-meson.c
drivers/reset/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_RESET_CONTROLLER) += core.o obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o +obj-$(CONFIG_ARCH_MESON) += reset-meson.o obj-$(CONFIG_ARCH_STI) += sti/
drivers/reset/reset-meson.c new file +138 -0
138 lines not on this page · raw message
Signature · 1 line
1.9.1
Philipp Zabel
maintainerPATCH v3 1/3 ARM: meson: reset: Add reset controller for MesonX SoCs
Am Montag, den 20.10.2014, 13:19 +0200 schrieb Carlo Caione:
Quoted 8 lines
Hi Philipp,
from the documentation and the sources I have, it seems that in the register together with the bits for resetting the ICs there are also bits for turning the ICs on and off. I really wanted to avoid create a newof_xlatefunction just to map the reset IDs to the correct bit in the register so I left thenr_resetstoBITS_PER_LONGand I'm using the defaultof_xlate. This way I can also avoid to use obscure reset IDs to be remapped when I can use directly the bit number in the register as reset ID.
I'm fine with reusing of_reset_simple_xlate and using the bit offsets as reset control number. Do you already know what abstraction you'll choose for the IC enable bits? (Are those clock gates, or maybe power domains?) Hopefully the documentation you obtained will help to decide.
regards
Philipp
PATCH v3 1/3 ARM: meson: reset: Add reset controller for MesonX SoCs
Quoted 10 lines · Philipp Zabel
Am Montag, den 20.10.2014, 13:19 +0200 schrieb Carlo Caione:
Quoted 8 lines
Hi Philipp,
from the documentation and the sources I have, it seems that in the register together with the bits for resetting the ICs there are also bits for turning the ICs on and off. I really wanted to avoid create a newof_xlatefunction just to map the reset IDs to the correct bit in the register so I left thenr_resetstoBITS_PER_LONGand I'm using the defaultof_xlate. This way I can also avoid to use obscure reset IDs to be remapped when I can use directly the bit number in the register as reset ID.
Quoted 4 lines
I'm fine with reusing
of_reset_simple_xlateand using the bit offsets as reset control number. Do you already know what abstraction you'll choose for the IC enable bits? (Are those clock gates, or maybe power domains?) Hopefully the documentation you obtained will help to decide.
Those are clock gates actually. Arnd suggested to add a driver for the entire block (resets and clock gates) so probably I need to dig deeper in the CCF.
Signature · 1 line
Carlo Caione
PATCH v3 2/3 ARM: meson: DTSI: Enable reset controller
In reply to Carlo CaioneAdd the node for the reset controller in the DTSI.
--- arch/arm/boot/dts/meson.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/meson.dtsi +6 -0
@@ -75,6 +75,12 @@ reg = <0xc1109900 0x8>; }; + reset_AO: reset at c8100040 { + #reset-cells = <1>; + compatible = "amlogic,meson6-rst-mgr-ao"; + reg = <0xc8100040 0x4>; + }; + uart_AO: serial at c81004c0 { compatible = "amlogic,meson-uart"; reg = <0xc81004c0 0x14>;
Signature · 1 line
1.9.1
PATCH v3 3/3 ARM: meson: docs: Add docs for MesonX reset controller
In reply to Carlo Caione--- .../bindings/reset/amlogic,meson6-rst-mgr-ao.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/reset/amlogic,meson6-rst-mgr-ao.txt
Documentation/devicetree/bindings/reset/amlogic,meson6-rst-mgr-ao.txt new file +14 -0
@@ -0,0 +1,14 @@ +Amlogic MesonX Reset Manager (AO domain) + +Required properties: +- compatible : "amlogic,meson6-rst-mgr-ao" +- reg : Should contain 1 register ranges(address and length) +- #reset-cells: 1 + +Example: + + reset: reset at c8100040 { + #reset-cells = <1>; + compatible = "amlogic,meson6-rst-mgr-ao"; + reg = <0xc8100040 0x4>; + };
Signature · 1 line
1.9.1
v3 cover ARM: meson: Add reset controller
In reply to Carlo CaioneQuoted 6 lines · Carlo Caione
Apparently several IPs found in the MesonX SoCs can be reset by programming a specific bit in a register in the so called AO (Always-On) domain. From the documentation released by Amlogic under NDA it is not clear which devices can be reset acting on this register. So far from the sources release by Amlogic it seems that at least two IPs use this register for reset: RTC and UART. Since I need it to reset the RTC, I wrote this small driver.
Hi Philipp,
a couple of minutes ago I received new documentation about the controller. I'll submit a v4 soon.
Thanks,
Signature · 1 line
Carlo Caione