Merge tag 'block-5.14-2021-08-07' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / arch / arm / mach-ixp4xx / ixp4xx-of.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * IXP4xx Device Tree boot support
4  */
5 #include <linux/kernel.h>
6 #include <linux/init.h>
7 #include <linux/io.h>
8
9 #include <asm/mach/arch.h>
10 #include <asm/mach/map.h>
11
12 /*
13  * These are the only fixed phys to virt mappings we ever need
14  * we put it right after the UART mapping at 0xffc80000-0xffc81fff
15  */
16 #define IXP4XX_EXP_CFG_BASE_PHYS        0xC4000000
17 #define IXP4XX_EXP_CFG_BASE_VIRT        0xFEC14000
18
19 static struct map_desc ixp4xx_of_io_desc[] __initdata = {
20         /*
21          * This is needed for runtime system configuration checks,
22          * such as reading if hardware so-and-so is present. This
23          * could eventually be converted into a syscon once all boards
24          * are converted to device tree.
25          */
26         {
27                 .virtual = IXP4XX_EXP_CFG_BASE_VIRT,
28                 .pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
29                 .length = SZ_4K,
30                 .type = MT_DEVICE,
31         },
32 #ifdef CONFIG_DEBUG_UART_8250
33         /* This is needed for LL-debug/earlyprintk/debug-macro.S */
34         {
35                 .virtual = CONFIG_DEBUG_UART_VIRT,
36                 .pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
37                 .length = SZ_4K,
38                 .type = MT_DEVICE,
39         },
40 #endif
41 };
42
43 static void __init ixp4xx_of_map_io(void)
44 {
45         iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc));
46 }
47
48 /*
49  * We handle 4 differen SoC families. These compatible strings are enough
50  * to provide the core so that different boards can add their more detailed
51  * specifics.
52  */
53 static const char *ixp4xx_of_board_compat[] = {
54         "intel,ixp42x",
55         "intel,ixp43x",
56         "intel,ixp45x",
57         "intel,ixp46x",
58         NULL,
59 };
60
61 DT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)")
62         .map_io         = ixp4xx_of_map_io,
63         .dt_compat      = ixp4xx_of_board_compat,
64 MACHINE_END