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