[kernel] r22685 - in dists/jessie/linux/debian/patches: . features/all

Ian James Campbell ijc at moszumanska.debian.org
Sun May 24 13:48:47 UTC 2015


Author: ijc
Date: Sun May 24 13:48:46 2015
New Revision: 22685

Log:
Backport Generic SYSCON regmap reset driver

Added:
   dists/jessie/linux/debian/patches/features/all/power-reset-Add-generic-SYSCON-register-mapped-reset.patch
   dists/jessie/linux/debian/patches/features/all/power-reset-adjust-priority-of-simple-syscon-reboot-.patch
   dists/jessie/linux/debian/patches/features/all/power-reset-corrections-for-simple-syscon-reboot-dri.patch
   dists/jessie/linux/debian/patches/features/all/syscon-reboot-Backport-to-pre-register_restart_handl.patch
Modified:
   dists/jessie/linux/debian/patches/series

Added: dists/jessie/linux/debian/patches/features/all/power-reset-Add-generic-SYSCON-register-mapped-reset.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/power-reset-Add-generic-SYSCON-register-mapped-reset.patch	Sun May 24 13:48:46 2015	(r22685)
@@ -0,0 +1,144 @@
+From 5d58fd8107e08a0a4e626a8ea45215bf83b7e60d Mon Sep 17 00:00:00 2001
+From: Feng Kan <fkan at apm.com>
+Date: Tue, 30 Sep 2014 16:25:03 -0700
+Subject: [PATCH 1/3] power: reset: Add generic SYSCON register mapped reset
+Origin: https://git.kernel.org/linus/09fb07bcaf529a21612fbebd1297d8c5dd1abf1b
+
+Add a generic SYSCON register mapped reset mechanism.
+
+Signed-off-by: Feng Kan <fkan at apm.com>
+Signed-off-by: Sebastian Reichel <sre at kernel.org>
+---
+ drivers/power/reset/Kconfig         |  5 ++
+ drivers/power/reset/Makefile        |  1 +
+ drivers/power/reset/syscon-reboot.c | 96 +++++++++++++++++++++++++++++++++++++
+ 3 files changed, 102 insertions(+)
+ create mode 100644 drivers/power/reset/syscon-reboot.c
+
+diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
+index bdcf517..fd5f9e5 100644
+--- a/drivers/power/reset/Kconfig
++++ b/drivers/power/reset/Kconfig
+@@ -80,3 +80,8 @@ config POWER_RESET_KEYSTONE
+ 	help
+ 	  Reboot support for the KEYSTONE SoCs.
+ 
++config POWER_RESET_SYSCON
++	bool "Generic SYSCON regmap reset driver"
++	depends on POWER_RESET && MFD_SYSCON && OF
++	help
++	  Reboot support for generic SYSCON mapped register reset.
+diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
+index dde2e8b..b1b5ab3 100644
+--- a/drivers/power/reset/Makefile
++++ b/drivers/power/reset/Makefile
+@@ -8,3 +8,4 @@ obj-$(CONFIG_POWER_RESET_SUN6I) += sun6i-reboot.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
++obj-$(CONFIG_POWER_RESET_SYSCON) += syscon-reboot.o
+diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
+new file mode 100644
+index 0000000..948e0ee
+--- /dev/null
++++ b/drivers/power/reset/syscon-reboot.c
+@@ -0,0 +1,96 @@
++/*
++ * Generic Syscon Reboot Driver
++ *
++ * Copyright (c) 2013, Applied Micro Circuits Corporation
++ * Author: Feng Kan <fkan at apm.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; either version 2 of
++ * the License, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ */
++#include <linux/io.h>
++#include <linux/of_device.h>
++#include <linux/of_address.h>
++#include <linux/platform_device.h>
++#include <linux/notifier.h>
++#include <linux/mfd/syscon.h>
++#include <linux/regmap.h>
++#include <linux/reboot.h>
++
++struct syscon_reboot_context {
++	struct regmap *map;
++	u32 offset;
++	u32 mask;
++	struct notifier_block restart_handler;
++};
++
++static struct syscon_reboot_context *syscon_reboot_ctx;
++
++static int syscon_restart_handle(struct notifier_block *this,
++					unsigned long mode, void *cmd)
++{
++	struct syscon_reboot_context *ctx = syscon_reboot_ctx;
++	unsigned long timeout;
++
++	/* Issue the reboot */
++	if (ctx->map)
++		regmap_write(ctx->map, ctx->offset, ctx->mask);
++
++	timeout = jiffies + HZ;
++	while (time_before(jiffies, timeout))
++		cpu_relax();
++
++	pr_emerg("Unable to restart system\n");
++	return NOTIFY_DONE;
++}
++
++static int syscon_reboot_probe(struct platform_device *pdev)
++{
++	struct syscon_reboot_context *ctx;
++	struct device *dev = &pdev->dev;
++	int err;
++
++	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
++	if (!ctx)
++		return -ENOMEM;
++
++	ctx->map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap");
++	if (IS_ERR(ctx->map))
++		return PTR_ERR(ctx->map);
++
++	if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
++		return -EINVAL;
++
++	if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask))
++		return -EINVAL;
++
++	ctx->restart_handler.notifier_call = syscon_restart_handle;
++	ctx->restart_handler.priority = 128;
++	err = register_restart_handler(&ctx->restart_handler);
++	if (err)
++		dev_err(dev, "can't register restart notifier (err=%d)\n", err);
++
++	syscon_reboot_ctx = ctx;
++
++	return 0;
++}
++
++static struct of_device_id syscon_reboot_of_match[] = {
++	{ .compatible = "syscon-reboot" },
++	{}
++};
++
++static struct platform_driver syscon_reboot_driver = {
++	.probe = syscon_reboot_probe,
++	.driver = {
++		.name = "syscon-reboot",
++		.of_match_table = syscon_reboot_of_match,
++	},
++};
++module_platform_driver(syscon_reboot_driver);
+-- 
+2.1.4
+

Added: dists/jessie/linux/debian/patches/features/all/power-reset-adjust-priority-of-simple-syscon-reboot-.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/power-reset-adjust-priority-of-simple-syscon-reboot-.patch	Sun May 24 13:48:46 2015	(r22685)
@@ -0,0 +1,38 @@
+From daa276e1bf9d01d013579ac20b999d8aee11966a Mon Sep 17 00:00:00 2001
+From: Stefan Agner <stefan at agner.ch>
+Date: Tue, 2 Dec 2014 18:11:58 +0100
+Subject: [PATCH 3/3] power: reset: adjust priority of simple syscon reboot
+ driver
+Origin: https://git.kernel.org/linus/b81180b3fd4814af0459a5b6aeb1ee188fea98dc
+
+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 <stefan at agner.ch>
+Reviewed-by: Guenter Roeck <linux at roeck-us.net>
+Acked-by: Mark Rutland <mark.rutland at arm.com>
+Signed-off-by: Sebastian Reichel <sre at kernel.org>
+---
+ 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.4
+

Added: dists/jessie/linux/debian/patches/features/all/power-reset-corrections-for-simple-syscon-reboot-dri.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/power-reset-corrections-for-simple-syscon-reboot-dri.patch	Sun May 24 13:48:46 2015	(r22685)
@@ -0,0 +1,98 @@
+From 3510002127a93666f07b575e29e871430b431c2a Mon Sep 17 00:00:00 2001
+From: Feng Kan <fkan at apm.com>
+Date: Thu, 2 Oct 2014 11:24:15 -0700
+Subject: [PATCH 2/3] power: reset: corrections for simple syscon reboot driver
+Origin: https://git.kernel.org/linus/afaebbdbd48ada5ead707d6a90ce4b604e1d77d4
+
+This patch is to fix some bugs in reboot driver. Which includes auto selection
+of the MFD_SYSCON for the driver, use of container to locate restart handler,
+correction of the count down failure timer and ordering of the header file.
+
+Signed-off-by: Feng Kan <fkan at apm.com>
+Reviewed-by: Guenter Roeck <linux at roeck-us.net>
+[ sre: return err instead of 0 in syscon_reboot_probe() ]
+Signed-off-by: Sebastian Reichel <sre at kernel.org>
+
+---
+ drivers/power/reset/Kconfig         |  3 ++-
+ drivers/power/reset/syscon-reboot.c | 27 +++++++++++----------------
+ 2 files changed, 13 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
+index fd5f9e5..4044bd1 100644
+--- a/drivers/power/reset/Kconfig
++++ b/drivers/power/reset/Kconfig
+@@ -82,6 +82,7 @@ config POWER_RESET_KEYSTONE
+ 
+ config POWER_RESET_SYSCON
+ 	bool "Generic SYSCON regmap reset driver"
+-	depends on POWER_RESET && MFD_SYSCON && OF
++	depends on POWER_RESET && OF
++	select MFD_SYSCON
+ 	help
+ 	  Reboot support for generic SYSCON mapped register reset.
+diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
+index 948e0ee..815b901 100644
+--- a/drivers/power/reset/syscon-reboot.c
++++ b/drivers/power/reset/syscon-reboot.c
+@@ -14,14 +14,15 @@
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  */
++#include <linux/delay.h>
+ #include <linux/io.h>
+-#include <linux/of_device.h>
+-#include <linux/of_address.h>
+-#include <linux/platform_device.h>
+ #include <linux/notifier.h>
+ #include <linux/mfd/syscon.h>
+-#include <linux/regmap.h>
++#include <linux/of_address.h>
++#include <linux/of_device.h>
++#include <linux/platform_device.h>
+ #include <linux/reboot.h>
++#include <linux/regmap.h>
+ 
+ struct syscon_reboot_context {
+ 	struct regmap *map;
+@@ -30,21 +31,17 @@ struct syscon_reboot_context {
+ 	struct notifier_block restart_handler;
+ };
+ 
+-static struct syscon_reboot_context *syscon_reboot_ctx;
+-
+ static int syscon_restart_handle(struct notifier_block *this,
+ 					unsigned long mode, void *cmd)
+ {
+-	struct syscon_reboot_context *ctx = syscon_reboot_ctx;
+-	unsigned long timeout;
++	struct syscon_reboot_context *ctx =
++			container_of(this, struct syscon_reboot_context,
++					restart_handler);
+ 
+ 	/* Issue the reboot */
+-	if (ctx->map)
+-		regmap_write(ctx->map, ctx->offset, ctx->mask);
++	regmap_write(ctx->map, ctx->offset, ctx->mask);
+ 
+-	timeout = jiffies + HZ;
+-	while (time_before(jiffies, timeout))
+-		cpu_relax();
++	mdelay(1000);
+ 
+ 	pr_emerg("Unable to restart system\n");
+ 	return NOTIFY_DONE;
+@@ -76,9 +73,7 @@ static int syscon_reboot_probe(struct platform_device *pdev)
+ 	if (err)
+ 		dev_err(dev, "can't register restart notifier (err=%d)\n", err);
+ 
+-	syscon_reboot_ctx = ctx;
+-
+-	return 0;
++	return err;
+ }
+ 
+ static struct of_device_id syscon_reboot_of_match[] = {
+-- 
+2.1.4
+

Added: dists/jessie/linux/debian/patches/features/all/syscon-reboot-Backport-to-pre-register_restart_handl.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/jessie/linux/debian/patches/features/all/syscon-reboot-Backport-to-pre-register_restart_handl.patch	Sun May 24 13:48:46 2015	(r22685)
@@ -0,0 +1,94 @@
+From 12ff863361eb5607e02fe38123867cdc1ad048be Mon Sep 17 00:00:00 2001
+From: Ian Campbell <ijc at debian.org>
+Date: Sun, 24 May 2015 12:53:19 +0100
+Subject: [PATCH] syscon-reboot: Backport to pre-register_restart_handler
+ kernels
+Forwarded: not-needed
+
+Signed-off-by: Ian Campbell <ijc at debian.org:>
+---
+ drivers/power/reset/Kconfig         |  1 +
+ drivers/power/reset/syscon-reboot.c | 27 ++++++++++++---------------
+ 2 files changed, 13 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
+index 4044bd1..1b55a79 100644
+--- a/drivers/power/reset/Kconfig
++++ b/drivers/power/reset/Kconfig
+@@ -83,6 +83,7 @@ config POWER_RESET_KEYSTONE
+ config POWER_RESET_SYSCON
+ 	bool "Generic SYSCON regmap reset driver"
+ 	depends on POWER_RESET && OF
++	depends on ARM || ARM64
+ 	select MFD_SYSCON
+ 	help
+ 	  Reboot support for generic SYSCON mapped register reset.
+diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
+index c4049f4..fd4e00b 100644
+--- a/drivers/power/reset/syscon-reboot.c
++++ b/drivers/power/reset/syscon-reboot.c
+@@ -23,35 +23,33 @@
+ #include <linux/platform_device.h>
+ #include <linux/reboot.h>
+ #include <linux/regmap.h>
++#include <asm/system_misc.h>
+ 
+ struct syscon_reboot_context {
++	struct platform_device *pdev;
+ 	struct regmap *map;
+ 	u32 offset;
+ 	u32 mask;
+-	struct notifier_block restart_handler;
+ };
+ 
+-static int syscon_restart_handle(struct notifier_block *this,
+-					unsigned long mode, void *cmd)
++static struct syscon_reboot_context *syscon_reboot_context;
++
++static void syscon_restart(enum reboot_mode reboot_mode, const char *cmd)
+ {
+-	struct syscon_reboot_context *ctx =
+-			container_of(this, struct syscon_reboot_context,
+-					restart_handler);
++	struct syscon_reboot_context *ctx = syscon_reboot_context;
+ 
+ 	/* Issue the reboot */
+ 	regmap_write(ctx->map, ctx->offset, ctx->mask);
+ 
+ 	mdelay(1000);
+ 
+-	pr_emerg("Unable to restart system\n");
+-	return NOTIFY_DONE;
++	dev_emerg(&ctx->pdev->dev, "Unable to restart system\n");
+ }
+ 
+ static int syscon_reboot_probe(struct platform_device *pdev)
+ {
+ 	struct syscon_reboot_context *ctx;
+ 	struct device *dev = &pdev->dev;
+-	int err;
+ 
+ 	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
+ 	if (!ctx)
+@@ -67,13 +65,12 @@ static int syscon_reboot_probe(struct platform_device *pdev)
+ 	if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask))
+ 		return -EINVAL;
+ 
+-	ctx->restart_handler.notifier_call = syscon_restart_handle;
+-	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);
++	ctx->pdev = pdev;
++
++	syscon_reboot_context = ctx;
++	arm_pm_restart = syscon_restart;
+ 
+-	return err;
++	return 0;
+ }
+ 
+ static struct of_device_id syscon_reboot_of_match[] = {
+-- 
+2.1.4
+

Modified: dists/jessie/linux/debian/patches/series
==============================================================================
--- dists/jessie/linux/debian/patches/series	Sun May 24 08:11:25 2015	(r22684)
+++ dists/jessie/linux/debian/patches/series	Sun May 24 13:48:46 2015	(r22685)
@@ -261,6 +261,10 @@
 features/all/simplefb-Fix-build-errors-when-CONFIG_COMMON_CLK-is-.patch
 features/all/simplefb-Fix-build-failure-on-Sparc.patch
 features/all/fbcon-Change-fbcon_init-from-module_init-to-fs_initc.patch
+features/all/power-reset-Add-generic-SYSCON-register-mapped-reset.patch
+features/all/power-reset-corrections-for-simple-syscon-reboot-dri.patch
+features/all/power-reset-adjust-priority-of-simple-syscon-reboot-.patch
+features/all/syscon-reboot-Backport-to-pre-register_restart_handl.patch
 
 # Update r8723au to 3.17
 features/all/r8723au/0001-staging-rtl8723au-rtw_get_wps_ie23a-Remove-unused-de.patch



More information about the Kernel-svn-changes mailing list