]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/armv7/mx5/soc.c
7c7a565665f5c644ee3a2421731a08f526e1b671
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / mx5 / soc.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/arch/imx-regs.h>
28 #include <asm/arch/clock.h>
29 #include <asm/errno.h>
30 #include <asm/io.h>
31
32 #ifdef CONFIG_FSL_ESDHC
33 #include <fsl_esdhc.h>
34 #endif
35
36 #if defined(CONFIG_MX51)
37 #define CPU_TYPE 0x51000
38 #else
39 #error "CPU_TYPE not defined"
40 #endif
41
42 u32 get_cpu_rev(void)
43 {
44         int system_rev = CPU_TYPE;
45         int reg = __raw_readl(ROM_SI_REV);
46
47         switch (reg) {
48         case 0x02:
49                 system_rev |= CHIP_REV_1_1;
50                 break;
51         case 0x10:
52                 if ((__raw_readl(GPIO1_BASE_ADDR + 0x0) & (0x1 << 22)) == 0)
53                         system_rev |= CHIP_REV_2_5;
54                 else
55                         system_rev |= CHIP_REV_2_0;
56                 break;
57         case 0x20:
58                 system_rev |= CHIP_REV_3_0;
59                 break;
60         return system_rev;
61         default:
62                 system_rev |= CHIP_REV_1_0;
63                 break;
64         }
65         return system_rev;
66 }
67
68
69 #if defined(CONFIG_DISPLAY_CPUINFO)
70 int print_cpuinfo(void)
71 {
72         u32 cpurev;
73
74         cpurev = get_cpu_rev();
75         printf("CPU:   Freescale i.MX%x family rev%d.%d at %d MHz\n",
76                 (cpurev & 0xFF000) >> 12,
77                 (cpurev & 0x000F0) >> 4,
78                 (cpurev & 0x0000F) >> 0,
79                 mxc_get_clock(MXC_ARM_CLK) / 1000000);
80         return 0;
81 }
82 #endif
83
84 /*
85  * Initializes on-chip ethernet controllers.
86  * to override, implement board_eth_init()
87  */
88 #if defined(CONFIG_FEC_MXC)
89 extern int fecmxc_initialize(bd_t *bis);
90 #endif
91
92 int cpu_eth_init(bd_t *bis)
93 {
94         int rc = -ENODEV;
95
96 #if defined(CONFIG_FEC_MXC)
97         rc = fecmxc_initialize(bis);
98 #endif
99
100         return rc;
101 }
102
103 /*
104  * Initializes on-chip MMC controllers.
105  * to override, implement board_mmc_init()
106  */
107 int cpu_mmc_init(bd_t *bis)
108 {
109 #ifdef CONFIG_FSL_ESDHC
110         return fsl_esdhc_mmc_init(bis);
111 #else
112         return 0;
113 #endif
114 }
115
116
117 void reset_cpu(ulong addr)
118 {
119         __raw_writew(4, WDOG1_BASE_ADDR);
120 }