xref: /openbmc/linux/arch/arm/mach-ixp4xx/ixp4xx-of.c (revision 55fd7e02)
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 #include <mach/hardware.h>
13 #include <mach/ixp4xx-regs.h>
14 
15 static struct map_desc ixp4xx_of_io_desc[] __initdata = {
16 	/*
17 	 * This is needed for runtime system configuration checks,
18 	 * such as reading if hardware so-and-so is present. This
19 	 * could eventually be converted into a syscon once all boards
20 	 * are converted to device tree.
21 	 */
22 	{
23 		.virtual = IXP4XX_EXP_CFG_BASE_VIRT,
24 		.pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
25 		.length = SZ_4K,
26 		.type = MT_DEVICE,
27 	},
28 #ifdef CONFIG_DEBUG_UART_8250
29 	/* This is needed for LL-debug/earlyprintk/debug-macro.S */
30 	{
31 		.virtual = CONFIG_DEBUG_UART_VIRT,
32 		.pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
33 		.length = SZ_4K,
34 		.type = MT_DEVICE,
35 	},
36 #endif
37 };
38 
39 static void __init ixp4xx_of_map_io(void)
40 {
41 	iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc));
42 }
43 
44 /*
45  * We handle 4 differen SoC families. These compatible strings are enough
46  * to provide the core so that different boards can add their more detailed
47  * specifics.
48  */
49 static const char *ixp4xx_of_board_compat[] = {
50 	"intel,ixp42x",
51 	"intel,ixp43x",
52 	"intel,ixp45x",
53 	"intel,ixp46x",
54 	NULL,
55 };
56 
57 DT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)")
58 	.map_io		= ixp4xx_of_map_io,
59 	.dt_compat	= ixp4xx_of_board_compat,
60 MACHINE_END
61