]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/sunxi/board.c
sunxi: add sun7i cpu, board and start of day support
[karo-tx-uboot.git] / board / sunxi / board.c
1 /*
2  * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net>
3  * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
4  *
5  * (C) Copyright 2007-2011
6  * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
7  * Tom Cubie <tangliang@allwinnertech.com>
8  *
9  * Some board init for the Allwinner A10-evb board.
10  *
11  * SPDX-License-Identifier:     GPL-2.0+
12  */
13
14 #include <common.h>
15 #include <asm/arch/clock.h>
16 #include <asm/arch/dram.h>
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 /* add board specific code here */
21 int board_init(void)
22 {
23         int id_pfr1;
24
25         gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100);
26
27         asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1));
28         debug("id_pfr1: 0x%08x\n", id_pfr1);
29         /* Generic Timer Extension available? */
30         if ((id_pfr1 >> 16) & 0xf) {
31                 debug("Setting CNTFRQ\n");
32                 /* CNTFRQ == 24 MHz */
33                 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000));
34         }
35
36         return 0;
37 }
38
39 int dram_init(void)
40 {
41         gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
42
43         return 0;
44 }
45
46 #ifdef CONFIG_SPL_BUILD
47 void sunxi_board_init(void)
48 {
49         unsigned long ramsize;
50
51         printf("DRAM:");
52         ramsize = sunxi_dram_init();
53         printf(" %lu MiB\n", ramsize >> 20);
54         if (!ramsize)
55                 hang();
56 }
57 #endif