xref: /openbmc/u-boot/arch/arm/cpu/arm926ejs/spear/cpu.c (revision 962d026b6aaf7d801d182f3188e4bbc106e057e3)
1 /*
2  * (C) Copyright 2010
3  * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 
24 #include <common.h>
25 #include <asm/io.h>
26 #include <asm/arch/hardware.h>
27 #include <asm/arch/spr_misc.h>
28 
29 int arch_cpu_init(void)
30 {
31 	struct misc_regs *const misc_p =
32 	    (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
33 	u32 periph1_clken;
34 
35 	periph1_clken = readl(&misc_p->periph1_clken);
36 
37 #if defined(CONFIG_SPEAR3XX)
38 	periph1_clken |= MISC_GPT2ENB;
39 #elif defined(CONFIG_SPEAR600)
40 	periph1_clken |= MISC_GPT3ENB;
41 #endif
42 
43 #if defined(CONFIG_PL011_SERIAL)
44 	periph1_clken |= MISC_UART0ENB;
45 #endif
46 #if defined(CONFIG_DESIGNWARE_ETH)
47 	periph1_clken |= MISC_ETHENB;
48 #endif
49 #if defined(CONFIG_DW_UDC)
50 	periph1_clken |= MISC_USBDENB;
51 #endif
52 #if defined(CONFIG_DW_I2C)
53 	periph1_clken |= MISC_I2CENB;
54 #endif
55 #if defined(CONFIG_ST_SMI)
56 	periph1_clken |= MISC_SMIENB;
57 #endif
58 #if defined(CONFIG_NAND_FSMC)
59 	periph1_clken |= MISC_FSMCENB;
60 #endif
61 
62 	writel(periph1_clken, &misc_p->periph1_clken);
63 	return 0;
64 }
65 
66 #ifdef CONFIG_DISPLAY_CPUINFO
67 int print_cpuinfo(void)
68 {
69 #ifdef CONFIG_SPEAR300
70 	printf("CPU:   SPEAr300\n");
71 #elif defined(CONFIG_SPEAR310)
72 	printf("CPU:   SPEAr310\n");
73 #elif defined(CONFIG_SPEAR320)
74 	printf("CPU:   SPEAr320\n");
75 #elif defined(CONFIG_SPEAR600)
76 	printf("CPU:   SPEAr600\n");
77 #else
78 #error CPU not supported in spear platform
79 #endif
80 	return 0;
81 }
82 #endif
83