diff -pNaur -X b/Documentation/dontdiff a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c --- a/arch/arm/mach-omap1/board-palmte.c 2006-07-16 04:20:06.000000000 +0200 +++ b/arch/arm/mach-omap1/board-palmte.c 2006-07-16 04:25:32.000000000 +0200 @@ -55,12 +55,12 @@ static struct omap_usb_config palmte_usb }; static struct omap_mmc_config palmte_mmc_config __initdata = { - .mmc [0] = { + .mmc[0] = { .enabled = 1, - .wire4 = 1, - .wp_pin = OMAP_MPUIO(3), + .wire4 = 0, + .wp_pin = PALMTE_MMC_WP_GPIO, .power_pin = -1, - .switch_pin = -1, + .switch_pin = OMAP_MPUIO(4), }, }; @@ -74,12 +74,24 @@ static struct omap_board_config_kernel p { OMAP_TAG_LCD, &palmte_lcd_config }, }; +static void __init palmte_gpio_setup(void) +{ + /* Set MMC/SD host WP pin as input */ + if (omap_request_gpio(PALMTE_MMC_WP_GPIO)) { + printk(KERN_ERR "Could not reserve WP GPIO!\n"); + return; + } + omap_set_gpio_direction(PALMTE_MMC_WP_GPIO, 1); +} + static void __init omap_palmte_init(void) { omap_board_config = palmte_config; omap_board_config_size = ARRAY_SIZE(palmte_config); platform_add_devices(devices, ARRAY_SIZE(devices)); + + palmte_gpio_setup(); } static void __init omap_palmte_map_io(void) diff -pNaur -X b/Documentation/dontdiff a/drivers/mmc/mmc_block.c b/drivers/mmc/mmc_block.c --- a/drivers/mmc/mmc_block.c 2006-03-22 18:44:41.000000000 +0100 +++ b/drivers/mmc/mmc_block.c 2006-07-16 04:28:22.000000000 +0200 @@ -260,7 +260,7 @@ static int mmc_blk_issue_rq(struct mmc_q return 1; - cmd_err: +cmd_err: mmc_card_release_host(card); /* diff -pNaur -X b/Documentation/dontdiff a/drivers/mmc/omap.c b/drivers/mmc/omap.c --- a/drivers/mmc/omap.c 2006-07-16 02:30:11.000000000 +0200 +++ b/drivers/mmc/omap.c 2006-07-16 04:28:22.000000000 +0200 @@ -185,39 +185,38 @@ mmc_omap_start_command(struct mmc_omap_h host->hw_bus_mode = host->bus_mode; } - if (!(cmd->flags & MMC_RSP_PRESENT)) - resptype = 0; /* Resp 0 */ - - if (cmd->flags & MMC_RSP_136) - resptype = 2; /* Resp 2 */ - else { - if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) - resptype = 3; /* Resp 3 */ - else - resptype = 1; /* Resp 1, Resp 1b */ + switch (mmc_resp_type(cmd)) { + case MMC_RSP_NONE: + /* Response type 0 */ + break; + case MMC_RSP_R1: + case MMC_RSP_R1B: + resptype = 1; + break; + case MMC_RSP_R2: + resptype = 2; + break; + case MMC_RSP_R3: + resptype = 3; + break; + case MMC_RSP_R6: + resptype = 6; + break; } - /* Protocol layer does not provide command type, but our hardware - * needs it! - * any data transfer means adtc type (but that information is not - * in command structure, so we flagged it into host struct.) - * However, telling bc, bcr and ac apart based on response is - * not foolproof: - * CMD0 = bc = resp0 CMD15 = ac = resp0 - * CMD2 = bcr = resp2 CMD10 = ac = resp2 - * - * Resolve to best guess with some exception testing: - * resp0 -> bc, except CMD15 = ac - * rest are ac, except if opendrain - */ - if (host->data) { + switch (cmd->flags & MMC_CMD_MASK) { + case MMC_CMD_AC: + cmdtype = OMAP_MMC_CMDTYPE_AC; + break; + case MMC_CMD_ADTC: cmdtype = OMAP_MMC_CMDTYPE_ADTC; - } else if (resptype == 0 && cmd->opcode != 15) { + break; + case MMC_CMD_BC: cmdtype = OMAP_MMC_CMDTYPE_BC; - } else if (host->bus_mode == MMC_BUSMODE_OPENDRAIN) { + break; + case MMC_CMD_BCR: cmdtype = OMAP_MMC_CMDTYPE_BCR; - } else { - cmdtype = OMAP_MMC_CMDTYPE_AC; + break; } cmdreg = cmd->opcode | (resptype << 8) | (cmdtype << 12); @@ -724,7 +723,8 @@ mmc_omap_prepare_dma(struct mmc_omap_hos int dst_port = 0; int sync_dev = 0; - data_addr = (unsigned long)io_v2p((void __force *) host->base) + OMAP_MMC_REG_DATA; + data_addr = (unsigned long)io_v2p((void __force *) host->base) + + OMAP_MMC_REG_DATA; frame = 1 << data->blksz_bits; count = (u32)sg_dma_len(sg); @@ -890,7 +890,7 @@ static inline void set_cmd_timeout(struc reg &= ~(1 << 5); OMAP_MMC_WRITE(host->base, SDIO, reg); /* Set maximum timeout */ - OMAP_MMC_WRITE(host->base, CTO, 0xff); + OMAP_MMC_WRITE(host->base, CTO, 0xfd); } static inline void set_data_timeout(struct mmc_omap_host *host, struct mmc_request *req) @@ -1282,7 +1282,7 @@ static int __init mmc_omap_probe(struct host->irq = pdev->resource[1].start; host->base = (void __iomem *)pdev->resource[0].start; - if (minfo->wire4) + if (minfo->wire4) mmc->caps |= MMC_CAP_4_BIT_DATA; mmc->ops = &mmc_omap_ops;