Add support for the Allwinner A31 Reset Controllers
Subsystems (5)
v2 cover Add support for the Allwinner A31 Reset Controllers
Hi everyone,
This patchset adds support for the reset controllers found in the Allwinner A31 SoCs. Since these controllers are pretty simple, basically just a few MMIO registers, with a single bit controlling the reset state of the other devices it asserts in reset, the driver is quite simple as well.
However, one of the IPs asserted in reset by these controllers are the timers, the only thing standing out is that it requires to be registered before the timers are initialized.
Thanks,
Maxime
Changes from v1:
- Don't call request_mem_region, since some of these controllers will share registers with clock drivers
- Switched to a more generic allwinner,sun4i-clock-reset compatible, since a lot of these controllers are found in other SoCs than the A31
- Switched to a "real" driver using the device model for all these reset controllers but the one that needs to be initialised early.
- Fixed a typo in one of the DT bindings that was leading to a compilation breakage
Maxime Ripard (4):
reset: Add Allwinner A31 Reset Controller Driver
ARM: sunxi: Select ARCH_HAS_RESET_CONTROLLER
ARM: sunxi: Register the A31 reset IP in init_time
ARM: sun6i: Add the reset controller to the DTSI
arch/arm/boot/dts/sun6i-a31.dtsi | 24 ++++++ arch/arm/mach-sunxi/Kconfig | 1 + arch/arm/mach-sunxi/sunxi.c | 10 ++- drivers/reset/Makefile | 1 + drivers/reset/reset-sunxi.c | 156 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 drivers/reset/reset-sunxi.c
Signature · 1 line
1.8.4
PATCH v2 1/4 reset: Add Allwinner A31 Reset Controller Driver
The Allwinner A31 has an IP maintaining a few other IPs in the SoC in reset by default. Among these IPs are the High Speed Timers, hence why we can't use the regular driver construct, and need to call the registering function directly during machine initialisation.
--- drivers/reset/Makefile | 1 + drivers/reset/reset-sunxi.c | 156 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 drivers/reset/reset-sunxi.c
drivers/reset/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_RESET_CONTROLLER) += core.o +obj-$(CONFIG_ARCH_SUNXI) += reset-sun6i.o
drivers/reset/reset-sunxi.c new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
1.8.4
PATCH v2 1/4 reset: Add Allwinner A31 Reset Controller Driver
Quoted 4 lines · Maxime Ripard
The Allwinner A31 has an IP maintaining a few other IPs in the SoC in reset by default. Among these IPs are the High Speed Timers, hence why we can't use the regular driver construct, and need to call the registering function directly during machine initialisation.
Maybe it is better to have a more generic commit message here, since this driver will be used for all the sunxi.
PATCH v2 1/4 reset: Add Allwinner A31 Reset Controller Driver
Quoted 9 lines · Arokux X
Quoted 4 lines · Maxime Ripard
The Allwinner A31 has an IP maintaining a few other IPs in the SoC in reset by default. Among these IPs are the High Speed Timers, hence why we can't use the regular driver construct, and need to call the registering function directly during machine initialisation.
Maybe it is better to have a more generic commit message here, since this driver will be used for all the sunxi.
Right. I'll change it.
Thanks!
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131016/d8f86f7e/attachment.sig>
PATCH v2 2/4 ARM: sunxi: Select ARCH_HAS_RESET_CONTROLLER
In reply to Maxime RipardThe A31 has a reset controller, and we have to select this option to have access to the reset controller framework.
--- arch/arm/mach-sunxi/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-sunxi/Kconfig +1 -0
@@ -1,5 +1,6 @@ config ARCH_SUNXI bool "Allwinner A1X SOCs" if ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARCH_REQUIRE_GPIOLIB select ARM_GIC select CLKSRC_MMIO
Signature · 1 line
1.8.4
PATCH v2 3/4 ARM: sunxi: Register the A31 reset IP in init_time
In reply to Maxime RipardThe A31 has a reset IP that maintains a few other IPs in reset by default. Among these IPs are the UARTs, and most notably the timers. We thus need to register the reset driver before initializing the timers so that the reset timer can use the reset framework.
--- arch/arm/mach-sunxi/sunxi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/sunxi.c +9 -1
@@ -142,9 +142,17 @@ static const char * const sun6i_board_dt_compat[] = { NULL, }; +extern void __init sun6i_reset_init (void ); +static void __init sun6i_timer_init (void ) +{ +sunxi_init_clocks (); +sun6i_reset_init (); +clocksource_of_init (); +} +DT_MACHINE_START (SUN6I_DT ,"Allwinner sun6i (A31) Family" ) .init_machine = sunxi_dt_init, - .init_time = sunxi_timer_init, + .init_time = sun6i_timer_init, .dt_compat = sun6i_board_dt_compat, .restart = sun6i_restart,MACHINE_END
Signature · 1 line
1.8.4
PATCH v2 4/4 ARM: sun6i: Add the reset controller to the DTSI
In reply to Maxime RipardThe A31 has a reset controller IP that maintains a few other IPs in reset, among which we can find the UARTs, high speed timers or the I2C. Now that we have support for them, add the reset controllers to the DTSI.
--- arch/arm/boot/dts/sun6i-a31.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm/boot/dts/sun6i-a31.dtsi +24 -0
@@ -209,6 +209,24 @@ }; }; + ahb1_rst: reset at 01c202c0 { + #reset-cells = <1>; + compatible = "allwinner,sun6i-a31-ahb1-reset"; + reg = <0x01c202c0 0xc>; + }; + + apb1_rst: reset at 01c202d0 { + #reset-cells = <1>; + compatible = "allwinner,sun4i-clock-reset"; + reg = <0x01c202d0 0x4>; + }; + + apb2_rst: reset at 01c202d8 { + #reset-cells = <1>; + compatible = "allwinner,sun4i-clock-reset"; + reg = <0x01c202d8 0x4>; + }; + timer at 01c20c00 { compatible = "allwinner,sun4i-timer"; reg = <0x01c20c00 0xa0>;
@@ -232,6 +250,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 16>; + resets = <&apb2_rst 16>; status = "disabled"; };
@@ -242,6 +261,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 17>; + resets = <&apb2_rst 17>; status = "disabled"; };
@@ -252,6 +272,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 18>; + resets = <&apb2_rst 18>; status = "disabled"; };
@@ -262,6 +283,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 19>; + resets = <&apb2_rst 19>; status = "disabled"; };
@@ -272,6 +294,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 20>; + resets = <&apb2_rst 20>; status = "disabled"; };
@@ -282,6 +305,7 @@ reg-shift = <2>; reg-io-width = <4>; clocks = <&apb2_gates 21>; + resets = <&apb2_rst 21>; status = "disabled"; };
Signature · 1 line
1.8.4
v2 cover Add support for the Allwinner A31 Reset Controllers
In reply to Maxime RipardHi Maxime,
Quoted 1 line
This patchset adds support for the reset controllers found in the Allwinner A31
I cannot apply some of the patches against your sunxi-next. Which branch are they based on?
Thanks
v2 cover Add support for the Allwinner A31 Reset Controllers
Hi Roman,
Quoted 4 lines · Arokux X
Quoted 1 line
This patchset adds support for the reset controllers found in the Allwinner A31
I cannot apply some of the patches against your sunxi-next. Which branch are they based on?
I just tested it again, and it applies fine on top of this branch here. Anyway, I just pushed it to my repo, branch sunxi-next-a31-reset.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131016/1fa49f57/attachment.sig>