diff options
Diffstat (limited to 'arch/arm/mach-mxs/mach-mx28evk.c')
-rw-r--r-- | arch/arm/mach-mxs/mach-mx28evk.c | 80 |
1 files changed, 18 insertions, 62 deletions
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c index fdb0a5664dd6..e386c142f93c 100644 --- a/arch/arm/mach-mxs/mach-mx28evk.c +++ b/arch/arm/mach-mxs/mach-mx28evk.c | |||
@@ -223,7 +223,6 @@ static const struct gpio_led_platform_data mx28evk_led_data __initconst = { | |||
223 | /* fec */ | 223 | /* fec */ |
224 | static void __init mx28evk_fec_reset(void) | 224 | static void __init mx28evk_fec_reset(void) |
225 | { | 225 | { |
226 | int ret; | ||
227 | struct clk *clk; | 226 | struct clk *clk; |
228 | 227 | ||
229 | /* Enable fec phy clock */ | 228 | /* Enable fec phy clock */ |
@@ -231,32 +230,7 @@ static void __init mx28evk_fec_reset(void) | |||
231 | if (!IS_ERR(clk)) | 230 | if (!IS_ERR(clk)) |
232 | clk_prepare_enable(clk); | 231 | clk_prepare_enable(clk); |
233 | 232 | ||
234 | /* Power up fec phy */ | 233 | gpio_set_value(MX28EVK_FEC_PHY_RESET, 0); |
235 | ret = gpio_request(MX28EVK_FEC_PHY_POWER, "fec-phy-power"); | ||
236 | if (ret) { | ||
237 | pr_err("Failed to request gpio fec-phy-%s: %d\n", "power", ret); | ||
238 | return; | ||
239 | } | ||
240 | |||
241 | ret = gpio_direction_output(MX28EVK_FEC_PHY_POWER, 0); | ||
242 | if (ret) { | ||
243 | pr_err("Failed to drive gpio fec-phy-%s: %d\n", "power", ret); | ||
244 | return; | ||
245 | } | ||
246 | |||
247 | /* Reset fec phy */ | ||
248 | ret = gpio_request(MX28EVK_FEC_PHY_RESET, "fec-phy-reset"); | ||
249 | if (ret) { | ||
250 | pr_err("Failed to request gpio fec-phy-%s: %d\n", "reset", ret); | ||
251 | return; | ||
252 | } | ||
253 | |||
254 | gpio_direction_output(MX28EVK_FEC_PHY_RESET, 0); | ||
255 | if (ret) { | ||
256 | pr_err("Failed to drive gpio fec-phy-%s: %d\n", "reset", ret); | ||
257 | return; | ||
258 | } | ||
259 | |||
260 | mdelay(1); | 234 | mdelay(1); |
261 | gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); | 235 | gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); |
262 | } | 236 | } |
@@ -278,14 +252,14 @@ static int __init mx28evk_fec_get_mac(void) | |||
278 | const u32 *ocotp = mxs_get_ocotp(); | 252 | const u32 *ocotp = mxs_get_ocotp(); |
279 | 253 | ||
280 | if (!ocotp) | 254 | if (!ocotp) |
281 | goto error; | 255 | return -ETIMEDOUT; |
282 | 256 | ||
283 | /* | 257 | /* |
284 | * OCOTP only stores the last 4 octets for each mac address, | 258 | * OCOTP only stores the last 4 octets for each mac address, |
285 | * so hard-code Freescale OUI (00:04:9f) here. | 259 | * so hard-code Freescale OUI (00:04:9f) here. |
286 | */ | 260 | */ |
287 | for (i = 0; i < 2; i++) { | 261 | for (i = 0; i < 2; i++) { |
288 | val = ocotp[i * 4]; | 262 | val = ocotp[i]; |
289 | mx28_fec_pdata[i].mac[0] = 0x00; | 263 | mx28_fec_pdata[i].mac[0] = 0x00; |
290 | mx28_fec_pdata[i].mac[1] = 0x04; | 264 | mx28_fec_pdata[i].mac[1] = 0x04; |
291 | mx28_fec_pdata[i].mac[2] = 0x9f; | 265 | mx28_fec_pdata[i].mac[2] = 0x9f; |
@@ -295,10 +269,6 @@ static int __init mx28evk_fec_get_mac(void) | |||
295 | } | 269 | } |
296 | 270 | ||
297 | return 0; | 271 | return 0; |
298 | |||
299 | error: | ||
300 | pr_err("%s: timeout when reading fec mac from OCOTP\n", __func__); | ||
301 | return -ETIMEDOUT; | ||
302 | } | 272 | } |
303 | 273 | ||
304 | /* | 274 | /* |
@@ -417,9 +387,14 @@ static void __init mx28evk_add_regulators(void) | |||
417 | static void __init mx28evk_add_regulators(void) {} | 387 | static void __init mx28evk_add_regulators(void) {} |
418 | #endif | 388 | #endif |
419 | 389 | ||
420 | static struct gpio mx28evk_lcd_gpios[] = { | 390 | static const struct gpio mx28evk_gpios[] __initconst = { |
421 | { MX28EVK_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, "lcd-enable" }, | 391 | { MX28EVK_LCD_ENABLE, GPIOF_OUT_INIT_HIGH, "lcd-enable" }, |
422 | { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" }, | 392 | { MX28EVK_BL_ENABLE, GPIOF_OUT_INIT_HIGH, "bl-enable" }, |
393 | { MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, "flexcan-switch" }, | ||
394 | { MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc0-slot-power" }, | ||
395 | { MX28EVK_MMC1_SLOT_POWER, GPIOF_OUT_INIT_LOW, "mmc1-slot-power" }, | ||
396 | { MX28EVK_FEC_PHY_POWER, GPIOF_OUT_INIT_LOW, "fec-phy-power" }, | ||
397 | { MX28EVK_FEC_PHY_RESET, GPIOF_DIR_OUT, "fec-phy-reset" }, | ||
423 | }; | 398 | }; |
424 | 399 | ||
425 | static const struct mxs_saif_platform_data | 400 | static const struct mxs_saif_platform_data |
@@ -447,25 +422,18 @@ static void __init mx28evk_init(void) | |||
447 | if (mx28evk_fec_get_mac()) | 422 | if (mx28evk_fec_get_mac()) |
448 | pr_warn("%s: failed on fec mac setup\n", __func__); | 423 | pr_warn("%s: failed on fec mac setup\n", __func__); |
449 | 424 | ||
425 | ret = gpio_request_array(mx28evk_gpios, ARRAY_SIZE(mx28evk_gpios)); | ||
426 | if (ret) | ||
427 | pr_err("One or more GPIOs failed to be requested: %d\n", ret); | ||
428 | |||
450 | mx28evk_fec_reset(); | 429 | mx28evk_fec_reset(); |
451 | mx28_add_fec(0, &mx28_fec_pdata[0]); | 430 | mx28_add_fec(0, &mx28_fec_pdata[0]); |
452 | mx28_add_fec(1, &mx28_fec_pdata[1]); | 431 | mx28_add_fec(1, &mx28_fec_pdata[1]); |
453 | 432 | ||
454 | ret = gpio_request_one(MX28EVK_FLEXCAN_SWITCH, GPIOF_DIR_OUT, | 433 | mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); |
455 | "flexcan-switch"); | 434 | mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); |
456 | if (ret) { | ||
457 | pr_err("failed to request gpio flexcan-switch: %d\n", ret); | ||
458 | } else { | ||
459 | mx28_add_flexcan(0, &mx28evk_flexcan_pdata[0]); | ||
460 | mx28_add_flexcan(1, &mx28evk_flexcan_pdata[1]); | ||
461 | } | ||
462 | 435 | ||
463 | ret = gpio_request_array(mx28evk_lcd_gpios, | 436 | mx28_add_mxsfb(&mx28evk_mxsfb_pdata); |
464 | ARRAY_SIZE(mx28evk_lcd_gpios)); | ||
465 | if (ret) | ||
466 | pr_warn("failed to request gpio pins for lcd: %d\n", ret); | ||
467 | else | ||
468 | mx28_add_mxsfb(&mx28evk_mxsfb_pdata); | ||
469 | 437 | ||
470 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); | 438 | mxs_saif_clkmux_select(MXS_DIGCTL_SAIF_CLKMUX_EXTMSTR0); |
471 | mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]); | 439 | mx28_add_saif(0, &mx28evk_mxs_saif_pdata[0]); |
@@ -480,20 +448,8 @@ static void __init mx28evk_init(void) | |||
480 | mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, | 448 | mxs_add_platform_device("mxs-sgtl5000", 0, NULL, 0, |
481 | NULL, 0); | 449 | NULL, 0); |
482 | 450 | ||
483 | /* power on mmc slot by writing 0 to the gpio */ | 451 | mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]); |
484 | ret = gpio_request_one(MX28EVK_MMC0_SLOT_POWER, GPIOF_OUT_INIT_LOW, | 452 | mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); |
485 | "mmc0-slot-power"); | ||
486 | if (ret) | ||
487 | pr_warn("failed to request gpio mmc0-slot-power: %d\n", ret); | ||
488 | else | ||
489 | mx28_add_mxs_mmc(0, &mx28evk_mmc_pdata[0]); | ||
490 | |||
491 | ret = gpio_request_one(MX28EVK_MMC1_SLOT_POWER, GPIOF_OUT_INIT_LOW, | ||
492 | "mmc1-slot-power"); | ||
493 | if (ret) | ||
494 | pr_warn("failed to request gpio mmc1-slot-power: %d\n", ret); | ||
495 | else | ||
496 | mx28_add_mxs_mmc(1, &mx28evk_mmc_pdata[1]); | ||
497 | 453 | ||
498 | mx28_add_rtc_stmp3xxx(); | 454 | mx28_add_rtc_stmp3xxx(); |
499 | 455 | ||