blob: c1c0fb414c2883ad60ddd0a41d3cb4745bda92e2 [file] [log] [blame]
Dong Aishengbc3a59c2012-03-31 21:26:57 +08001/*
2 * Copyright 2012 Freescale Semiconductor, Inc.
3 * Copyright 2012 Linaro Ltd.
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/clk.h>
14#include <linux/clkdev.h>
Shawn Guo633ef4c2013-03-25 14:53:08 +080015#include <linux/clocksource.h>
Shawn Guo44ffb782012-08-06 22:00:45 +080016#include <linux/can/platform/flexcan.h>
Shawn Guo2c7c2c12012-07-13 14:15:34 +080017#include <linux/delay.h>
Dong Aishengbc3a59c2012-03-31 21:26:57 +080018#include <linux/err.h>
Shawn Guo2c7c2c12012-07-13 14:15:34 +080019#include <linux/gpio.h>
Dong Aishengbc3a59c2012-03-31 21:26:57 +080020#include <linux/init.h>
Shawn Guo3143bbb2012-07-07 23:12:03 +080021#include <linux/micrel_phy.h>
Shawn Guoab2815c2012-06-25 21:21:46 +080022#include <linux/mxsfb.h>
Dong Aishengbc3a59c2012-03-31 21:26:57 +080023#include <linux/of_platform.h>
Shawn Guo3143bbb2012-07-07 23:12:03 +080024#include <linux/phy.h>
Shawn Guo2c7c2c12012-07-13 14:15:34 +080025#include <linux/pinctrl/consumer.h>
Dong Aishengbc3a59c2012-03-31 21:26:57 +080026#include <asm/mach/arch.h>
27#include <asm/mach/time.h>
28#include <mach/common.h>
Dong Aishenge3173172012-08-01 11:20:16 +080029#include <mach/digctl.h>
Shawn Guo2c7c2c12012-07-13 14:15:34 +080030#include <mach/mxs.h>
Dong Aishengbc3a59c2012-03-31 21:26:57 +080031
Shawn Guoab2815c2012-06-25 21:21:46 +080032static struct fb_videomode mx23evk_video_modes[] = {
33 {
34 .name = "Samsung-LMS430HF02",
35 .refresh = 60,
36 .xres = 480,
37 .yres = 272,
38 .pixclock = 108096, /* picosecond (9.2 MHz) */
39 .left_margin = 15,
40 .right_margin = 8,
41 .upper_margin = 12,
42 .lower_margin = 4,
43 .hsync_len = 1,
44 .vsync_len = 1,
Shawn Guoab2815c2012-06-25 21:21:46 +080045 },
46};
47
48static struct fb_videomode mx28evk_video_modes[] = {
49 {
50 .name = "Seiko-43WVF1G",
51 .refresh = 60,
52 .xres = 800,
53 .yres = 480,
54 .pixclock = 29851, /* picosecond (33.5 MHz) */
55 .left_margin = 89,
56 .right_margin = 164,
57 .upper_margin = 23,
58 .lower_margin = 10,
59 .hsync_len = 10,
60 .vsync_len = 10,
Shawn Guoab2815c2012-06-25 21:21:46 +080061 },
62};
63
Marek Vasut8fa62e12012-07-07 21:21:38 +080064static struct fb_videomode m28evk_video_modes[] = {
65 {
66 .name = "Ampire AM-800480R2TMQW-T01H",
67 .refresh = 60,
68 .xres = 800,
69 .yres = 480,
70 .pixclock = 30066, /* picosecond (33.26 MHz) */
71 .left_margin = 0,
72 .right_margin = 256,
73 .upper_margin = 0,
74 .lower_margin = 45,
75 .hsync_len = 1,
76 .vsync_len = 1,
Marek Vasut8fa62e12012-07-07 21:21:38 +080077 },
78};
79
Lauri Hintsalad8bb8232012-07-10 10:08:08 +030080static struct fb_videomode apx4devkit_video_modes[] = {
81 {
82 .name = "HannStar PJ70112A",
83 .refresh = 60,
84 .xres = 800,
85 .yres = 480,
86 .pixclock = 33333, /* picosecond (30.00 MHz) */
87 .left_margin = 88,
88 .right_margin = 40,
89 .upper_margin = 32,
90 .lower_margin = 13,
91 .hsync_len = 48,
92 .vsync_len = 3,
Marek Vasut6a150752013-03-18 19:24:02 +010093 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
Lauri Hintsalad8bb8232012-07-10 10:08:08 +030094 },
95};
96
Gwenhael Goavec-Meroua4dabca2012-11-02 19:01:48 +010097static struct fb_videomode apf28dev_video_modes[] = {
98 {
99 .name = "LW700",
100 .refresh = 60,
101 .xres = 800,
102 .yres = 480,
103 .pixclock = 30303, /* picosecond */
104 .left_margin = 96,
105 .right_margin = 96, /* at least 3 & 1 */
106 .upper_margin = 0x14,
107 .lower_margin = 0x15,
108 .hsync_len = 64,
109 .vsync_len = 4,
Marek Vasut6a150752013-03-18 19:24:02 +0100110 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
Gwenhael Goavec-Meroua4dabca2012-11-02 19:01:48 +0100111 },
112};
113
Maxime Ripard1fe42742013-01-25 09:54:07 +0100114static struct fb_videomode cfa10049_video_modes[] = {
115 {
116 .name = "Himax HX8357-B",
117 .refresh = 60,
118 .xres = 320,
119 .yres = 480,
120 .pixclock = 108506, /* picosecond (9.216 MHz) */
121 .left_margin = 2,
122 .right_margin = 2,
123 .upper_margin = 2,
124 .lower_margin = 2,
125 .hsync_len = 15,
126 .vsync_len = 15,
Maxime Ripard1fe42742013-01-25 09:54:07 +0100127 },
128};
129
Shawn Guoab2815c2012-06-25 21:21:46 +0800130static struct mxsfb_platform_data mxsfb_pdata __initdata;
131
Shawn Guo44ffb782012-08-06 22:00:45 +0800132/*
133 * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers
134 */
135#define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13)
136
137static int flexcan0_en, flexcan1_en;
138
139static void mx28evk_flexcan_switch(void)
140{
141 if (flexcan0_en || flexcan1_en)
142 gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1);
143 else
144 gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0);
145}
146
147static void mx28evk_flexcan0_switch(int enable)
148{
149 flexcan0_en = enable;
150 mx28evk_flexcan_switch();
151}
152
153static void mx28evk_flexcan1_switch(int enable)
154{
155 flexcan1_en = enable;
156 mx28evk_flexcan_switch();
157}
158
159static struct flexcan_platform_data flexcan_pdata[2];
160
Shawn Guoab2815c2012-06-25 21:21:46 +0800161static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
162 OF_DEV_AUXDATA("fsl,imx23-lcdif", 0x80030000, NULL, &mxsfb_pdata),
163 OF_DEV_AUXDATA("fsl,imx28-lcdif", 0x80030000, NULL, &mxsfb_pdata),
Shawn Guo44ffb782012-08-06 22:00:45 +0800164 OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80032000, NULL, &flexcan_pdata[0]),
165 OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80034000, NULL, &flexcan_pdata[1]),
Shawn Guoab2815c2012-06-25 21:21:46 +0800166 { /* sentinel */ }
167};
168
Shawn Guo2954ff32012-05-04 21:33:42 +0800169static void __init imx23_timer_init(void)
170{
171 mx23_clocks_init();
Shawn Guo633ef4c2013-03-25 14:53:08 +0800172 clocksource_of_init();
Shawn Guo2954ff32012-05-04 21:33:42 +0800173}
174
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800175static void __init imx28_timer_init(void)
176{
177 mx28_clocks_init();
Shawn Guo633ef4c2013-03-25 14:53:08 +0800178 clocksource_of_init();
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800179}
180
Shawn Guo5653acc2012-06-19 22:38:14 +0800181enum mac_oui {
182 OUI_FSL,
183 OUI_DENX,
Maxime Ripard8eec4b32012-10-07 10:36:28 +0800184 OUI_CRYSTALFONTZ,
Shawn Guo5653acc2012-06-19 22:38:14 +0800185};
186
187static void __init update_fec_mac_prop(enum mac_oui oui)
188{
189 struct device_node *np, *from = NULL;
Shawn Guofa7c8652012-07-13 14:13:55 +0800190 struct property *newmac;
Shawn Guo5653acc2012-06-19 22:38:14 +0800191 const u32 *ocotp = mxs_get_ocotp();
192 u8 *macaddr;
193 u32 val;
194 int i;
195
196 for (i = 0; i < 2; i++) {
197 np = of_find_compatible_node(from, NULL, "fsl,imx28-fec");
198 if (!np)
199 return;
Marek Vasut16d47702012-09-25 13:32:18 +0200200
Shawn Guo5653acc2012-06-19 22:38:14 +0800201 from = np;
202
Marek Vasut16d47702012-09-25 13:32:18 +0200203 if (of_get_property(np, "local-mac-address", NULL))
204 continue;
205
Shawn Guo5653acc2012-06-19 22:38:14 +0800206 newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL);
207 if (!newmac)
208 return;
209 newmac->value = newmac + 1;
210 newmac->length = 6;
211
212 newmac->name = kstrdup("local-mac-address", GFP_KERNEL);
213 if (!newmac->name) {
214 kfree(newmac);
215 return;
216 }
217
218 /*
219 * OCOTP only stores the last 4 octets for each mac address,
220 * so hard-code OUI here.
221 */
222 macaddr = newmac->value;
223 switch (oui) {
224 case OUI_FSL:
225 macaddr[0] = 0x00;
226 macaddr[1] = 0x04;
227 macaddr[2] = 0x9f;
228 break;
229 case OUI_DENX:
230 macaddr[0] = 0xc0;
231 macaddr[1] = 0xe5;
232 macaddr[2] = 0x4e;
233 break;
Maxime Ripard8eec4b32012-10-07 10:36:28 +0800234 case OUI_CRYSTALFONTZ:
235 macaddr[0] = 0x58;
236 macaddr[1] = 0xb9;
237 macaddr[2] = 0xe1;
238 break;
Shawn Guo5653acc2012-06-19 22:38:14 +0800239 }
240 val = ocotp[i];
241 macaddr[3] = (val >> 16) & 0xff;
242 macaddr[4] = (val >> 8) & 0xff;
243 macaddr[5] = (val >> 0) & 0xff;
244
Nathan Fontenot79d1c712012-10-02 16:58:46 +0000245 of_update_property(np, newmac);
Shawn Guo5653acc2012-06-19 22:38:14 +0800246 }
247}
248
Shawn Guoab2815c2012-06-25 21:21:46 +0800249static void __init imx23_evk_init(void)
250{
251 mxsfb_pdata.mode_list = mx23evk_video_modes;
252 mxsfb_pdata.mode_count = ARRAY_SIZE(mx23evk_video_modes);
253 mxsfb_pdata.default_bpp = 32;
254 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100255 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT |
256 MXSFB_SYNC_DOTCLK_FAILING_ACT;
Shawn Guoab2815c2012-06-25 21:21:46 +0800257}
258
Marek Vasut8fa62e12012-07-07 21:21:38 +0800259static inline void enable_clk_enet_out(void)
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800260{
Marek Vasut8fa62e12012-07-07 21:21:38 +0800261 struct clk *clk = clk_get_sys("enet_out", NULL);
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800262
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800263 if (!IS_ERR(clk))
264 clk_prepare_enable(clk);
Marek Vasut8fa62e12012-07-07 21:21:38 +0800265}
Shawn Guo5653acc2012-06-19 22:38:14 +0800266
Marek Vasut8fa62e12012-07-07 21:21:38 +0800267static void __init imx28_evk_init(void)
268{
269 enable_clk_enet_out();
Shawn Guo5653acc2012-06-19 22:38:14 +0800270 update_fec_mac_prop(OUI_FSL);
Shawn Guoab2815c2012-06-25 21:21:46 +0800271
272 mxsfb_pdata.mode_list = mx28evk_video_modes;
273 mxsfb_pdata.mode_count = ARRAY_SIZE(mx28evk_video_modes);
274 mxsfb_pdata.default_bpp = 32;
275 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100276 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT |
277 MXSFB_SYNC_DOTCLK_FAILING_ACT;
Dong Aishenge3173172012-08-01 11:20:16 +0800278
279 mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0);
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800280}
281
Shawn Guo44ffb782012-08-06 22:00:45 +0800282static void __init imx28_evk_post_init(void)
283{
284 if (!gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT,
285 "flexcan-switch")) {
286 flexcan_pdata[0].transceiver_switch = mx28evk_flexcan0_switch;
287 flexcan_pdata[1].transceiver_switch = mx28evk_flexcan1_switch;
288 }
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800289}
290
Marek Vasut8fa62e12012-07-07 21:21:38 +0800291static void __init m28evk_init(void)
292{
Marek Vasut8fa62e12012-07-07 21:21:38 +0800293 mxsfb_pdata.mode_list = m28evk_video_modes;
294 mxsfb_pdata.mode_count = ARRAY_SIZE(m28evk_video_modes);
295 mxsfb_pdata.default_bpp = 16;
296 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100297 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT;
Marek Vasut8fa62e12012-07-07 21:21:38 +0800298}
299
Marek Vasut160d5f22012-11-18 22:08:29 +0100300static void __init sc_sps1_init(void)
301{
302 enable_clk_enet_out();
303}
304
Shawn Guo3143bbb2012-07-07 23:12:03 +0800305static int apx4devkit_phy_fixup(struct phy_device *phy)
306{
307 phy->dev_flags |= MICREL_PHY_50MHZ_CLK;
308 return 0;
309}
310
311static void __init apx4devkit_init(void)
312{
313 enable_clk_enet_out();
314
315 if (IS_BUILTIN(CONFIG_PHYLIB))
Marek Vasut510d5732012-09-23 16:58:50 +0000316 phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK,
Shawn Guo3143bbb2012-07-07 23:12:03 +0800317 apx4devkit_phy_fixup);
Lauri Hintsalad8bb8232012-07-10 10:08:08 +0300318
319 mxsfb_pdata.mode_list = apx4devkit_video_modes;
320 mxsfb_pdata.mode_count = ARRAY_SIZE(apx4devkit_video_modes);
321 mxsfb_pdata.default_bpp = 32;
322 mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100323 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT |
324 MXSFB_SYNC_DOTCLK_FAILING_ACT;
Shawn Guo3143bbb2012-07-07 23:12:03 +0800325}
326
Shawn Guo2c7c2c12012-07-13 14:15:34 +0800327#define ENET0_MDC__GPIO_4_0 MXS_GPIO_NR(4, 0)
328#define ENET0_MDIO__GPIO_4_1 MXS_GPIO_NR(4, 1)
329#define ENET0_RX_EN__GPIO_4_2 MXS_GPIO_NR(4, 2)
330#define ENET0_RXD0__GPIO_4_3 MXS_GPIO_NR(4, 3)
331#define ENET0_RXD1__GPIO_4_4 MXS_GPIO_NR(4, 4)
332#define ENET0_TX_EN__GPIO_4_6 MXS_GPIO_NR(4, 6)
333#define ENET0_TXD0__GPIO_4_7 MXS_GPIO_NR(4, 7)
334#define ENET0_TXD1__GPIO_4_8 MXS_GPIO_NR(4, 8)
335#define ENET_CLK__GPIO_4_16 MXS_GPIO_NR(4, 16)
336
337#define TX28_FEC_PHY_POWER MXS_GPIO_NR(3, 29)
338#define TX28_FEC_PHY_RESET MXS_GPIO_NR(4, 13)
339#define TX28_FEC_nINT MXS_GPIO_NR(4, 5)
340
341static const struct gpio tx28_gpios[] __initconst = {
342 { ENET0_MDC__GPIO_4_0, GPIOF_OUT_INIT_LOW, "GPIO_4_0" },
343 { ENET0_MDIO__GPIO_4_1, GPIOF_OUT_INIT_LOW, "GPIO_4_1" },
344 { ENET0_RX_EN__GPIO_4_2, GPIOF_OUT_INIT_LOW, "GPIO_4_2" },
345 { ENET0_RXD0__GPIO_4_3, GPIOF_OUT_INIT_LOW, "GPIO_4_3" },
346 { ENET0_RXD1__GPIO_4_4, GPIOF_OUT_INIT_LOW, "GPIO_4_4" },
347 { ENET0_TX_EN__GPIO_4_6, GPIOF_OUT_INIT_LOW, "GPIO_4_6" },
348 { ENET0_TXD0__GPIO_4_7, GPIOF_OUT_INIT_LOW, "GPIO_4_7" },
349 { ENET0_TXD1__GPIO_4_8, GPIOF_OUT_INIT_LOW, "GPIO_4_8" },
350 { ENET_CLK__GPIO_4_16, GPIOF_OUT_INIT_LOW, "GPIO_4_16" },
351 { TX28_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-phy-power" },
352 { TX28_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW, "fec-phy-reset" },
353 { TX28_FEC_nINT, GPIOF_DIR_IN, "fec-int" },
354};
355
356static void __init tx28_post_init(void)
357{
358 struct device_node *np;
359 struct platform_device *pdev;
360 struct pinctrl *pctl;
361 int ret;
362
363 enable_clk_enet_out();
364
365 np = of_find_compatible_node(NULL, NULL, "fsl,imx28-fec");
366 pdev = of_find_device_by_node(np);
367 if (!pdev) {
368 pr_err("%s: failed to find fec device\n", __func__);
369 return;
370 }
371
372 pctl = pinctrl_get_select(&pdev->dev, "gpio_mode");
373 if (IS_ERR(pctl)) {
374 pr_err("%s: failed to get pinctrl state\n", __func__);
375 return;
376 }
377
378 ret = gpio_request_array(tx28_gpios, ARRAY_SIZE(tx28_gpios));
379 if (ret) {
380 pr_err("%s: failed to request gpios: %d\n", __func__, ret);
381 return;
382 }
383
384 /* Power up fec phy */
385 gpio_set_value(TX28_FEC_PHY_POWER, 1);
386 msleep(26); /* 25ms according to data sheet */
387
388 /* Mode strap pins */
389 gpio_set_value(ENET0_RX_EN__GPIO_4_2, 1);
390 gpio_set_value(ENET0_RXD0__GPIO_4_3, 1);
391 gpio_set_value(ENET0_RXD1__GPIO_4_4, 1);
392
393 udelay(100); /* minimum assertion time for nRST */
394
395 /* Deasserting FEC PHY RESET */
396 gpio_set_value(TX28_FEC_PHY_RESET, 1);
397
398 pinctrl_put(pctl);
399}
400
Maxime Ripard8eec4b32012-10-07 10:36:28 +0800401static void __init cfa10049_init(void)
402{
403 enable_clk_enet_out();
404 update_fec_mac_prop(OUI_CRYSTALFONTZ);
Maxime Ripard4a38a852013-03-05 16:13:35 +0100405
406 mxsfb_pdata.mode_list = cfa10049_video_modes;
407 mxsfb_pdata.mode_count = ARRAY_SIZE(cfa10049_video_modes);
408 mxsfb_pdata.default_bpp = 32;
409 mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100410 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT;
Maxime Ripard8eec4b32012-10-07 10:36:28 +0800411}
412
Maxime Riparde0f7d902013-01-26 13:40:37 +0800413static void __init cfa10037_init(void)
414{
415 enable_clk_enet_out();
416 update_fec_mac_prop(OUI_CRYSTALFONTZ);
417}
418
Julien Boibessota957fdc2012-10-18 11:50:26 +0200419static void __init apf28_init(void)
420{
421 enable_clk_enet_out();
Gwenhael Goavec-Meroua4dabca2012-11-02 19:01:48 +0100422
423 mxsfb_pdata.mode_list = apf28dev_video_modes;
424 mxsfb_pdata.mode_count = ARRAY_SIZE(apf28dev_video_modes);
425 mxsfb_pdata.default_bpp = 16;
426 mxsfb_pdata.ld_intf_width = STMLCDIF_16BIT;
Marek Vasut6a150752013-03-18 19:24:02 +0100427 mxsfb_pdata.sync = MXSFB_SYNC_DATA_ENABLE_HIGH_ACT |
428 MXSFB_SYNC_DOTCLK_FAILING_ACT;
Julien Boibessota957fdc2012-10-18 11:50:26 +0200429}
430
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800431static void __init mxs_machine_init(void)
432{
433 if (of_machine_is_compatible("fsl,imx28-evk"))
434 imx28_evk_init();
Shawn Guoab2815c2012-06-25 21:21:46 +0800435 else if (of_machine_is_compatible("fsl,imx23-evk"))
436 imx23_evk_init();
Marek Vasut8fa62e12012-07-07 21:21:38 +0800437 else if (of_machine_is_compatible("denx,m28evk"))
438 m28evk_init();
Shawn Guo3143bbb2012-07-07 23:12:03 +0800439 else if (of_machine_is_compatible("bluegiga,apx4devkit"))
440 apx4devkit_init();
Maxime Riparde0f7d902013-01-26 13:40:37 +0800441 else if (of_machine_is_compatible("crystalfontz,cfa10037"))
442 cfa10037_init();
Maxime Ripard8eec4b32012-10-07 10:36:28 +0800443 else if (of_machine_is_compatible("crystalfontz,cfa10049"))
444 cfa10049_init();
Julien Boibessota957fdc2012-10-18 11:50:26 +0200445 else if (of_machine_is_compatible("armadeus,imx28-apf28"))
446 apf28_init();
Marek Vasut160d5f22012-11-18 22:08:29 +0100447 else if (of_machine_is_compatible("schulercontrol,imx28-sps1"))
448 sc_sps1_init();
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800449
450 of_platform_populate(NULL, of_default_bus_match_table,
Shawn Guoab2815c2012-06-25 21:21:46 +0800451 mxs_auxdata_lookup, NULL);
Shawn Guo2c7c2c12012-07-13 14:15:34 +0800452
453 if (of_machine_is_compatible("karo,tx28"))
454 tx28_post_init();
Shawn Guo44ffb782012-08-06 22:00:45 +0800455
456 if (of_machine_is_compatible("fsl,imx28-evk"))
457 imx28_evk_post_init();
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800458}
459
Shawn Guo2954ff32012-05-04 21:33:42 +0800460static const char *imx23_dt_compat[] __initdata = {
Shawn Guo2954ff32012-05-04 21:33:42 +0800461 "fsl,imx23",
462 NULL,
463};
464
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800465static const char *imx28_dt_compat[] __initdata = {
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800466 "fsl,imx28",
467 NULL,
468};
469
Shawn Guo2954ff32012-05-04 21:33:42 +0800470DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
471 .map_io = mx23_map_io,
Shawn Guo83a84ef2012-08-20 21:34:56 +0800472 .init_irq = icoll_init_irq,
Shawn Guo4e0a1b82012-08-20 10:14:56 +0800473 .handle_irq = icoll_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700474 .init_time = imx23_timer_init,
Shawn Guo2954ff32012-05-04 21:33:42 +0800475 .init_machine = mxs_machine_init,
476 .dt_compat = imx23_dt_compat,
477 .restart = mxs_restart,
478MACHINE_END
479
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800480DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
481 .map_io = mx28_map_io,
Shawn Guo83a84ef2012-08-20 21:34:56 +0800482 .init_irq = icoll_init_irq,
Shawn Guo4e0a1b82012-08-20 10:14:56 +0800483 .handle_irq = icoll_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700484 .init_time = imx28_timer_init,
Dong Aishengbc3a59c2012-03-31 21:26:57 +0800485 .init_machine = mxs_machine_init,
486 .dt_compat = imx28_dt_compat,
487 .restart = mxs_restart,
488MACHINE_END