ARM: bcm283x: Set rpi_bcm283x_base at run-time
[platform/kernel/u-boot.git] / arch / arm / mach-bcm283x / init.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * (C) Copyright 2012 Stephen Warren
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  */
8
9 #include <common.h>
10 #include <dm/device.h>
11 #include <fdt_support.h>
12
13 unsigned long rpi_bcm283x_base = 0x3f000000;
14
15 int arch_cpu_init(void)
16 {
17         icache_enable();
18
19         return 0;
20 }
21
22 int mach_cpu_init(void)
23 {
24         int ret, soc_offset;
25         u64 io_base, size;
26
27         /* Get IO base from device tree */
28         soc_offset = fdt_path_offset(gd->fdt_blob, "/soc");
29         if (soc_offset < 0)
30                 return soc_offset;
31
32         ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL,
33                                 &io_base, &size);
34         if (ret)
35                 return ret;
36
37         rpi_bcm283x_base = io_base;
38
39         return 0;
40 }
41
42 #ifdef CONFIG_ARMV7_LPAE
43 void enable_caches(void)
44 {
45         dcache_enable();
46 }
47 #endif