diff options
author | Tony Lindgren <tony@atomide.com> | 2013-11-25 18:17:09 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-11-25 18:31:16 -0500 |
commit | c8f27e977310b3684ff9245a94aad55d0ee27c9f (patch) | |
tree | 59631edabcd2f5ab0ead870ca18f32109d3c2e91 /arch/arm | |
parent | 036582f76ad900e4c1b9ec290ce66c6f698bd00d (diff) |
ARM: OMAP2+: Add device tree compatible revision checks for n8x0
This allows us to initialize the legacy devices when booted
with device tree.
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/board-n8x0.c | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 827d15009a86..d61a00dba419 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -42,6 +42,38 @@ | |||
42 | #define TUSB6010_GPIO_ENABLE 0 | 42 | #define TUSB6010_GPIO_ENABLE 0 |
43 | #define TUSB6010_DMACHAN 0x3f | 43 | #define TUSB6010_DMACHAN 0x3f |
44 | 44 | ||
45 | #define NOKIA_N810_WIMAX (1 << 2) | ||
46 | #define NOKIA_N810 (1 << 1) | ||
47 | #define NOKIA_N800 (1 << 0) | ||
48 | |||
49 | static u32 board_caps; | ||
50 | |||
51 | #define board_is_n800() (board_caps & NOKIA_N800) | ||
52 | #define board_is_n810() (board_caps & NOKIA_N810) | ||
53 | #define board_is_n810_wimax() (board_caps & NOKIA_N810_WIMAX) | ||
54 | |||
55 | static void board_check_revision(void) | ||
56 | { | ||
57 | if (of_have_populated_dt()) { | ||
58 | if (of_machine_is_compatible("nokia,n800")) | ||
59 | board_caps = NOKIA_N800; | ||
60 | else if (of_machine_is_compatible("nokia,n810")) | ||
61 | board_caps = NOKIA_N810; | ||
62 | else if (of_machine_is_compatible("nokia,n810-wimax")) | ||
63 | board_caps = NOKIA_N810_WIMAX; | ||
64 | } else { | ||
65 | if (machine_is_nokia_n800()) | ||
66 | board_caps = NOKIA_N800; | ||
67 | else if (machine_is_nokia_n810()) | ||
68 | board_caps = NOKIA_N810; | ||
69 | else if (machine_is_nokia_n810_wimax()) | ||
70 | board_caps = NOKIA_N810_WIMAX; | ||
71 | } | ||
72 | |||
73 | if (!board_caps) | ||
74 | pr_err("Unknown board\n"); | ||
75 | } | ||
76 | |||
45 | #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) | 77 | #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) |
46 | static struct i2c_cbus_platform_data n8x0_cbus_data = { | 78 | static struct i2c_cbus_platform_data n8x0_cbus_data = { |
47 | .clk_gpio = 66, | 79 | .clk_gpio = 66, |
@@ -342,7 +374,7 @@ static void n810_set_power_emmc(struct device *dev, | |||
342 | static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, | 374 | static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, |
343 | int vdd) | 375 | int vdd) |
344 | { | 376 | { |
345 | if (machine_is_nokia_n800() || slot == 0) | 377 | if (board_is_n800() || slot == 0) |
346 | return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); | 378 | return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); |
347 | 379 | ||
348 | n810_set_power_emmc(dev, power_on); | 380 | n810_set_power_emmc(dev, power_on); |
@@ -388,7 +420,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) | |||
388 | { | 420 | { |
389 | int bit, *openp, index; | 421 | int bit, *openp, index; |
390 | 422 | ||
391 | if (machine_is_nokia_n800()) { | 423 | if (board_is_n800()) { |
392 | bit = 1 << 1; | 424 | bit = 1 << 1; |
393 | openp = &slot2_cover_open; | 425 | openp = &slot2_cover_open; |
394 | index = 1; | 426 | index = 1; |
@@ -421,7 +453,7 @@ static int n8x0_mmc_late_init(struct device *dev) | |||
421 | if (r < 0) | 453 | if (r < 0) |
422 | return r; | 454 | return r; |
423 | 455 | ||
424 | if (machine_is_nokia_n800()) | 456 | if (board_is_n800()) |
425 | vs2sel = 0; | 457 | vs2sel = 0; |
426 | else | 458 | else |
427 | vs2sel = 2; | 459 | vs2sel = 2; |
@@ -444,7 +476,7 @@ static int n8x0_mmc_late_init(struct device *dev) | |||
444 | if (r < 0) | 476 | if (r < 0) |
445 | return r; | 477 | return r; |
446 | 478 | ||
447 | if (machine_is_nokia_n800()) { | 479 | if (board_is_n800()) { |
448 | bit = 1 << 1; | 480 | bit = 1 << 1; |
449 | openp = &slot2_cover_open; | 481 | openp = &slot2_cover_open; |
450 | } else { | 482 | } else { |
@@ -471,7 +503,7 @@ static void n8x0_mmc_shutdown(struct device *dev) | |||
471 | { | 503 | { |
472 | int vs2sel; | 504 | int vs2sel; |
473 | 505 | ||
474 | if (machine_is_nokia_n800()) | 506 | if (board_is_n800()) |
475 | vs2sel = 0; | 507 | vs2sel = 0; |
476 | else | 508 | else |
477 | vs2sel = 2; | 509 | vs2sel = 2; |
@@ -486,7 +518,7 @@ static void n8x0_mmc_cleanup(struct device *dev) | |||
486 | 518 | ||
487 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | 519 | gpio_free(N8X0_SLOT_SWITCH_GPIO); |
488 | 520 | ||
489 | if (machine_is_nokia_n810()) { | 521 | if (board_is_n810()) { |
490 | gpio_free(N810_EMMC_VSD_GPIO); | 522 | gpio_free(N810_EMMC_VSD_GPIO); |
491 | gpio_free(N810_EMMC_VIO_GPIO); | 523 | gpio_free(N810_EMMC_VIO_GPIO); |
492 | } | 524 | } |
@@ -537,7 +569,7 @@ static void __init n8x0_mmc_init(void) | |||
537 | { | 569 | { |
538 | int err; | 570 | int err; |
539 | 571 | ||
540 | if (machine_is_nokia_n810()) { | 572 | if (board_is_n810()) { |
541 | mmc1_data.slots[0].name = "external"; | 573 | mmc1_data.slots[0].name = "external"; |
542 | 574 | ||
543 | /* | 575 | /* |
@@ -555,7 +587,7 @@ static void __init n8x0_mmc_init(void) | |||
555 | if (err) | 587 | if (err) |
556 | return; | 588 | return; |
557 | 589 | ||
558 | if (machine_is_nokia_n810()) { | 590 | if (board_is_n810()) { |
559 | err = gpio_request_array(n810_emmc_gpios, | 591 | err = gpio_request_array(n810_emmc_gpios, |
560 | ARRAY_SIZE(n810_emmc_gpios)); | 592 | ARRAY_SIZE(n810_emmc_gpios)); |
561 | if (err) { | 593 | if (err) { |
@@ -700,6 +732,7 @@ static inline void board_serial_init(void) | |||
700 | 732 | ||
701 | static void __init n8x0_init_machine(void) | 733 | static void __init n8x0_init_machine(void) |
702 | { | 734 | { |
735 | board_check_revision(); | ||
703 | omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); | 736 | omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); |
704 | /* FIXME: add n810 spi devices */ | 737 | /* FIXME: add n810 spi devices */ |
705 | spi_register_board_info(n800_spi_board_info, | 738 | spi_register_board_info(n800_spi_board_info, |
@@ -707,7 +740,7 @@ static void __init n8x0_init_machine(void) | |||
707 | omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, | 740 | omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, |
708 | ARRAY_SIZE(n8x0_i2c_board_info_1)); | 741 | ARRAY_SIZE(n8x0_i2c_board_info_1)); |
709 | omap_register_i2c_bus(2, 400, NULL, 0); | 742 | omap_register_i2c_bus(2, 400, NULL, 0); |
710 | if (machine_is_nokia_n810()) | 743 | if (board_is_n810()) |
711 | i2c_register_board_info(2, n810_i2c_board_info_2, | 744 | i2c_register_board_info(2, n810_i2c_board_info_2, |
712 | ARRAY_SIZE(n810_i2c_board_info_2)); | 745 | ARRAY_SIZE(n810_i2c_board_info_2)); |
713 | board_serial_init(); | 746 | board_serial_init(); |