blob: dcbe7ec6d5433ed10b77c2bcaf8f4e6550bdb25b [file] [log] [blame]
Thomas Gleixner16216332019-05-19 15:51:31 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Juergen Beiserteea643f2008-07-05 10:02:56 +02002/*
Uwe Kleine-Königd1091672010-06-10 15:11:13 +02003 * arch/arm/mach-imx/mm-imx27.c
Juergen Beiserteea643f2008-07-05 10:02:56 +02004 *
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
Juergen Beiserteea643f2008-07-05 10:02:56 +02006 */
7
8#include <linux/mm.h>
9#include <linux/init.h>
Dong Aishenga2aa65a2012-05-02 19:31:20 +080010#include <linux/pinctrl/machine.h>
Juergen Beiserteea643f2008-07-05 10:02:56 +020011#include <asm/pgtable.h>
12#include <asm/mach/map.h>
Shawn Guo267dd342012-09-13 13:26:00 +080013
Shawn Guoe3372472012-09-13 21:01:00 +080014#include "common.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080015#include "devices/devices-common.h"
Shawn Guo50f2de62012-09-14 14:14:45 +080016#include "hardware.h"
Shawn Guo267dd342012-09-13 13:26:00 +080017#include "iomux-v1.h"
Juergen Beiserteea643f2008-07-05 10:02:56 +020018
19/* MX27 memory map definition */
Uwe Kleine-König4a50d002010-02-05 22:00:11 +010020static struct map_desc imx27_io_desc[] __initdata = {
Juergen Beiserteea643f2008-07-05 10:02:56 +020021 /*
22 * this fixed mapping covers:
23 * - AIPI1
24 * - AIPI2
25 * - AITC
26 * - ROM Patch
27 * - and some reserved space
28 */
Uwe Kleine-König08ff97b2010-10-25 15:38:09 +020029 imx_map_entry(MX27, AIPI, MT_DEVICE),
Juergen Beiserteea643f2008-07-05 10:02:56 +020030 /*
31 * this fixed mapping covers:
32 * - CSI
33 * - ATA
34 */
Uwe Kleine-König08ff97b2010-10-25 15:38:09 +020035 imx_map_entry(MX27, SAHB1, MT_DEVICE),
Juergen Beiserteea643f2008-07-05 10:02:56 +020036 /*
37 * this fixed mapping covers:
38 * - EMI
39 */
Uwe Kleine-König08ff97b2010-10-25 15:38:09 +020040 imx_map_entry(MX27, X_MEMC, MT_DEVICE),
Juergen Beiserteea643f2008-07-05 10:02:56 +020041};
42
43/*
44 * Initialize the memory map. It is called during the
45 * system startup to create static physical to virtual
46 * memory map for the IO modules.
47 */
Sascha Hauercd4a05f2009-04-02 22:32:10 +020048void __init mx27_map_io(void)
49{
Uwe Kleine-König3dac2192011-02-07 16:35:19 +010050 iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
51}
52
53void __init imx27_init_early(void)
54{
Sascha Hauercd4a05f2009-04-02 22:32:10 +020055 mxc_set_cpu_type(MXC_CPU_MX27);
Sascha Hauerff255fe2011-02-17 15:08:12 +010056 imx_iomuxv1_init(MX27_IO_ADDRESS(MX27_GPIO_BASE_ADDR),
57 MX27_NUM_GPIO_PORT);
Sascha Hauercd4a05f2009-04-02 22:32:10 +020058}
59
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +020060void __init mx27_init_irq(void)
61{
Uwe Kleine-König4a50d002010-02-05 22:00:11 +010062 mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
Shawn Guob78d8e52011-06-06 00:07:55 +080063}
64
Richard Zhao3bc34a62012-03-05 22:30:52 +080065static const struct resource imx27_audmux_res[] __initconst = {
66 DEFINE_RES_MEM(MX27_AUDMUX_BASE_ADDR, SZ_4K),
67};
68
Shawn Guob78d8e52011-06-06 00:07:55 +080069void __init imx27_soc_init(void)
70{
Shawn Guo18cb6802013-05-10 09:13:44 +080071 mxc_arch_reset_init(MX27_IO_ADDRESS(MX27_WDOG_BASE_ADDR));
Shawn Guo69ac71d2012-09-20 14:21:16 +080072 mxc_device_init();
73
Shawn Guoe7fc6ae2011-07-07 00:37:41 +080074 /* i.mx27 has the i.mx21 type gpio */
75 mxc_register_gpio("imx21-gpio", 0, MX27_GPIO1_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
76 mxc_register_gpio("imx21-gpio", 1, MX27_GPIO2_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
77 mxc_register_gpio("imx21-gpio", 2, MX27_GPIO3_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
78 mxc_register_gpio("imx21-gpio", 3, MX27_GPIO4_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
79 mxc_register_gpio("imx21-gpio", 4, MX27_GPIO5_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
80 mxc_register_gpio("imx21-gpio", 5, MX27_GPIO6_BASE_ADDR, SZ_256, MX27_INT_GPIO, 0);
Shawn Guo36223602011-06-22 22:41:30 +080081
Dong Aishenga2aa65a2012-05-02 19:31:20 +080082 pinctrl_provide_dummies();
Shawn Guoe51d0f02012-09-15 21:11:28 +080083 imx_add_imx_dma("imx27-dma", MX27_DMA_BASE_ADDR,
84 MX27_INT_DMACH0, 0); /* No ERR irq */
Richard Zhao3bc34a62012-03-05 22:30:52 +080085 /* imx27 has the imx21 type audmux */
86 platform_device_register_simple("imx21-audmux", 0, imx27_audmux_res,
87 ARRAY_SIZE(imx27_audmux_res));
Arnd Bergmann48e076d2016-06-28 10:22:16 +080088
89 imx27_pm_init();
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +020090}