[5/6] ARM: dts: rockchip: add reboot mode node
diff mbox

Message ID 1450698149-30260-1-git-send-email-andy.yan@rock-chips.com
State New
Headers show

Commit Message

Andy Yan Dec. 21, 2015, 11:42 a.m. UTC
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

Comments

FUKAUMI Naoki Dec. 22, 2015, 3:04 a.m. UTC | #1
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,
Andy Yan Dec. 22, 2015, 9:04 a.m. UTC | #2
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.

Patch
diff mbox

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