1
2
3
4
5
6
7#include <common.h>
8#include <dm.h>
9#include <fdtdec.h>
10#include <libfdt.h>
11#include <asm/io.h>
12#include <asm/system.h>
13#include <asm/arch/cpu.h>
14#include <asm/arch/soc.h>
15#include <asm/armv8/mmu.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19
20#define MVEBU_RFU_BASE (MVEBU_REGISTER(0x6f0000))
21#define RFU_GLOBAL_SW_RST (MVEBU_RFU_BASE + 0x84)
22#define RFU_SW_RESET_OFFSET 0
23
24
25
26
27
28
29
30
31#define ARMADA_7K8K_COMMON_REGIONS_START 2
32static struct mm_region mvebu_mem_map[] = {
33
34 {
35
36 .phys = 0xf4000000UL,
37 .virt = 0xf4000000UL,
38 .size = 0x02000000UL,
39 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
40 PTE_BLOCK_NON_SHARE
41 },
42 {
43
44 .phys = 0xfa000000UL,
45 .virt = 0xfa000000UL,
46 .size = 0x04000000UL,
47 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
48 PTE_BLOCK_NON_SHARE
49 },
50
51 {
52
53 .phys = 0x0UL,
54 .virt = 0x0UL,
55 .size = 0x80000000UL,
56 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
57 PTE_BLOCK_INNER_SHARE
58 },
59 {
60
61 .phys = 0xf0000000UL,
62 .virt = 0xf0000000UL,
63 .size = 0x01000000UL,
64 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
65 PTE_BLOCK_NON_SHARE
66 },
67 {
68
69 .phys = 0xf2000000UL,
70 .virt = 0xf2000000UL,
71 .size = 0x02000000UL,
72 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
73 PTE_BLOCK_NON_SHARE
74 },
75 {
76
77 .phys = 0xf6000000UL,
78 .virt = 0xf6000000UL,
79 .size = 0x04000000UL,
80 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
81 PTE_BLOCK_NON_SHARE
82 },
83 {
84 0,
85 }
86};
87
88struct mm_region *mem_map = mvebu_mem_map;
89
90void enable_caches(void)
91{
92
93
94
95
96
97
98 if (of_machine_is_compatible("marvell,armada7040"))
99 mem_map = &mvebu_mem_map[ARMADA_7K8K_COMMON_REGIONS_START];
100
101 icache_enable();
102 dcache_enable();
103}
104
105void reset_cpu(ulong ignored)
106{
107 u32 reg;
108
109 reg = readl(RFU_GLOBAL_SW_RST);
110 reg &= ~(1 << RFU_SW_RESET_OFFSET);
111 writel(reg, RFU_GLOBAL_SW_RST);
112}
113
114
115
116
117
118
119u32 mvebu_get_nand_clock(void)
120{
121 unsigned long NAND_FLASH_CLK_CTRL = 0xF2440700UL;
122 unsigned long NF_CLOCK_SEL_MASK = 0x1;
123 u32 reg;
124
125 reg = readl(NAND_FLASH_CLK_CTRL);
126 if (reg & NF_CLOCK_SEL_MASK)
127 return 400 * 1000000;
128 else
129 return 250 * 1000000;
130}
131