blob: efc9395b9604fc799581ec39049fc0051c009c38 [file] [log] [blame]
Lei Wen43013032011-02-09 18:06:58 +05301/*
2 * (C) Copyright 2011
3 * Marvell Semiconductor <www.marvell.com>
4 * Written-by: Lei Wen <leiwen@marvell.com>
5 *
6 * See file CREDITS for list of people who contributed to this
7 * project.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 * MA 02110-1301 USA
23 */
24
25#include <common.h>
Lei Wen24f41da2011-10-18 19:21:33 +053026#include <asm/arch/cpu.h>
Lei Wen43013032011-02-09 18:06:58 +053027#include <asm/arch/pantheon.h>
Lei Wen43013032011-02-09 18:06:58 +053028
29#define UARTCLK14745KHZ (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1))
30#define SET_MRVL_ID (1<<8)
31#define L2C_RAM_SEL (1<<4)
32
33int arch_cpu_init(void)
34{
35 u32 val;
36 struct panthcpu_registers *cpuregs =
37 (struct panthcpu_registers*) PANTHEON_CPU_BASE;
38
39 struct panthapb_registers *apbclkres =
40 (struct panthapb_registers*) PANTHEON_APBC_BASE;
41
42 struct panthmpmu_registers *mpmu =
43 (struct panthmpmu_registers*) PANTHEON_MPMU_BASE;
44
45 /* set SEL_MRVL_ID bit in PANTHEON_CPU_CONF register */
46 val = readl(&cpuregs->cpu_conf);
47 val = val | SET_MRVL_ID;
48 writel(val, &cpuregs->cpu_conf);
49
50 /* Turn on clock gating (PMUM_CCGR) */
51 writel(0xFFFFFFFF, &mpmu->ccgr);
52
53 /* Turn on clock gating (PMUM_ACGR) */
54 writel(0xFFFFFFFF, &mpmu->acgr);
55
56 /* Turn on uart2 clock */
57 writel(UARTCLK14745KHZ, &apbclkres->uart0);
58
59 /* Enable GPIO clock */
60 writel(APBC_APBCLK, &apbclkres->gpio);
61
Lei Wend10e3972011-04-13 23:48:34 +053062#ifdef CONFIG_I2C_MV
63 /* Enable I2C clock */
64 writel(APBC_RST | APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
65 writel(APBC_FNCLK | APBC_APBCLK, &apbclkres->twsi);
66#endif
67
Lei Wen43013032011-02-09 18:06:58 +053068 icache_enable();
69
70 return 0;
71}
72
73#if defined(CONFIG_DISPLAY_CPUINFO)
74int print_cpuinfo(void)
75{
76 u32 id;
77 struct panthcpu_registers *cpuregs =
78 (struct panthcpu_registers*) PANTHEON_CPU_BASE;
79
80 id = readl(&cpuregs->chip_id);
81 printf("SoC: PANTHEON 88AP%X-%X\n", (id & 0xFFF), (id >> 0x10));
82 return 0;
83}
84#endif
Lei Wend10e3972011-04-13 23:48:34 +053085
86#ifdef CONFIG_I2C_MV
87void i2c_clk_enable(void)
88{
89}
90#endif