All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] misc: add reboot mode driver
@ 2015-12-21 11:27 ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:27 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan


This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the vendor specific write interfae
to store the boot mode in some place like special register
or sram , which can be read by the bootloader after system
reboot.

This is commonly done on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Before this patch , I have try some hack on[0], and then found
John Stultz also doing the same work[1].

As John is busy these days, I go on with this work.

[0]https://patchwork.kernel.org/patch/7647751/
[1]https://patchwork.kernel.org/patch/7802391/


Andy Yan (6):
  dt-bindings: misc: add document for reboot-mode driver
  dt-bindings: soc: add document for rockchip reboot-mode driver
  misc: add reboot mode driver
  soc: rockchip: add reboot mode driver
  ARM: dts: rockchip: add reboot mode node
  ARM64: dts: rockchip: add reboot mode node

 .../devicetree/bindings/misc/reboot-mode.txt       | 41 +++++++++
 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 +++++++++
 arch/arm/boot/dts/rk3288.dtsi                      | 25 ++++++
 arch/arm/boot/dts/rk3xxx.dtsi                      | 26 ++++++
 arch/arm64/boot/dts/rockchip/rk3368.dtsi           | 26 ++++++
 drivers/misc/Kconfig                               |  7 ++
 drivers/misc/Makefile                              |  1 +
 drivers/misc/reboot_mode.c                         | 96 ++++++++++++++++++++++
 drivers/power/reset/Kconfig                        |  1 -
 drivers/soc/rockchip/Kconfig                       |  8 ++
 drivers/soc/rockchip/Makefile                      |  1 +
 drivers/soc/rockchip/loader.h                      | 22 +++++
 drivers/soc/rockchip/reboot.c                      | 66 +++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h       | 30 +++++++
 include/linux/reboot.h                             |  4 +-
 15 files changed, 391 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
 create mode 100644 drivers/misc/reboot_mode.c
 create mode 100644 drivers/soc/rockchip/loader.h
 create mode 100644 drivers/soc/rockchip/reboot.c
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

-- 
1.9.1



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

* [PATCH 0/6] misc: add reboot mode driver
@ 2015-12-21 11:27 ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:27 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	arnd-r2nGTMty4D4, john.stultz-QSEj5FYQhm4dnm+yROfE0A
  Cc: sjg-F7+t8E8rja9g9hUCZPvPmw,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	treding-DDmLM1+adcrQT0dZR+AlfA, galak-sgV2jX0FEOL9JmXXK+q4OQ,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	wxt-TNX95d0MmH7DzftRWevZcw, catalin.marinas-5wv7dgnIgG8,
	olof-nZhT3qVonbNeoWH0uzbU5w,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w, sre-DgEjT+Ai2ygdnm+yROfE0A,
	jun.nie-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	devicetree-u79uwXL29TY76Z2rM5mHXA, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	joel-U3u1mxZcP9KHXe+LvDLADg,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	lorenzo.pieralisi-5wv7dgnIgG8, khilman-QSEj5FYQhm4dnm+yROfE0A,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	Andy Yan


This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the vendor specific write interfae
to store the boot mode in some place like special register
or sram , which can be read by the bootloader after system
reboot.

This is commonly done on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Before this patch , I have try some hack on[0], and then found
John Stultz also doing the same work[1].

As John is busy these days, I go on with this work.

[0]https://patchwork.kernel.org/patch/7647751/
[1]https://patchwork.kernel.org/patch/7802391/


Andy Yan (6):
  dt-bindings: misc: add document for reboot-mode driver
  dt-bindings: soc: add document for rockchip reboot-mode driver
  misc: add reboot mode driver
  soc: rockchip: add reboot mode driver
  ARM: dts: rockchip: add reboot mode node
  ARM64: dts: rockchip: add reboot mode node

 .../devicetree/bindings/misc/reboot-mode.txt       | 41 +++++++++
 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 +++++++++
 arch/arm/boot/dts/rk3288.dtsi                      | 25 ++++++
 arch/arm/boot/dts/rk3xxx.dtsi                      | 26 ++++++
 arch/arm64/boot/dts/rockchip/rk3368.dtsi           | 26 ++++++
 drivers/misc/Kconfig                               |  7 ++
 drivers/misc/Makefile                              |  1 +
 drivers/misc/reboot_mode.c                         | 96 ++++++++++++++++++++++
 drivers/power/reset/Kconfig                        |  1 -
 drivers/soc/rockchip/Kconfig                       |  8 ++
 drivers/soc/rockchip/Makefile                      |  1 +
 drivers/soc/rockchip/loader.h                      | 22 +++++
 drivers/soc/rockchip/reboot.c                      | 66 +++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h       | 30 +++++++
 include/linux/reboot.h                             |  4 +-
 15 files changed, 391 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
 create mode 100644 drivers/misc/reboot_mode.c
 create mode 100644 drivers/soc/rockchip/loader.h
 create mode 100644 drivers/soc/rockchip/reboot.c
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

-- 
1.9.1


--
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] 26+ messages in thread

* [PATCH 0/6] misc: add reboot mode driver
@ 2015-12-21 11:27 ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:27 UTC (permalink / raw)
  To: linux-arm-kernel


This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the vendor specific write interfae
to store the boot mode in some place like special register
or sram , which can be read by the bootloader after system
reboot.

This is commonly done on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Before this patch , I have try some hack on[0], and then found
John Stultz also doing the same work[1].

As John is busy these days, I go on with this work.

[0]https://patchwork.kernel.org/patch/7647751/
[1]https://patchwork.kernel.org/patch/7802391/


Andy Yan (6):
  dt-bindings: misc: add document for reboot-mode driver
  dt-bindings: soc: add document for rockchip reboot-mode driver
  misc: add reboot mode driver
  soc: rockchip: add reboot mode driver
  ARM: dts: rockchip: add reboot mode node
  ARM64: dts: rockchip: add reboot mode node

 .../devicetree/bindings/misc/reboot-mode.txt       | 41 +++++++++
 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 +++++++++
 arch/arm/boot/dts/rk3288.dtsi                      | 25 ++++++
 arch/arm/boot/dts/rk3xxx.dtsi                      | 26 ++++++
 arch/arm64/boot/dts/rockchip/rk3368.dtsi           | 26 ++++++
 drivers/misc/Kconfig                               |  7 ++
 drivers/misc/Makefile                              |  1 +
 drivers/misc/reboot_mode.c                         | 96 ++++++++++++++++++++++
 drivers/power/reset/Kconfig                        |  1 -
 drivers/soc/rockchip/Kconfig                       |  8 ++
 drivers/soc/rockchip/Makefile                      |  1 +
 drivers/soc/rockchip/loader.h                      | 22 +++++
 drivers/soc/rockchip/reboot.c                      | 66 +++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h       | 30 +++++++
 include/linux/reboot.h                             |  4 +-
 15 files changed, 391 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/misc/reboot-mode.txt
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
 create mode 100644 drivers/misc/reboot_mode.c
 create mode 100644 drivers/soc/rockchip/loader.h
 create mode 100644 drivers/soc/rockchip/reboot.c
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

-- 
1.9.1

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

* [PATCH 1/6] dt-bindings: misc: add document for reboot-mode driver
  2015-12-21 11:27 ` Andy Yan
@ 2015-12-21 11:30   ` Andy Yan
  -1 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:30 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

add device tree bindings document for reboot-mode driver

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

 .../devicetree/bindings/misc/reboot-mode.txt       | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/reboot-mode.txt

diff --git a/Documentation/devicetree/bindings/misc/reboot-mode.txt b/Documentation/devicetree/bindings/misc/reboot-mode.txt
new file mode 100644
index 0000000..68346b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/reboot-mode.txt
@@ -0,0 +1,41 @@
+Generic reboot mode communication driver
+
+This driver get reboot mode arguments from userspace
+and stores it in special register or ram . Then the
+bootloader will read it and take different action
+according the argument stored.
+
+Required properties:
+        - compatible = "reboot-mode" or other vendor compatible string;
+
+Each mode is represented as a sub-node of reboot_mode:
+
+Subnode properties:
+        - linux,mode: reboot mode command,such as "loader","recover", "fastboot".
+        - linux,magic: magic number for the mode, this is vendor specific.
+
+example:
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+        };
-- 
1.9.1



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

* [PATCH 1/6] dt-bindings: misc: add document for reboot-mode driver
@ 2015-12-21 11:30   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:30 UTC (permalink / raw)
  To: linux-arm-kernel

add device tree bindings document for reboot-mode driver

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>

---

 .../devicetree/bindings/misc/reboot-mode.txt       | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/reboot-mode.txt

diff --git a/Documentation/devicetree/bindings/misc/reboot-mode.txt b/Documentation/devicetree/bindings/misc/reboot-mode.txt
new file mode 100644
index 0000000..68346b3
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/reboot-mode.txt
@@ -0,0 +1,41 @@
+Generic reboot mode communication driver
+
+This driver get reboot mode arguments from userspace
+and stores it in special register or ram . Then the
+bootloader will read it and take different action
+according the argument stored.
+
+Required properties:
+        - compatible = "reboot-mode" or other vendor compatible string;
+
+Each mode is represented as a sub-node of reboot_mode:
+
+Subnode properties:
+        - linux,mode: reboot mode command,such as "loader","recover", "fastboot".
+        - linux,magic: magic number for the mode, this is vendor specific.
+
+example:
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+        };
-- 
1.9.1

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

* [PATCH 2/6] dt-bindings: soc: add document for rockchip reboot-mode driver
@ 2015-12-21 11:33   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:33 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

Add device tree binding document for rockchip reboot-mode driver

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt

diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
new file mode 100644
index 0000000..ede8509
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
@@ -0,0 +1,39 @@
+Rockchip reboot mode 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-mode"
+- regmap: this is phandle to the register map node
+- offset: offset in the register map for the storage register (in bytes)
+The rest of the properties should follow the generic reboot-mode discription
+found in ../../misc/reboot-mode.txt
+
+Examples:
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
-- 
1.9.1



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

* [PATCH 2/6] dt-bindings: soc: add document for rockchip reboot-mode driver
@ 2015-12-21 11:33   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:33 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	arnd-r2nGTMty4D4, john.stultz-QSEj5FYQhm4dnm+yROfE0A
  Cc: sjg-F7+t8E8rja9g9hUCZPvPmw,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	treding-DDmLM1+adcrQT0dZR+AlfA, galak-sgV2jX0FEOL9JmXXK+q4OQ,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	wxt-TNX95d0MmH7DzftRWevZcw, catalin.marinas-5wv7dgnIgG8,
	olof-nZhT3qVonbNeoWH0uzbU5w,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w, sre-DgEjT+Ai2ygdnm+yROfE0A,
	jun.nie-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	devicetree-u79uwXL29TY76Z2rM5mHXA, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	joel-U3u1mxZcP9KHXe+LvDLADg,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	lorenzo.pieralisi-5wv7dgnIgG8, khilman-QSEj5FYQhm4dnm+yROfE0A,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	Andy Yan

Add device tree binding document for rockchip reboot-mode driver

Signed-off-by: Andy Yan <andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---

 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt

diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
new file mode 100644
index 0000000..ede8509
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
@@ -0,0 +1,39 @@
+Rockchip reboot mode 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-mode"
+- regmap: this is phandle to the register map node
+- offset: offset in the register map for the storage register (in bytes)
+The rest of the properties should follow the generic reboot-mode discription
+found in ../../misc/reboot-mode.txt
+
+Examples:
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
-- 
1.9.1


--
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 related	[flat|nested] 26+ messages in thread

* [PATCH 2/6] dt-bindings: soc: add document for rockchip reboot-mode driver
@ 2015-12-21 11:33   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:33 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree binding document for rockchip reboot-mode driver

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 .../bindings/soc/rockchip/rockchip,reboot-mode.txt | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt

diff --git a/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
new file mode 100644
index 0000000..ede8509
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/rockchip,reboot-mode.txt
@@ -0,0 +1,39 @@
+Rockchip reboot mode 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-mode"
+- regmap: this is phandle to the register map node
+- offset: offset in the register map for the storage register (in bytes)
+The rest of the properties should follow the generic reboot-mode discription
+found in ../../misc/reboot-mode.txt
+
+Examples:
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
-- 
1.9.1

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

* [PATCH 3/6] misc: add reboot mode driver
  2015-12-21 11:27 ` Andy Yan
@ 2015-12-21 11:36   ` Andy Yan
  -1 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:36 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the vendor specific write interfae
to store the boot mode in some place like special register
or sram , which can be read by the bootloader after system
reboot.

This is commonly done on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 drivers/misc/Kconfig        |  7 ++++
 drivers/misc/Makefile       |  1 +
 drivers/misc/reboot_mode.c  | 96 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/power/reset/Kconfig |  1 -
 include/linux/reboot.h      |  4 +-
 5 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 drivers/misc/reboot_mode.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 22892c7..039be78 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -525,6 +525,13 @@ config VEXPRESS_SYSCFG
 	  bus. System Configuration interface is one of the possible means
 	  of generating transactions on this bus.
 
+config REBOOT_MODE
+	tristate
+	depends on OF
+	help
+	 This driver will help to communicate the system reboot mode
+	 to bootloader
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 537d7f3..6ada5de 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -56,3 +56,4 @@ obj-$(CONFIG_GENWQE)		+= genwqe/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
+obj-$(CONFIG_REBOOT_MODE)       += reboot_mode.o
diff --git a/drivers/misc/reboot_mode.c b/drivers/misc/reboot_mode.c
new file mode 100644
index 0000000..39e3f9f
--- /dev/null
+++ b/drivers/misc/reboot_mode.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015, 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/device.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/reboot.h>
+
+struct mode_info {
+	const char *mode;
+	int magic;
+	struct list_head list;
+};
+
+struct reboot_mode_driver {
+	struct list_head head;
+	int (*write)(int magic);
+	struct notifier_block reboot_notifier;
+};
+
+static int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
+				 const char *cmd)
+{
+	int magic = 0;
+	struct mode_info *info;
+
+	if (cmd) {
+		list_for_each_entry(info, &reboot->head, list) {
+			if (!strcmp(info->mode, cmd)) {
+				magic = info->magic;
+				break;
+			}
+		}
+	}
+
+	return magic;
+}
+
+static int reboot_mode_notify(struct notifier_block *this,
+				  unsigned long mode, void *cmd)
+{
+	struct reboot_mode_driver *reboot;
+	int magic;
+
+	reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
+	magic = get_reboot_mode_magic(reboot, cmd);
+	reboot->write(magic);
+
+	return NOTIFY_DONE;
+}
+
+int reboot_mode_register(struct device *dev, int (*write)(int))
+{
+	struct reboot_mode_driver *reboot;
+	struct mode_info *info;
+	struct device_node *child;
+	int ret;
+
+	reboot = devm_kzalloc(dev, sizeof(*reboot), GFP_KERNEL);
+	if (!reboot)
+		return -ENOMEM;
+
+	reboot->write = write;
+	INIT_LIST_HEAD(&reboot->head);
+	for_each_child_of_node(dev->of_node, child) {
+		info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
+		if (!info)
+			return -ENOMEM;
+		info->mode = of_get_property(child, "linux,mode", NULL);
+		if (of_property_read_u32(child, "linux,magic", &info->magic)) {
+			dev_err(dev, "reboot mode %s without magic number\n",
+				info->mode);
+			devm_kfree(dev, info);
+			continue;
+		}
+		list_add_tail(&info->list, &reboot->head);
+	}
+	reboot->reboot_notifier.notifier_call = reboot_mode_notify;
+	ret = register_reboot_notifier(&reboot->reboot_notifier);
+	if (ret)
+		dev_err(dev, "can't register reboot notifier\n");
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(reboot_mode_register);
+
+MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com");
+MODULE_DESCRIPTION("System reboot mode driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 1131cf7..43521fd 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -172,6 +172,5 @@ config POWER_RESET_ZX
 	depends on HAS_IOMEM
 	help
 	  Reboot support for ZTE SoCs.
-
 endif
 
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index a7ff409..f523c32 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -1,7 +1,7 @@
 #ifndef _LINUX_REBOOT_H
 #define _LINUX_REBOOT_H
 
-
+#include <linux/device.h>
 #include <linux/notifier.h>
 #include <uapi/linux/reboot.h>
 
@@ -42,6 +42,8 @@ extern int register_restart_handler(struct notifier_block *);
 extern int unregister_restart_handler(struct notifier_block *);
 extern void do_kernel_restart(char *cmd);
 
+extern int reboot_mode_register(struct device *dev, int (*write)(int));
+
 /*
  * Architecture-specific implementations of sys_reboot commands.
  */
-- 
1.9.1



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

* [PATCH 3/6] misc: add reboot mode driver
@ 2015-12-21 11:36   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:36 UTC (permalink / raw)
  To: linux-arm-kernel

This driver parse the reboot commands like "reboot loader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the vendor specific write interfae
to store the boot mode in some place like special register
or sram , which can be read by the bootloader after system
reboot.

This is commonly done on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 drivers/misc/Kconfig        |  7 ++++
 drivers/misc/Makefile       |  1 +
 drivers/misc/reboot_mode.c  | 96 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/power/reset/Kconfig |  1 -
 include/linux/reboot.h      |  4 +-
 5 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 drivers/misc/reboot_mode.c

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 22892c7..039be78 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -525,6 +525,13 @@ config VEXPRESS_SYSCFG
 	  bus. System Configuration interface is one of the possible means
 	  of generating transactions on this bus.
 
+config REBOOT_MODE
+	tristate
+	depends on OF
+	help
+	 This driver will help to communicate the system reboot mode
+	 to bootloader
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 537d7f3..6ada5de 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -56,3 +56,4 @@ obj-$(CONFIG_GENWQE)		+= genwqe/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
+obj-$(CONFIG_REBOOT_MODE)       += reboot_mode.o
diff --git a/drivers/misc/reboot_mode.c b/drivers/misc/reboot_mode.c
new file mode 100644
index 0000000..39e3f9f
--- /dev/null
+++ b/drivers/misc/reboot_mode.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2015, 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/device.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/reboot.h>
+
+struct mode_info {
+	const char *mode;
+	int magic;
+	struct list_head list;
+};
+
+struct reboot_mode_driver {
+	struct list_head head;
+	int (*write)(int magic);
+	struct notifier_block reboot_notifier;
+};
+
+static int get_reboot_mode_magic(struct reboot_mode_driver *reboot,
+				 const char *cmd)
+{
+	int magic = 0;
+	struct mode_info *info;
+
+	if (cmd) {
+		list_for_each_entry(info, &reboot->head, list) {
+			if (!strcmp(info->mode, cmd)) {
+				magic = info->magic;
+				break;
+			}
+		}
+	}
+
+	return magic;
+}
+
+static int reboot_mode_notify(struct notifier_block *this,
+				  unsigned long mode, void *cmd)
+{
+	struct reboot_mode_driver *reboot;
+	int magic;
+
+	reboot = container_of(this, struct reboot_mode_driver, reboot_notifier);
+	magic = get_reboot_mode_magic(reboot, cmd);
+	reboot->write(magic);
+
+	return NOTIFY_DONE;
+}
+
+int reboot_mode_register(struct device *dev, int (*write)(int))
+{
+	struct reboot_mode_driver *reboot;
+	struct mode_info *info;
+	struct device_node *child;
+	int ret;
+
+	reboot = devm_kzalloc(dev, sizeof(*reboot), GFP_KERNEL);
+	if (!reboot)
+		return -ENOMEM;
+
+	reboot->write = write;
+	INIT_LIST_HEAD(&reboot->head);
+	for_each_child_of_node(dev->of_node, child) {
+		info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
+		if (!info)
+			return -ENOMEM;
+		info->mode = of_get_property(child, "linux,mode", NULL);
+		if (of_property_read_u32(child, "linux,magic", &info->magic)) {
+			dev_err(dev, "reboot mode %s without magic number\n",
+				info->mode);
+			devm_kfree(dev, info);
+			continue;
+		}
+		list_add_tail(&info->list, &reboot->head);
+	}
+	reboot->reboot_notifier.notifier_call = reboot_mode_notify;
+	ret = register_reboot_notifier(&reboot->reboot_notifier);
+	if (ret)
+		dev_err(dev, "can't register reboot notifier\n");
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(reboot_mode_register);
+
+MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com");
+MODULE_DESCRIPTION("System reboot mode driver");
+MODULE_LICENSE("GPL");
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 1131cf7..43521fd 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -172,6 +172,5 @@ config POWER_RESET_ZX
 	depends on HAS_IOMEM
 	help
 	  Reboot support for ZTE SoCs.
-
 endif
 
diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index a7ff409..f523c32 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -1,7 +1,7 @@
 #ifndef _LINUX_REBOOT_H
 #define _LINUX_REBOOT_H
 
-
+#include <linux/device.h>
 #include <linux/notifier.h>
 #include <uapi/linux/reboot.h>
 
@@ -42,6 +42,8 @@ extern int register_restart_handler(struct notifier_block *);
 extern int unregister_restart_handler(struct notifier_block *);
 extern void do_kernel_restart(char *cmd);
 
+extern int reboot_mode_register(struct device *dev, int (*write)(int));
+
 /*
  * Architecture-specific implementations of sys_reboot commands.
  */
-- 
1.9.1

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

* [PATCH 4/6] soc: rockchip: add reboot mode driver
  2015-12-21 11:27 ` Andy Yan
@ 2015-12-21 11:39   ` Andy Yan
  -1 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:39 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

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>
---

 drivers/soc/rockchip/Kconfig  |  8 ++++++
 drivers/soc/rockchip/Makefile |  1 +
 drivers/soc/rockchip/loader.h | 22 +++++++++++++++
 drivers/soc/rockchip/reboot.c | 66 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 97 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..855d518 100644
--- a/drivers/soc/rockchip/Kconfig
+++ b/drivers/soc/rockchip/Kconfig
@@ -15,4 +15,12 @@ config ROCKCHIP_PM_DOMAINS
 
           If unsure, say N.
 
+config ROCKCHIP_REBOOT
+	bool "Rockchip reboot mode driver"
+	select REBOOT_MODE
+	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..eb580b5
--- /dev/null
+++ b/drivers/soc/rockchip/reboot.c
@@ -0,0 +1,66 @@
+/*
+ * 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 regmap *map;
+u32 offset;
+
+static int rockchip_reboot_mode_write(int magic)
+{
+	pr_info("%s---------magic:%x\n", __func__, magic);
+	regmap_write(map, offset, magic);
+
+}
+
+static int __init rockchip_reboot_probe(struct platform_device *pdev)
+{
+	struct rockchip_reboot *reboot;
+	int ret;
+
+	map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+						      "rockchip,regmap");
+	if (IS_ERR(map))
+		return PTR_ERR(map);
+
+	if (of_property_read_u32(pdev->dev.of_node, "offset", &offset))
+		return -EINVAL;
+
+	ret = reboot_mode_register(&pdev->dev, rockchip_reboot_mode_write);
+	if (ret)
+		dev_err(&pdev->dev, "can't register reboot mode\n");
+
+	return ret;
+}
+
+static const struct of_device_id rockchip_reboot_of_match[] = {
+	{ .compatible = "rockchip,reboot-mode" },
+	{}
+};
+
+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



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

* [PATCH 4/6] soc: rockchip: add reboot mode driver
@ 2015-12-21 11:39   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:39 UTC (permalink / raw)
  To: linux-arm-kernel

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>
---

 drivers/soc/rockchip/Kconfig  |  8 ++++++
 drivers/soc/rockchip/Makefile |  1 +
 drivers/soc/rockchip/loader.h | 22 +++++++++++++++
 drivers/soc/rockchip/reboot.c | 66 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 97 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..855d518 100644
--- a/drivers/soc/rockchip/Kconfig
+++ b/drivers/soc/rockchip/Kconfig
@@ -15,4 +15,12 @@ config ROCKCHIP_PM_DOMAINS
 
           If unsure, say N.
 
+config ROCKCHIP_REBOOT
+	bool "Rockchip reboot mode driver"
+	select REBOOT_MODE
+	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..eb580b5
--- /dev/null
+++ b/drivers/soc/rockchip/reboot.c
@@ -0,0 +1,66 @@
+/*
+ * 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 regmap *map;
+u32 offset;
+
+static int rockchip_reboot_mode_write(int magic)
+{
+	pr_info("%s---------magic:%x\n", __func__, magic);
+	regmap_write(map, offset, magic);
+
+}
+
+static int __init rockchip_reboot_probe(struct platform_device *pdev)
+{
+	struct rockchip_reboot *reboot;
+	int ret;
+
+	map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
+						      "rockchip,regmap");
+	if (IS_ERR(map))
+		return PTR_ERR(map);
+
+	if (of_property_read_u32(pdev->dev.of_node, "offset", &offset))
+		return -EINVAL;
+
+	ret = reboot_mode_register(&pdev->dev, rockchip_reboot_mode_write);
+	if (ret)
+		dev_err(&pdev->dev, "can't register reboot mode\n");
+
+	return ret;
+}
+
+static const struct of_device_id rockchip_reboot_of_match[] = {
+	{ .compatible = "rockchip,reboot-mode" },
+	{}
+};
+
+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

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

* [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-21 11:42   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:42 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

Add reboot mode driver DT node for rk3xxx,rk3288 platform

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 04ea209..937ba4c 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -170,6 +170,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x94>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
+
 	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..735eef4 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -43,6 +43,7 @@
 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/soc/rockchip_boot-mode.h>
 #include "skeleton.dtsi"
 
 / {
@@ -103,6 +104,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <BOOT_LOADER>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <BOOT_MASKROM>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <BOOT_RECOVERY>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <BOOT_FASTBOOT>;
+		};
+	};
+
 	xin24m: oscillator {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
diff --git a/include/dt-bindings/soc/rockchip_boot-mode.h b/include/dt-bindings/soc/rockchip_boot-mode.h
new file mode 100644
index 0000000..129edf8
--- /dev/null
+++ b/include/dt-bindings/soc/rockchip_boot-mode.h
@@ -0,0 +1,30 @@
+#ifndef __ROCKCHIP_BOOT_MODE_H
+#define __ROCKCHIP_BOOT_MODE_H
+
+/*high 24 bits is tag, low 8 bits is type*/
+#define	REBOOT_FLAG		0x5242C300
+/* normal boot */
+#define	BOOT_NORMAL		(REBOOT_FLAG + 0)
+/* enter loader rockusb mode */
+#define	BOOT_LOADER		(REBOOT_FLAG + 1)
+/* enter maskrom rockusb mode */
+#define	BOOT_MASKROM		(REBOOT_FLAG + 2)
+/* enter recovery */
+#define	BOOT_RECOVERY		(REBOOT_FLAG + 3)
+/* do not enter recover */
+#define	BOOT_NORECOVER		(REBOOT_FLAG + 4)
+/* boot second OS*/
+#define	BOOT_SECONDOS		(REBOOT_FLAG + 5)
+/* enter recover and wipe data. */
+#define	BOOT_WIPEDATA		(REBOOT_FLAG + 6)
+/* enter recover and wipe all data. */
+#define	BOOT_WIPEALL		(REBOOT_FLAG + 7)
+/* check firmware img with backup part*/
+#define	BOOT_CHECKIMG		(REBOOT_FLAG + 8)
+ /* enter fast boot mode */
+#define	BOOT_FASTBOOT		(REBOOT_FLAG + 9)
+#define	BOOT_SECUREBOOT_DISABLE	(REBOOT_FLAG + 10)
+/* enter charge mode */
+#define	BOOT_CHARGING		(REBOOT_FLAG + 11)
+
+#endif
-- 
1.9.1



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

* [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-21 11:42   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:42 UTC (permalink / raw)
  To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	arnd-r2nGTMty4D4, john.stultz-QSEj5FYQhm4dnm+yROfE0A
  Cc: sjg-F7+t8E8rja9g9hUCZPvPmw,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	treding-DDmLM1+adcrQT0dZR+AlfA, galak-sgV2jX0FEOL9JmXXK+q4OQ,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	wxt-TNX95d0MmH7DzftRWevZcw, catalin.marinas-5wv7dgnIgG8,
	olof-nZhT3qVonbNeoWH0uzbU5w,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w, sre-DgEjT+Ai2ygdnm+yROfE0A,
	jun.nie-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	will.deacon-5wv7dgnIgG8, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	devicetree-u79uwXL29TY76Z2rM5mHXA, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	joel-U3u1mxZcP9KHXe+LvDLADg,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	lorenzo.pieralisi-5wv7dgnIgG8, khilman-QSEj5FYQhm4dnm+yROfE0A,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	Andy Yan

Add reboot mode driver DT node for rk3xxx,rk3288 platform

Signed-off-by: Andy Yan <andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
---

 arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 04ea209..937ba4c 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -170,6 +170,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x94>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
+
 	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..735eef4 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -43,6 +43,7 @@
 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/soc/rockchip_boot-mode.h>
 #include "skeleton.dtsi"
 
 / {
@@ -103,6 +104,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <BOOT_LOADER>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <BOOT_MASKROM>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <BOOT_RECOVERY>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <BOOT_FASTBOOT>;
+		};
+	};
+
 	xin24m: oscillator {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
diff --git a/include/dt-bindings/soc/rockchip_boot-mode.h b/include/dt-bindings/soc/rockchip_boot-mode.h
new file mode 100644
index 0000000..129edf8
--- /dev/null
+++ b/include/dt-bindings/soc/rockchip_boot-mode.h
@@ -0,0 +1,30 @@
+#ifndef __ROCKCHIP_BOOT_MODE_H
+#define __ROCKCHIP_BOOT_MODE_H
+
+/*high 24 bits is tag, low 8 bits is type*/
+#define	REBOOT_FLAG		0x5242C300
+/* normal boot */
+#define	BOOT_NORMAL		(REBOOT_FLAG + 0)
+/* enter loader rockusb mode */
+#define	BOOT_LOADER		(REBOOT_FLAG + 1)
+/* enter maskrom rockusb mode */
+#define	BOOT_MASKROM		(REBOOT_FLAG + 2)
+/* enter recovery */
+#define	BOOT_RECOVERY		(REBOOT_FLAG + 3)
+/* do not enter recover */
+#define	BOOT_NORECOVER		(REBOOT_FLAG + 4)
+/* boot second OS*/
+#define	BOOT_SECONDOS		(REBOOT_FLAG + 5)
+/* enter recover and wipe data. */
+#define	BOOT_WIPEDATA		(REBOOT_FLAG + 6)
+/* enter recover and wipe all data. */
+#define	BOOT_WIPEALL		(REBOOT_FLAG + 7)
+/* check firmware img with backup part*/
+#define	BOOT_CHECKIMG		(REBOOT_FLAG + 8)
+ /* enter fast boot mode */
+#define	BOOT_FASTBOOT		(REBOOT_FLAG + 9)
+#define	BOOT_SECUREBOOT_DISABLE	(REBOOT_FLAG + 10)
+/* enter charge mode */
+#define	BOOT_CHARGING		(REBOOT_FLAG + 11)
+
+#endif
-- 
1.9.1


--
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 related	[flat|nested] 26+ messages in thread

* [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-21 11:42   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:42 UTC (permalink / raw)
  To: linux-arm-kernel

Add reboot mode driver DT node for rk3xxx,rk3288 platform

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
 arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
 include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 04ea209..937ba4c 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -170,6 +170,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x94>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <0x5242C301>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <0x5242C302>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <0x5242C303>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <0x5242C309>;
+		};
+	};
+
 	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..735eef4 100644
--- a/arch/arm/boot/dts/rk3xxx.dtsi
+++ b/arch/arm/boot/dts/rk3xxx.dtsi
@@ -43,6 +43,7 @@
 
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/soc/rockchip_boot-mode.h>
 #include "skeleton.dtsi"
 
 / {
@@ -103,6 +104,31 @@
 		};
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmu>;
+		offset = <0x40>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <BOOT_LOADER>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <BOOT_MASKROM>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <BOOT_RECOVERY>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <BOOT_FASTBOOT>;
+		};
+	};
+
 	xin24m: oscillator {
 		compatible = "fixed-clock";
 		clock-frequency = <24000000>;
diff --git a/include/dt-bindings/soc/rockchip_boot-mode.h b/include/dt-bindings/soc/rockchip_boot-mode.h
new file mode 100644
index 0000000..129edf8
--- /dev/null
+++ b/include/dt-bindings/soc/rockchip_boot-mode.h
@@ -0,0 +1,30 @@
+#ifndef __ROCKCHIP_BOOT_MODE_H
+#define __ROCKCHIP_BOOT_MODE_H
+
+/*high 24 bits is tag, low 8 bits is type*/
+#define	REBOOT_FLAG		0x5242C300
+/* normal boot */
+#define	BOOT_NORMAL		(REBOOT_FLAG + 0)
+/* enter loader rockusb mode */
+#define	BOOT_LOADER		(REBOOT_FLAG + 1)
+/* enter maskrom rockusb mode */
+#define	BOOT_MASKROM		(REBOOT_FLAG + 2)
+/* enter recovery */
+#define	BOOT_RECOVERY		(REBOOT_FLAG + 3)
+/* do not enter recover */
+#define	BOOT_NORECOVER		(REBOOT_FLAG + 4)
+/* boot second OS*/
+#define	BOOT_SECONDOS		(REBOOT_FLAG + 5)
+/* enter recover and wipe data. */
+#define	BOOT_WIPEDATA		(REBOOT_FLAG + 6)
+/* enter recover and wipe all data. */
+#define	BOOT_WIPEALL		(REBOOT_FLAG + 7)
+/* check firmware img with backup part*/
+#define	BOOT_CHECKIMG		(REBOOT_FLAG + 8)
+ /* enter fast boot mode */
+#define	BOOT_FASTBOOT		(REBOOT_FLAG + 9)
+#define	BOOT_SECUREBOOT_DISABLE	(REBOOT_FLAG + 10)
+/* enter charge mode */
+#define	BOOT_CHARGING		(REBOOT_FLAG + 11)
+
+#endif
-- 
1.9.1

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

* [PATCH 6/6] ARM64: dts: rockchip: add reboot mode node
  2015-12-21 11:27 ` Andy Yan
@ 2015-12-21 11:45   ` Andy Yan
  -1 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:45 UTC (permalink / raw)
  To: robh+dt, heiko, arnd, john.stultz
  Cc: sjg, alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

Add reboot mode driver DT node for rk3368 platform

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 arch/arm64/boot/dts/rockchip/rk3368.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
index cc093a4..776f1be 100644
--- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
@@ -45,6 +45,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/soc/rockchip_boot-mode.h>
 
 / {
 	compatible = "rockchip,rk3368";
@@ -202,6 +203,31 @@
 		method = "smc";
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmugrf>;
+		offset = <0x200>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <BOOT_LOADER>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <BOOT_MASKROM>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <BOOT_RECOVERY>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <BOOT_FASTBOOT>;
+		};
+	};
+
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-- 
1.9.1



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

* [PATCH 6/6] ARM64: dts: rockchip: add reboot mode node
@ 2015-12-21 11:45   ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-21 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

Add reboot mode driver DT node for rk3368 platform

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---

 arch/arm64/boot/dts/rockchip/rk3368.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3368.dtsi b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
index cc093a4..776f1be 100644
--- a/arch/arm64/boot/dts/rockchip/rk3368.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3368.dtsi
@@ -45,6 +45,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/soc/rockchip_boot-mode.h>
 
 / {
 	compatible = "rockchip,rk3368";
@@ -202,6 +203,31 @@
 		method = "smc";
 	};
 
+	reboot_mode {
+		compatible = "rockchip,reboot-mode";
+		rockchip,regmap = <&pmugrf>;
+		offset = <0x200>;
+		loader {
+			linux,mode = "loader";
+			linux,magic = <BOOT_LOADER>;
+		};
+
+		maskrom {
+			linux,mode = "maskrom";
+			linux,magic = <BOOT_MASKROM>;
+		};
+
+		recovery {
+			linux,mode = "recovery";
+			linux,magic = <BOOT_RECOVERY>;
+		};
+
+		fastboot {
+			linux,mode = "fastboot";
+			linux,magic = <BOOT_FASTBOOT>;
+		};
+	};
+
 	timer {
 		compatible = "arm,armv8-timer";
 		interrupts = <GIC_PPI 13
-- 
1.9.1

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

* Re: [PATCH 4/6] soc: rockchip: add reboot mode driver
  2015-12-21 11:39   ` Andy Yan
  (?)
@ 2015-12-22  0:59     ` kbuild test robot
  -1 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2015-12-22  0:59 UTC (permalink / raw)
  To: Andy Yan
  Cc: kbuild-all, robh+dt, heiko, arnd, john.stultz, sjg,
	alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

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

Hi Andy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.4-rc6 next-20151221]
[cannot apply to rockchip/for-next]

url:    https://github.com/0day-ci/linux/commits/Andy-Yan/misc-add-reboot-mode-driver/20151221-195031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_mode_write':
>> drivers/soc/rockchip/reboot.c:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_probe':
   drivers/soc/rockchip/reboot.c:32:26: warning: unused variable 'reboot' [-Wunused-variable]
     struct rockchip_reboot *reboot;
                             ^

vim +28 drivers/soc/rockchip/reboot.c

    12	#include <linux/of.h>
    13	#include <linux/of_address.h>
    14	#include <linux/platform_device.h>
    15	#include <linux/reboot.h>
    16	#include <linux/regmap.h>
    17	#include <linux/mfd/syscon.h>
    18	#include "loader.h"
    19	
    20	struct regmap *map;
    21	u32 offset;
    22	
    23	static int rockchip_reboot_mode_write(int magic)
    24	{
    25		pr_info("%s---------magic:%x\n", __func__, magic);
    26		regmap_write(map, offset, magic);
    27	
  > 28	}
    29	
    30	static int __init rockchip_reboot_probe(struct platform_device *pdev)
    31	{
    32		struct rockchip_reboot *reboot;
    33		int ret;
    34	
    35		map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
    36							      "rockchip,regmap");

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 54607 bytes --]

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

* Re: [PATCH 4/6] soc: rockchip: add reboot mode driver
@ 2015-12-22  0:59     ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2015-12-22  0:59 UTC (permalink / raw)
  Cc: kbuild-all, robh+dt, heiko, arnd, john.stultz, sjg,
	alexandre.belloni, treding, galak, ijc+devicetree, wxt,
	catalin.marinas, olof, geert+renesas, linux-rockchip, dbaryshkov,
	sre, jun.nie, pawel.moll, will.deacon, akpm, devicetree, linux,
	gregkh, joel, linux-arm-kernel, lorenzo.pieralisi, khilman,
	moritz.fischer, linux-kernel, mark.rutland, Andy Yan

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

Hi Andy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.4-rc6 next-20151221]
[cannot apply to rockchip/for-next]

url:    https://github.com/0day-ci/linux/commits/Andy-Yan/misc-add-reboot-mode-driver/20151221-195031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_mode_write':
>> drivers/soc/rockchip/reboot.c:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_probe':
   drivers/soc/rockchip/reboot.c:32:26: warning: unused variable 'reboot' [-Wunused-variable]
     struct rockchip_reboot *reboot;
                             ^

vim +28 drivers/soc/rockchip/reboot.c

    12	#include <linux/of.h>
    13	#include <linux/of_address.h>
    14	#include <linux/platform_device.h>
    15	#include <linux/reboot.h>
    16	#include <linux/regmap.h>
    17	#include <linux/mfd/syscon.h>
    18	#include "loader.h"
    19	
    20	struct regmap *map;
    21	u32 offset;
    22	
    23	static int rockchip_reboot_mode_write(int magic)
    24	{
    25		pr_info("%s---------magic:%x\n", __func__, magic);
    26		regmap_write(map, offset, magic);
    27	
  > 28	}
    29	
    30	static int __init rockchip_reboot_probe(struct platform_device *pdev)
    31	{
    32		struct rockchip_reboot *reboot;
    33		int ret;
    34	
    35		map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
    36							      "rockchip,regmap");

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 54607 bytes --]

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

* [PATCH 4/6] soc: rockchip: add reboot mode driver
@ 2015-12-22  0:59     ` kbuild test robot
  0 siblings, 0 replies; 26+ messages in thread
From: kbuild test robot @ 2015-12-22  0:59 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Andy,

[auto build test WARNING on robh/for-next]
[also build test WARNING on v4.4-rc6 next-20151221]
[cannot apply to rockchip/for-next]

url:    https://github.com/0day-ci/linux/commits/Andy-Yan/misc-add-reboot-mode-driver/20151221-195031
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next
config: arm-allmodconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All warnings (new ones prefixed by >>):

   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_mode_write':
>> drivers/soc/rockchip/reboot.c:28:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   drivers/soc/rockchip/reboot.c: In function 'rockchip_reboot_probe':
   drivers/soc/rockchip/reboot.c:32:26: warning: unused variable 'reboot' [-Wunused-variable]
     struct rockchip_reboot *reboot;
                             ^

vim +28 drivers/soc/rockchip/reboot.c

    12	#include <linux/of.h>
    13	#include <linux/of_address.h>
    14	#include <linux/platform_device.h>
    15	#include <linux/reboot.h>
    16	#include <linux/regmap.h>
    17	#include <linux/mfd/syscon.h>
    18	#include "loader.h"
    19	
    20	struct regmap *map;
    21	u32 offset;
    22	
    23	static int rockchip_reboot_mode_write(int magic)
    24	{
    25		pr_info("%s---------magic:%x\n", __func__, magic);
    26		regmap_write(map, offset, magic);
    27	
  > 28	}
    29	
    30	static int __init rockchip_reboot_probe(struct platform_device *pdev)
    31	{
    32		struct rockchip_reboot *reboot;
    33		int ret;
    34	
    35		map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
    36							      "rockchip,regmap");

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 54607 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151222/456696f4/attachment-0001.obj>

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

* Re: [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  3:04     ` Naoki FUKAUMI
  0 siblings, 0 replies; 26+ messages in thread
From: Naoki FUKAUMI @ 2015-12-22  3:04 UTC (permalink / raw)
  To: Andy Yan
  Cc: robh+dt, heiko, arnd, john.stultz, mark.rutland, geert+renesas,
	catalin.marinas, will.deacon, linux-kernel, alexandre.belloni,
	lorenzo.pieralisi, linux, dbaryshkov, linux-rockchip, joel,
	treding, wxt, devicetree, khilman, pawel.moll, ijc+devicetree,
	akpm, linux-arm-kernel, moritz.fischer, gregkh, sjg, sre, galak,
	olof, jun.nie

hi,

On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan <andy.yan@rock-chips.com> wrote:
> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
>
>  arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>  arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>  include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>  3 files changed, 81 insertions(+)
>  create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>
> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
> index 04ea209..937ba4c 100644
> --- a/arch/arm/boot/dts/rk3288.dtsi
> +++ b/arch/arm/boot/dts/rk3288.dtsi
> @@ -170,6 +170,31 @@
>                 };
>         };
>
> +       reboot_mode {
> +               compatible = "rockchip,reboot-mode";
> +               rockchip,regmap = <&pmu>;
> +               offset = <0x94>;
> +               loader {
> +                       linux,mode = "loader";
> +                       linux,magic = <0x5242C301>;
> +               };
> +
> +               maskrom {
> +                       linux,mode = "maskrom";
> +                       linux,magic = <0x5242C302>;
> +               };
> +
> +               recovery {
> +                       linux,mode = "recovery";
> +                       linux,magic = <0x5242C303>;
> +               };
> +
> +               fastboot {
> +                       linux,mode = "fastboot";
> +                       linux,magic = <0x5242C309>;
> +               };
> +       };
> +
(snip)

I sometimes use 0xEF08A53C to load bootloader from SD card instead of
on-board flash memory such as eMMC.
 https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893

I don't know any detail about this function.
(above code says "reboot to maskrom", but it should be wrong from my experience)

do you know something about this function? can you handle this too?

Regards,

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

* Re: [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  3:04     ` Naoki FUKAUMI
  0 siblings, 0 replies; 26+ messages in thread
From: Naoki FUKAUMI @ 2015-12-22  3:04 UTC (permalink / raw)
  To: Andy Yan
  Cc: mark.rutland-5wv7dgnIgG8, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	lorenzo.pieralisi-5wv7dgnIgG8, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	arnd-r2nGTMty4D4, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	joel-U3u1mxZcP9KHXe+LvDLADg, treding-DDmLM1+adcrQT0dZR+AlfA,
	wxt-TNX95d0MmH7DzftRWevZcw, devicetree-u79uwXL29TY76Z2rM5mHXA,
	khilman-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	john.stultz-QSEj5FYQhm4dnm+yROfE0A,
	jun.nie-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	sjg-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, olof-nZhT3qVonbNeoWH0uzbU5w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b

hi,

On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan <andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org> wrote:
> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>
> Signed-off-by: Andy Yan <andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
> ---
>
>  arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>  arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>  include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>  3 files changed, 81 insertions(+)
>  create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>
> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
> index 04ea209..937ba4c 100644
> --- a/arch/arm/boot/dts/rk3288.dtsi
> +++ b/arch/arm/boot/dts/rk3288.dtsi
> @@ -170,6 +170,31 @@
>                 };
>         };
>
> +       reboot_mode {
> +               compatible = "rockchip,reboot-mode";
> +               rockchip,regmap = <&pmu>;
> +               offset = <0x94>;
> +               loader {
> +                       linux,mode = "loader";
> +                       linux,magic = <0x5242C301>;
> +               };
> +
> +               maskrom {
> +                       linux,mode = "maskrom";
> +                       linux,magic = <0x5242C302>;
> +               };
> +
> +               recovery {
> +                       linux,mode = "recovery";
> +                       linux,magic = <0x5242C303>;
> +               };
> +
> +               fastboot {
> +                       linux,mode = "fastboot";
> +                       linux,magic = <0x5242C309>;
> +               };
> +       };
> +
(snip)

I sometimes use 0xEF08A53C to load bootloader from SD card instead of
on-board flash memory such as eMMC.
 https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893

I don't know any detail about this function.
(above code says "reboot to maskrom", but it should be wrong from my experience)

do you know something about this function? can you handle this too?

Regards,

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

* [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  3:04     ` Naoki FUKAUMI
  0 siblings, 0 replies; 26+ messages in thread
From: Naoki FUKAUMI @ 2015-12-22  3:04 UTC (permalink / raw)
  To: linux-arm-kernel

hi,

On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan <andy.yan@rock-chips.com> wrote:
> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
>
>  arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>  arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>  include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>  3 files changed, 81 insertions(+)
>  create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>
> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
> index 04ea209..937ba4c 100644
> --- a/arch/arm/boot/dts/rk3288.dtsi
> +++ b/arch/arm/boot/dts/rk3288.dtsi
> @@ -170,6 +170,31 @@
>                 };
>         };
>
> +       reboot_mode {
> +               compatible = "rockchip,reboot-mode";
> +               rockchip,regmap = <&pmu>;
> +               offset = <0x94>;
> +               loader {
> +                       linux,mode = "loader";
> +                       linux,magic = <0x5242C301>;
> +               };
> +
> +               maskrom {
> +                       linux,mode = "maskrom";
> +                       linux,magic = <0x5242C302>;
> +               };
> +
> +               recovery {
> +                       linux,mode = "recovery";
> +                       linux,magic = <0x5242C303>;
> +               };
> +
> +               fastboot {
> +                       linux,mode = "fastboot";
> +                       linux,magic = <0x5242C309>;
> +               };
> +       };
> +
(snip)

I sometimes use 0xEF08A53C to load bootloader from SD card instead of
on-board flash memory such as eMMC.
 https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893

I don't know any detail about this function.
(above code says "reboot to maskrom", but it should be wrong from my experience)

do you know something about this function? can you handle this too?

Regards,

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

* Re: [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  9:04       ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-22  9:04 UTC (permalink / raw)
  To: Naoki FUKAUMI
  Cc: robh+dt, heiko, arnd, john.stultz, mark.rutland, geert+renesas,
	catalin.marinas, will.deacon, linux-kernel, alexandre.belloni,
	lorenzo.pieralisi, linux, dbaryshkov, linux-rockchip, joel,
	treding, wxt, devicetree, khilman, pawel.moll, ijc+devicetree,
	akpm, linux-arm-kernel, moritz.fischer, gregkh, sjg, sre, galak,
	olof, jun.nie

Hi,

On 2015年12月22日 11:04, Naoki FUKAUMI wrote:
> hi,
>
> On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan<andy.yan@rock-chips.com>  wrote:
>> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>>
>> Signed-off-by: Andy Yan<andy.yan@rock-chips.com>
>> ---
>>
>>   arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>>   arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>>   include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>>   3 files changed, 81 insertions(+)
>>   create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>>
>> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
>> index 04ea209..937ba4c 100644
>> --- a/arch/arm/boot/dts/rk3288.dtsi
>> +++ b/arch/arm/boot/dts/rk3288.dtsi
>> @@ -170,6 +170,31 @@
>>                  };
>>          };
>>
>> +       reboot_mode {
>> +               compatible = "rockchip,reboot-mode";
>> +               rockchip,regmap = <&pmu>;
>> +               offset = <0x94>;
>> +               loader {
>> +                       linux,mode = "loader";
>> +                       linux,magic = <0x5242C301>;
>> +               };
>> +
>> +               maskrom {
>> +                       linux,mode = "maskrom";
>> +                       linux,magic = <0x5242C302>;
>> +               };
>> +
>> +               recovery {
>> +                       linux,mode = "recovery";
>> +                       linux,magic = <0x5242C303>;
>> +               };
>> +
>> +               fastboot {
>> +                       linux,mode = "fastboot";
>> +                       linux,magic = <0x5242C309>;
>> +               };
>> +       };
>> +
> (snip)
>
> I sometimes use 0xEF08A53C to load bootloader from SD card instead of
> on-board flash memory such as eMMC.
>   https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893
>
> I don't know any detail about this function.
> (above code says "reboot to maskrom", but it should be wrong from my experience)
>
> do you know something about this function? can you handle this too?
>
> Regards,
>
>
>
  Have some discussion with the bootloader engineer, the correct magic  
number to
  reboot the system to maskrom mode is 0xEF08A53C. I will  fix it in 
next version.


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

* Re: [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  9:04       ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-22  9:04 UTC (permalink / raw)
  To: Naoki FUKAUMI
  Cc: mark.rutland-5wv7dgnIgG8, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ,
	catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	sre-DgEjT+Ai2ygdnm+yROfE0A,
	alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
	lorenzo.pieralisi-5wv7dgnIgG8, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	arnd-r2nGTMty4D4, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	joel-U3u1mxZcP9KHXe+LvDLADg, treding-DDmLM1+adcrQT0dZR+AlfA,
	wxt-TNX95d0MmH7DzftRWevZcw, devicetree-u79uwXL29TY76Z2rM5mHXA,
	khilman-QSEj5FYQhm4dnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	john.stultz-QSEj5FYQhm4dnm+yROfE0A,
	jun.nie-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	sjg-F7+t8E8rja9g9hUCZPvPmw, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	galak-sgV2jX0FEOL9JmXXK+q4OQ, olof-nZhT3qVonbNeoWH0uzbU5w,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b

Hi,

On 2015年12月22日 11:04, Naoki FUKAUMI wrote:
> hi,
>
> On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan<andy.yan@rock-chips.com>  wrote:
>> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>>
>> Signed-off-by: Andy Yan<andy.yan@rock-chips.com>
>> ---
>>
>>   arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>>   arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>>   include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>>   3 files changed, 81 insertions(+)
>>   create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>>
>> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
>> index 04ea209..937ba4c 100644
>> --- a/arch/arm/boot/dts/rk3288.dtsi
>> +++ b/arch/arm/boot/dts/rk3288.dtsi
>> @@ -170,6 +170,31 @@
>>                  };
>>          };
>>
>> +       reboot_mode {
>> +               compatible = "rockchip,reboot-mode";
>> +               rockchip,regmap = <&pmu>;
>> +               offset = <0x94>;
>> +               loader {
>> +                       linux,mode = "loader";
>> +                       linux,magic = <0x5242C301>;
>> +               };
>> +
>> +               maskrom {
>> +                       linux,mode = "maskrom";
>> +                       linux,magic = <0x5242C302>;
>> +               };
>> +
>> +               recovery {
>> +                       linux,mode = "recovery";
>> +                       linux,magic = <0x5242C303>;
>> +               };
>> +
>> +               fastboot {
>> +                       linux,mode = "fastboot";
>> +                       linux,magic = <0x5242C309>;
>> +               };
>> +       };
>> +
> (snip)
>
> I sometimes use 0xEF08A53C to load bootloader from SD card instead of
> on-board flash memory such as eMMC.
>   https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893
>
> I don't know any detail about this function.
> (above code says "reboot to maskrom", but it should be wrong from my experience)
>
> do you know something about this function? can you handle this too?
>
> Regards,
>
>
>
  Have some discussion with the bootloader engineer, the correct magic  
number to
  reboot the system to maskrom mode is 0xEF08A53C. I will  fix it in 
next version.


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

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

* [PATCH 5/6] ARM: dts: rockchip: add reboot mode node
@ 2015-12-22  9:04       ` Andy Yan
  0 siblings, 0 replies; 26+ messages in thread
From: Andy Yan @ 2015-12-22  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 2015?12?22? 11:04, Naoki FUKAUMI wrote:
> hi,
>
> On Mon, Dec 21, 2015 at 8:42 PM, Andy Yan<andy.yan@rock-chips.com>  wrote:
>> Add reboot mode driver DT node for rk3xxx,rk3288 platform
>>
>> Signed-off-by: Andy Yan<andy.yan@rock-chips.com>
>> ---
>>
>>   arch/arm/boot/dts/rk3288.dtsi                | 25 +++++++++++++++++++++++
>>   arch/arm/boot/dts/rk3xxx.dtsi                | 26 ++++++++++++++++++++++++
>>   include/dt-bindings/soc/rockchip_boot-mode.h | 30 ++++++++++++++++++++++++++++
>>   3 files changed, 81 insertions(+)
>>   create mode 100644 include/dt-bindings/soc/rockchip_boot-mode.h
>>
>> diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
>> index 04ea209..937ba4c 100644
>> --- a/arch/arm/boot/dts/rk3288.dtsi
>> +++ b/arch/arm/boot/dts/rk3288.dtsi
>> @@ -170,6 +170,31 @@
>>                  };
>>          };
>>
>> +       reboot_mode {
>> +               compatible = "rockchip,reboot-mode";
>> +               rockchip,regmap = <&pmu>;
>> +               offset = <0x94>;
>> +               loader {
>> +                       linux,mode = "loader";
>> +                       linux,magic = <0x5242C301>;
>> +               };
>> +
>> +               maskrom {
>> +                       linux,mode = "maskrom";
>> +                       linux,magic = <0x5242C302>;
>> +               };
>> +
>> +               recovery {
>> +                       linux,mode = "recovery";
>> +                       linux,magic = <0x5242C303>;
>> +               };
>> +
>> +               fastboot {
>> +                       linux,mode = "fastboot";
>> +                       linux,magic = <0x5242C309>;
>> +               };
>> +       };
>> +
> (snip)
>
> I sometimes use 0xEF08A53C to load bootloader from SD card instead of
> on-board flash memory such as eMMC.
>   https://github.com/linux-rockchip/u-boot-rockchip/blob/u-boot-rk3288/common/cmd_rockusb.c#L893
>
> I don't know any detail about this function.
> (above code says "reboot to maskrom", but it should be wrong from my experience)
>
> do you know something about this function? can you handle this too?
>
> Regards,
>
>
>
  Have some discussion with the bootloader engineer, the correct magic  
number to
  reboot the system to maskrom mode is 0xEF08A53C. I will  fix it in 
next version.

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

end of thread, other threads:[~2015-12-22  9:06 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 11:27 [PATCH 0/6] misc: add reboot mode driver Andy Yan
2015-12-21 11:27 ` Andy Yan
2015-12-21 11:27 ` Andy Yan
2015-12-21 11:30 ` [PATCH 1/6] dt-bindings: misc: add document for reboot-mode driver Andy Yan
2015-12-21 11:30   ` Andy Yan
2015-12-21 11:33 ` [PATCH 2/6] dt-bindings: soc: add document for rockchip " Andy Yan
2015-12-21 11:33   ` Andy Yan
2015-12-21 11:33   ` Andy Yan
2015-12-21 11:36 ` [PATCH 3/6] misc: add reboot mode driver Andy Yan
2015-12-21 11:36   ` Andy Yan
2015-12-21 11:39 ` [PATCH 4/6] soc: rockchip: " Andy Yan
2015-12-21 11:39   ` Andy Yan
2015-12-22  0:59   ` kbuild test robot
2015-12-22  0:59     ` kbuild test robot
2015-12-22  0:59     ` kbuild test robot
2015-12-21 11:42 ` [PATCH 5/6] ARM: dts: rockchip: add reboot mode node Andy Yan
2015-12-21 11:42   ` Andy Yan
2015-12-21 11:42   ` Andy Yan
2015-12-22  3:04   ` Naoki FUKAUMI
2015-12-22  3:04     ` Naoki FUKAUMI
2015-12-22  3:04     ` Naoki FUKAUMI
2015-12-22  9:04     ` Andy Yan
2015-12-22  9:04       ` Andy Yan
2015-12-22  9:04       ` Andy Yan
2015-12-21 11:45 ` [PATCH 6/6] ARM64: " Andy Yan
2015-12-21 11:45   ` Andy Yan

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.