1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/mm.h>
15#include <linux/init.h>
16#include <linux/clk.h>
17#include <linux/pinctrl/machine.h>
18
19#include <asm/mach/map.h>
20
21#include "common.h"
22#include "devices/devices-common.h"
23#include "hardware.h"
24#include "iomux-v3.h"
25
26
27
28
29static struct map_desc mx51_io_desc[] __initdata = {
30 imx_map_entry(MX51, TZIC, MT_DEVICE),
31 imx_map_entry(MX51, IRAM, MT_DEVICE),
32 imx_map_entry(MX51, AIPS1, MT_DEVICE),
33 imx_map_entry(MX51, SPBA0, MT_DEVICE),
34 imx_map_entry(MX51, AIPS2, MT_DEVICE),
35};
36
37
38
39
40static struct map_desc mx53_io_desc[] __initdata = {
41 imx_map_entry(MX53, TZIC, MT_DEVICE),
42 imx_map_entry(MX53, AIPS1, MT_DEVICE),
43 imx_map_entry(MX53, SPBA0, MT_DEVICE),
44 imx_map_entry(MX53, AIPS2, MT_DEVICE),
45};
46
47
48
49
50
51
52void __init mx51_map_io(void)
53{
54 iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
55}
56
57void __init mx53_map_io(void)
58{
59 iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
60}
61
62
63
64
65
66
67
68static void __init imx51_ipu_mipi_setup(void)
69{
70 void __iomem *hsc_addr;
71 hsc_addr = MX51_IO_ADDRESS(MX51_MIPI_HSC_BASE_ADDR);
72
73
74 __raw_writel(0xf00, hsc_addr);
75
76
77 __raw_writel(__raw_readl(hsc_addr + 0x800) | 0x30ff,
78 hsc_addr + 0x800);
79}
80
81void __init imx51_init_early(void)
82{
83 imx51_ipu_mipi_setup();
84 mxc_set_cpu_type(MXC_CPU_MX51);
85 mxc_iomux_v3_init(MX51_IO_ADDRESS(MX51_IOMUXC_BASE_ADDR));
86 mxc_arch_reset_init(MX51_IO_ADDRESS(MX51_WDOG1_BASE_ADDR));
87 imx_src_init();
88}
89
90void __init imx53_init_early(void)
91{
92 mxc_set_cpu_type(MXC_CPU_MX53);
93 mxc_iomux_v3_init(MX53_IO_ADDRESS(MX53_IOMUXC_BASE_ADDR));
94 mxc_arch_reset_init(MX53_IO_ADDRESS(MX53_WDOG1_BASE_ADDR));
95 imx_src_init();
96}
97
98void __init mx51_init_irq(void)
99{
100 tzic_init_irq(MX51_IO_ADDRESS(MX51_TZIC_BASE_ADDR));
101}
102
103void __init mx53_init_irq(void)
104{
105 tzic_init_irq(MX53_IO_ADDRESS(MX53_TZIC_BASE_ADDR));
106}
107
108static struct sdma_script_start_addrs imx51_sdma_script __initdata = {
109 .ap_2_ap_addr = 642,
110 .uart_2_mcu_addr = 817,
111 .mcu_2_app_addr = 747,
112 .mcu_2_shp_addr = 961,
113 .ata_2_mcu_addr = 1473,
114 .mcu_2_ata_addr = 1392,
115 .app_2_per_addr = 1033,
116 .app_2_mcu_addr = 683,
117 .shp_2_per_addr = 1251,
118 .shp_2_mcu_addr = 892,
119};
120
121static struct sdma_platform_data imx51_sdma_pdata __initdata = {
122 .fw_name = "sdma-imx51.bin",
123 .script_addrs = &imx51_sdma_script,
124};
125
126static const struct resource imx51_audmux_res[] __initconst = {
127 DEFINE_RES_MEM(MX51_AUDMUX_BASE_ADDR, SZ_16K),
128};
129
130void __init imx51_soc_init(void)
131{
132 mxc_device_init();
133
134
135 mxc_register_gpio("imx35-gpio", 0, MX51_GPIO1_BASE_ADDR, SZ_16K, MX51_INT_GPIO1_LOW, MX51_INT_GPIO1_HIGH);
136 mxc_register_gpio("imx35-gpio", 1, MX51_GPIO2_BASE_ADDR, SZ_16K, MX51_INT_GPIO2_LOW, MX51_INT_GPIO2_HIGH);
137 mxc_register_gpio("imx35-gpio", 2, MX51_GPIO3_BASE_ADDR, SZ_16K, MX51_INT_GPIO3_LOW, MX51_INT_GPIO3_HIGH);
138 mxc_register_gpio("imx35-gpio", 3, MX51_GPIO4_BASE_ADDR, SZ_16K, MX51_INT_GPIO4_LOW, MX51_INT_GPIO4_HIGH);
139
140 pinctrl_provide_dummies();
141
142
143 imx_add_imx_sdma("imx35-sdma", MX51_SDMA_BASE_ADDR, MX51_INT_SDMA, &imx51_sdma_pdata);
144
145
146 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS1_BASE_ADDR));
147 imx_set_aips(MX51_IO_ADDRESS(MX51_AIPS2_BASE_ADDR));
148
149
150 platform_device_register_simple("imx31-audmux", 0, imx51_audmux_res,
151 ARRAY_SIZE(imx51_audmux_res));
152}
153
154void __init imx51_init_late(void)
155{
156 mx51_neon_fixup();
157 imx51_pm_init();
158}
159
160void __init imx53_init_late(void)
161{
162 imx53_pm_init();
163}
164