18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * IXP4xx Device Tree boot support
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#include <linux/kernel.h>
68c2ecf20Sopenharmony_ci#include <linux/init.h>
78c2ecf20Sopenharmony_ci#include <linux/io.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
108c2ecf20Sopenharmony_ci#include <asm/mach/map.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <mach/hardware.h>
138c2ecf20Sopenharmony_ci#include <mach/ixp4xx-regs.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistatic struct map_desc ixp4xx_of_io_desc[] __initdata = {
168c2ecf20Sopenharmony_ci	/*
178c2ecf20Sopenharmony_ci	 * This is needed for runtime system configuration checks,
188c2ecf20Sopenharmony_ci	 * such as reading if hardware so-and-so is present. This
198c2ecf20Sopenharmony_ci	 * could eventually be converted into a syscon once all boards
208c2ecf20Sopenharmony_ci	 * are converted to device tree.
218c2ecf20Sopenharmony_ci	 */
228c2ecf20Sopenharmony_ci	{
238c2ecf20Sopenharmony_ci		.virtual = IXP4XX_EXP_CFG_BASE_VIRT,
248c2ecf20Sopenharmony_ci		.pfn = __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),
258c2ecf20Sopenharmony_ci		.length = SZ_4K,
268c2ecf20Sopenharmony_ci		.type = MT_DEVICE,
278c2ecf20Sopenharmony_ci	},
288c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_UART_8250
298c2ecf20Sopenharmony_ci	/* This is needed for LL-debug/earlyprintk/debug-macro.S */
308c2ecf20Sopenharmony_ci	{
318c2ecf20Sopenharmony_ci		.virtual = CONFIG_DEBUG_UART_VIRT,
328c2ecf20Sopenharmony_ci		.pfn = __phys_to_pfn(CONFIG_DEBUG_UART_PHYS),
338c2ecf20Sopenharmony_ci		.length = SZ_4K,
348c2ecf20Sopenharmony_ci		.type = MT_DEVICE,
358c2ecf20Sopenharmony_ci	},
368c2ecf20Sopenharmony_ci#endif
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistatic void __init ixp4xx_of_map_io(void)
408c2ecf20Sopenharmony_ci{
418c2ecf20Sopenharmony_ci	iotable_init(ixp4xx_of_io_desc, ARRAY_SIZE(ixp4xx_of_io_desc));
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * We handle 4 differen SoC families. These compatible strings are enough
468c2ecf20Sopenharmony_ci * to provide the core so that different boards can add their more detailed
478c2ecf20Sopenharmony_ci * specifics.
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_cistatic const char *ixp4xx_of_board_compat[] = {
508c2ecf20Sopenharmony_ci	"intel,ixp42x",
518c2ecf20Sopenharmony_ci	"intel,ixp43x",
528c2ecf20Sopenharmony_ci	"intel,ixp45x",
538c2ecf20Sopenharmony_ci	"intel,ixp46x",
548c2ecf20Sopenharmony_ci	NULL,
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciDT_MACHINE_START(IXP4XX_DT, "IXP4xx (Device Tree)")
588c2ecf20Sopenharmony_ci	.map_io		= ixp4xx_of_map_io,
598c2ecf20Sopenharmony_ci	.dt_compat	= ixp4xx_of_board_compat,
608c2ecf20Sopenharmony_ciMACHINE_END
61