]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/imx-common/cpu.c
arm/imx-common: Fix warning 'get_reset_cause' defined but not used
[u-boot] / arch / arm / imx-common / cpu.c
index 24740b860397a22049c975aa98d6b73e25397222..0cd08cb951b91fda82f19011a3f3ba5d5a313909 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
 #include <ipu_pixfmt.h>
+#include <thermal.h>
+#include <sata.h>
 
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
 #endif
 
-char *get_reset_cause(void)
+#if defined(CONFIG_DISPLAY_CPUINFO)
+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:
@@ -51,6 +57,12 @@ char *get_reset_cause(void)
        }
 }
 
+u32 get_imx_reset_cause(void)
+{
+       return reset_cause;
+}
+#endif
+
 #if defined(CONFIG_MX53) || defined(CONFIG_MX6)
 #if defined(CONFIG_MX53)
 #define MEMCTL_BASE    ESDCTL_BASE_ADDR
@@ -134,6 +146,11 @@ int print_cpuinfo(void)
 {
        u32 cpurev;
 
+#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+       struct udevice *thermal_dev;
+       int cpu_tmp, ret;
+#endif
+
        cpurev = get_cpu_rev();
 
        printf("CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n",
@@ -141,6 +158,21 @@ int print_cpuinfo(void)
                (cpurev & 0x000F0) >> 4,
                (cpurev & 0x0000F) >> 0,
                mxc_get_clock(MXC_ARM_CLK) / 1000000);
+
+#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+       ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
+       if (!ret) {
+               ret = thermal_get_temp(thermal_dev, &cpu_tmp);
+
+               if (!ret)
+                       printf("CPU:   Temperature %d C\n", cpu_tmp);
+               else
+                       printf("CPU:   Temperature: invalid sensor data\n");
+       } else {
+               printf("CPU:   Temperature: Can't find sensor device\n");
+       }
+#endif
+
        printf("Reset cause: %s\n", get_reset_cause());
        return 0;
 }
@@ -180,13 +212,19 @@ u32 get_ahb_clk(void)
        return get_periph_clk() / (ahb_podf + 1);
 }
 
-#if defined(CONFIG_VIDEO_IPUV3)
 void arch_preboot_os(void)
 {
+#if defined(CONFIG_CMD_SATA)
+       sata_stop();
+#if defined(CONFIG_MX6)
+       disable_sata_clock();
+#endif
+#endif
+#if defined(CONFIG_VIDEO_IPUV3)
        /* disable video before launching O/S */
        ipuv3_fb_shutdown();
-}
 #endif
+}
 
 void set_chipselect_size(int const cs_size)
 {