Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 1 | /* |
| 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 Guo | 44ffb78 | 2012-08-06 22:00:45 +0800 | [diff] [blame^] | 15 | #include <linux/can/platform/flexcan.h> |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 16 | #include <linux/delay.h> |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 17 | #include <linux/err.h> |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 18 | #include <linux/gpio.h> |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 19 | #include <linux/init.h> |
| 20 | #include <linux/irqdomain.h> |
Shawn Guo | 3143bbb | 2012-07-07 23:12:03 +0800 | [diff] [blame] | 21 | #include <linux/micrel_phy.h> |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 22 | #include <linux/mxsfb.h> |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 23 | #include <linux/of_irq.h> |
| 24 | #include <linux/of_platform.h> |
Shawn Guo | 3143bbb | 2012-07-07 23:12:03 +0800 | [diff] [blame] | 25 | #include <linux/phy.h> |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 26 | #include <linux/pinctrl/consumer.h> |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 27 | #include <asm/mach/arch.h> |
| 28 | #include <asm/mach/time.h> |
| 29 | #include <mach/common.h> |
Dong Aisheng | e317317 | 2012-08-01 11:20:16 +0800 | [diff] [blame] | 30 | #include <mach/digctl.h> |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 31 | #include <mach/mxs.h> |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 32 | |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 33 | static struct fb_videomode mx23evk_video_modes[] = { |
| 34 | { |
| 35 | .name = "Samsung-LMS430HF02", |
| 36 | .refresh = 60, |
| 37 | .xres = 480, |
| 38 | .yres = 272, |
| 39 | .pixclock = 108096, /* picosecond (9.2 MHz) */ |
| 40 | .left_margin = 15, |
| 41 | .right_margin = 8, |
| 42 | .upper_margin = 12, |
| 43 | .lower_margin = 4, |
| 44 | .hsync_len = 1, |
| 45 | .vsync_len = 1, |
| 46 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | |
| 47 | FB_SYNC_DOTCLK_FAILING_ACT, |
| 48 | }, |
| 49 | }; |
| 50 | |
| 51 | static struct fb_videomode mx28evk_video_modes[] = { |
| 52 | { |
| 53 | .name = "Seiko-43WVF1G", |
| 54 | .refresh = 60, |
| 55 | .xres = 800, |
| 56 | .yres = 480, |
| 57 | .pixclock = 29851, /* picosecond (33.5 MHz) */ |
| 58 | .left_margin = 89, |
| 59 | .right_margin = 164, |
| 60 | .upper_margin = 23, |
| 61 | .lower_margin = 10, |
| 62 | .hsync_len = 10, |
| 63 | .vsync_len = 10, |
| 64 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT | |
| 65 | FB_SYNC_DOTCLK_FAILING_ACT, |
| 66 | }, |
| 67 | }; |
| 68 | |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 69 | static struct fb_videomode m28evk_video_modes[] = { |
| 70 | { |
| 71 | .name = "Ampire AM-800480R2TMQW-T01H", |
| 72 | .refresh = 60, |
| 73 | .xres = 800, |
| 74 | .yres = 480, |
| 75 | .pixclock = 30066, /* picosecond (33.26 MHz) */ |
| 76 | .left_margin = 0, |
| 77 | .right_margin = 256, |
| 78 | .upper_margin = 0, |
| 79 | .lower_margin = 45, |
| 80 | .hsync_len = 1, |
| 81 | .vsync_len = 1, |
| 82 | .sync = FB_SYNC_DATA_ENABLE_HIGH_ACT, |
| 83 | }, |
| 84 | }; |
| 85 | |
Lauri Hintsala | d8bb823 | 2012-07-10 10:08:08 +0300 | [diff] [blame] | 86 | static struct fb_videomode apx4devkit_video_modes[] = { |
| 87 | { |
| 88 | .name = "HannStar PJ70112A", |
| 89 | .refresh = 60, |
| 90 | .xres = 800, |
| 91 | .yres = 480, |
| 92 | .pixclock = 33333, /* picosecond (30.00 MHz) */ |
| 93 | .left_margin = 88, |
| 94 | .right_margin = 40, |
| 95 | .upper_margin = 32, |
| 96 | .lower_margin = 13, |
| 97 | .hsync_len = 48, |
| 98 | .vsync_len = 3, |
| 99 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT | |
| 100 | FB_SYNC_DATA_ENABLE_HIGH_ACT | |
| 101 | FB_SYNC_DOTCLK_FAILING_ACT, |
| 102 | }, |
| 103 | }; |
| 104 | |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 105 | static struct mxsfb_platform_data mxsfb_pdata __initdata; |
| 106 | |
Shawn Guo | 44ffb78 | 2012-08-06 22:00:45 +0800 | [diff] [blame^] | 107 | /* |
| 108 | * MX28EVK_FLEXCAN_SWITCH is shared between both flexcan controllers |
| 109 | */ |
| 110 | #define MX28EVK_FLEXCAN_SWITCH MXS_GPIO_NR(2, 13) |
| 111 | |
| 112 | static int flexcan0_en, flexcan1_en; |
| 113 | |
| 114 | static void mx28evk_flexcan_switch(void) |
| 115 | { |
| 116 | if (flexcan0_en || flexcan1_en) |
| 117 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 1); |
| 118 | else |
| 119 | gpio_set_value(MX28EVK_FLEXCAN_SWITCH, 0); |
| 120 | } |
| 121 | |
| 122 | static void mx28evk_flexcan0_switch(int enable) |
| 123 | { |
| 124 | flexcan0_en = enable; |
| 125 | mx28evk_flexcan_switch(); |
| 126 | } |
| 127 | |
| 128 | static void mx28evk_flexcan1_switch(int enable) |
| 129 | { |
| 130 | flexcan1_en = enable; |
| 131 | mx28evk_flexcan_switch(); |
| 132 | } |
| 133 | |
| 134 | static struct flexcan_platform_data flexcan_pdata[2]; |
| 135 | |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 136 | static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = { |
| 137 | OF_DEV_AUXDATA("fsl,imx23-lcdif", 0x80030000, NULL, &mxsfb_pdata), |
| 138 | OF_DEV_AUXDATA("fsl,imx28-lcdif", 0x80030000, NULL, &mxsfb_pdata), |
Shawn Guo | 44ffb78 | 2012-08-06 22:00:45 +0800 | [diff] [blame^] | 139 | OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80032000, NULL, &flexcan_pdata[0]), |
| 140 | OF_DEV_AUXDATA("fsl,imx28-flexcan", 0x80034000, NULL, &flexcan_pdata[1]), |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 141 | { /* sentinel */ } |
| 142 | }; |
| 143 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 144 | static int __init mxs_icoll_add_irq_domain(struct device_node *np, |
| 145 | struct device_node *interrupt_parent) |
| 146 | { |
| 147 | irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); |
| 148 | |
| 149 | return 0; |
| 150 | } |
| 151 | |
Shawn Guo | ce4c6f9 | 2012-05-04 14:32:35 +0800 | [diff] [blame] | 152 | static int __init mxs_gpio_add_irq_domain(struct device_node *np, |
| 153 | struct device_node *interrupt_parent) |
| 154 | { |
| 155 | static int gpio_irq_base = MXS_GPIO_IRQ_START; |
| 156 | |
| 157 | irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); |
| 158 | gpio_irq_base += 32; |
| 159 | |
| 160 | return 0; |
| 161 | } |
| 162 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 163 | static const struct of_device_id mxs_irq_match[] __initconst = { |
| 164 | { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, }, |
Shawn Guo | ce4c6f9 | 2012-05-04 14:32:35 +0800 | [diff] [blame] | 165 | { .compatible = "fsl,mxs-gpio", .data = mxs_gpio_add_irq_domain, }, |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 166 | { /* sentinel */ } |
| 167 | }; |
| 168 | |
| 169 | static void __init mxs_dt_init_irq(void) |
| 170 | { |
| 171 | icoll_init_irq(); |
| 172 | of_irq_init(mxs_irq_match); |
| 173 | } |
| 174 | |
Shawn Guo | 2954ff3 | 2012-05-04 21:33:42 +0800 | [diff] [blame] | 175 | static void __init imx23_timer_init(void) |
| 176 | { |
| 177 | mx23_clocks_init(); |
| 178 | } |
| 179 | |
| 180 | static struct sys_timer imx23_timer = { |
| 181 | .init = imx23_timer_init, |
| 182 | }; |
| 183 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 184 | static void __init imx28_timer_init(void) |
| 185 | { |
| 186 | mx28_clocks_init(); |
| 187 | } |
| 188 | |
| 189 | static struct sys_timer imx28_timer = { |
| 190 | .init = imx28_timer_init, |
| 191 | }; |
| 192 | |
Shawn Guo | 5653acc | 2012-06-19 22:38:14 +0800 | [diff] [blame] | 193 | enum mac_oui { |
| 194 | OUI_FSL, |
| 195 | OUI_DENX, |
| 196 | }; |
| 197 | |
| 198 | static void __init update_fec_mac_prop(enum mac_oui oui) |
| 199 | { |
| 200 | struct device_node *np, *from = NULL; |
Shawn Guo | fa7c865 | 2012-07-13 14:13:55 +0800 | [diff] [blame] | 201 | struct property *newmac; |
Shawn Guo | 5653acc | 2012-06-19 22:38:14 +0800 | [diff] [blame] | 202 | const u32 *ocotp = mxs_get_ocotp(); |
| 203 | u8 *macaddr; |
| 204 | u32 val; |
| 205 | int i; |
| 206 | |
| 207 | for (i = 0; i < 2; i++) { |
| 208 | np = of_find_compatible_node(from, NULL, "fsl,imx28-fec"); |
| 209 | if (!np) |
| 210 | return; |
| 211 | from = np; |
| 212 | |
| 213 | newmac = kzalloc(sizeof(*newmac) + 6, GFP_KERNEL); |
| 214 | if (!newmac) |
| 215 | return; |
| 216 | newmac->value = newmac + 1; |
| 217 | newmac->length = 6; |
| 218 | |
| 219 | newmac->name = kstrdup("local-mac-address", GFP_KERNEL); |
| 220 | if (!newmac->name) { |
| 221 | kfree(newmac); |
| 222 | return; |
| 223 | } |
| 224 | |
| 225 | /* |
| 226 | * OCOTP only stores the last 4 octets for each mac address, |
| 227 | * so hard-code OUI here. |
| 228 | */ |
| 229 | macaddr = newmac->value; |
| 230 | switch (oui) { |
| 231 | case OUI_FSL: |
| 232 | macaddr[0] = 0x00; |
| 233 | macaddr[1] = 0x04; |
| 234 | macaddr[2] = 0x9f; |
| 235 | break; |
| 236 | case OUI_DENX: |
| 237 | macaddr[0] = 0xc0; |
| 238 | macaddr[1] = 0xe5; |
| 239 | macaddr[2] = 0x4e; |
| 240 | break; |
| 241 | } |
| 242 | val = ocotp[i]; |
| 243 | macaddr[3] = (val >> 16) & 0xff; |
| 244 | macaddr[4] = (val >> 8) & 0xff; |
| 245 | macaddr[5] = (val >> 0) & 0xff; |
| 246 | |
Shawn Guo | fa7c865 | 2012-07-13 14:13:55 +0800 | [diff] [blame] | 247 | prom_update_property(np, newmac); |
Shawn Guo | 5653acc | 2012-06-19 22:38:14 +0800 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 251 | static void __init imx23_evk_init(void) |
| 252 | { |
| 253 | mxsfb_pdata.mode_list = mx23evk_video_modes; |
| 254 | mxsfb_pdata.mode_count = ARRAY_SIZE(mx23evk_video_modes); |
| 255 | mxsfb_pdata.default_bpp = 32; |
| 256 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; |
| 257 | } |
| 258 | |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 259 | static inline void enable_clk_enet_out(void) |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 260 | { |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 261 | struct clk *clk = clk_get_sys("enet_out", NULL); |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 262 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 263 | if (!IS_ERR(clk)) |
| 264 | clk_prepare_enable(clk); |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 265 | } |
Shawn Guo | 5653acc | 2012-06-19 22:38:14 +0800 | [diff] [blame] | 266 | |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 267 | static void __init imx28_evk_init(void) |
| 268 | { |
| 269 | enable_clk_enet_out(); |
Shawn Guo | 5653acc | 2012-06-19 22:38:14 +0800 | [diff] [blame] | 270 | update_fec_mac_prop(OUI_FSL); |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 271 | |
| 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; |
Dong Aisheng | e317317 | 2012-08-01 11:20:16 +0800 | [diff] [blame] | 276 | |
| 277 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 278 | } |
| 279 | |
Shawn Guo | 44ffb78 | 2012-08-06 22:00:45 +0800 | [diff] [blame^] | 280 | static void __init imx28_evk_post_init(void) |
| 281 | { |
| 282 | if (!gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, |
| 283 | "flexcan-switch")) { |
| 284 | flexcan_pdata[0].transceiver_switch = mx28evk_flexcan0_switch; |
| 285 | flexcan_pdata[1].transceiver_switch = mx28evk_flexcan1_switch; |
| 286 | } |
| 287 | } |
| 288 | |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 289 | static void __init m28evk_init(void) |
| 290 | { |
| 291 | enable_clk_enet_out(); |
| 292 | update_fec_mac_prop(OUI_DENX); |
| 293 | |
| 294 | mxsfb_pdata.mode_list = m28evk_video_modes; |
| 295 | mxsfb_pdata.mode_count = ARRAY_SIZE(m28evk_video_modes); |
| 296 | mxsfb_pdata.default_bpp = 16; |
| 297 | mxsfb_pdata.ld_intf_width = STMLCDIF_18BIT; |
| 298 | } |
| 299 | |
Shawn Guo | 3143bbb | 2012-07-07 23:12:03 +0800 | [diff] [blame] | 300 | static int apx4devkit_phy_fixup(struct phy_device *phy) |
| 301 | { |
| 302 | phy->dev_flags |= MICREL_PHY_50MHZ_CLK; |
| 303 | return 0; |
| 304 | } |
| 305 | |
| 306 | static void __init apx4devkit_init(void) |
| 307 | { |
| 308 | enable_clk_enet_out(); |
| 309 | |
| 310 | if (IS_BUILTIN(CONFIG_PHYLIB)) |
| 311 | phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, |
| 312 | apx4devkit_phy_fixup); |
Lauri Hintsala | d8bb823 | 2012-07-10 10:08:08 +0300 | [diff] [blame] | 313 | |
| 314 | mxsfb_pdata.mode_list = apx4devkit_video_modes; |
| 315 | mxsfb_pdata.mode_count = ARRAY_SIZE(apx4devkit_video_modes); |
| 316 | mxsfb_pdata.default_bpp = 32; |
| 317 | mxsfb_pdata.ld_intf_width = STMLCDIF_24BIT; |
Shawn Guo | 3143bbb | 2012-07-07 23:12:03 +0800 | [diff] [blame] | 318 | } |
| 319 | |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 320 | #define ENET0_MDC__GPIO_4_0 MXS_GPIO_NR(4, 0) |
| 321 | #define ENET0_MDIO__GPIO_4_1 MXS_GPIO_NR(4, 1) |
| 322 | #define ENET0_RX_EN__GPIO_4_2 MXS_GPIO_NR(4, 2) |
| 323 | #define ENET0_RXD0__GPIO_4_3 MXS_GPIO_NR(4, 3) |
| 324 | #define ENET0_RXD1__GPIO_4_4 MXS_GPIO_NR(4, 4) |
| 325 | #define ENET0_TX_EN__GPIO_4_6 MXS_GPIO_NR(4, 6) |
| 326 | #define ENET0_TXD0__GPIO_4_7 MXS_GPIO_NR(4, 7) |
| 327 | #define ENET0_TXD1__GPIO_4_8 MXS_GPIO_NR(4, 8) |
| 328 | #define ENET_CLK__GPIO_4_16 MXS_GPIO_NR(4, 16) |
| 329 | |
| 330 | #define TX28_FEC_PHY_POWER MXS_GPIO_NR(3, 29) |
| 331 | #define TX28_FEC_PHY_RESET MXS_GPIO_NR(4, 13) |
| 332 | #define TX28_FEC_nINT MXS_GPIO_NR(4, 5) |
| 333 | |
| 334 | static const struct gpio tx28_gpios[] __initconst = { |
| 335 | { ENET0_MDC__GPIO_4_0, GPIOF_OUT_INIT_LOW, "GPIO_4_0" }, |
| 336 | { ENET0_MDIO__GPIO_4_1, GPIOF_OUT_INIT_LOW, "GPIO_4_1" }, |
| 337 | { ENET0_RX_EN__GPIO_4_2, GPIOF_OUT_INIT_LOW, "GPIO_4_2" }, |
| 338 | { ENET0_RXD0__GPIO_4_3, GPIOF_OUT_INIT_LOW, "GPIO_4_3" }, |
| 339 | { ENET0_RXD1__GPIO_4_4, GPIOF_OUT_INIT_LOW, "GPIO_4_4" }, |
| 340 | { ENET0_TX_EN__GPIO_4_6, GPIOF_OUT_INIT_LOW, "GPIO_4_6" }, |
| 341 | { ENET0_TXD0__GPIO_4_7, GPIOF_OUT_INIT_LOW, "GPIO_4_7" }, |
| 342 | { ENET0_TXD1__GPIO_4_8, GPIOF_OUT_INIT_LOW, "GPIO_4_8" }, |
| 343 | { ENET_CLK__GPIO_4_16, GPIOF_OUT_INIT_LOW, "GPIO_4_16" }, |
| 344 | { TX28_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-phy-power" }, |
| 345 | { TX28_FEC_PHY_RESET, GPIOF_OUT_INIT_LOW, "fec-phy-reset" }, |
| 346 | { TX28_FEC_nINT, GPIOF_DIR_IN, "fec-int" }, |
| 347 | }; |
| 348 | |
| 349 | static void __init tx28_post_init(void) |
| 350 | { |
| 351 | struct device_node *np; |
| 352 | struct platform_device *pdev; |
| 353 | struct pinctrl *pctl; |
| 354 | int ret; |
| 355 | |
| 356 | enable_clk_enet_out(); |
| 357 | |
| 358 | np = of_find_compatible_node(NULL, NULL, "fsl,imx28-fec"); |
| 359 | pdev = of_find_device_by_node(np); |
| 360 | if (!pdev) { |
| 361 | pr_err("%s: failed to find fec device\n", __func__); |
| 362 | return; |
| 363 | } |
| 364 | |
| 365 | pctl = pinctrl_get_select(&pdev->dev, "gpio_mode"); |
| 366 | if (IS_ERR(pctl)) { |
| 367 | pr_err("%s: failed to get pinctrl state\n", __func__); |
| 368 | return; |
| 369 | } |
| 370 | |
| 371 | ret = gpio_request_array(tx28_gpios, ARRAY_SIZE(tx28_gpios)); |
| 372 | if (ret) { |
| 373 | pr_err("%s: failed to request gpios: %d\n", __func__, ret); |
| 374 | return; |
| 375 | } |
| 376 | |
| 377 | /* Power up fec phy */ |
| 378 | gpio_set_value(TX28_FEC_PHY_POWER, 1); |
| 379 | msleep(26); /* 25ms according to data sheet */ |
| 380 | |
| 381 | /* Mode strap pins */ |
| 382 | gpio_set_value(ENET0_RX_EN__GPIO_4_2, 1); |
| 383 | gpio_set_value(ENET0_RXD0__GPIO_4_3, 1); |
| 384 | gpio_set_value(ENET0_RXD1__GPIO_4_4, 1); |
| 385 | |
| 386 | udelay(100); /* minimum assertion time for nRST */ |
| 387 | |
| 388 | /* Deasserting FEC PHY RESET */ |
| 389 | gpio_set_value(TX28_FEC_PHY_RESET, 1); |
| 390 | |
| 391 | pinctrl_put(pctl); |
| 392 | } |
| 393 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 394 | static void __init mxs_machine_init(void) |
| 395 | { |
| 396 | if (of_machine_is_compatible("fsl,imx28-evk")) |
| 397 | imx28_evk_init(); |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 398 | else if (of_machine_is_compatible("fsl,imx23-evk")) |
| 399 | imx23_evk_init(); |
Marek Vasut | 8fa62e1 | 2012-07-07 21:21:38 +0800 | [diff] [blame] | 400 | else if (of_machine_is_compatible("denx,m28evk")) |
| 401 | m28evk_init(); |
Shawn Guo | 3143bbb | 2012-07-07 23:12:03 +0800 | [diff] [blame] | 402 | else if (of_machine_is_compatible("bluegiga,apx4devkit")) |
| 403 | apx4devkit_init(); |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 404 | |
| 405 | of_platform_populate(NULL, of_default_bus_match_table, |
Shawn Guo | ab2815c | 2012-06-25 21:21:46 +0800 | [diff] [blame] | 406 | mxs_auxdata_lookup, NULL); |
Shawn Guo | 2c7c2c1 | 2012-07-13 14:15:34 +0800 | [diff] [blame] | 407 | |
| 408 | if (of_machine_is_compatible("karo,tx28")) |
| 409 | tx28_post_init(); |
Shawn Guo | 44ffb78 | 2012-08-06 22:00:45 +0800 | [diff] [blame^] | 410 | |
| 411 | if (of_machine_is_compatible("fsl,imx28-evk")) |
| 412 | imx28_evk_post_init(); |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 413 | } |
| 414 | |
Shawn Guo | 2954ff3 | 2012-05-04 21:33:42 +0800 | [diff] [blame] | 415 | static const char *imx23_dt_compat[] __initdata = { |
Shawn Guo | 2954ff3 | 2012-05-04 21:33:42 +0800 | [diff] [blame] | 416 | "fsl,imx23", |
| 417 | NULL, |
| 418 | }; |
| 419 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 420 | static const char *imx28_dt_compat[] __initdata = { |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 421 | "fsl,imx28", |
| 422 | NULL, |
| 423 | }; |
| 424 | |
Shawn Guo | 2954ff3 | 2012-05-04 21:33:42 +0800 | [diff] [blame] | 425 | DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)") |
| 426 | .map_io = mx23_map_io, |
| 427 | .init_irq = mxs_dt_init_irq, |
| 428 | .timer = &imx23_timer, |
| 429 | .init_machine = mxs_machine_init, |
| 430 | .dt_compat = imx23_dt_compat, |
| 431 | .restart = mxs_restart, |
| 432 | MACHINE_END |
| 433 | |
Dong Aisheng | bc3a59c | 2012-03-31 21:26:57 +0800 | [diff] [blame] | 434 | DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)") |
| 435 | .map_io = mx28_map_io, |
| 436 | .init_irq = mxs_dt_init_irq, |
| 437 | .timer = &imx28_timer, |
| 438 | .init_machine = mxs_machine_init, |
| 439 | .dt_compat = imx28_dt_compat, |
| 440 | .restart = mxs_restart, |
| 441 | MACHINE_END |