1
2
3
4
5
6#include <common.h>
7#include <cpu_func.h>
8#include <dwmmc.h>
9#include <init.h>
10#include <malloc.h>
11#include <asm/arcregs.h>
12#include <asm/global_data.h>
13#include "axs10x.h"
14#include <asm/cache.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18#define AXS_MB_CREG 0xE0011000
19
20int board_early_init_f(void)
21{
22 if (readl((void __iomem *)AXS_MB_CREG + 0x234) & (1 << 28))
23 gd->board_type = AXS_MB_V3;
24 else
25 gd->board_type = AXS_MB_V2;
26
27 return 0;
28}
29
30#ifdef CONFIG_ISA_ARCV2
31
32void board_jump_and_run(ulong entry, int zero, int arch, uint params)
33{
34 void (*kernel_entry)(int zero, int arch, uint params);
35
36 kernel_entry = (void (*)(int, int, uint))entry;
37
38 smp_set_core_boot_addr(entry, -1);
39 smp_kick_all_cpus();
40 kernel_entry(zero, arch, params);
41}
42
43#define RESET_VECTOR_ADDR 0x0
44
45void smp_set_core_boot_addr(unsigned long addr, int corenr)
46{
47
48 writel(addr, (void __iomem *)RESET_VECTOR_ADDR);
49
50
51 flush_dcache_all();
52}
53
54void smp_kick_all_cpus(void)
55{
56
57#define AXC003_CREG_CPU_START 0xF0001400
58
59#define BITS_START 0
60#define BITS_START_MODE 4
61#define BITS_CORE_SEL 9
62
63
64
65
66
67
68
69
70
71#define BITS_START_CORE1 1
72
73#define ARCVER_HS38_3_0 0x53
74
75 int core_family = read_aux_reg(ARC_AUX_IDENTITY) & 0xff;
76 int cmd = readl((void __iomem *)AXC003_CREG_CPU_START);
77
78 if (core_family < ARCVER_HS38_3_0) {
79 cmd |= (1 << BITS_CORE_SEL) | (1 << BITS_START);
80 cmd &= ~(1 << BITS_START_MODE);
81 } else {
82 cmd |= (1 << BITS_START_CORE1);
83 }
84 writel(cmd, (void __iomem *)AXC003_CREG_CPU_START);
85}
86#endif
87
88int checkboard(void)
89{
90 printf("Board: ARC Software Development Platform AXS%s\n",
91 is_isa_arcv2() ? "103" : "101");
92
93 return 0;
94};
95