]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - arch/arm/imx-common/cpu.c
ARM: i.MX: provide access to reset cause through get_imx_reset_cause()
[karo-tx-uboot.git] / arch / arm / imx-common / cpu.c
index b58df7da6fc1e3f992e2f5f5ad2e4b40afabb1ea..a39e053c570c486800ae64deacb15c9307e2899a 100644 (file)
 #include <fsl_esdhc.h>
 #endif
 
-char *get_reset_cause(void)
+static u32 reset_cause = -1;
+
+static char *get_reset_cause(void)
 {
        u32 cause;
        struct src *src_regs = (struct src *)SRC_BASE_ADDR;
 
        cause = readl(&src_regs->srsr);
        writel(cause, &src_regs->srsr);
+       reset_cause = cause;
 
        switch (cause) {
        case 0x00001:
@@ -53,8 +56,13 @@ char *get_reset_cause(void)
        }
 }
 
-#if defined(CONFIG_MX53) || defined(CONFIG_MX6)
-#if defined(CONFIG_MX53)
+u32 get_imx_reset_cause(void)
+{
+       return reset_cause;
+}
+
+#if defined(CONFIG_SOC_MX53) || defined(CONFIG_SOC_MX6)
+#if defined(CONFIG_SOC_MX53)
 #define MEMCTL_BASE    ESDCTL_BASE_ADDR
 #else
 #define MEMCTL_BASE    MMDC_P0_BASE_ADDR
@@ -136,7 +144,7 @@ int print_cpuinfo(void)
 {
        u32 cpurev;
 
-#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+#if defined(CONFIG_SOC_MX6) && defined(CONFIG_IMX6_THERMAL)
        struct udevice *thermal_dev;
        int cpu_tmp, ret;
 #endif
@@ -149,7 +157,7 @@ int print_cpuinfo(void)
                (cpurev & 0x0000F) >> 0,
                mxc_get_clock(MXC_ARM_CLK) / 1000000);
 
-#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+#if defined(CONFIG_SOC_MX6) && defined(CONFIG_IMX6_THERMAL)
        ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
        if (!ret) {
                ret = thermal_get_temp(thermal_dev, &cpu_tmp);
@@ -206,6 +214,9 @@ void arch_preboot_os(void)
 {
 #if defined(CONFIG_CMD_SATA)
        sata_stop();
+#if defined(CONFIG_SOC_MX6)
+       disable_sata_clock();
+#endif
 #endif
 #if defined(CONFIG_VIDEO_IPUV3)
        /* disable video before launching O/S */