3 * Sascha Hauer, Pengutronix
5 * (C) Copyright 2009 Freescale Semiconductor, Inc.
7 * See file CREDITS for list of people who contributed to this
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.
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.
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,
27 #include <asm/arch/imx-regs.h>
28 #include <asm/arch/clock.h>
29 #include <asm/arch/sys_proto.h>
31 #include <asm/errno.h>
34 #ifdef CONFIG_FSL_ESDHC
35 #include <fsl_esdhc.h>
38 #if !(defined(CONFIG_MX51) || defined(CONFIG_MX53))
39 #error "CPU_TYPE not defined"
45 int system_rev = 0x51000;
47 int system_rev = 0x53000;
49 int reg = __raw_readl(ROM_SI_REV);
51 #if defined(CONFIG_MX51)
54 system_rev |= CHIP_REV_1_1;
57 if ((__raw_readl(GPIO1_BASE_ADDR + 0x0) & (0x1 << 22)) == 0)
58 system_rev |= CHIP_REV_2_5;
60 system_rev |= CHIP_REV_2_0;
63 system_rev |= CHIP_REV_3_0;
66 system_rev |= CHIP_REV_1_0;
71 system_rev |= CHIP_REV_1_0;
78 static char *get_reset_cause(void)
81 struct src *src_regs = (struct src *)SRC_BASE_ADDR;
83 cause = readl(&src_regs->srsr);
84 writel(cause, &src_regs->srsr);
102 return "unknown reset";
106 #if defined(CONFIG_DISPLAY_CPUINFO)
107 int print_cpuinfo(void)
111 cpurev = get_cpu_rev();
112 printf("CPU: Freescale i.MX%x family rev%d.%d at %d MHz\n",
113 (cpurev & 0xFF000) >> 12,
114 (cpurev & 0x000F0) >> 4,
115 (cpurev & 0x0000F) >> 0,
116 mxc_get_clock(MXC_ARM_CLK) / 1000000);
117 printf("Reset cause: %s\n", get_reset_cause());
122 int cpu_eth_init(bd_t *bis)
126 #if defined(CONFIG_FEC_MXC)
127 rc = fecmxc_initialize(bis);
133 #if defined(CONFIG_FEC_MXC)
134 void imx_get_mac_from_fuse(unsigned char *mac)
137 struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
138 struct fuse_bank *bank = &iim->bank[1];
139 struct fuse_bank1_regs *fuse =
140 (struct fuse_bank1_regs *)bank->fuse_regs;
142 for (i = 0; i < 6; i++)
143 mac[i] = readl(&fuse->mac_addr[i]) & 0xff;
148 * Initializes on-chip MMC controllers.
149 * to override, implement board_mmc_init()
151 int cpu_mmc_init(bd_t *bis)
153 #ifdef CONFIG_FSL_ESDHC
154 return fsl_esdhc_mmc_init(bis);
160 void set_chipselect_size(int const cs_size)
163 struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
164 reg = readl(&iomuxc_regs->gpr1);
168 reg &= ~0x7; /* CS0=128MB, CS1=0, CS2=0, CS3=0 */
171 case CS0_64M_CS1_64M:
172 reg &= ~0x3F; /* CS0=64MB, CS1=64MB, CS2=0, CS3=0 */
175 case CS0_64M_CS1_32M_CS2_32M:
176 reg &= ~0x1FF; /* CS0=64MB, CS1=32MB, CS2=32MB, CS3=0 */
179 case CS0_32M_CS1_32M_CS2_32M_CS3_32M:
180 reg &= ~0xFFF; /* CS0=32MB, CS1=32MB, CS2=32MB, CS3=32MB */
184 printf("Unknown chip select size: %d\n", cs_size);
188 writel(reg, &iomuxc_regs->gpr1);
191 void reset_cpu(ulong addr)
193 __raw_writew(4, WDOG1_BASE_ADDR);