Modifications at board-n800-mmc.c and board-n800.c files to work with MMC multislot support.
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Tony Lindgren <tony@atomide.com>
#include <asm/arch/menelaus.h>
#include <asm/arch/gpio.h>
#include <asm/arch/menelaus.h>
#include <asm/arch/gpio.h>
+#include <asm/mach-types.h>
+#include <linux/delay.h>
+
#ifdef CONFIG_MMC_OMAP
static const int slot_switch_gpio = 96;
#ifdef CONFIG_MMC_OMAP
static const int slot_switch_gpio = 96;
-static const int slot1_wp_gpio = 23;
-static const int slot2_wp_gpio = 8;
-static int slot1_cover_closed;
-static int slot2_cover_closed;
+static int slot1_cover_open;
+static int slot2_cover_open;
static struct device *mmc_device;
/*
static struct device *mmc_device;
/*
slot++;
BUG_ON(slot != 1 && slot != 2);
if (slot == 1)
slot++;
BUG_ON(slot != 1 && slot != 2);
if (slot == 1)
- return slot1_cover_closed;
+ return slot1_cover_open;
- return slot2_cover_closed;
+ return slot2_cover_open;
}
static void n800_mmc_callback(void *data, u8 card_mask)
{
}
static void n800_mmc_callback(void *data, u8 card_mask)
{
- if (card_mask & (1 << 1))
- slot2_cover_closed = 0;
+ int bit, *openp, index;
+
+ if (machine_is_nokia_n800()) {
+ bit = 1 << 1;
+ openp = &slot2_cover_open;
+ index = 1;
+ }
+
+ if (card_mask & bit)
+ *openp = 1;
- slot2_cover_closed = 1;
- omap_mmc_notify_cover_event(mmc_device, 1, slot2_cover_closed);
+ *openp = 0;
+
+ omap_mmc_notify_cover_event(mmc_device, index, *openp);
}
void n800_mmc_slot1_cover_handler(void *arg, int state)
}
void n800_mmc_slot1_cover_handler(void *arg, int state)
if (mmc_device == NULL)
return;
if (mmc_device == NULL)
return;
- slot1_cover_closed = state;
+ slot1_cover_open = !state;
omap_mmc_notify_cover_event(mmc_device, 0, state);
}
static int n800_mmc_late_init(struct device *dev)
{
omap_mmc_notify_cover_event(mmc_device, 0, state);
}
static int n800_mmc_late_init(struct device *dev)
{
- if (r & (1 << 1))
- slot2_cover_closed = 1;
+ if (machine_is_nokia_n800()) {
+ bit = 1 << 1;
+ openp = &slot2_cover_open;
+ }
+
+ /* All slot pin bits seem to be inversed until first swith change */
+ if (r == 0xf || r == (0xf & ~bit))
+ r = ~r;
+
+ if (r & bit)
+ *openp = 1;
- slot2_cover_closed = 0;
r = menelaus_register_mmc_callback(n800_mmc_callback, NULL);
r = menelaus_register_mmc_callback(n800_mmc_callback, NULL);
}
static struct omap_mmc_platform_data n800_mmc_data = {
}
static struct omap_mmc_platform_data n800_mmc_data = {
.switch_slot = n800_mmc_switch_slot,
.init = n800_mmc_late_init,
.cleanup = n800_mmc_cleanup,
.switch_slot = n800_mmc_switch_slot,
.init = n800_mmc_late_init,
.cleanup = n800_mmc_cleanup,
BUG();
omap_set_gpio_dataout(slot_switch_gpio, 0);
omap_set_gpio_direction(slot_switch_gpio, 0);
BUG();
omap_set_gpio_dataout(slot_switch_gpio, 0);
omap_set_gpio_direction(slot_switch_gpio, 0);
- if (omap_request_gpio(slot1_wp_gpio) < 0)
- BUG();
- if (omap_request_gpio(slot2_wp_gpio) < 0)
- BUG();
- omap_set_gpio_direction(slot1_wp_gpio, 1);
- omap_set_gpio_direction(slot2_wp_gpio, 1);
omapfb_set_ctrl_platform_data(&n800_blizzard_data);
}
omapfb_set_ctrl_platform_data(&n800_blizzard_data);
}
+static struct omap_mmc_config n800_mmc_config __initdata = {
+ .mmc [0] = {
+ .enabled = 1,
+ .wire4 = 1,
+ },
+};
+
+extern struct omap_mmc_platform_data n800_mmc_data;
static struct omap_board_config_kernel n800_config[] __initdata = {
{ OMAP_TAG_UART, &n800_uart_config },
static struct omap_board_config_kernel n800_config[] __initdata = {
{ OMAP_TAG_UART, &n800_uart_config },
{ OMAP_TAG_FBMEM, &n800_fbmem1_config },
{ OMAP_TAG_FBMEM, &n800_fbmem2_config },
{ OMAP_TAG_TMP105, &n800_tmp105_config },
{ OMAP_TAG_FBMEM, &n800_fbmem1_config },
{ OMAP_TAG_FBMEM, &n800_fbmem2_config },
{ OMAP_TAG_TMP105, &n800_tmp105_config },
+ { OMAP_TAG_MMC, &n800_mmc_config },
+extern void __init n800_mmc_init(void);
+
static void __init nokia_n800_init(void)
{
platform_add_devices(n800_devices, ARRAY_SIZE(n800_devices));
static void __init nokia_n800_init(void)
{
platform_add_devices(n800_devices, ARRAY_SIZE(n800_devices));