Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1272059 > unrolled thread
| Started by | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| First post | 2015-11-18 10:50 +0100 |
| Last post | 2015-11-18 11:10 +0100 |
| Articles | 14 — 5 participants |
Back to article view | Back to linux.kernel
[PATCH v3 0/5] Add reboot notifier driver for rockchip platform Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 10:50 +0100
[PATCH v3 3/5] soc: rockchip: add reboot notifier driver Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 11:00 +0100
[PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 11:00 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Rob Herring <robh@kernel.org> - 2015-11-19 00:00 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Andy Yan <andy.yan@rock-chips.com> - 2015-11-19 02:20 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Heiko Stuebner <heiko@sntech.de> - 2015-11-19 05:40 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Andy Yan <andy.yan@rock-chips.com> - 2015-11-20 02:20 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Rob Herring <robh@kernel.org> - 2015-11-20 03:00 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Thierry Reding <treding@nvidia.com> - 2015-11-19 14:00 +0100
Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver Thierry Reding <treding@nvidia.com> - 2015-11-19 16:40 +0100
[PATCH v3 1/5] ARM: dts: rockchip: rk3288-veyron: rename pinctrl node reboot to reset Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 11:00 +0100
Re: [PATCH v3 1/5] ARM: dts: rockchip: rk3288-veyron: rename pinctrl node reboot to reset Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-11-18 15:20 +0100
[PATCH v3 4/5] ARM: dts: rockchip: add reboot node Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 11:10 +0100
[PATCH v3 5/5] ARM64: dts: rockchip: add reboot node Andy Yan <andy.yan@rock-chips.com> - 2015-11-18 11:10 +0100
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 10:50 +0100 |
| Subject | [PATCH v3 0/5] Add reboot notifier driver for rockchip platform |
| Message-ID | <qw7xg-17g-25@gated-at.bofh.it> |
rockchip platform have a protocol to pass the kernel reboot mode to bootloader by some special registers when system reboot. By this way the bootloader can take different action according to the different kernel reboot mode, for example, command "reboot loader" will reboot the board to rockusb mode, this is a very convenient way to get the board enter download mode. And Android system also use this protocol to pass "recovery"、 “fastboot” reboot mode to bootloader. In upstream land, We found tegra platform also use this mechanism. Before this version, I have sent two Series, which can be found at [0] [1] [0] https://patchwork.kernel.org/patch/7140751/ [1] https://patchwork.kernel.org/patch/7153531/ Changes in v3: - rename a pinctrl node in rk3288-veyron, the original name will be used in the incoming reboot notifier driver - add dt binding - move from mach-rockchip to drivers/soc/rockchip, as the tegra does - use dts pass the related register - add DT node Changes in v2: - check cpu dt node - remove a unnecessary of_put_node in function rockchip_get_pmu_regmap - fix a align issue - use reboot_notifier instead of restart_handler Andy Yan (5): ARM: dts: rockchip: rk3288-veyron: rename pinctrl node reboot to reset dt-bindings: soc: add document for rockchip reboot notifier driver soc: rockchip: add reboot notifier driver ARM: dts: rockchip: add reboot node ARM64: dts: rockchip: add reboot node .../bindings/soc/rockchip/rockchip-reboot.txt | 18 ++++ arch/arm/boot/dts/rk3288-veyron.dtsi | 2 +- arch/arm/boot/dts/rk3288.dtsi | 6 ++ arch/arm/boot/dts/rk3xxx.dtsi | 6 ++ arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 ++ drivers/soc/rockchip/Kconfig | 7 ++ drivers/soc/rockchip/Makefile | 1 + drivers/soc/rockchip/loader.h | 22 +++++ drivers/soc/rockchip/reboot.c | 98 ++++++++++++++++++++++ 9 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt create mode 100644 drivers/soc/rockchip/loader.h create mode 100644 drivers/soc/rockchip/reboot.c -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 11:00 +0100 |
| Subject | [PATCH v3 3/5] soc: rockchip: add reboot notifier driver |
| Message-ID | <qw7GV-1aT-5@gated-at.bofh.it> |
| In reply to | #1272059 |
rockchip platform have a protocol to pass the kernel reboot
mode to bootloader by some special registers when system reboot.
By this way the bootloader can take different action according
to the different kernel reboot mode, for example, command
"reboot loader" will reboot the board to rockusb mode, this is
a very convenient way to get the board enter download mode.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
Changes in v3:
- move from mach-rockchip to drivers/soc/rockchip, as the tegra does
- use dts pass the related register
Changes in v2:
- check cpu dt node
- remove a unnecessary of_put_node in function rockchip_get_pmu_regmap
- fix a align issue
- use reboot_notifier instead of restart_handler
drivers/soc/rockchip/Kconfig | 7 ++++
drivers/soc/rockchip/Makefile | 1 +
drivers/soc/rockchip/loader.h | 22 ++++++++++
drivers/soc/rockchip/reboot.c | 98 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 128 insertions(+)
create mode 100644 drivers/soc/rockchip/loader.h
create mode 100644 drivers/soc/rockchip/reboot.c
diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig
index 7140ff8..4edbc44 100644
--- a/drivers/soc/rockchip/Kconfig
+++ b/drivers/soc/rockchip/Kconfig
@@ -15,4 +15,11 @@ config ROCKCHIP_PM_DOMAINS
If unsure, say N.
+config ROCKCHIP_REBOOT
+ bool "Rockchip reboot notifier driver"
+ help
+ Say y here will enable reboot notifier support.
+ This will get reboot mode arguments from userspace and
+ store it in special register.
+
endif
diff --git a/drivers/soc/rockchip/Makefile b/drivers/soc/rockchip/Makefile
index 3d73d06..9817496 100644
--- a/drivers/soc/rockchip/Makefile
+++ b/drivers/soc/rockchip/Makefile
@@ -2,3 +2,4 @@
# Rockchip Soc drivers
#
obj-$(CONFIG_ROCKCHIP_PM_DOMAINS) += pm_domains.o
+obj-$(CONFIG_ROCKCHIP_REBOOT) += reboot.o
diff --git a/drivers/soc/rockchip/loader.h b/drivers/soc/rockchip/loader.h
new file mode 100644
index 0000000..bf51baa
--- /dev/null
+++ b/drivers/soc/rockchip/loader.h
@@ -0,0 +1,22 @@
+#ifndef __MACH_ROCKCHIP_LOADER_H
+#define __MACH_ROCKCHIP_LOADER_H
+
+/*high 24 bits is tag, low 8 bits is type*/
+#define SYS_LOADER_REBOOT_FLAG 0x5242C300
+
+enum {
+ BOOT_NORMAL = 0, /* normal boot */
+ BOOT_LOADER, /* enter loader rockusb mode */
+ BOOT_MASKROM, /* enter maskrom rockusb mode (not support now) */
+ BOOT_RECOVER, /* enter recover */
+ BOOT_NORECOVER, /* do not enter recover */
+ BOOT_SECONDOS, /* boot second OS (not support now)*/
+ BOOT_WIPEDATA, /* enter recover and wipe data. */
+ BOOT_WIPEALL, /* enter recover and wipe all data. */
+ BOOT_CHECKIMG, /* check firmware img with backup part*/
+ BOOT_FASTBOOT, /* enter fast boot mode */
+ BOOT_SECUREBOOT_DISABLE,
+ BOOT_CHARGING, /* enter charge mode */
+ BOOT_MAX /* MAX VALID BOOT TYPE.*/
+};
+#endif
diff --git a/drivers/soc/rockchip/reboot.c b/drivers/soc/rockchip/reboot.c
new file mode 100644
index 0000000..048aeb0b
--- /dev/null
+++ b/drivers/soc/rockchip/reboot.c
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * 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.
+ */
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include "loader.h"
+
+struct rockchip_reboot {
+ struct device *dev;
+ struct regmap *map;
+ u32 offset;
+ struct notifier_block reboot_notifier;
+};
+
+static void rockchip_get_reboot_flag(const char *cmd, u32 *flag)
+{
+ *flag = SYS_LOADER_REBOOT_FLAG + BOOT_NORMAL;
+
+ if (cmd) {
+ if (!strcmp(cmd, "loader") || !strcmp(cmd, "bootloader"))
+ *flag = SYS_LOADER_REBOOT_FLAG + BOOT_LOADER;
+ else if (!strcmp(cmd, "recovery"))
+ *flag = SYS_LOADER_REBOOT_FLAG + BOOT_RECOVER;
+ else if (!strcmp(cmd, "charge"))
+ *flag = SYS_LOADER_REBOOT_FLAG + BOOT_CHARGING;
+ else if (!strcmp(cmd, "fastboot"))
+ *flag = SYS_LOADER_REBOOT_FLAG + BOOT_FASTBOOT;
+ }
+}
+
+static int rockchip_reboot_notify(struct notifier_block *this,
+ unsigned long mode, void *cmd)
+{
+ struct rockchip_reboot *reboot;
+ u32 flag;
+
+ reboot = container_of(this, struct rockchip_reboot, reboot_notifier);
+ rockchip_get_reboot_flag(cmd, &flag);
+ regmap_write(reboot->map, reboot->offset, flag);
+
+ return NOTIFY_DONE;
+}
+
+static int __init rockchip_reboot_probe(struct platform_device *pdev)
+{
+ struct rockchip_reboot *reboot;
+ int ret;
+
+ reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL);
+ if (!reboot)
+ return -ENOMEM;
+
+ reboot->dev = &pdev->dev;
+ reboot->map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+ "rockchip,regmap");
+ if (IS_ERR(reboot->map))
+ return PTR_ERR(reboot->map);
+
+ if (of_property_read_u32(pdev->dev.of_node, "offset", &reboot->offset))
+ return -EINVAL;
+
+ reboot->reboot_notifier.notifier_call = rockchip_reboot_notify;
+ ret = register_reboot_notifier(&reboot->reboot_notifier);
+ if (ret)
+ dev_err(reboot->dev, "can't register reboot notifier\n");
+
+ return ret;
+}
+
+static const struct of_device_id rockchip_reboot_of_match[] = {
+ { .compatible = "rockchip,reboot" },
+ {}
+};
+
+static struct platform_driver rockchip_reboot_driver = {
+ .probe = rockchip_reboot_probe,
+ .driver = {
+ .name = "rockchip-reboot",
+ .of_match_table = rockchip_reboot_of_match,
+ },
+};
+module_platform_driver(rockchip_reboot_driver);
+
+MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com");
+MODULE_DESCRIPTION("Rockchip platform reboot notifier driver");
+MODULE_LICENSE("GPL");
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 11:00 +0100 |
| Subject | [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qw7GW-1aT-19@gated-at.bofh.it> |
| In reply to | #1272059 |
Add devicetree binding document for rockchip reboot nofifier driver
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
Changes in v3:
- add dt binding
Changes in v2: None
.../bindings/soc/rockchip/rockchip-reboot.txt | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
new file mode 100644
index 0000000..6f69c8d
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
@@ -0,0 +1,18 @@
+Rockchip reboot notifier driver
+
+This driver get reboot mode arguments from userspace
+and stores it in special register. Then the bootloader
+will read it and take different action according the
+argument stored.
+
+Required properties:
+- compatible: should be "rockchip,reboot"
+- regmap: this is phandle to the register map node
+- offset: offset in the register map for the storage register (in bytes)
+
+Examples:
+ reboot {
+ compatible = "rockchip,reboot";
+ regmap = <&pmu>;
+ offset = <0x94>;
+ };
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2015-11-19 00:00 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwjRM-YV-11@gated-at.bofh.it> |
| In reply to | #1272064 |
On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote:
> Add devicetree binding document for rockchip reboot nofifier driver
Just reading the subject this is way too specific to the Linux driver
needs rather than a h/w description. Please don't create fake DT nodes
just to bind to drivers. Whatever &pmu is is probably what should have
the DT node. Let the driver for it create child devices if you need
that.
Rob
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>
> ---
>
> Changes in v3:
> - add dt binding
>
> Changes in v2: None
>
> .../bindings/soc/rockchip/rockchip-reboot.txt | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
>
> diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
> new file mode 100644
> index 0000000..6f69c8d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
> @@ -0,0 +1,18 @@
> +Rockchip reboot notifier driver
> +
> +This driver get reboot mode arguments from userspace
> +and stores it in special register. Then the bootloader
> +will read it and take different action according the
> +argument stored.
> +
> +Required properties:
> +- compatible: should be "rockchip,reboot"
> +- regmap: this is phandle to the register map node
> +- offset: offset in the register map for the storage register (in bytes)
> +
> +Examples:
> + reboot {
> + compatible = "rockchip,reboot";
> + regmap = <&pmu>;
> + offset = <0x94>;
> + };
> --
> 1.9.1
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-19 02:20 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwm3g-2wj-7@gated-at.bofh.it> |
| In reply to | #1272656 |
Hi Rob:
On 2015年11月19日 06:59, Rob Herring wrote:
> On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote:
>> Add devicetree binding document for rockchip reboot nofifier driver
> Just reading the subject this is way too specific to the Linux driver
> needs rather than a h/w description. Please don't create fake DT nodes
> just to bind to drivers. Whatever &pmu is is probably what should have
> the DT node. Let the driver for it create child devices if you need
> that.
This is note a fake DT nodes, we really need it to tell the driver
which register to use to store the reboot mode. Because rockchip
use different register file to store the reboot mode on different
platform, on rk3066,rk3188, rk3288,it use one of the PMU
register, on
the incoming RK3036, it use one of the GRF register, and it use
one of
the PMUGRF register for arm64 platform rk3368. On the other hand, the
PMU/GRF/PMUGRF register file are mapped as "syscon", then referenced
by other DT nodes by phandle. So maybe let it as a separate DT
node here
is better.
> Rob
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>
>> ---
>>
>> Changes in v3:
>> - add dt binding
>>
>> Changes in v2: None
>>
>> .../bindings/soc/rockchip/rockchip-reboot.txt | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
>>
>> diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
>> new file mode 100644
>> index 0000000..6f69c8d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip-reboot.txt
>> @@ -0,0 +1,18 @@
>> +Rockchip reboot notifier driver
>> +
>> +This driver get reboot mode arguments from userspace
>> +and stores it in special register. Then the bootloader
>> +will read it and take different action according the
>> +argument stored.
>> +
>> +Required properties:
>> +- compatible: should be "rockchip,reboot"
>> +- regmap: this is phandle to the register map node
>> +- offset: offset in the register map for the storage register (in bytes)
>> +
>> +Examples:
>> + reboot {
>> + compatible = "rockchip,reboot";
>> + regmap = <&pmu>;
>> + offset = <0x94>;
>> + };
>> --
>> 1.9.1
>>
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Heiko Stuebner <heiko@sntech.de> |
|---|---|
| Date | 2015-11-19 05:40 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwpaN-4vn-1@gated-at.bofh.it> |
| In reply to | #1272731 |
Hi Andy,
Am Donnerstag, 19. November 2015, 09:17:37 schrieb Andy Yan:
> Hi Rob:
>
> On 2015年11月19日 06:59, Rob Herring wrote:
> > On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote:
> >> Add devicetree binding document for rockchip reboot nofifier driver
> > Just reading the subject this is way too specific to the Linux driver
> > needs rather than a h/w description. Please don't create fake DT nodes
> > just to bind to drivers. Whatever &pmu is is probably what should have
> > the DT node. Let the driver for it create child devices if you need
> > that.
>
> This is note a fake DT nodes, we really need it to tell the driver
> which register to use to store the reboot mode. Because rockchip
> use different register file to store the reboot mode on different
> platform, on rk3066,rk3188, rk3288,it use one of the PMU
> register, on
> the incoming RK3036, it use one of the GRF register, and it use
> one of
> the PMUGRF register for arm64 platform rk3368. On the other hand, the
> PMU/GRF/PMUGRF register file are mapped as "syscon", then referenced
> by other DT nodes by phandle. So maybe let it as a separate DT
> node here
> is better.
or alternatively we could do something similar to what the bl-switcher
cupfreq-driver does. Take a look at
drivers/cpufreq/arm_big_little.c
drivers/clk/clk-mb86s7x.c
We already have the core restart-handler code in the clock-tree, so could
maybe simply do the
platform_device_register_simple("rockchip-reboot", -1, NULL, 0);
in that common code?
Though I'm not yet sure how to get the platform-data. I guess one option would
be to do things like the 3288 suspend code does (arch/arm/mach-rockchip/pm.c
at the bottom), by having the per-soc-data in the driver and then matching
against the pmu. Because the pmu is not part of the clock controller binding
(and probably also shouldn't be).
Heiko
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-20 02:20 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwIwO-kQ-13@gated-at.bofh.it> |
| In reply to | #1272844 |
Hi Heiko:
On 2015年11月19日 12:35, Heiko Stuebner wrote:
> Hi Andy,
>
> Am Donnerstag, 19. November 2015, 09:17:37 schrieb Andy Yan:
>> Hi Rob:
>>
>> On 2015年11月19日 06:59, Rob Herring wrote:
>>> On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote:
>>>> Add devicetree binding document for rockchip reboot nofifier driver
>>> Just reading the subject this is way too specific to the Linux driver
>>> needs rather than a h/w description. Please don't create fake DT nodes
>>> just to bind to drivers. Whatever &pmu is is probably what should have
>>> the DT node. Let the driver for it create child devices if you need
>>> that.
>> This is note a fake DT nodes, we really need it to tell the driver
>> which register to use to store the reboot mode. Because rockchip
>> use different register file to store the reboot mode on different
>> platform, on rk3066,rk3188, rk3288,it use one of the PMU
>> register, on
>> the incoming RK3036, it use one of the GRF register, and it use
>> one of
>> the PMUGRF register for arm64 platform rk3368. On the other hand, the
>> PMU/GRF/PMUGRF register file are mapped as "syscon", then referenced
>> by other DT nodes by phandle. So maybe let it as a separate DT
>> node here
>> is better.
> or alternatively we could do something similar to what the bl-switcher
> cupfreq-driver does. Take a look at
>
> drivers/cpufreq/arm_big_little.c
> drivers/clk/clk-mb86s7x.c
>
> We already have the core restart-handler code in the clock-tree, so could
> maybe simply do the
> platform_device_register_simple("rockchip-reboot", -1, NULL, 0);
> in that common code?
>
> Though I'm not yet sure how to get the platform-data. I guess one option would
> be to do things like the 3288 suspend code does (arch/arm/mach-rockchip/pm.c
> at the bottom), by having the per-soc-data in the driver and then matching
> against the pmu. Because the pmu is not part of the clock controller binding
> (and probably also shouldn't be).
>
>
> Heiko
>
>
>
>
>
Thanks for your suggestion.
I have read the code you list above, if we implement the reboot
notifier
driver like this, the driver need to add much more code to find the
platform
data(like arch/arm/mach-rockhcip/pm.c), what's more, if we have a
new soc
in the future and the soc use a different register here, we need
modify the
driver to add a new platform data again, this will bring additional
work.
Use the DT node pass the register will make the driver code simple
and clear.
Is there any hurt to put this information in the DT?
Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Rob Herring <robh@kernel.org> |
|---|---|
| Date | 2015-11-20 03:00 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwJ9w-zj-5@gated-at.bofh.it> |
| In reply to | #1273658 |
On Thu, Nov 19, 2015 at 7:16 PM, Andy Yan <andy.yan@rock-chips.com> wrote:
> On 2015年11月19日 12:35, Heiko Stuebner wrote:
>> Am Donnerstag, 19. November 2015, 09:17:37 schrieb Andy Yan:
>>> On 2015年11月19日 06:59, Rob Herring wrote:
>>>> On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote:
>>>>>
>>>>> Add devicetree binding document for rockchip reboot nofifier driver
>>>>
>>>> Just reading the subject this is way too specific to the Linux driver
>>>> needs rather than a h/w description. Please don't create fake DT nodes
>>>> just to bind to drivers. Whatever &pmu is is probably what should have
>>>> the DT node. Let the driver for it create child devices if you need
>>>> that.
>>>
>>> This is note a fake DT nodes, we really need it to tell the driver
>>> which register to use to store the reboot mode. Because rockchip
>>> use different register file to store the reboot mode on different
>>> platform, on rk3066,rk3188, rk3288,it use one of the PMU
>>> register, on
>>> the incoming RK3036, it use one of the GRF register, and it use
>>> one of
>>> the PMUGRF register for arm64 platform rk3368. On the other hand,
>>> the
>>> PMU/GRF/PMUGRF register file are mapped as "syscon", then
>>> referenced
>>> by other DT nodes by phandle. So maybe let it as a separate DT
>>> node here
>>> is better.
>>
>> or alternatively we could do something similar to what the bl-switcher
>> cupfreq-driver does. Take a look at
>>
>> drivers/cpufreq/arm_big_little.c
>> drivers/clk/clk-mb86s7x.c
>>
>> We already have the core restart-handler code in the clock-tree, so could
>> maybe simply do the
>> platform_device_register_simple("rockchip-reboot", -1, NULL, 0);
>> in that common code?
>>
>> Though I'm not yet sure how to get the platform-data. I guess one option
>> would
>> be to do things like the 3288 suspend code does
>> (arch/arm/mach-rockchip/pm.c
>> at the bottom), by having the per-soc-data in the driver and then matching
>> against the pmu. Because the pmu is not part of the clock controller
>> binding
>> (and probably also shouldn't be).
>>
> Thanks for your suggestion.
> I have read the code you list above, if we implement the reboot notifier
> driver like this, the driver need to add much more code to find the
> platform
> data(like arch/arm/mach-rockhcip/pm.c), what's more, if we have a new
> soc
> in the future and the soc use a different register here, we need modify
> the
> driver to add a new platform data again, this will bring additional
> work.
>
> Use the DT node pass the register will make the driver code simple and
> clear.
> Is there any hurt to put this information in the DT?
Add the data you need to the PMU node. Then the PMU driver can get it
and pass to the child driver.
Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Thierry Reding <treding@nvidia.com> |
|---|---|
| Date | 2015-11-19 14:00 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwwYG-105-7@gated-at.bofh.it> |
| In reply to | #1272731 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Nov 19, 2015 at 09:17:37AM +0800, Andy Yan wrote: > Hi Rob: > > On 2015年11月19日 06:59, Rob Herring wrote: > >On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote: > >>Add devicetree binding document for rockchip reboot nofifier driver > >Just reading the subject this is way too specific to the Linux driver > >needs rather than a h/w description. Please don't create fake DT nodes > >just to bind to drivers. Whatever &pmu is is probably what should have > >the DT node. Let the driver for it create child devices if you need > >that. > > This is note a fake DT nodes, we really need it to tell the driver > which register to use to store the reboot mode. Because rockchip > use different register file to store the reboot mode on different > platform, on rk3066,rk3188, rk3288,it use one of the PMU register, on > the incoming RK3036, it use one of the GRF register, and it use one of > the PMUGRF register for arm64 platform rk3368. On the other hand, the > PMU/GRF/PMUGRF register file are mapped as "syscon", then referenced > by other DT nodes by phandle. So maybe let it as a separate DT node > here > is better. In that case you should probably implement a reboot notifier in each of the drivers you list and depending on the generation of the SoC. You can easily parameterize this by matching on the compatible string. Thierry
[toc] | [prev] | [next] | [standalone]
| From | Thierry Reding <treding@nvidia.com> |
|---|---|
| Date | 2015-11-19 16:40 +0100 |
| Subject | Re: [PATCH v3 2/5] dt-bindings: soc: add document for rockchip reboot notifier driver |
| Message-ID | <qwztw-2Iv-15@gated-at.bofh.it> |
| In reply to | #1273115 |
[Multipart message — attachments visible in raw view] — view raw
On Thu, Nov 19, 2015 at 09:39:02PM +0800, Andy Yan wrote: > Hi Thierry: > > 2015-11-19 20:56 GMT+08:00 Thierry Reding <treding@nvidia.com>: > > > On Thu, Nov 19, 2015 at 09:17:37AM +0800, Andy Yan wrote: > > > Hi Rob: > > > > > > On 2015年11月19日 06:59, Rob Herring wrote: > > > >On Wed, Nov 18, 2015 at 05:53:30PM +0800, Andy Yan wrote: > > > >>Add devicetree binding document for rockchip reboot nofifier driver > > > >Just reading the subject this is way too specific to the Linux driver > > > >needs rather than a h/w description. Please don't create fake DT nodes > > > >just to bind to drivers. Whatever &pmu is is probably what should have > > > >the DT node. Let the driver for it create child devices if you need > > > >that. > > > > > > This is note a fake DT nodes, we really need it to tell the driver > > > which register to use to store the reboot mode. Because rockchip > > > use different register file to store the reboot mode on different > > > platform, on rk3066,rk3188, rk3288,it use one of the PMU register, > > on > > > the incoming RK3036, it use one of the GRF register, and it use > > one of > > > the PMUGRF register for arm64 platform rk3368. On the other hand, > > the > > > PMU/GRF/PMUGRF register file are mapped as "syscon", then referenced > > > by other DT nodes by phandle. So maybe let it as a separate DT node > > > here > > > is better. > > > > In that case you should probably implement a reboot notifier in each of > > the drivers you list and depending on the generation of the SoC. You can > > easily parameterize this by matching on the compatible string. > > > > Thierry > > > > There is no rockchip specific driver for PMU/GRF/PMUGRF register file I > list above, they > use the generic driver “syscon” Well, just go and write specific drivers, then. Thierry
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 11:00 +0100 |
| Subject | [PATCH v3 1/5] ARM: dts: rockchip: rk3288-veyron: rename pinctrl node reboot to reset |
| Message-ID | <qw7GW-1aT-27@gated-at.bofh.it> |
| In reply to | #1272059 |
rename pinctrl node reboot to reset to match it's lable name
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
Changes in v3:
- rename a pinctrl node in rk3288-veyron, the original name will be
used in the incoming reboot notifier driver
Changes in v2: None
arch/arm/boot/dts/rk3288-veyron.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/rk3288-veyron.dtsi b/arch/arm/boot/dts/rk3288-veyron.dtsi
index 2fa7a0d..292aaaf 100644
--- a/arch/arm/boot/dts/rk3288-veyron.dtsi
+++ b/arch/arm/boot/dts/rk3288-veyron.dtsi
@@ -495,7 +495,7 @@
};
};
- reboot {
+ reset {
ap_warm_reset_h: ap-warm-reset-h {
rockchip,pins = <RK_GPIO0 13 RK_FUNC_GPIO &pcfg_pull_none>;
};
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2015-11-18 15:20 +0100 |
| Subject | Re: [PATCH v3 1/5] ARM: dts: rockchip: rk3288-veyron: rename pinctrl node reboot to reset |
| Message-ID | <qwbKz-3ZJ-11@gated-at.bofh.it> |
| In reply to | #1272068 |
Hello.
On 11/18/2015 12:50 PM, Andy Yan wrote:
> rename pinctrl node reboot to reset to match it's lable name
Label? BTW, I'm not seeing it on this node...
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>
> ---
>
> Changes in v3:
> - rename a pinctrl node in rk3288-veyron, the original name will be
> used in the incoming reboot notifier driver
>
> Changes in v2: None
>
> arch/arm/boot/dts/rk3288-veyron.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/rk3288-veyron.dtsi b/arch/arm/boot/dts/rk3288-veyron.dtsi
> index 2fa7a0d..292aaaf 100644
> --- a/arch/arm/boot/dts/rk3288-veyron.dtsi
> +++ b/arch/arm/boot/dts/rk3288-veyron.dtsi
> @@ -495,7 +495,7 @@
> };
> };
>
> - reboot {
> + reset {
> ap_warm_reset_h: ap-warm-reset-h {
> rockchip,pins = <RK_GPIO0 13 RK_FUNC_GPIO &pcfg_pull_none>;
> };
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 11:10 +0100 |
| Subject | [PATCH v3 4/5] ARM: dts: rockchip: add reboot node |
| Message-ID | <qw7QB-1tN-1@gated-at.bofh.it> |
| In reply to | #1272059 |
Add reboot notifier driver DT node for rk3xxx,rk3288 platform
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
Changes in v3:
- add DT node
Changes in v2: None
arch/arm/boot/dts/rk3288.dtsi | 6 ++++++
arch/arm/boot/dts/rk3xxx.dtsi | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 906e938..975b8c9 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -169,6 +169,12 @@
};
};
+ reboot {
+ compatible = "rockchip,reboot";
+ rockchip,regmap = <&pmu>;
+ offset = <0x94>;
+ };
+
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
index 4497d28..7b14d7a 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -103,6 +103,12 @@
};
};
+ reboot {
+ compatible = "rockchip,reboot";
+ rockchip,regmap = <&pmu>;
+ offset = <0x40>;
+ };
+
xin24m: oscillator {
compatible = "fixed-clock";
clock-frequency = <24000000>;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andy Yan <andy.yan@rock-chips.com> |
|---|---|
| Date | 2015-11-18 11:10 +0100 |
| Subject | [PATCH v3 5/5] ARM64: dts: rockchip: add reboot node |
| Message-ID | <qw7QB-1tN-7@gated-at.bofh.it> |
| In reply to | #1272059 |
Add reboot notifier driver DT node for rk3368 platform
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
Changes in v3:
- add DT node
Changes in v2: None
arch/arm64/boot/dts/rockchip/rk3368.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
index a712bea..c390f61 100644
--- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
@@ -202,6 +202,12 @@
method = "smc";
};
+ reboot {
+ compatible = "rockchip,reboot";
+ rockchip,regmap = <&pmugrf>;
+ offset = <0x200>;
+ };
+
timer {
compatible = "arm,armv8-timer";
interrupts = <GIC_PPI 13
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web