All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  2:02 ` Xiaogang Cui
  0 siblings, 0 replies; 14+ messages in thread
From: Xiaogang Cui @ 2016-10-14  2:02 UTC (permalink / raw)
  To: andy.gross
  Cc: Xiaogang Cui, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, John Stultz, Alexandre Belloni, Nicolas Ferre,
	Chris Brand, Richard Weinberger, Moritz Fischer,
	Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

This is a initial version so it's very similar with syscon
reboot mode driver. We will add more functionalities in the
further after dependency is ready.

Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
---
 .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
 drivers/power/reset/Kconfig                        |  10 ++
 drivers/power/reset/Makefile                       |   1 +
 drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
 4 files changed, 143 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
 create mode 100644 drivers/power/reset/qcom-reboot-mode.c

diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
new file mode 100644
index 0000000..8b33592
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
@@ -0,0 +1,23 @@
+Qualcomm Reboot Mode Driver
+
+Qualcomm reboot mode driver based on reboot mode framework to update
+SPMI specific bits.
+
+Required Properties:
+-compatible: "qcom,reboot-mode"
+-offset: offset of the SPMI reboot mode register
+
+Optional Properties:
+-mask: mask of reboot mode
+-mode-xxx: magic of reboot mode
+
+Example:
+	qcom,reboot-mode@88f {
+		compatible = "qcom,reboot-mode";
+		offset = <0x88f>;
+		mode-normal = <0x00>;
+		mode-recovery = <0x04>;
+		mode-bootloader = <0x08>;
+		mode-rtc = <0x0C>;
+	};
+
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index c74c3f6..bdcf6d3f 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
 	  register, then the bootloader can read it to take different
 	  action according to the mode.
 
+config QCOM_REBOOT_MODE
+	tristate "Qualcomm reboot mode driver"
+	depends on MFD_SPMI_PMIC
+	select REBOOT_MODE
+	help
+	  Say y here will enable Qualcomm reboot mode driver. This will
+	  get reboot mode arguments and store it in SPMI PMIC register,
+	  then the bootloader can read it to take different action
+	  according to the mode.
+
 endif
 
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 1be307c..06e010f 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
 obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
 obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
 obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
+obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
diff --git a/drivers/power/reset/qcom-reboot-mode.c b/drivers/power/reset/qcom-reboot-mode.c
new file mode 100644
index 0000000..37bb635
--- /dev/null
+++ b/drivers/power/reset/qcom-reboot-mode.c
@@ -0,0 +1,109 @@
+/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+#include "reboot-mode.h"
+
+struct qcom_reboot_mode {
+	struct regmap *map;
+	struct reboot_mode_driver reboot;
+	u32 offset;
+	u32 mask;
+};
+
+static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
+				    unsigned int magic)
+{
+	struct qcom_reboot_mode *qrm;
+	int ret;
+
+	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
+
+	/* update reboot magic */
+	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
+	if (ret < 0) {
+		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int qcom_reboot_mode_probe(struct platform_device *pdev)
+{
+	struct qcom_reboot_mode *qrm;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
+	if (!qrm)
+		return -ENOMEM;
+
+	qrm->reboot.dev = dev;
+	qrm->reboot.write = qcom_reboot_mode_write;
+	qrm->mask = 0xffffffff;
+
+	qrm->map = dev_get_regmap(dev->parent, NULL);
+	if (IS_ERR_OR_NULL(qrm->map))
+		return -EINVAL;
+
+	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
+		return -EINVAL;
+
+	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
+
+	ret = reboot_mode_register(&qrm->reboot);
+	if (ret)
+		dev_err(dev, "Failed to register reboot mode\n");
+
+	dev_set_drvdata(dev, qrm);
+	return ret;
+}
+
+static int qcom_reboot_mode_remove(struct platform_device *pdev)
+{
+	struct qcom_reboot_mode *qrm;
+
+	qrm = dev_get_drvdata(&pdev->dev);
+	return reboot_mode_unregister(&qrm->reboot);
+}
+
+static const struct of_device_id of_qcom_reboot_mode_match[] = {
+	{ .compatible = "qcom,reboot-mode" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
+
+static struct platform_driver qcom_reboot_mode_driver = {
+	.probe = qcom_reboot_mode_probe,
+	.remove = qcom_reboot_mode_remove,
+	.driver = {
+		.name = "qcom-reboot-mode",
+		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
+	},
+};
+
+static int __init qcom_reboot_mode_init(void)
+{
+	return platform_driver_register(&qcom_reboot_mode_driver);
+}
+device_initcall(qcom_reboot_mode_init);
+
+MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
+MODULE_LICENSE("GPL v2");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  2:02 ` Xiaogang Cui
  0 siblings, 0 replies; 14+ messages in thread
From: Xiaogang Cui @ 2016-10-14  2:02 UTC (permalink / raw)
  To: andy.gross
  Cc: Xiaogang Cui, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, John Stultz, Alexandre Belloni, Nicolas Ferre,
	Chris Brand, Richard Weinberger, Moritz Fischer,
	Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED

This is a initial version so it's very similar with syscon
reboot mode driver. We will add more functionalities in the
further after dependency is ready.

Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
---
 .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
 drivers/power/reset/Kconfig                        |  10 ++
 drivers/power/reset/Makefile                       |   1 +
 drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
 4 files changed, 143 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
 create mode 100644 drivers/power/reset/qcom-reboot-mode.c

diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
new file mode 100644
index 0000000..8b33592
--- /dev/null
+++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
@@ -0,0 +1,23 @@
+Qualcomm Reboot Mode Driver
+
+Qualcomm reboot mode driver based on reboot mode framework to update
+SPMI specific bits.
+
+Required Properties:
+-compatible: "qcom,reboot-mode"
+-offset: offset of the SPMI reboot mode register
+
+Optional Properties:
+-mask: mask of reboot mode
+-mode-xxx: magic of reboot mode
+
+Example:
+	qcom,reboot-mode@88f {
+		compatible = "qcom,reboot-mode";
+		offset = <0x88f>;
+		mode-normal = <0x00>;
+		mode-recovery = <0x04>;
+		mode-bootloader = <0x08>;
+		mode-rtc = <0x0C>;
+	};
+
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index c74c3f6..bdcf6d3f 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
 	  register, then the bootloader can read it to take different
 	  action according to the mode.
 
+config QCOM_REBOOT_MODE
+	tristate "Qualcomm reboot mode driver"
+	depends on MFD_SPMI_PMIC
+	select REBOOT_MODE
+	help
+	  Say y here will enable Qualcomm reboot mode driver. This will
+	  get reboot mode arguments and store it in SPMI PMIC register,
+	  then the bootloader can read it to take different action
+	  according to the mode.
+
 endif
 
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 1be307c..06e010f 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
 obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
 obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
 obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
+obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
diff --git a/drivers/power/reset/qcom-reboot-mode.c b/drivers/power/reset/qcom-reboot-mode.c
new file mode 100644
index 0000000..37bb635
--- /dev/null
+++ b/drivers/power/reset/qcom-reboot-mode.c
@@ -0,0 +1,109 @@
+/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+#include "reboot-mode.h"
+
+struct qcom_reboot_mode {
+	struct regmap *map;
+	struct reboot_mode_driver reboot;
+	u32 offset;
+	u32 mask;
+};
+
+static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
+				    unsigned int magic)
+{
+	struct qcom_reboot_mode *qrm;
+	int ret;
+
+	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
+
+	/* update reboot magic */
+	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
+	if (ret < 0) {
+		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int qcom_reboot_mode_probe(struct platform_device *pdev)
+{
+	struct qcom_reboot_mode *qrm;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
+	if (!qrm)
+		return -ENOMEM;
+
+	qrm->reboot.dev = dev;
+	qrm->reboot.write = qcom_reboot_mode_write;
+	qrm->mask = 0xffffffff;
+
+	qrm->map = dev_get_regmap(dev->parent, NULL);
+	if (IS_ERR_OR_NULL(qrm->map))
+		return -EINVAL;
+
+	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
+		return -EINVAL;
+
+	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
+
+	ret = reboot_mode_register(&qrm->reboot);
+	if (ret)
+		dev_err(dev, "Failed to register reboot mode\n");
+
+	dev_set_drvdata(dev, qrm);
+	return ret;
+}
+
+static int qcom_reboot_mode_remove(struct platform_device *pdev)
+{
+	struct qcom_reboot_mode *qrm;
+
+	qrm = dev_get_drvdata(&pdev->dev);
+	return reboot_mode_unregister(&qrm->reboot);
+}
+
+static const struct of_device_id of_qcom_reboot_mode_match[] = {
+	{ .compatible = "qcom,reboot-mode" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
+
+static struct platform_driver qcom_reboot_mode_driver = {
+	.probe = qcom_reboot_mode_probe,
+	.remove = qcom_reboot_mode_remove,
+	.driver = {
+		.name = "qcom-reboot-mode",
+		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
+	},
+};
+
+static int __init qcom_reboot_mode_init(void)
+{
+	return platform_driver_register(&qcom_reboot_mode_driver);
+}
+device_initcall(qcom_reboot_mode_init);
+
+MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
+MODULE_LICENSE("GPL v2");
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  2:41   ` Andy Yan
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Yan @ 2016-10-14  2:41 UTC (permalink / raw)
  To: Xiaogang Cui, andy.gross
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Rob Herring, Mark Rutland, Krzysztof Kozlowski, John Stultz,
	Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

Hi Xiaogang:


On 2016年10月14日 10:02, Xiaogang Cui wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
>
> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
> ---

     As your commit messages said, "it's very similar with syscon reboot 
mode driver", so maybe we can try to reuse the syscon reboot mode 
driver, and extend your new function on it.
>   .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>   drivers/power/reset/Kconfig                        |  10 ++
>   drivers/power/reset/Makefile                       |   1 +
>   drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>   4 files changed, 143 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>   create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +	qcom,reboot-mode@88f {
> +		compatible = "qcom,reboot-mode";
> +		offset = <0x88f>;
> +		mode-normal = <0x00>;
> +		mode-recovery = <0x04>;
> +		mode-bootloader = <0x08>;
> +		mode-rtc = <0x0C>;
> +	};
> +
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index c74c3f6..bdcf6d3f 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
>   	  register, then the bootloader can read it to take different
>   	  action according to the mode.
>   
> +config QCOM_REBOOT_MODE
> +	tristate "Qualcomm reboot mode driver"
> +	depends on MFD_SPMI_PMIC
> +	select REBOOT_MODE
> +	help
> +	  Say y here will enable Qualcomm reboot mode driver. This will
> +	  get reboot mode arguments and store it in SPMI PMIC register,
> +	  then the bootloader can read it to take different action
> +	  according to the mode.
> +
>   endif
>   
> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> index 1be307c..06e010f 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
>   obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
>   obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
>   obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
> +obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
> diff --git a/drivers/power/reset/qcom-reboot-mode.c b/drivers/power/reset/qcom-reboot-mode.c
> new file mode 100644
> index 0000000..37bb635
> --- /dev/null
> +++ b/drivers/power/reset/qcom-reboot-mode.c
> @@ -0,0 +1,109 @@
> +/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * 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/init.h>
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +#include <linux/regmap.h>
> +#include "reboot-mode.h"
> +
> +struct qcom_reboot_mode {
> +	struct regmap *map;
> +	struct reboot_mode_driver reboot;
> +	u32 offset;
> +	u32 mask;
> +};
> +
> +static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
> +				    unsigned int magic)
> +{
> +	struct qcom_reboot_mode *qrm;
> +	int ret;
> +
> +	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
> +
> +	/* update reboot magic */
> +	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
> +	if (ret < 0) {
> +		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int qcom_reboot_mode_probe(struct platform_device *pdev)
> +{
> +	struct qcom_reboot_mode *qrm;
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
> +	if (!qrm)
> +		return -ENOMEM;
> +
> +	qrm->reboot.dev = dev;
> +	qrm->reboot.write = qcom_reboot_mode_write;
> +	qrm->mask = 0xffffffff;
> +
> +	qrm->map = dev_get_regmap(dev->parent, NULL);
> +	if (IS_ERR_OR_NULL(qrm->map))
> +		return -EINVAL;
> +
> +	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
> +		return -EINVAL;
> +
> +	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
> +
> +	ret = reboot_mode_register(&qrm->reboot);
> +	if (ret)
> +		dev_err(dev, "Failed to register reboot mode\n");
> +
> +	dev_set_drvdata(dev, qrm);
> +	return ret;
> +}
> +
> +static int qcom_reboot_mode_remove(struct platform_device *pdev)
> +{
> +	struct qcom_reboot_mode *qrm;
> +
> +	qrm = dev_get_drvdata(&pdev->dev);
> +	return reboot_mode_unregister(&qrm->reboot);
> +}
> +
> +static const struct of_device_id of_qcom_reboot_mode_match[] = {
> +	{ .compatible = "qcom,reboot-mode" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
> +
> +static struct platform_driver qcom_reboot_mode_driver = {
> +	.probe = qcom_reboot_mode_probe,
> +	.remove = qcom_reboot_mode_remove,
> +	.driver = {
> +		.name = "qcom-reboot-mode",
> +		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
> +	},
> +};
> +
> +static int __init qcom_reboot_mode_init(void)
> +{
> +	return platform_driver_register(&qcom_reboot_mode_driver);
> +}
> +device_initcall(qcom_reboot_mode_init);
> +
> +MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
> +MODULE_LICENSE("GPL v2");

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  2:41   ` Andy Yan
  0 siblings, 0 replies; 14+ messages in thread
From: Andy Yan @ 2016-10-14  2:41 UTC (permalink / raw)
  To: Xiaogang Cui, andy.gross-QSEj5FYQhm4dnm+yROfE0A
  Cc: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse,
	Rob Herring, Mark Rutland, Krzysztof Kozlowski, John Stultz,
	Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

Hi Xiaogang:


On 2016年10月14日 10:02, Xiaogang Cui wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
>
> Signed-off-by: Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---

     As your commit messages said, "it's very similar with syscon reboot 
mode driver", so maybe we can try to reuse the syscon reboot mode 
driver, and extend your new function on it.
>   .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>   drivers/power/reset/Kconfig                        |  10 ++
>   drivers/power/reset/Makefile                       |   1 +
>   drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>   4 files changed, 143 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>   create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +	qcom,reboot-mode@88f {
> +		compatible = "qcom,reboot-mode";
> +		offset = <0x88f>;
> +		mode-normal = <0x00>;
> +		mode-recovery = <0x04>;
> +		mode-bootloader = <0x08>;
> +		mode-rtc = <0x0C>;
> +	};
> +
> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
> index c74c3f6..bdcf6d3f 100644
> --- a/drivers/power/reset/Kconfig
> +++ b/drivers/power/reset/Kconfig
> @@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
>   	  register, then the bootloader can read it to take different
>   	  action according to the mode.
>   
> +config QCOM_REBOOT_MODE
> +	tristate "Qualcomm reboot mode driver"
> +	depends on MFD_SPMI_PMIC
> +	select REBOOT_MODE
> +	help
> +	  Say y here will enable Qualcomm reboot mode driver. This will
> +	  get reboot mode arguments and store it in SPMI PMIC register,
> +	  then the bootloader can read it to take different action
> +	  according to the mode.
> +
>   endif
>   
> diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
> index 1be307c..06e010f 100644
> --- a/drivers/power/reset/Makefile
> +++ b/drivers/power/reset/Makefile
> @@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
>   obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
>   obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
>   obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
> +obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
> diff --git a/drivers/power/reset/qcom-reboot-mode.c b/drivers/power/reset/qcom-reboot-mode.c
> new file mode 100644
> index 0000000..37bb635
> --- /dev/null
> +++ b/drivers/power/reset/qcom-reboot-mode.c
> @@ -0,0 +1,109 @@
> +/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * 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/init.h>
> +#include <linux/module.h>
> +#include <linux/kernel.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/reboot.h>
> +#include <linux/regmap.h>
> +#include "reboot-mode.h"
> +
> +struct qcom_reboot_mode {
> +	struct regmap *map;
> +	struct reboot_mode_driver reboot;
> +	u32 offset;
> +	u32 mask;
> +};
> +
> +static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
> +				    unsigned int magic)
> +{
> +	struct qcom_reboot_mode *qrm;
> +	int ret;
> +
> +	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
> +
> +	/* update reboot magic */
> +	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
> +	if (ret < 0) {
> +		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static int qcom_reboot_mode_probe(struct platform_device *pdev)
> +{
> +	struct qcom_reboot_mode *qrm;
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
> +	if (!qrm)
> +		return -ENOMEM;
> +
> +	qrm->reboot.dev = dev;
> +	qrm->reboot.write = qcom_reboot_mode_write;
> +	qrm->mask = 0xffffffff;
> +
> +	qrm->map = dev_get_regmap(dev->parent, NULL);
> +	if (IS_ERR_OR_NULL(qrm->map))
> +		return -EINVAL;
> +
> +	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
> +		return -EINVAL;
> +
> +	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
> +
> +	ret = reboot_mode_register(&qrm->reboot);
> +	if (ret)
> +		dev_err(dev, "Failed to register reboot mode\n");
> +
> +	dev_set_drvdata(dev, qrm);
> +	return ret;
> +}
> +
> +static int qcom_reboot_mode_remove(struct platform_device *pdev)
> +{
> +	struct qcom_reboot_mode *qrm;
> +
> +	qrm = dev_get_drvdata(&pdev->dev);
> +	return reboot_mode_unregister(&qrm->reboot);
> +}
> +
> +static const struct of_device_id of_qcom_reboot_mode_match[] = {
> +	{ .compatible = "qcom,reboot-mode" },
> +	{}
> +};
> +MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
> +
> +static struct platform_driver qcom_reboot_mode_driver = {
> +	.probe = qcom_reboot_mode_probe,
> +	.remove = qcom_reboot_mode_remove,
> +	.driver = {
> +		.name = "qcom-reboot-mode",
> +		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
> +	},
> +};
> +
> +static int __init qcom_reboot_mode_init(void)
> +{
> +	return platform_driver_register(&qcom_reboot_mode_driver);
> +}
> +device_initcall(qcom_reboot_mode_init);
> +
> +MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
> +MODULE_LICENSE("GPL v2");


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
  2016-10-14  2:41   ` Andy Yan
@ 2016-10-14  3:06     ` xiaogang
  -1 siblings, 0 replies; 14+ messages in thread
From: xiaogang @ 2016-10-14  3:06 UTC (permalink / raw)
  To: Andy Yan
  Cc: andy.gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	John Stultz, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

Hi, Andy:

在 2016-10-14 10:41,Andy Yan 写道:
> Hi Xiaogang:
> 
> 
> On 2016年10月14日 10:02, Xiaogang Cui wrote:
>> This is a initial version so it's very similar with syscon
>> reboot mode driver. We will add more functionalities in the
>> further after dependency is ready.
>> 
>> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
>> ---
> 
>     As your commit messages said, "it's very similar with syscon
> reboot mode driver", so maybe we can try to reuse the syscon reboot
> mode driver, and extend your new function on it.

       Since it will heavily depend on Qualcomm qpnp and download mode 
driver.
I prefer to add a new driver for this.

>>   .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>>   drivers/power/reset/Kconfig                        |  10 ++
>>   drivers/power/reset/Makefile                       |   1 +
>>   drivers/power/reset/qcom-reboot-mode.c             | 109 
>> +++++++++++++++++++++
>>   4 files changed, 143 insertions(+)
>>   create mode 100644 
>> Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>>   create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> new file mode 100644
>> index 0000000..8b33592
>> --- /dev/null
>> +++ 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> @@ -0,0 +1,23 @@
>> +Qualcomm Reboot Mode Driver
>> +
>> +Qualcomm reboot mode driver based on reboot mode framework to update
>> +SPMI specific bits.
>> +
>> +Required Properties:
>> +-compatible: "qcom,reboot-mode"
>> +-offset: offset of the SPMI reboot mode register
>> +
>> +Optional Properties:
>> +-mask: mask of reboot mode
>> +-mode-xxx: magic of reboot mode
>> +
>> +Example:
>> +	qcom,reboot-mode@88f {
>> +		compatible = "qcom,reboot-mode";
>> +		offset = <0x88f>;
>> +		mode-normal = <0x00>;
>> +		mode-recovery = <0x04>;
>> +		mode-bootloader = <0x08>;
>> +		mode-rtc = <0x0C>;
>> +	};
>> +
>> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
>> index c74c3f6..bdcf6d3f 100644
>> --- a/drivers/power/reset/Kconfig
>> +++ b/drivers/power/reset/Kconfig
>> @@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
>>   	  register, then the bootloader can read it to take different
>>   	  action according to the mode.
>>   +config QCOM_REBOOT_MODE
>> +	tristate "Qualcomm reboot mode driver"
>> +	depends on MFD_SPMI_PMIC
>> +	select REBOOT_MODE
>> +	help
>> +	  Say y here will enable Qualcomm reboot mode driver. This will
>> +	  get reboot mode arguments and store it in SPMI PMIC register,
>> +	  then the bootloader can read it to take different action
>> +	  according to the mode.
>> +
>>   endif
>>   diff --git a/drivers/power/reset/Makefile 
>> b/drivers/power/reset/Makefile
>> index 1be307c..06e010f 100644
>> --- a/drivers/power/reset/Makefile
>> +++ b/drivers/power/reset/Makefile
>> @@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
>>   obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
>>   obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
>>   obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
>> +obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
>> diff --git a/drivers/power/reset/qcom-reboot-mode.c 
>> b/drivers/power/reset/qcom-reboot-mode.c
>> new file mode 100644
>> index 0000000..37bb635
>> --- /dev/null
>> +++ b/drivers/power/reset/qcom-reboot-mode.c
>> @@ -0,0 +1,109 @@
>> +/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or 
>> modify
>> + * it under the terms of the GNU General Public License version 2 and
>> + * only version 2 as published by the Free Software Foundation.
>> + *
>> + * 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/init.h>
>> +#include <linux/module.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reboot.h>
>> +#include <linux/regmap.h>
>> +#include "reboot-mode.h"
>> +
>> +struct qcom_reboot_mode {
>> +	struct regmap *map;
>> +	struct reboot_mode_driver reboot;
>> +	u32 offset;
>> +	u32 mask;
>> +};
>> +
>> +static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
>> +				    unsigned int magic)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +	int ret;
>> +
>> +	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
>> +
>> +	/* update reboot magic */
>> +	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
>> +	if (ret < 0) {
>> +		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
>> +		return ret;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int qcom_reboot_mode_probe(struct platform_device *pdev)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +	struct device *dev = &pdev->dev;
>> +	int ret;
>> +
>> +	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
>> +	if (!qrm)
>> +		return -ENOMEM;
>> +
>> +	qrm->reboot.dev = dev;
>> +	qrm->reboot.write = qcom_reboot_mode_write;
>> +	qrm->mask = 0xffffffff;
>> +
>> +	qrm->map = dev_get_regmap(dev->parent, NULL);
>> +	if (IS_ERR_OR_NULL(qrm->map))
>> +		return -EINVAL;
>> +
>> +	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
>> +		return -EINVAL;
>> +
>> +	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
>> +
>> +	ret = reboot_mode_register(&qrm->reboot);
>> +	if (ret)
>> +		dev_err(dev, "Failed to register reboot mode\n");
>> +
>> +	dev_set_drvdata(dev, qrm);
>> +	return ret;
>> +}
>> +
>> +static int qcom_reboot_mode_remove(struct platform_device *pdev)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +
>> +	qrm = dev_get_drvdata(&pdev->dev);
>> +	return reboot_mode_unregister(&qrm->reboot);
>> +}
>> +
>> +static const struct of_device_id of_qcom_reboot_mode_match[] = {
>> +	{ .compatible = "qcom,reboot-mode" },
>> +	{}
>> +};
>> +MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
>> +
>> +static struct platform_driver qcom_reboot_mode_driver = {
>> +	.probe = qcom_reboot_mode_probe,
>> +	.remove = qcom_reboot_mode_remove,
>> +	.driver = {
>> +		.name = "qcom-reboot-mode",
>> +		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
>> +	},
>> +};
>> +
>> +static int __init qcom_reboot_mode_init(void)
>> +{
>> +	return platform_driver_register(&qcom_reboot_mode_driver);
>> +}
>> +device_initcall(qcom_reboot_mode_init);
>> +
>> +MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
>> +MODULE_LICENSE("GPL v2");

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  3:06     ` xiaogang
  0 siblings, 0 replies; 14+ messages in thread
From: xiaogang @ 2016-10-14  3:06 UTC (permalink / raw)
  To: Andy Yan
  Cc: andy.gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	John Stultz, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

Hi, Andy:

在 2016-10-14 10:41,Andy Yan 写道:
> Hi Xiaogang:
> 
> 
> On 2016年10月14日 10:02, Xiaogang Cui wrote:
>> This is a initial version so it's very similar with syscon
>> reboot mode driver. We will add more functionalities in the
>> further after dependency is ready.
>> 
>> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
>> ---
> 
>     As your commit messages said, "it's very similar with syscon
> reboot mode driver", so maybe we can try to reuse the syscon reboot
> mode driver, and extend your new function on it.

       Since it will heavily depend on Qualcomm qpnp and download mode 
driver.
I prefer to add a new driver for this.

>>   .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>>   drivers/power/reset/Kconfig                        |  10 ++
>>   drivers/power/reset/Makefile                       |   1 +
>>   drivers/power/reset/qcom-reboot-mode.c             | 109 
>> +++++++++++++++++++++
>>   4 files changed, 143 insertions(+)
>>   create mode 100644 
>> Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>>   create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> new file mode 100644
>> index 0000000..8b33592
>> --- /dev/null
>> +++ 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> @@ -0,0 +1,23 @@
>> +Qualcomm Reboot Mode Driver
>> +
>> +Qualcomm reboot mode driver based on reboot mode framework to update
>> +SPMI specific bits.
>> +
>> +Required Properties:
>> +-compatible: "qcom,reboot-mode"
>> +-offset: offset of the SPMI reboot mode register
>> +
>> +Optional Properties:
>> +-mask: mask of reboot mode
>> +-mode-xxx: magic of reboot mode
>> +
>> +Example:
>> +	qcom,reboot-mode@88f {
>> +		compatible = "qcom,reboot-mode";
>> +		offset = <0x88f>;
>> +		mode-normal = <0x00>;
>> +		mode-recovery = <0x04>;
>> +		mode-bootloader = <0x08>;
>> +		mode-rtc = <0x0C>;
>> +	};
>> +
>> diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
>> index c74c3f6..bdcf6d3f 100644
>> --- a/drivers/power/reset/Kconfig
>> +++ b/drivers/power/reset/Kconfig
>> @@ -208,5 +208,15 @@ config SYSCON_REBOOT_MODE
>>   	  register, then the bootloader can read it to take different
>>   	  action according to the mode.
>>   +config QCOM_REBOOT_MODE
>> +	tristate "Qualcomm reboot mode driver"
>> +	depends on MFD_SPMI_PMIC
>> +	select REBOOT_MODE
>> +	help
>> +	  Say y here will enable Qualcomm reboot mode driver. This will
>> +	  get reboot mode arguments and store it in SPMI PMIC register,
>> +	  then the bootloader can read it to take different action
>> +	  according to the mode.
>> +
>>   endif
>>   diff --git a/drivers/power/reset/Makefile 
>> b/drivers/power/reset/Makefile
>> index 1be307c..06e010f 100644
>> --- a/drivers/power/reset/Makefile
>> +++ b/drivers/power/reset/Makefile
>> @@ -24,3 +24,4 @@ obj-$(CONFIG_POWER_RESET_RMOBILE) += rmobile-reset.o
>>   obj-$(CONFIG_POWER_RESET_ZX) += zx-reboot.o
>>   obj-$(CONFIG_REBOOT_MODE) += reboot-mode.o
>>   obj-$(CONFIG_SYSCON_REBOOT_MODE) += syscon-reboot-mode.o
>> +obj-$(CONFIG_QCOM_REBOOT_MODE) += qcom-reboot-mode.o
>> diff --git a/drivers/power/reset/qcom-reboot-mode.c 
>> b/drivers/power/reset/qcom-reboot-mode.c
>> new file mode 100644
>> index 0000000..37bb635
>> --- /dev/null
>> +++ b/drivers/power/reset/qcom-reboot-mode.c
>> @@ -0,0 +1,109 @@
>> +/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
>> + *
>> + * This program is free software; you can redistribute it and/or 
>> modify
>> + * it under the terms of the GNU General Public License version 2 and
>> + * only version 2 as published by the Free Software Foundation.
>> + *
>> + * 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/init.h>
>> +#include <linux/module.h>
>> +#include <linux/kernel.h>
>> +#include <linux/of.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/reboot.h>
>> +#include <linux/regmap.h>
>> +#include "reboot-mode.h"
>> +
>> +struct qcom_reboot_mode {
>> +	struct regmap *map;
>> +	struct reboot_mode_driver reboot;
>> +	u32 offset;
>> +	u32 mask;
>> +};
>> +
>> +static int qcom_reboot_mode_write(struct reboot_mode_driver *reboot,
>> +				    unsigned int magic)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +	int ret;
>> +
>> +	qrm = container_of(reboot, struct qcom_reboot_mode, reboot);
>> +
>> +	/* update reboot magic */
>> +	ret = regmap_update_bits(qrm->map, qrm->offset, qrm->mask, magic);
>> +	if (ret < 0) {
>> +		dev_err(reboot->dev, "Failed to update reboot mode bits\n");
>> +		return ret;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>> +static int qcom_reboot_mode_probe(struct platform_device *pdev)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +	struct device *dev = &pdev->dev;
>> +	int ret;
>> +
>> +	qrm = devm_kzalloc(&pdev->dev, sizeof(*qrm), GFP_KERNEL);
>> +	if (!qrm)
>> +		return -ENOMEM;
>> +
>> +	qrm->reboot.dev = dev;
>> +	qrm->reboot.write = qcom_reboot_mode_write;
>> +	qrm->mask = 0xffffffff;
>> +
>> +	qrm->map = dev_get_regmap(dev->parent, NULL);
>> +	if (IS_ERR_OR_NULL(qrm->map))
>> +		return -EINVAL;
>> +
>> +	if (of_property_read_u32(dev->of_node, "offset", &qrm->offset))
>> +		return -EINVAL;
>> +
>> +	of_property_read_u32(dev->of_node, "mask", &qrm->mask);
>> +
>> +	ret = reboot_mode_register(&qrm->reboot);
>> +	if (ret)
>> +		dev_err(dev, "Failed to register reboot mode\n");
>> +
>> +	dev_set_drvdata(dev, qrm);
>> +	return ret;
>> +}
>> +
>> +static int qcom_reboot_mode_remove(struct platform_device *pdev)
>> +{
>> +	struct qcom_reboot_mode *qrm;
>> +
>> +	qrm = dev_get_drvdata(&pdev->dev);
>> +	return reboot_mode_unregister(&qrm->reboot);
>> +}
>> +
>> +static const struct of_device_id of_qcom_reboot_mode_match[] = {
>> +	{ .compatible = "qcom,reboot-mode" },
>> +	{}
>> +};
>> +MODULE_DEVICE_TABLE(of, of_qcom_reboot_mode_match);
>> +
>> +static struct platform_driver qcom_reboot_mode_driver = {
>> +	.probe = qcom_reboot_mode_probe,
>> +	.remove = qcom_reboot_mode_remove,
>> +	.driver = {
>> +		.name = "qcom-reboot-mode",
>> +		.of_match_table = of_match_ptr(of_qcom_reboot_mode_match),
>> +	},
>> +};
>> +
>> +static int __init qcom_reboot_mode_init(void)
>> +{
>> +	return platform_driver_register(&qcom_reboot_mode_driver);
>> +}
>> +device_initcall(qcom_reboot_mode_init);
>> +
>> +MODULE_DESCRIPTION("QCOM Reboot Mode Driver");
>> +MODULE_LICENSE("GPL v2");

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  3:25   ` John Stultz
  0 siblings, 0 replies; 14+ messages in thread
From: John Stultz @ 2016-10-14  3:25 UTC (permalink / raw)
  To: Xiaogang Cui
  Cc: Andy Gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

On Thu, Oct 13, 2016 at 7:02 PM, Xiaogang Cui <xiaogang@codeaurora.org> wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
>
> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
> ---
>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>  drivers/power/reset/Kconfig                        |  10 ++
>  drivers/power/reset/Makefile                       |   1 +
>  drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>  4 files changed, 143 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +       qcom,reboot-mode@88f {
> +               compatible = "qcom,reboot-mode";
> +               offset = <0x88f>;
> +               mode-normal = <0x00>;
> +               mode-recovery = <0x04>;
> +               mode-bootloader = <0x08>;
> +               mode-rtc = <0x0C>;

So I don't think we've had a "rtc" mode before. This needs to be very
clearly documented (or maybe just skipped) so we don't start fraying
with all the various vendor specific modes.

thanks
-john

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  3:25   ` John Stultz
  0 siblings, 0 replies; 14+ messages in thread
From: John Stultz @ 2016-10-14  3:25 UTC (permalink / raw)
  To: Xiaogang Cui
  Cc: Andy Gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

On Thu, Oct 13, 2016 at 7:02 PM, Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
>
> Signed-off-by: Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>  drivers/power/reset/Kconfig                        |  10 ++
>  drivers/power/reset/Makefile                       |   1 +
>  drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>  4 files changed, 143 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +       qcom,reboot-mode@88f {
> +               compatible = "qcom,reboot-mode";
> +               offset = <0x88f>;
> +               mode-normal = <0x00>;
> +               mode-recovery = <0x04>;
> +               mode-bootloader = <0x08>;
> +               mode-rtc = <0x0C>;

So I don't think we've had a "rtc" mode before. This needs to be very
clearly documented (or maybe just skipped) so we don't start fraying
with all the various vendor specific modes.

thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  3:40     ` xiaogang-sgV2jX0FEOL9JmXXK+q4OQ
  0 siblings, 0 replies; 14+ messages in thread
From: xiaogang @ 2016-10-14  3:40 UTC (permalink / raw)
  To: John Stultz
  Cc: Andy Gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

在 2016-10-14 11:25,John Stultz 写道:
> On Thu, Oct 13, 2016 at 7:02 PM, Xiaogang Cui <xiaogang@codeaurora.org> 
> wrote:
>> This is a initial version so it's very similar with syscon
>> reboot mode driver. We will add more functionalities in the
>> further after dependency is ready.
>> 
>> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
>> ---
>>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>>  drivers/power/reset/Kconfig                        |  10 ++
>>  drivers/power/reset/Makefile                       |   1 +
>>  drivers/power/reset/qcom-reboot-mode.c             | 109 
>> +++++++++++++++++++++
>>  4 files changed, 143 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> new file mode 100644
>> index 0000000..8b33592
>> --- /dev/null
>> +++ 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> @@ -0,0 +1,23 @@
>> +Qualcomm Reboot Mode Driver
>> +
>> +Qualcomm reboot mode driver based on reboot mode framework to update
>> +SPMI specific bits.
>> +
>> +Required Properties:
>> +-compatible: "qcom,reboot-mode"
>> +-offset: offset of the SPMI reboot mode register
>> +
>> +Optional Properties:
>> +-mask: mask of reboot mode
>> +-mode-xxx: magic of reboot mode
>> +
>> +Example:
>> +       qcom,reboot-mode@88f {
>> +               compatible = "qcom,reboot-mode";
>> +               offset = <0x88f>;
>> +               mode-normal = <0x00>;
>> +               mode-recovery = <0x04>;
>> +               mode-bootloader = <0x08>;
>> +               mode-rtc = <0x0C>;
> 
> So I don't think we've had a "rtc" mode before. This needs to be very
> clearly documented (or maybe just skipped) so we don't start fraying
> with all the various vendor specific modes.
> 

Thanks for the comments, I will skip this specific mode in next version 
of this patch.

> thanks
> -john

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14  3:40     ` xiaogang-sgV2jX0FEOL9JmXXK+q4OQ
  0 siblings, 0 replies; 14+ messages in thread
From: xiaogang-sgV2jX0FEOL9JmXXK+q4OQ @ 2016-10-14  3:40 UTC (permalink / raw)
  To: John Stultz
  Cc: Andy Gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Rob Herring, Mark Rutland, Krzysztof Kozlowski,
	Andy Yan, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS

在 2016-10-14 11:25,John Stultz 写道:
> On Thu, Oct 13, 2016 at 7:02 PM, Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> 
> wrote:
>> This is a initial version so it's very similar with syscon
>> reboot mode driver. We will add more functionalities in the
>> further after dependency is ready.
>> 
>> Signed-off-by: Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
>> ---
>>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>>  drivers/power/reset/Kconfig                        |  10 ++
>>  drivers/power/reset/Makefile                       |   1 +
>>  drivers/power/reset/qcom-reboot-mode.c             | 109 
>> +++++++++++++++++++++
>>  4 files changed, 143 insertions(+)
>>  create mode 100644 
>> Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
>> 
>> diff --git 
>> a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> new file mode 100644
>> index 0000000..8b33592
>> --- /dev/null
>> +++ 
>> b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>> @@ -0,0 +1,23 @@
>> +Qualcomm Reboot Mode Driver
>> +
>> +Qualcomm reboot mode driver based on reboot mode framework to update
>> +SPMI specific bits.
>> +
>> +Required Properties:
>> +-compatible: "qcom,reboot-mode"
>> +-offset: offset of the SPMI reboot mode register
>> +
>> +Optional Properties:
>> +-mask: mask of reboot mode
>> +-mode-xxx: magic of reboot mode
>> +
>> +Example:
>> +       qcom,reboot-mode@88f {
>> +               compatible = "qcom,reboot-mode";
>> +               offset = <0x88f>;
>> +               mode-normal = <0x00>;
>> +               mode-recovery = <0x04>;
>> +               mode-bootloader = <0x08>;
>> +               mode-rtc = <0x0C>;
> 
> So I don't think we've had a "rtc" mode before. This needs to be very
> clearly documented (or maybe just skipped) so we don't start fraying
> with all the various vendor specific modes.
> 

Thanks for the comments, I will skip this specific mode in next version 
of this patch.

> thanks
> -john
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14 13:15       ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-10-14 13:15 UTC (permalink / raw)
  To: xiaogang
  Cc: Andy Yan, andy.gross, Dmitry Eremin-Solenikov, David Woodhouse,
	Rob Herring, Mark Rutland, Krzysztof Kozlowski, John Stultz,
	Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

Hi,

On Fri, Oct 14, 2016 at 11:06:14AM +0800, xiaogang@codeaurora.org wrote:
> 在 2016-10-14 10:41,Andy Yan 写道:
> > On 2016年10月14日 10:02, Xiaogang Cui wrote:
> > > This is a initial version so it's very similar with syscon
> > > reboot mode driver. We will add more functionalities in the
> > > further after dependency is ready.
> > > 
> > > Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
> > > ---
> > 
> > As your commit messages said, "it's very similar with syscon
> > reboot mode driver", so maybe we can try to reuse the syscon
> > reboot mode driver, and extend your new function on it.
> 
> Since it will heavily depend on Qualcomm qpnp and download mode
> driver. I prefer to add a new driver for this.

So use syscon driver until then. In its current state is more
or less a copy of syscon driver with s/syscon/qcom/g. I will
not queue that.

Just add a more specific compatible value in addition to the
syscon one:

compatible = "qcom,reboot-mode", "syscon-reboot-mode";

Then syscon driver is used and if something more complex
is required later we can easily switch to it.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-14 13:15       ` Sebastian Reichel
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2016-10-14 13:15 UTC (permalink / raw)
  To: xiaogang-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: Andy Yan, andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	Dmitry Eremin-Solenikov, David Woodhouse, Rob Herring,
	Mark Rutland, Krzysztof Kozlowski, John Stultz,
	Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

Hi,

On Fri, Oct 14, 2016 at 11:06:14AM +0800, xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org wrote:
> 在 2016-10-14 10:41,Andy Yan 写道:
> > On 2016年10月14日 10:02, Xiaogang Cui wrote:
> > > This is a initial version so it's very similar with syscon
> > > reboot mode driver. We will add more functionalities in the
> > > further after dependency is ready.
> > > 
> > > Signed-off-by: Xiaogang Cui <xiaogang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> > > ---
> > 
> > As your commit messages said, "it's very similar with syscon
> > reboot mode driver", so maybe we can try to reuse the syscon
> > reboot mode driver, and extend your new function on it.
> 
> Since it will heavily depend on Qualcomm qpnp and download mode
> driver. I prefer to add a new driver for this.

So use syscon driver until then. In its current state is more
or less a copy of syscon driver with s/syscon/qcom/g. I will
not queue that.

Just add a more specific compatible value in addition to the
syscon one:

compatible = "qcom,reboot-mode", "syscon-reboot-mode";

Then syscon driver is used and if something more complex
is required later we can easily switch to it.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
  2016-10-14  2:02 ` Xiaogang Cui
@ 2016-10-18 14:12   ` Rob Herring
  -1 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2016-10-18 14:12 UTC (permalink / raw)
  To: Xiaogang Cui
  Cc: andy.gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Mark Rutland, Krzysztof Kozlowski, Andy Yan,
	John Stultz, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

On Fri, Oct 14, 2016 at 10:02:27AM +0800, Xiaogang Cui wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
> 
> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
> ---
>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>  drivers/power/reset/Kconfig                        |  10 ++
>  drivers/power/reset/Makefile                       |   1 +
>  drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>  4 files changed, 143 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
> 
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +	qcom,reboot-mode@88f {

Node names should be generic. Just reboot-mode@...

> +		compatible = "qcom,reboot-mode";
> +		offset = <0x88f>;
> +		mode-normal = <0x00>;
> +		mode-recovery = <0x04>;
> +		mode-bootloader = <0x08>;
> +		mode-rtc = <0x0C>;

In addition to what John said, I think vendor specfic modes should 
have a vendor prefix (e.g. qcom,mode-rtc). That will complicate parsing 
a bit though.

Rob

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/2] power: reset: Add qcom reboot mode driver
@ 2016-10-18 14:12   ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2016-10-18 14:12 UTC (permalink / raw)
  To: Xiaogang Cui
  Cc: andy.gross, Sebastian Reichel, Dmitry Eremin-Solenikov,
	David Woodhouse, Mark Rutland, Krzysztof Kozlowski, Andy Yan,
	John Stultz, Alexandre Belloni, Nicolas Ferre, Chris Brand,
	Richard Weinberger, Moritz Fischer, Florian Fainelli,
	open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

On Fri, Oct 14, 2016 at 10:02:27AM +0800, Xiaogang Cui wrote:
> This is a initial version so it's very similar with syscon
> reboot mode driver. We will add more functionalities in the
> further after dependency is ready.
> 
> Signed-off-by: Xiaogang Cui <xiaogang@codeaurora.org>
> ---
>  .../bindings/power_supply/qcom-reboot-mode.txt     |  23 +++++
>  drivers/power/reset/Kconfig                        |  10 ++
>  drivers/power/reset/Makefile                       |   1 +
>  drivers/power/reset/qcom-reboot-mode.c             | 109 +++++++++++++++++++++
>  4 files changed, 143 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
>  create mode 100644 drivers/power/reset/qcom-reboot-mode.c
> 
> diff --git a/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> new file mode 100644
> index 0000000..8b33592
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power_supply/qcom-reboot-mode.txt
> @@ -0,0 +1,23 @@
> +Qualcomm Reboot Mode Driver
> +
> +Qualcomm reboot mode driver based on reboot mode framework to update
> +SPMI specific bits.
> +
> +Required Properties:
> +-compatible: "qcom,reboot-mode"
> +-offset: offset of the SPMI reboot mode register
> +
> +Optional Properties:
> +-mask: mask of reboot mode
> +-mode-xxx: magic of reboot mode
> +
> +Example:
> +	qcom,reboot-mode@88f {

Node names should be generic. Just reboot-mode@...

> +		compatible = "qcom,reboot-mode";
> +		offset = <0x88f>;
> +		mode-normal = <0x00>;
> +		mode-recovery = <0x04>;
> +		mode-bootloader = <0x08>;
> +		mode-rtc = <0x0C>;

In addition to what John said, I think vendor specfic modes should 
have a vendor prefix (e.g. qcom,mode-rtc). That will complicate parsing 
a bit though.

Rob

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-10-18 14:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14  2:02 [PATCH 1/2] power: reset: Add qcom reboot mode driver Xiaogang Cui
2016-10-14  2:02 ` Xiaogang Cui
2016-10-14  2:41 ` Andy Yan
2016-10-14  2:41   ` Andy Yan
2016-10-14  3:06   ` xiaogang
2016-10-14  3:06     ` xiaogang
2016-10-14 13:15     ` Sebastian Reichel
2016-10-14 13:15       ` Sebastian Reichel
2016-10-14  3:25 ` John Stultz
2016-10-14  3:25   ` John Stultz
2016-10-14  3:40   ` xiaogang
2016-10-14  3:40     ` xiaogang-sgV2jX0FEOL9JmXXK+q4OQ
2016-10-18 14:12 ` Rob Herring
2016-10-18 14:12   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.