]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/highbank/highbank.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / board / highbank / highbank.c
1 /*
2  * Copyright 2010-2011 Calxeda, Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <ahci.h>
9 #include <netdev.h>
10 #include <scsi.h>
11
12 #include <asm/sizes.h>
13 #include <asm/io.h>
14
15 #define HB_SREG_A9_PWR_REQ              0xfff3cf00
16 #define HB_SREG_A9_BOOT_SRC_STAT        0xfff3cf04
17 #define HB_PWR_SUSPEND                  0
18 #define HB_PWR_SOFT_RESET               1
19 #define HB_PWR_HARD_RESET               2
20 #define HB_PWR_SHUTDOWN                 3
21
22 DECLARE_GLOBAL_DATA_PTR;
23
24 /*
25  * Miscellaneous platform dependent initialisations
26  */
27 int board_init(void)
28 {
29         icache_enable();
30
31         return 0;
32 }
33
34 /* We know all the init functions have been run now */
35 int board_eth_init(bd_t *bis)
36 {
37         int rc = 0;
38
39 #ifdef CONFIG_CALXEDA_XGMAC
40         rc += calxedaxgmac_initialize(0, 0xfff50000);
41         rc += calxedaxgmac_initialize(1, 0xfff51000);
42 #endif
43         return rc;
44 }
45
46 int misc_init_r(void)
47 {
48         char envbuffer[16];
49         u32 boot_choice;
50
51         ahci_init(0xffe08000);
52         scsi_scan(1);
53
54         boot_choice = readl(HB_SREG_A9_BOOT_SRC_STAT) & 0xff;
55         sprintf(envbuffer, "bootcmd%d", boot_choice);
56         if (getenv(envbuffer)) {
57                 sprintf(envbuffer, "run bootcmd%d", boot_choice);
58                 setenv("bootcmd", envbuffer);
59         } else
60                 setenv("bootcmd", "");
61
62         return 0;
63 }
64
65 int dram_init(void)
66 {
67         gd->ram_size = SZ_512M;
68         return 0;
69 }
70
71 void dram_init_banksize(void)
72 {
73         gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
74         gd->bd->bi_dram[0].size =  PHYS_SDRAM_1_SIZE;
75 }
76
77 void reset_cpu(ulong addr)
78 {
79         writel(HB_PWR_HARD_RESET, HB_SREG_A9_PWR_REQ);
80
81         wfi();
82 }