3 * Reinhard Meyer, reinhard.meyer@emk-elektronik.de
5 * Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
7 * Bo Shen <voice.shen@atmel.com>
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
30 #include <asm/arch/hardware.h>
31 #include <asm/arch/at91_dbu.h>
32 #include <asm/arch/at91_pmc.h>
33 #include <asm/arch/at91_pit.h>
34 #include <asm/arch/at91_gpbr.h>
35 #include <asm/arch/clk.h>
37 #ifndef CONFIG_SYS_AT91_MAIN_CLOCK
38 #define CONFIG_SYS_AT91_MAIN_CLOCK 0
41 int arch_cpu_init(void)
43 return at91_clock_init(CONFIG_SYS_AT91_MAIN_CLOCK);
46 void arch_preboot_os(void)
49 at91_pit_t *pit = (at91_pit_t *)ATMEL_BASE_PIT;
51 cpiv = AT91_PIT_MR_PIV_MASK(readl(&pit->piir));
55 * Add 0x1000 to current counter to stop it faster
56 * without waiting for wrapping back to 0
58 writel(cpiv + 0x1000, &pit->mr);
61 #if defined(CONFIG_DISPLAY_CPUINFO)
62 int print_cpuinfo(void)
66 printf("CPU: %s\n", get_cpu_name());
67 printf("Crystal frequency: %8s MHz\n",
68 strmhz(buf, get_main_clk_rate()));
69 printf("CPU clock : %8s MHz\n",
70 strmhz(buf, get_cpu_clk_rate()));
71 printf("Master clock : %8s MHz\n",
72 strmhz(buf, get_mck_clk_rate()));
78 void enable_caches(void)
82 unsigned int get_chip_id(void)
84 return readl(ATMEL_BASE_DBGU + AT91_DBU_CIDR) & ~AT91_DBU_CIDR_MASK;
87 unsigned int get_extension_chip_id(void)
89 return readl(ATMEL_BASE_DBGU + AT91_DBU_EXID);