xref: /openbmc/linux/arch/arm/mach-sunxi/sunxi.c (revision f055f1f6)
13b52634fSMaxime Ripard /*
23b52634fSMaxime Ripard  * Device Tree support for Allwinner A1X SoCs
33b52634fSMaxime Ripard  *
43b52634fSMaxime Ripard  * Copyright (C) 2012 Maxime Ripard
53b52634fSMaxime Ripard  *
63b52634fSMaxime Ripard  * Maxime Ripard <maxime.ripard@free-electrons.com>
73b52634fSMaxime Ripard  *
83b52634fSMaxime Ripard  * This file is licensed under the terms of the GNU General Public
93b52634fSMaxime Ripard  * License version 2.  This program is licensed "as is" without any
103b52634fSMaxime Ripard  * warranty of any kind, whether express or implied.
113b52634fSMaxime Ripard  */
123b52634fSMaxime Ripard 
133b52634fSMaxime Ripard #include <linux/kernel.h>
143b52634fSMaxime Ripard #include <linux/init.h>
153b52634fSMaxime Ripard #include <linux/of_irq.h>
163b52634fSMaxime Ripard #include <linux/of_platform.h>
173b52634fSMaxime Ripard #include <linux/io.h>
183b52634fSMaxime Ripard #include <linux/sunxi_timer.h>
193b52634fSMaxime Ripard 
203b52634fSMaxime Ripard #include <linux/irqchip/sunxi.h>
213b52634fSMaxime Ripard 
223b52634fSMaxime Ripard #include <asm/hardware/vic.h>
233b52634fSMaxime Ripard 
243b52634fSMaxime Ripard #include <asm/mach/arch.h>
253b52634fSMaxime Ripard #include <asm/mach/map.h>
263b52634fSMaxime Ripard 
273b52634fSMaxime Ripard #include "sunxi.h"
283b52634fSMaxime Ripard 
293b52634fSMaxime Ripard static struct map_desc sunxi_io_desc[] __initdata = {
303b52634fSMaxime Ripard 	{
313b52634fSMaxime Ripard 		.virtual	= (unsigned long) SUNXI_REGS_VIRT_BASE,
323b52634fSMaxime Ripard 		.pfn		= __phys_to_pfn(SUNXI_REGS_PHYS_BASE),
333b52634fSMaxime Ripard 		.length		= SUNXI_REGS_SIZE,
343b52634fSMaxime Ripard 		.type		= MT_DEVICE,
353b52634fSMaxime Ripard 	},
363b52634fSMaxime Ripard };
373b52634fSMaxime Ripard 
383b52634fSMaxime Ripard void __init sunxi_map_io(void)
393b52634fSMaxime Ripard {
403b52634fSMaxime Ripard 	iotable_init(sunxi_io_desc, ARRAY_SIZE(sunxi_io_desc));
413b52634fSMaxime Ripard }
423b52634fSMaxime Ripard 
433b52634fSMaxime Ripard static void __init sunxi_dt_init(void)
443b52634fSMaxime Ripard {
453b52634fSMaxime Ripard 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
463b52634fSMaxime Ripard }
473b52634fSMaxime Ripard 
483b52634fSMaxime Ripard static const char * const sunxi_board_dt_compat[] = {
49f055f1f6SStefan Roese 	"allwinner,sun4i",
503b52634fSMaxime Ripard 	"allwinner,sun5i",
513b52634fSMaxime Ripard 	NULL,
523b52634fSMaxime Ripard };
533b52634fSMaxime Ripard 
543b52634fSMaxime Ripard DT_MACHINE_START(SUNXI_DT, "Allwinner A1X (Device Tree)")
553b52634fSMaxime Ripard 	.init_machine	= sunxi_dt_init,
563b52634fSMaxime Ripard 	.map_io		= sunxi_map_io,
573b52634fSMaxime Ripard 	.init_irq	= sunxi_init_irq,
583b52634fSMaxime Ripard 	.handle_irq	= sunxi_handle_irq,
593b52634fSMaxime Ripard 	.timer		= &sunxi_timer,
603b52634fSMaxime Ripard 	.dt_compat	= sunxi_board_dt_compat,
613b52634fSMaxime Ripard MACHINE_END
62