xref: /linux/arch/arm/mach-imx/mach-imx27.c (revision fc673fbf8cc16f496b9a2d2ae65aab15beb5e3b8)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright 2012 Sascha Hauer, Pengutronix
4  */
5 
6 #include <linux/init.h>
7 #include <linux/irq.h>
8 #include <linux/of_address.h>
9 #include <linux/of_irq.h>
10 #include <linux/of_platform.h>
11 #include <linux/mm.h>
12 #include <asm/mach/arch.h>
13 #include <asm/mach/map.h>
14 #include <asm/mach/time.h>
15 
16 #include "common.h"
17 #include "devices/devices-common.h"
18 #include "hardware.h"
19 #include "mx27.h"
20 
21 /* MX27 memory map definition */
22 static struct map_desc imx27_io_desc[] __initdata = {
23 	/*
24 	 * this fixed mapping covers:
25 	 * - AIPI1
26 	 * - AIPI2
27 	 * - AITC
28 	 * - ROM Patch
29 	 * - and some reserved space
30 	 */
31 	imx_map_entry(MX27, AIPI, MT_DEVICE),
32 	/*
33 	 * this fixed mapping covers:
34 	 * - CSI
35 	 * - ATA
36 	 */
37 	imx_map_entry(MX27, SAHB1, MT_DEVICE),
38 	/*
39 	 * this fixed mapping covers:
40 	 * - EMI
41 	 */
42 	imx_map_entry(MX27, X_MEMC, MT_DEVICE),
43 };
44 
45 /*
46  * Initialize the memory map. It is called during the
47  * system startup to create static physical to virtual
48  * memory map for the IO modules.
49  */
50 static void __init mx27_map_io(void)
51 {
52 	iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
53 }
54 
55 static void __init imx27_init_early(void)
56 {
57 	mxc_set_cpu_type(MXC_CPU_MX27);
58 }
59 
60 static void __init mx27_init_irq(void)
61 {
62 	void __iomem *avic_base;
63 	struct device_node *np;
64 
65 	np = of_find_compatible_node(NULL, NULL, "fsl,avic");
66 	avic_base = of_iomap(np, 0);
67 	BUG_ON(!avic_base);
68 	mxc_init_irq(avic_base);
69 }
70 
71 static const char * const imx27_dt_board_compat[] __initconst = {
72 	"fsl,imx27",
73 	NULL
74 };
75 
76 DT_MACHINE_START(IMX27_DT, "Freescale i.MX27 (Device Tree Support)")
77 	.map_io		= mx27_map_io,
78 	.init_early	= imx27_init_early,
79 	.init_irq	= mx27_init_irq,
80 	.init_late	= imx27_pm_init,
81 	.dt_compat	= imx27_dt_board_compat,
82 MACHINE_END
83