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