Vipin KUMAR | 962d026 | 2012-05-07 13:06:45 +0530 | [diff] [blame] | 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; |
Shiraz Hashim | 7c885a0 | 2012-05-07 13:06:59 +0530 | [diff] [blame^] | 33 | u32 periph1_clken, periph_clk_cfg; |
Vipin KUMAR | 962d026 | 2012-05-07 13:06:45 +0530 | [diff] [blame] | 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; |
Shiraz Hashim | 7c885a0 | 2012-05-07 13:06:59 +0530 | [diff] [blame^] | 45 | |
| 46 | periph_clk_cfg = readl(&misc_p->periph_clk_cfg); |
| 47 | periph_clk_cfg &= ~CONFIG_SPEAR_UARTCLKMSK; |
| 48 | periph_clk_cfg |= CONFIG_SPEAR_UART48M; |
| 49 | writel(periph_clk_cfg, &misc_p->periph_clk_cfg); |
Vipin KUMAR | 962d026 | 2012-05-07 13:06:45 +0530 | [diff] [blame] | 50 | #endif |
| 51 | #if defined(CONFIG_DESIGNWARE_ETH) |
| 52 | periph1_clken |= MISC_ETHENB; |
| 53 | #endif |
| 54 | #if defined(CONFIG_DW_UDC) |
| 55 | periph1_clken |= MISC_USBDENB; |
| 56 | #endif |
| 57 | #if defined(CONFIG_DW_I2C) |
| 58 | periph1_clken |= MISC_I2CENB; |
| 59 | #endif |
| 60 | #if defined(CONFIG_ST_SMI) |
| 61 | periph1_clken |= MISC_SMIENB; |
| 62 | #endif |
| 63 | #if defined(CONFIG_NAND_FSMC) |
| 64 | periph1_clken |= MISC_FSMCENB; |
| 65 | #endif |
| 66 | |
| 67 | writel(periph1_clken, &misc_p->periph1_clken); |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | #ifdef CONFIG_DISPLAY_CPUINFO |
| 72 | int print_cpuinfo(void) |
| 73 | { |
| 74 | #ifdef CONFIG_SPEAR300 |
| 75 | printf("CPU: SPEAr300\n"); |
| 76 | #elif defined(CONFIG_SPEAR310) |
| 77 | printf("CPU: SPEAr310\n"); |
| 78 | #elif defined(CONFIG_SPEAR320) |
| 79 | printf("CPU: SPEAr320\n"); |
| 80 | #elif defined(CONFIG_SPEAR600) |
| 81 | printf("CPU: SPEAr600\n"); |
| 82 | #else |
| 83 | #error CPU not supported in spear platform |
| 84 | #endif |
| 85 | return 0; |
| 86 | } |
| 87 | #endif |