blob: 697e0945d79cc80a9051c405e96d10d4771f3357 [file] [log] [blame]
Vipin KUMAR4255edc2012-05-07 13:06:45 +05301/*
2 * (C) Copyright 2010
3 * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Vipin KUMAR4255edc2012-05-07 13:06:45 +05306 */
7
8#include <common.h>
9#include <asm/io.h>
10#include <asm/arch/hardware.h>
11#include <asm/arch/spr_misc.h>
12
13int arch_cpu_init(void)
14{
15 struct misc_regs *const misc_p =
16 (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
Shiraz Hashim74a7e052012-05-07 13:06:59 +053017 u32 periph1_clken, periph_clk_cfg;
Vipin KUMAR4255edc2012-05-07 13:06:45 +053018
19 periph1_clken = readl(&misc_p->periph1_clken);
20
21#if defined(CONFIG_SPEAR3XX)
22 periph1_clken |= MISC_GPT2ENB;
23#elif defined(CONFIG_SPEAR600)
24 periph1_clken |= MISC_GPT3ENB;
25#endif
26
27#if defined(CONFIG_PL011_SERIAL)
28 periph1_clken |= MISC_UART0ENB;
Shiraz Hashim74a7e052012-05-07 13:06:59 +053029
30 periph_clk_cfg = readl(&misc_p->periph_clk_cfg);
31 periph_clk_cfg &= ~CONFIG_SPEAR_UARTCLKMSK;
32 periph_clk_cfg |= CONFIG_SPEAR_UART48M;
33 writel(periph_clk_cfg, &misc_p->periph_clk_cfg);
Vipin KUMAR4255edc2012-05-07 13:06:45 +053034#endif
35#if defined(CONFIG_DESIGNWARE_ETH)
36 periph1_clken |= MISC_ETHENB;
37#endif
38#if defined(CONFIG_DW_UDC)
39 periph1_clken |= MISC_USBDENB;
40#endif
Stefan Roeseef6073e2014-10-28 12:12:00 +010041#if defined(CONFIG_SYS_I2C_DW)
Vipin KUMAR4255edc2012-05-07 13:06:45 +053042 periph1_clken |= MISC_I2CENB;
43#endif
44#if defined(CONFIG_ST_SMI)
45 periph1_clken |= MISC_SMIENB;
46#endif
47#if defined(CONFIG_NAND_FSMC)
48 periph1_clken |= MISC_FSMCENB;
49#endif
50
51 writel(periph1_clken, &misc_p->periph1_clken);
52 return 0;
53}
54
55#ifdef CONFIG_DISPLAY_CPUINFO
56int print_cpuinfo(void)
57{
58#ifdef CONFIG_SPEAR300
59 printf("CPU: SPEAr300\n");
60#elif defined(CONFIG_SPEAR310)
61 printf("CPU: SPEAr310\n");
62#elif defined(CONFIG_SPEAR320)
63 printf("CPU: SPEAr320\n");
64#elif defined(CONFIG_SPEAR600)
65 printf("CPU: SPEAr600\n");
66#else
67#error CPU not supported in spear platform
68#endif
69 return 0;
70}
71#endif