From: Per Hallsmark <per.hallsm...@windriver.com>

dts: correcting reset address

axxia-reset: hook in platform ddr retention on reboot

Signed-off-by: Per Hallsmark <per.hallsm...@windriver.com>
---
 arch/arm64/boot/dts/intel/axm56xx.dtsi |  2 +-
 drivers/power/reset/Kconfig            | 11 +++++++++++
 drivers/power/reset/axxia-reset.c      | 22 ++++++++++++++++++++++
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/intel/axm56xx.dtsi 
b/arch/arm64/boot/dts/intel/axm56xx.dtsi
index 4539d02..849d1e6 100644
--- a/arch/arm64/boot/dts/intel/axm56xx.dtsi
+++ b/arch/arm64/boot/dts/intel/axm56xx.dtsi
@@ -89,7 +89,7 @@
                        reg = <0x80 0x02c00000 0 0x40000>;
                };
 
-               reset: reset@2010031000 {
+               reset: reset@8002C02008 {
                        compatible = "intel,axm56xx-reset";
                        syscon = <&syscon>;
                };
diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 17d93a7..a263c58 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -38,6 +38,17 @@ config POWER_RESET_AXXIA
 
          Say Y if you have an Axxia family SoC.
 
+if POWER_RESET_AXXIA
+config POWER_RESET_AXXIA_DDR_RETENTION
+       bool "Keep memory content"
+       depends on POWER_RESET_AXXIA
+       help
+         Keep memory content during reset. Useful to reserve memory
+         for dumps, logs etc on fatal errors that can be analysed
+         after a reboot.
+endif
+
+
 config POWER_RESET_BRCMSTB
        bool "Broadcom STB reset driver"
        depends on ARM || MIPS || COMPILE_TEST
diff --git a/drivers/power/reset/axxia-reset.c 
b/drivers/power/reset/axxia-reset.c
index a4957fc..195d7cd 100644
--- a/drivers/power/reset/axxia-reset.c
+++ b/drivers/power/reset/axxia-reset.c
@@ -25,6 +25,7 @@
 #include <linux/proc_fs.h>
 #include <linux/reboot.h>
 #include <linux/regmap.h>
+#include <asm/system_misc.h>
 
 #define SC_PSCRATCH            0x00dc
 #define SC_CRIT_WRITE_KEY      0x2000
@@ -36,6 +37,11 @@ static struct regmap *syscon;
 
 static int ddr_retention_enabled;
 
+#ifdef CONFIG_POWER_RESET_AXXIA_DDR_RETENTION
+static void (*saved_arm_pm_restart)
+           (enum reboot_mode reboot_mode, const char *cmd);
+#endif
+
 void
 initiate_retention_reset(void)
 {
@@ -51,10 +57,21 @@ initiate_retention_reset(void)
        regmap_write(syscon, SC_PSCRATCH, 1);
 
        /* trap into secure monitor to do the reset */
+#ifdef CONFIG_POWER_RESET_AXXIA_DDR_RETENTION
+       saved_arm_pm_restart(0, NULL);
+#else
        machine_restart(NULL);
+#endif
 }
 EXPORT_SYMBOL(initiate_retention_reset);
 
+#ifdef CONFIG_POWER_RESET_AXXIA_DDR_RETENTION
+static void axxia_pm_restart(enum reboot_mode reboot_mode, const char *cmd)
+{
+       initiate_retention_reset();
+}
+#endif
+
 static ssize_t
 axxia_ddr_retention_trigger(struct file *file, const char __user *buf,
                            size_t count, loff_t *ppos)
@@ -125,6 +142,11 @@ static int axxia_reset_probe(struct platform_device *pdev)
        if (err)
                dev_err(dev, "cannot register restart handler (err=%d)\n", err);
 
+#ifdef CONFIG_POWER_RESET_AXXIA_DDR_RETENTION
+       saved_arm_pm_restart = arm_pm_restart;
+       arm_pm_restart = axxia_pm_restart;
+#endif
+
        return err;
 }
 
-- 
2.7.4

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to