]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/armv7/imx-common/cpu.c
3d58d8ae9160c7f0ff2e0fceeb03d7a80aeab537
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / imx-common / cpu.c
1 /*
2  * (C) Copyright 2007
3  * Sascha Hauer, Pengutronix
4  *
5  * (C) Copyright 2009 Freescale Semiconductor, Inc.
6  *
7  * See file CREDITS for list of people who contributed to this
8  * project.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  * MA 02111-1307 USA
24  */
25
26 #include <common.h>
27 #include <asm/errno.h>
28 #include <asm/io.h>
29 #include <asm/arch/imx-regs.h>
30 #include <asm/arch/clock.h>
31 #include <asm/arch/sys_proto.h>
32
33 #ifdef CONFIG_FSL_ESDHC
34 #include <fsl_esdhc.h>
35 #endif
36
37 static char *get_reset_cause(void)
38 {
39         u32 cause;
40         struct src *src_regs = (struct src *)SRC_BASE_ADDR;
41
42         cause = readl(&src_regs->srsr);
43         writel(cause, &src_regs->srsr);
44
45         switch (cause) {
46         case 0x00001:
47         case 0x00011:
48                 return "POR";
49         case 0x00004:
50                 return "CSU";
51         case 0x00008:
52                 return "IPP USER";
53         case 0x00010:
54                 return "WDOG";
55         case 0x00020:
56                 return "JTAG HIGH-Z";
57         case 0x00040:
58                 return "JTAG SW";
59         case 0x10000:
60                 return "WARM BOOT";
61         default:
62                 return "unknown reset";
63         }
64 }
65
66 #if defined(CONFIG_DISPLAY_CPUINFO)
67
68 static char *get_imx_type(u32 imxtype)
69 {
70         switch (imxtype) {
71         case 0x63:
72                 return "6Q";    /* Quad-core version of the mx6 */
73         case 0x61:
74                 return "6DS";   /* Dual/Solo version of the mx6 */
75         case 0x60:
76                 return "6SL";   /* Solo-Lite version of the mx6 */
77         case 0x51:
78                 return "51";
79         case 0x53:
80                 return "53";
81         default:
82                 return "unknown";
83         }
84 }
85
86 int print_cpuinfo(void)
87 {
88         u32 cpurev;
89
90         cpurev = get_cpu_rev();
91
92         printf("CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n",
93                 get_imx_type((cpurev & 0xFF000) >> 12),
94                 (cpurev & 0x000F0) >> 4,
95                 (cpurev & 0x0000F) >> 0,
96                 mxc_get_clock(MXC_ARM_CLK) / 1000000);
97         printf("Reset cause: %s\n", get_reset_cause());
98         return 0;
99 }
100 #endif
101
102 int cpu_eth_init(bd_t *bis)
103 {
104         int rc = -ENODEV;
105
106 #if defined(CONFIG_FEC_MXC)
107         rc = fecmxc_initialize(bis);
108 #endif
109
110         return rc;
111 }
112
113 /*
114  * Initializes on-chip MMC controllers.
115  * to override, implement board_mmc_init()
116  */
117 int cpu_mmc_init(bd_t *bis)
118 {
119 #ifdef CONFIG_FSL_ESDHC
120         return fsl_esdhc_mmc_init(bis);
121 #else
122         return 0;
123 #endif
124 }
125
126 void reset_cpu(ulong addr)
127 {
128         __raw_writew(4, WDOG1_BASE_ADDR);
129 }