diff options
author | Tony Lindgren <tony@atomide.com> | 2013-11-25 15:17:09 -0800 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2013-11-25 15:31:16 -0800 |
commit | c8f27e977310b3684ff9245a94aad55d0ee27c9f (patch) | |
tree | 59631edabcd2f5ab0ead870ca18f32109d3c2e91 /arch/arm/mach-omap2/board-n8x0.c | |
parent | 036582f76ad900e4c1b9ec290ce66c6f698bd00d (diff) | |
download | op-kernel-dev-c8f27e977310b3684ff9245a94aad55d0ee27c9f.zip op-kernel-dev-c8f27e977310b3684ff9245a94aad55d0ee27c9f.tar.gz |
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/mach-omap2/board-n8x0.c')
-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 827d150..d61a00d 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c @@ -42,6 +42,38 @@ #define TUSB6010_GPIO_ENABLE 0 #define TUSB6010_DMACHAN 0x3f +#define NOKIA_N810_WIMAX (1 << 2) +#define NOKIA_N810 (1 << 1) +#define NOKIA_N800 (1 << 0) + +static u32 board_caps; + +#define board_is_n800() (board_caps & NOKIA_N800) +#define board_is_n810() (board_caps & NOKIA_N810) +#define board_is_n810_wimax() (board_caps & NOKIA_N810_WIMAX) + +static void board_check_revision(void) +{ + if (of_have_populated_dt()) { + if (of_machine_is_compatible("nokia,n800")) + board_caps = NOKIA_N800; + else if (of_machine_is_compatible("nokia,n810")) + board_caps = NOKIA_N810; + else if (of_machine_is_compatible("nokia,n810-wimax")) + board_caps = NOKIA_N810_WIMAX; + } else { + if (machine_is_nokia_n800()) + board_caps = NOKIA_N800; + else if (machine_is_nokia_n810()) + board_caps = NOKIA_N810; + else if (machine_is_nokia_n810_wimax()) + board_caps = NOKIA_N810_WIMAX; + } + + if (!board_caps) + pr_err("Unknown board\n"); +} + #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) static struct i2c_cbus_platform_data n8x0_cbus_data = { .clk_gpio = 66, @@ -342,7 +374,7 @@ static void n810_set_power_emmc(struct device *dev, static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, int vdd) { - if (machine_is_nokia_n800() || slot == 0) + if (board_is_n800() || slot == 0) return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); n810_set_power_emmc(dev, power_on); @@ -388,7 +420,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) { int bit, *openp, index; - if (machine_is_nokia_n800()) { + if (board_is_n800()) { bit = 1 << 1; openp = &slot2_cover_open; index = 1; @@ -421,7 +453,7 @@ static int n8x0_mmc_late_init(struct device *dev) if (r < 0) return r; - if (machine_is_nokia_n800()) + if (board_is_n800()) vs2sel = 0; else vs2sel = 2; @@ -444,7 +476,7 @@ static int n8x0_mmc_late_init(struct device *dev) if (r < 0) return r; - if (machine_is_nokia_n800()) { + if (board_is_n800()) { bit = 1 << 1; openp = &slot2_cover_open; } else { @@ -471,7 +503,7 @@ static void n8x0_mmc_shutdown(struct device *dev) { int vs2sel; - if (machine_is_nokia_n800()) + if (board_is_n800()) vs2sel = 0; else vs2sel = 2; @@ -486,7 +518,7 @@ static void n8x0_mmc_cleanup(struct device *dev) gpio_free(N8X0_SLOT_SWITCH_GPIO); - if (machine_is_nokia_n810()) { + if (board_is_n810()) { gpio_free(N810_EMMC_VSD_GPIO); gpio_free(N810_EMMC_VIO_GPIO); } @@ -537,7 +569,7 @@ static void __init n8x0_mmc_init(void) { int err; - if (machine_is_nokia_n810()) { + if (board_is_n810()) { mmc1_data.slots[0].name = "external"; /* @@ -555,7 +587,7 @@ static void __init n8x0_mmc_init(void) if (err) return; - if (machine_is_nokia_n810()) { + if (board_is_n810()) { err = gpio_request_array(n810_emmc_gpios, ARRAY_SIZE(n810_emmc_gpios)); if (err) { @@ -700,6 +732,7 @@ static inline void board_serial_init(void) static void __init n8x0_init_machine(void) { + board_check_revision(); omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); /* FIXME: add n810 spi devices */ spi_register_board_info(n800_spi_board_info, @@ -707,7 +740,7 @@ static void __init n8x0_init_machine(void) omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, ARRAY_SIZE(n8x0_i2c_board_info_1)); omap_register_i2c_bus(2, 400, NULL, 0); - if (machine_is_nokia_n810()) + if (board_is_n810()) i2c_register_board_info(2, n810_i2c_board_info_2, ARRAY_SIZE(n810_i2c_board_info_2)); board_serial_init(); |