2014-12-02 17:12:18

by Stefan Agner

[permalink] [raw]
Subject: [PATCH v3 0/3] power: reset: vf610 system reset controller

This third version does essentially the same as v1, but with a lot
less code due to the usage of syscon and syscon-reboot driver. My
earlier misgivings that it might be a problem for the suspend/resume
implementation later on did not hold true: I tested my prelinear
suspend code and in case the code really needs to access some
registers form assembler, it is possible to map temporarly the
relevant region again.

I refrained from adding POWER_RESET_SYSCON as a hard dependency for
Vybrid (SOC_VF610): In its dual-core configuration, one might want
have the Cortex-M4 in charge of the system reset... Hence the user
should be able to build a kernel without the system reset (beside
the option to create a board specific device tree with disabled
SRC node).

Shawn, the defconfig change is based on the latest (almost-merged?)
defconfig patch.

Changes since v2:
- Drop priority property for syscon-reboot
- Alter default priority of syscon-reboot, set it to 192

Changes since v1:
- Total rework using syscon/syscon-reboot capabilities
- Enhance syscon-reboot with priority capabilities

Stefan Agner (3):
power: reset: adjust priority of simple syscon reboot driver
ARM: dts: vf610: add system reset controller and syscon-reboot
ARM: imx_v6_v7_defconfig: add POWER_RESET_SYSCON

arch/arm/boot/dts/vf500.dtsi | 4 ++++
arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
arch/arm/configs/imx_v6_v7_defconfig | 8 ++++----
drivers/power/reset/syscon-reboot.c | 2 +-
4 files changed, 21 insertions(+), 5 deletions(-)

--
2.1.3


2014-12-02 17:12:23

by Stefan Agner

[permalink] [raw]
Subject: [PATCH v3 2/3] ARM: dts: vf610: add system reset controller and syscon-reboot

Add the system reset controller (SRC) module and use syscon-reboot
to register a restart handler which restarts the SoC using the
SRC SW_RST bit.

Signed-off-by: Stefan Agner <[email protected]>
---
arch/arm/boot/dts/vf500.dtsi | 4 ++++
arch/arm/boot/dts/vfxxx.dtsi | 12 ++++++++++++
2 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/vf500.dtsi b/arch/arm/boot/dts/vf500.dtsi
index de67005..3f38f49 100644
--- a/arch/arm/boot/dts/vf500.dtsi
+++ b/arch/arm/boot/dts/vf500.dtsi
@@ -130,6 +130,10 @@
interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
};

+&src {
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
+};
+
&uart0 {
interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
};
diff --git a/arch/arm/boot/dts/vfxxx.dtsi b/arch/arm/boot/dts/vfxxx.dtsi
index 505969a..dddcd0c 100644
--- a/arch/arm/boot/dts/vfxxx.dtsi
+++ b/arch/arm/boot/dts/vfxxx.dtsi
@@ -43,6 +43,13 @@
clock-frequency = <32768>;
};

+ reboot: syscon-reboot {
+ compatible = "syscon-reboot";
+ regmap = <&src>;
+ offset = <0x0>;
+ mask = <0x1000>;
+ };
+
soc {
#address-cells = <1>;
#size-cells = <1>;
@@ -318,6 +325,11 @@
clocks = <&clks VF610_CLK_USBC0>;
status = "disabled";
};
+
+ src: src@4006e000 {
+ compatible = "fsl,vf610-src", "syscon";
+ reg = <0x4006e000 0x1000>;
+ };
};

aips1: aips-bus@40080000 {
--
2.1.3

2014-12-02 17:12:39

by Stefan Agner

[permalink] [raw]
Subject: [PATCH v3 3/3] ARM: imx_v6_v7_defconfig: add POWER_RESET_SYSCON

Add POWER_RESET_SYSCON since Vybrid SoC's now make use of this
driver to provide software reset capabilities through the SRC
module.

Also regenerated using savedefconfig which removed the config
BACKLIGHT_LCD_SUPPORT which is now selected by default since
commit 9c8ee3c734139 ("video: mx3fb: always enable
BACKLIGHT_LCD_SUPPORT").

Signed-off-by: Stefan Agner <[email protected]>
---
arch/arm/configs/imx_v6_v7_defconfig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index f707cd2..e928075 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -163,13 +163,14 @@ CONFIG_SPI_IMX=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_MC9S08DZ60=y
CONFIG_GPIO_STMPE=y
+CONFIG_POWER_SUPPLY=y
+CONFIG_POWER_RESET=y
+CONFIG_POWER_RESET_IMX=y
+CONFIG_POWER_RESET_SYSCON=y
CONFIG_SENSORS_GPIO_FAN=y
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_IMX_THERMAL=y
-CONFIG_POWER_SUPPLY=y
-CONFIG_POWER_RESET=y
-CONFIG_POWER_RESET_IMX=y
CONFIG_WATCHDOG=y
CONFIG_IMX2_WDT=y
CONFIG_MFD_DA9052_I2C=y
@@ -198,7 +199,6 @@ CONFIG_SOC_CAMERA_OV2640=y
CONFIG_IMX_IPUV3_CORE=y
CONFIG_DRM=y
CONFIG_DRM_PANEL_SIMPLE=y
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
CONFIG_LCD_CLASS_DEVICE=y
CONFIG_LCD_L4F00242T03=y
CONFIG_LCD_PLATFORM=y
--
2.1.3

2014-12-02 17:13:22

by Stefan Agner

[permalink] [raw]
Subject: [PATCH v3 1/3] power: reset: adjust priority of simple syscon reboot driver

Currently, all restart handler use the priority 128, including
watchdogs. Probably most SoC have a watchdog, and some of them
register it also as a restart handler. But if a SoC specifies
a dedicated reboot capability using this syscon driver, this is
usually the preferred reboot method. Hence, raise the priority
of this driver to 192.

Signed-off-by: Stefan Agner <[email protected]>
---
drivers/power/reset/syscon-reboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
index 815b901..c4049f4 100644
--- a/drivers/power/reset/syscon-reboot.c
+++ b/drivers/power/reset/syscon-reboot.c
@@ -68,7 +68,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
return -EINVAL;

ctx->restart_handler.notifier_call = syscon_restart_handle;
- ctx->restart_handler.priority = 128;
+ ctx->restart_handler.priority = 192;
err = register_restart_handler(&ctx->restart_handler);
if (err)
dev_err(dev, "can't register restart notifier (err=%d)\n", err);
--
2.1.3

2014-12-02 18:34:12

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] power: reset: adjust priority of simple syscon reboot driver

On Tue, Dec 02, 2014 at 06:11:58PM +0100, Stefan Agner wrote:
> Currently, all restart handler use the priority 128, including
> watchdogs. Probably most SoC have a watchdog, and some of them
> register it also as a restart handler. But if a SoC specifies
> a dedicated reboot capability using this syscon driver, this is
> usually the preferred reboot method. Hence, raise the priority
> of this driver to 192.
>
> Signed-off-by: Stefan Agner <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

2014-12-03 10:28:48

by Mark Rutland

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] power: reset: adjust priority of simple syscon reboot driver

On Tue, Dec 02, 2014 at 05:11:58PM +0000, Stefan Agner wrote:
> Currently, all restart handler use the priority 128, including
> watchdogs. Probably most SoC have a watchdog, and some of them
> register it also as a restart handler. But if a SoC specifies
> a dedicated reboot capability using this syscon driver, this is
> usually the preferred reboot method. Hence, raise the priority
> of this driver to 192.
>
> Signed-off-by: Stefan Agner <[email protected]>

This looks good to me.

Acked-by: Mark Rutland <[email protected]>

Thanks,
Mark.

> ---
> drivers/power/reset/syscon-reboot.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
> index 815b901..c4049f4 100644
> --- a/drivers/power/reset/syscon-reboot.c
> +++ b/drivers/power/reset/syscon-reboot.c
> @@ -68,7 +68,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
> return -EINVAL;
>
> ctx->restart_handler.notifier_call = syscon_restart_handle;
> - ctx->restart_handler.priority = 128;
> + ctx->restart_handler.priority = 192;
> err = register_restart_handler(&ctx->restart_handler);
> if (err)
> dev_err(dev, "can't register restart notifier (err=%d)\n", err);
> --
> 2.1.3
>
>

2014-12-16 04:11:49

by Shawn Guo

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] power: reset: vf610 system reset controller

On Tue, Dec 02, 2014 at 06:11:57PM +0100, Stefan Agner wrote:
> Stefan Agner (3):
> power: reset: adjust priority of simple syscon reboot driver
> ARM: dts: vf610: add system reset controller and syscon-reboot
> ARM: imx_v6_v7_defconfig: add POWER_RESET_SYSCON

Applied the last two.

Shawn