Add support for the Allwinner A31 Reset Controllers
Subsystems (5)
v4 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 v3:
- Added some locking
- Added back the sun6i compatible and the request_mem_region
Changes from v2:
- Changed the commit logs to be a bit more generic
- Fixed a stupid breakage in the Makefile
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 SoCs 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 | 175 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 drivers/reset/reset-sunxi.c
Signature · 1 line
1.8.4.2
PATCH v4 1/4 reset: Add Allwinner SoCs Reset Controller Driver
The Allwinner A31 and most of the other Allwinner SoCs have an IP maintaining a few other IPs in the SoC in reset by default. Among these IPs are the A31's High Speed Timers, hence why we can't use the regular driver construct in every cases, and need to call the registering function directly during machine initialisation.
Apart from this, the implementation is fairly straightforward, and could easily be moved to a generic MMIO-based reset controller driver if the need ever arise.
--- drivers/reset/Makefile | 1 + drivers/reset/reset-sunxi.c | 175 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 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-sunxi.o
drivers/reset/reset-sunxi.c new file +175 -0
175 lines not on this page · raw message
Signature · 1 line
1.8.4.2
PATCH v4 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.2
PATCH v4 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.2
PATCH v4 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,sun6i-a31-clock-reset"; + reg = <0x01c202d0 0x4>; + }; + + apb2_rst: reset at 01c202d8 { + #reset-cells = <1>; + compatible = "allwinner,sun6i-a31-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.2
Philipp Zabel
maintainerv4 cover Add support for the Allwinner A31 Reset Controllers
In reply to Maxime RipardHi Maxime,
Am Freitag, den 15.11.2013, 19:19 +0100 schrieb Maxime Ripard:
Quoted 7 lines
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.
Quoted 6 lines
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
Quoted 24 lines
Changes from v3:
- Added some locking
- Added back the sun6i compatible and therequest_mem_regionChanges from v2:
- Changed the commit logs to be a bit more generic
- Fixed a stupid breakage in theMakefileChanges from v1:
- Don't callrequest_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 breakageMaxime Ripard (4):
reset: Add Allwinner SoCs Reset Controller Driver
ARM: sunxi: SelectARCH_HAS_RESET_CONTROLLER
ARM: sunxi: Register the A31 reset IP ininit_time
ARM: sun6i: Add the reset controller to the DTSI
Quoted 7 lines
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 | 175 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 210 insertions(+), 1 deletion(-) create mode 100644 drivers/reset/reset-sunxi.c
regards
Philipp
v4 cover Add support for the Allwinner A31 Reset Controllers
Hi Philipp,
Quoted 10 lines · Philipp Zabel
Hi Maxime,
Am Freitag, den 15.11.2013, 19:19 +0100 schrieb Maxime Ripard:
Quoted 7 lines
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.
Quoted 8 lines
Quoted 6 lines
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,
MaximeAcked-by Philipp Zabel <[email protected]>
Thanks.
Do you want to merge this through your tree?
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/20131119/aed5fad8/attachment-0001.sig>
Philipp Zabel
maintainerv4 cover Add support for the Allwinner A31 Reset Controllers
Hi Maxime,
Am Dienstag, den 19.11.2013, 08:49 +0100 schrieb Maxime Ripard:
Quoted 17 lines
Hi Philipp,
Quoted 14 lines · Philipp Zabel
Hi Maxime,
Am Freitag, den 15.11.2013, 19:19 +0100 schrieb Maxime Ripard:
Quoted 11 lines
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.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Thanks,
MaximeAcked-by Philipp Zabel <[email protected]>Thanks.
Do you want to merge this through your tree?
since 0d74578b7de73c4b7f25daaacff8d5091fa83bd4 "ARM: sunxi:
remove .init_time hooks", patch 3/4 doesn't apply against soc/for-next anymore.
I could take the first patch now, and you merge the other three through your tree afterwards?
regards
Philipp
v4 cover Add support for the Allwinner A31 Reset Controllers
Hi Philipp,
Quoted 7 lines · Philipp Zabel
Quoted 1 line
Do you want to merge this through your tree?
since
0d74578b7de73c4b7f25daaacff8d5091fa83bd4"ARM: sunxi:
remove .init_time hooks", patch 3/4 doesn't apply against soc/for-next anymore.
I could take the first patch now, and you merge the other three through your tree afterwards?
Hmmm, patch 1, 2 and 3 can't be merged independently.
I guess the easiest will be for me to merge it with your Acked-by.
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/20131119/1c6f95f0/attachment.sig>
Philipp Zabel
maintainerv4 cover Add support for the Allwinner A31 Reset Controllers
Hi Maxime,
Am Dienstag, den 19.11.2013, 16:53 +0100 schrieb Maxime Ripard:
Quoted 11 lines
Hi Philipp,
Quoted 7 lines · Philipp Zabel
Quoted 1 line
Do you want to merge this through your tree?
since
0d74578b7de73c4b7f25daaacff8d5091fa83bd4"ARM: sunxi:
remove .init_time hooks", patch 3/4 doesn't apply against soc/for-next anymore.
I could take the first patch now, and you merge the other three through your tree afterwards?
Quoted 3 lines
Hmmm, patch 1, 2 and 3 can't be merged independently.
I guess the easiest will be for me to merge it with your Acked-by.
please do.
regards
Philipp