Commit c8f27e97 authored by Tony Lindgren's avatar Tony Lindgren

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: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 036582f7
...@@ -42,6 +42,38 @@ ...@@ -42,6 +42,38 @@
#define TUSB6010_GPIO_ENABLE 0 #define TUSB6010_GPIO_ENABLE 0
#define TUSB6010_DMACHAN 0x3f #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) #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE)
static struct i2c_cbus_platform_data n8x0_cbus_data = { static struct i2c_cbus_platform_data n8x0_cbus_data = {
.clk_gpio = 66, .clk_gpio = 66,
...@@ -342,7 +374,7 @@ static void n810_set_power_emmc(struct device *dev, ...@@ -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, static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on,
int vdd) 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); return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd);
n810_set_power_emmc(dev, power_on); n810_set_power_emmc(dev, power_on);
...@@ -388,7 +420,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) ...@@ -388,7 +420,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
{ {
int bit, *openp, index; int bit, *openp, index;
if (machine_is_nokia_n800()) { if (board_is_n800()) {
bit = 1 << 1; bit = 1 << 1;
openp = &slot2_cover_open; openp = &slot2_cover_open;
index = 1; index = 1;
...@@ -421,7 +453,7 @@ static int n8x0_mmc_late_init(struct device *dev) ...@@ -421,7 +453,7 @@ static int n8x0_mmc_late_init(struct device *dev)
if (r < 0) if (r < 0)
return r; return r;
if (machine_is_nokia_n800()) if (board_is_n800())
vs2sel = 0; vs2sel = 0;
else else
vs2sel = 2; vs2sel = 2;
...@@ -444,7 +476,7 @@ static int n8x0_mmc_late_init(struct device *dev) ...@@ -444,7 +476,7 @@ static int n8x0_mmc_late_init(struct device *dev)
if (r < 0) if (r < 0)
return r; return r;
if (machine_is_nokia_n800()) { if (board_is_n800()) {
bit = 1 << 1; bit = 1 << 1;
openp = &slot2_cover_open; openp = &slot2_cover_open;
} else { } else {
...@@ -471,7 +503,7 @@ static void n8x0_mmc_shutdown(struct device *dev) ...@@ -471,7 +503,7 @@ static void n8x0_mmc_shutdown(struct device *dev)
{ {
int vs2sel; int vs2sel;
if (machine_is_nokia_n800()) if (board_is_n800())
vs2sel = 0; vs2sel = 0;
else else
vs2sel = 2; vs2sel = 2;
...@@ -486,7 +518,7 @@ static void n8x0_mmc_cleanup(struct device *dev) ...@@ -486,7 +518,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
gpio_free(N8X0_SLOT_SWITCH_GPIO); 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_VSD_GPIO);
gpio_free(N810_EMMC_VIO_GPIO); gpio_free(N810_EMMC_VIO_GPIO);
} }
...@@ -537,7 +569,7 @@ static void __init n8x0_mmc_init(void) ...@@ -537,7 +569,7 @@ static void __init n8x0_mmc_init(void)
{ {
int err; int err;
if (machine_is_nokia_n810()) { if (board_is_n810()) {
mmc1_data.slots[0].name = "external"; mmc1_data.slots[0].name = "external";
/* /*
...@@ -555,7 +587,7 @@ static void __init n8x0_mmc_init(void) ...@@ -555,7 +587,7 @@ static void __init n8x0_mmc_init(void)
if (err) if (err)
return; return;
if (machine_is_nokia_n810()) { if (board_is_n810()) {
err = gpio_request_array(n810_emmc_gpios, err = gpio_request_array(n810_emmc_gpios,
ARRAY_SIZE(n810_emmc_gpios)); ARRAY_SIZE(n810_emmc_gpios));
if (err) { if (err) {
...@@ -700,6 +732,7 @@ static inline void board_serial_init(void) ...@@ -700,6 +732,7 @@ static inline void board_serial_init(void)
static void __init n8x0_init_machine(void) static void __init n8x0_init_machine(void)
{ {
board_check_revision();
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
/* FIXME: add n810 spi devices */ /* FIXME: add n810 spi devices */
spi_register_board_info(n800_spi_board_info, spi_register_board_info(n800_spi_board_info,
...@@ -707,7 +740,7 @@ static void __init n8x0_init_machine(void) ...@@ -707,7 +740,7 @@ static void __init n8x0_init_machine(void)
omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
ARRAY_SIZE(n8x0_i2c_board_info_1)); ARRAY_SIZE(n8x0_i2c_board_info_1));
omap_register_i2c_bus(2, 400, NULL, 0); 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, i2c_register_board_info(2, n810_i2c_board_info_2,
ARRAY_SIZE(n810_i2c_board_info_2)); ARRAY_SIZE(n810_i2c_board_info_2));
board_serial_init(); board_serial_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment