Introduce keystone reset driver
Subsystems (6)
v2 cover Introduce keystone reset driver
These patches introduce keystone reset driver.
The keystone SoC can be rebooted in several ways. By external reset pin, by soft and by watchdogs. This driver allows software reset or reset by one of the watchdogs. Also added opportunity to set soft/hard reset type.
Based on v3.15-rc1
v1..v2
- re basedon on v3.15-rc1 without changes
Ivan Khoronzhuk (5):
Power: reset: keystone-reset: introduce keystone reset driver
Power: reset: add bindings for keystone reset driver
ARM: keystone: remove redundant reset stuff
ARM: dts: keystone: update reset node to work with reset driver
ARM: keystone: enable reset driver support
.../bindings/power/reset/keystone-reset.txt | 59 +++++++ arch/arm/boot/dts/keystone.dtsi | 4 +- arch/arm/configs/keystone_defconfig | 3 + arch/arm/mach-keystone/keystone.c | 35 ----- drivers/power/reset/Kconfig | 7 + drivers/power/reset/Makefile | 1 + drivers/power/reset/keystone-reset.c | 171 +++++++++++++++++++++ 7 files changed, 244 insertions(+), 36 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/reset/keystone-reset.txt create mode 100644 drivers/power/reset/keystone-reset.c
Signature · 1 line
1.8.3.2
PATCH v2 1/5 Power: reset: keystone-reset: introduce keystone reset driver
The keystone SoC can be rebooted in several ways. By external reset pin, by soft and by watchdogs. To allow keystone SoC reset if watchdog is triggered we have to enable it in reset mux configuration register regarding of watchdog configuration. Also we need to set soft/hard reset we are going to use.
So add keystone reset driver to handle all this stuff.
--- drivers/power/reset/Kconfig | 7 ++ drivers/power/reset/Makefile | 1 + drivers/power/reset/keystone-reset.c | 171 +++++++++++++++++++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 drivers/power/reset/keystone-reset.c
drivers/power/reset/Kconfig +7 -0
@@ -57,3 +57,10 @@ config POWER_RESET_XGENE depends on POWER_RESET help Reboot support for the APM SoC X-Gene Eval boards. + +config POWER_RESET_KEYSTONE + bool "Keystone reset driver" + depends on ARCH_KEYSTONE + help + Reboot support for the KEYSTONE SoCs. +
drivers/power/reset/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o obj-$(CONFIG_POWER_RESET_XGENE) += xgene-reboot.o +obj-$(CONFIG_POWER_RESET_KEYSTONE) += keystone-reset.o
drivers/power/reset/keystone-reset.c new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v2 2/5 Power: reset: add bindings for keystone reset driver
In reply to Ivan KhoronzhukThis node is intended to allow SoC reset in case of software reset or appropriate watchdogs.
The Keystone SoCs can contain up to 4 watchdog timers to reset SoC. Each watchdog timer event input is connected to the Reset Mux block. The Reset Mux block can be configured to cause reset or not.
Additionally soft or hard reset can be configured.
--- .../bindings/power/reset/keystone-reset.txt | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/reset/keystone-reset.txt
Documentation/devicetree/bindings/power/reset/keystone-reset.txt new file +59 -0
@@ -0,0 +1,59 @@ +* Device tree bindings for Texas Instruments keystone reset + +This node is intended to allow SoC reset in case of software reset +of selected watchdogs. + +The Keystone SoCs can contain up to 4 watchdog timers to reset +SoC. Each watchdog timer event input is connected to the Reset Mux +block. The Reset Mux block can be configured to cause reset or not. + +Additionally soft or hard reset can be configured. + +Required properties: + +- compatible: ti,keystone-reset + +- reg: Contains offset/length value for mux registers. + + reg = <0x23100e4 0x10>, + <0x2620328 0x10>; + +-reg-names: Contains two ranges "pllregs" and "muxregs". + "pllregs" - PLL reset control regs: RSTYPE, RSCTRL, + RSCFG, RSISO. + "muxregs" - mux block registers for all watchdogs. + +Optional properties: + +- ti,soft-reset: Boolean option indicating soft reset. + By default hard reset is used. + +- ti,wdt_list: WDT list that can cause SoC reset. + The list in format: <0>, <2>; + Begins from 0 to 3, as keystone can contain up + to 4 SoC reset watchdogs. + +Example 1: +Setup keystone reset so that in case software reset or +WDT1 is triggered it issues hard reset for SoC. + +rstctrl: reset-controller { + compatible = "ti,keystone-reset"; + reg = <0x23100e4 0x10>, + <0x2620328 0x10>; + reg-names = "pllregs", "muxregs"; + ti,wdt_list = <0>; +}; + +Example 2: +Setup keystone reset so that in case of software reset or +WDT1 or WDT3 is triggered it issues soft reset for SoC. + +rstctrl: reset-controller { + compatible = "ti,keystone-reset"; + reg = <0x23100e4 0x10>, + <0x2620328 0x10>; + reg-names = "pllregs", "muxregs"; + ti,wdt_list = <0>, <2>; + ti,soft-reset; +};
Signature · 1 line
1.8.3.2
Re: [PATCH v2 2/5] Power: reset: add bindings for keystone reset driver
Documentation/devicetree/bindings/power/reset/keystone-reset.txt line 34
Quoted 10 lines · On Monday 14 April 2014 20:41:20 Ivan Khoronzhuk wrote:
Documentation/devicetree/bindings/power/reset/keystone-reset.txt new file +9
-0+Optional properties: + +- ti,soft-reset: Boolean option indicating soft reset. + By default hard reset is used. + +- ti,wdt_list: WDT list that can cause SoC reset. + The list in format: <0>, <2>; + Begins from 0 to 3, as keystone can contain up + to 4 SoC reset watchdogs.
This looks like your binding just describes a subset of the watchdog timer registers. If so, don't do a standalone reset driver, but instead do a watchdog driver that can also be used for reset, and have a binding that properly describes the watchdog hardware.
It is bad to have overlapping register ranges between logical devices, and it's also generally wrong to describe devices that are not actually there: The hardware contains a watchdog, not a system-reset device, so you should not make one up because it seems easier given the Linux driver model.
Arnd
Re: [PATCH v2 2/5] Power: reset: add bindings for keystone reset driver
Quoted 13 lines · Arnd Bergmann
Documentation/devicetree/bindings/power/reset/keystone-reset.txt line 34
Quoted 10 lines · On Monday 14 April 2014 20:41:20 Ivan Khoronzhuk wrote:
Documentation/devicetree/bindings/power/reset/keystone-reset.txt new file +9
-0+Optional properties: + +- ti,soft-reset: Boolean option indicating soft reset. + By default hard reset is used. + +- ti,wdt_list: WDT list that can cause SoC reset. + The list in format: <0>, <2>; + Begins from 0 to 3, as keystone can contain up + to 4 SoC reset watchdogs.This looks like your binding just describes a subset of the watchdog timer registers. If so, don't do a standalone reset
The registers are not a subset of watchdog hardware it's SoC specific future controlled by SoC specific registers (bootregs and PLL regs).
For watchog IP setup, the Keystone uses the watchdog driver common with other
SoCs -- davinci_watchdog that is not depend on other SoC settings like this driver does.
The Keystone SoCs have separate registers to tune Keystone2 reset functionality
by configuring Reset multiplexer & PLL. And it tunes not only watchdog usage.
The keystone SoC can be rebooted in several ways. By external reset pin, by soft and
by watchdogs. This driver allows software reset or reset by one of the watchdogs
(and other settings) independently on watchdog driver settings. This is job of reset driver.
Quoted 6 lines
It's
driver, but instead do a watchdog driver that can also be used for reset, and have a binding that properly describes the watchdog hardware.It is bad to have overlapping register ranges between logical
WDT doesn't overlap with this driver.
Quoted 6 lines
devices, and it's also generally wrong to describe devices that are not actually there: The hardware contains a watchdog, not a system-reset device, so you should not make one up because it seems easier given the Linux driver model.
Arnd
Signature · 2 lines
Regards, Ivan Khoronzhuk
Re: [PATCH v2 2/5] Power: reset: add bindings for keystone reset driver
Quoted 36 lines · Ivan Khoronzhuk
Quoted 13 lines · Arnd Bergmann
Documentation/devicetree/bindings/power/reset/keystone-reset.txt line 34
Quoted 10 lines · On Monday 14 April 2014 20:41:20 Ivan Khoronzhuk wrote:
Documentation/devicetree/bindings/power/reset/keystone-reset.txt new file +9
-0+Optional properties: + +- ti,soft-reset: Boolean option indicating soft reset. + By default hard reset is used. + +- ti,wdt_list: WDT list that can cause SoC reset. + The list in format: <0>, <2>; + Begins from 0 to 3, as keystone can contain up + to 4 SoC reset watchdogs.This looks like your binding just describes a subset of the watchdog timer registers. If so, don't do a standalone reset
The registers are not a subset of watchdog hardware it's SoC specific future
controlled by SoC specific registers (bootregs and PLL regs).For watchog IP setup, the Keystone uses the watchdog driver common with other
SoCs --davinci_watchdogthat is not depend on other SoC settings like this driver does.The Keystone SoCs have separate registers to tune Keystone2 reset functionality
by configuring Reset multiplexer & PLL. And it tunes not only watchdog usage.
The keystone SoC can be rebooted in several ways. By external reset pin, by soft and
by watchdogs. This driver allows software reset or reset by one of the watchdogs
(and other settings) independently on watchdog driver settings. This is job of reset driver.
Quoted 15 lines
Quoted 6 lines
It's
driver, but instead do a watchdog driver that can also be used for reset, and have a binding that properly describes the watchdog hardware.It is bad to have overlapping register ranges between logical
WDT doesn't overlap with this driver.
Quoted 6 lines
devices, and it's also generally wrong to describe devices that are not actually there: The hardware contains a watchdog, not a system-reset device, so you should not make one up because it seems easier given the Linux driver model.
Arnd
Hi Arnd,
Could I do smth additional to make bindings explanation more clear? Or this is enough?
I can write like the following:
Optional properties:
- ti,soft-reset: Boolean option indicating soft reset.
By default hard reset is used.
- ti,wdt_list: WDT list that can cause SoC reset. This is not
related to WDT driver, it's just needed to enable a SoC related reset that is triggered by one of
watchdogs.
The list in format: <0>, <2>;
Begins from 0 to 3, as keystone can contain up to 4 SoC reset watchdogs. Can be in random order.
That is OK?
Signature · 2 lines
Regards, Ivan Khoronzhuk
PATCH v2 3/5 ARM: keystone: remove redundant reset stuff
In reply to Ivan KhoronzhukRemove reset stuff in flavour of using keystone reset driver:driver/power/reset/keystone-reset.c
--- arch/arm/mach-keystone/keystone.c | 35 ----------------------------------- 1 file changed, 35 deletions(-)
arch/arm/mach-keystone/keystone.c +0 -35
@@ -23,24 +23,8 @@#include "keystone.h" -#define PLL_RESET_WRITE_KEY_MASK 0xffff0000 -#define PLL_RESET_WRITE_KEY 0x5a69 -#define PLL_RESET BIT(16) - -static void __iomem *keystone_rstctrl; -static void __init keystone_init (void ) { -struct device_node *node; - - node =of_find_compatible_node (NULL ,NULL ,"ti,keystone-reset" ); -if (WARN_ON (!node)) -pr_warn ("ti,keystone-reset node undefined\n" ); - - keystone_rstctrl =of_iomap (node,0 ); -if (WARN_ON (!keystone_rstctrl)) -pr_warn ("ti,keystone-reset iomap error\n" ); -keystone_pm_runtime_init ();of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); }
@@ -50,24 +34,6 @@ static const char *keystone_match[] __initconst = {NULL , }; -void keystone_restart (enum reboot_mode mode,const char *cmd) -{ -u32 val; - -BUG_ON (!keystone_rstctrl); - -/* Enable write access to RSTCTRL */ - val =readl (keystone_rstctrl); - val &=PLL_RESET_WRITE_KEY_MASK ; - val |=PLL_RESET_WRITE_KEY ; -writel (val, keystone_rstctrl); - -/* Reset the SOC */ - val =readl (keystone_rstctrl); - val &= ~PLL_RESET ; -writel (val, keystone_rstctrl); -} - DT_MACHINE_START(KEYSTONE, "Keystone")#if defined(CONFIG_ZONE_DMA ) && defined(CONFIG_ARM_LPAE ) .dma_zone_size = SZ_2G,
@@ -75,5 +41,4 @@ DT_MACHINE_START(KEYSTONE, "Keystone") .smp = smp_ops(keystone_smp_ops), .init_machine = keystone_init, .dt_compat = keystone_match, - .restart = keystone_restart,MACHINE_END
Signature · 1 line
1.8.3.2
PATCH v2 4/5 ARM: dts: keystone: update reset node to work with reset driver
In reply to Ivan KhoronzhukThe reset controller registers are part of the PLL Controller MMRs. According to TRM there are the following registers:
RSTYPE, RSCTRL, RSCFG and RSISO. Currently declared only one of them, but that is not enough to correctly setup reset properties, so add whole range of pll registers - pllregs.
Also add range for reset multiplex registers for SoC on the device. These registers are located in Bootcfg memory space and needed to setup behaviour after appropriate watchdog is triggered.
Add "ti,wdt_list" option to declare what watchdog are used to reboot the SoC.
--- arch/arm/boot/dts/keystone.dtsi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/boot/dts/keystone.dtsi +3 -1
@@ -69,7 +69,9 @@ rstctrl: reset-controller { compatible = "ti,keystone-reset"; - reg = <0x023100e8 4>; /* pll reset control reg */ + reg = <0x23100e4 0x10>, <0x2620328 0x10>; + reg-names = "pllregs", "muxregs"; + ti,wdt_list = <0>; }; /include/ "keystone-clocks.dtsi"
Signature · 1 line
1.8.3.2
PATCH v2 5/5 ARM: keystone: enable reset driver support
In reply to Ivan KhoronzhukEnable reset driver support in order to have opportunity to reboot SoC by watchdog and by software.
--- arch/arm/configs/keystone_defconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/configs/keystone_defconfig +3 -0
@@ -131,6 +131,9 @@ CONFIG_SPI=y CONFIG_SPI_DAVINCI=y CONFIG_SPI_SPIDEV=y # CONFIG_HWMON is not set +CONFIG_POWER_SUPPLY=y +CONFIG_POWER_RESET=y +CONFIG_POWER_RESET_KEYSTONE=y CONFIG_WATCHDOG=y CONFIG_WATCHDOG_CORE=y CONFIG_DAVINCI_WATCHDOG=y
Signature · 1 line
1.8.3.2