]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/arm926ejs/armada100/cpu.c
Merge branch 'next' of ../next
[karo-tx-uboot.git] / arch / arm / cpu / arm926ejs / armada100 / cpu.c
1 /*
2  * (C) Copyright 2010
3  * Marvell Semiconductor <www.marvell.com>
4  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
5  * Contributor: Mahavir Jain <mjain@marvell.com>
6  *
7  * See file CREDITS for list of people who contributed to this
8  * project.
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23  * MA 02110-1301 USA
24  */
25
26 #include <common.h>
27 #include <asm/arch/armada100.h>
28 #include <asm/io.h>
29
30 #define UARTCLK14745KHZ (APBC_APBCLK | APBC_FNCLK | APBC_FNCLKSEL(1))
31 #define SET_MRVL_ID     (1<<8)
32 #define L2C_RAM_SEL     (1<<4)
33
34 int arch_cpu_init(void)
35 {
36         u32 val;
37         struct armd1cpu_registers *cpuregs =
38                 (struct armd1cpu_registers *) ARMD1_CPU_BASE;
39
40         struct armd1apb1_registers *apb1clkres =
41                 (struct armd1apb1_registers *) ARMD1_APBC1_BASE;
42
43         struct armd1mpmu_registers *mpmu =
44                 (struct armd1mpmu_registers *) ARMD1_MPMU_BASE;
45
46         /* set SEL_MRVL_ID bit in ARMADA100_CPU_CONF register */
47         val = readl(&cpuregs->cpu_conf);
48         val = val | SET_MRVL_ID;
49         writel(val, &cpuregs->cpu_conf);
50
51         /* Enable Clocks for all hardware units */
52         writel(0xFFFFFFFF, &mpmu->acgr);
53
54         /* Turn on AIB and AIB-APB Functional clock */
55         writel(APBC_APBCLK | APBC_FNCLK, &apb1clkres->aib);
56
57         /* ensure L2 cache is not mapped as SRAM */
58         val = readl(&cpuregs->cpu_conf);
59         val = val & ~(L2C_RAM_SEL);
60         writel(val, &cpuregs->cpu_conf);
61
62         /* Enable GPIO clock */
63         writel(APBC_APBCLK, &apb1clkres->gpio);
64
65         /*
66          * Enable Functional and APB clock at 14.7456MHz
67          * for configured UART console
68          */
69 #if (CONFIG_SYS_NS16550_COM1 == ARMD1_UART3_BASE)
70         writel(UARTCLK14745KHZ, &apb1clkres->uart3);
71 #elif (CONFIG_SYS_NS16550_COM1 == ARMD1_UART2_BASE)
72         writel(UARTCLK14745KHZ, &apb1clkres->uart2);
73 #else
74         writel(UARTCLK14745KHZ, &apb1clkres->uart1);
75 #endif
76         icache_enable();
77
78         return 0;
79 }
80
81 #if defined(CONFIG_DISPLAY_CPUINFO)
82 int print_cpuinfo(void)
83 {
84         u32 id;
85         struct armd1cpu_registers *cpuregs =
86                 (struct armd1cpu_registers *) ARMD1_CPU_BASE;
87
88         id = readl(&cpuregs->chip_id);
89         printf("SoC:   Armada 88AP%X-%X\n", (id & 0xFFF), (id >> 0x10));
90         return 0;
91 }
92 #endif