From a37293414f1970ecacc5e6adc5137411cb61ccc2 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Tue, 1 Dec 2009 11:13:40 +0100 Subject: [PATCH] jz4740-mmc: Some minor fixes. --- .../arch/mips/jz4740/board-qi_lb60.c | 7 ++++--- .../files-2.6.31/drivers/mmc/host/jz_mmc.c | 18 ++++++++++-------- .../include/linux/mmc/jz4740_mmc.h | 11 ++++++----- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/target/linux/xburst/files-2.6.31/arch/mips/jz4740/board-qi_lb60.c b/target/linux/xburst/files-2.6.31/arch/mips/jz4740/board-qi_lb60.c index 979909291..0e1f95564 100644 --- a/target/linux/xburst/files-2.6.31/arch/mips/jz4740/board-qi_lb60.c +++ b/target/linux/xburst/files-2.6.31/arch/mips/jz4740/board-qi_lb60.c @@ -7,7 +7,7 @@ * Author: Xiangfu Liu * * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 or later + * it under the terms of the GNU General Public License version 2 or later * as published by the Free Software Foundation. */ @@ -329,8 +329,9 @@ static struct platform_device qi_lb60_gpio_keys = { static struct jz4740_mmc_platform_data qi_lb60_mmc_pdata = { .gpio_card_detect = JZ_GPIO_PORTD(0), - .gpio_read_only = JZ_GPIO_PORTD(16), + .gpio_read_only = -1, .gpio_power = JZ_GPIO_PORTD(2), + .power_active_low = 1, }; static struct platform_device *jz_platform_devices[] __initdata = { @@ -363,7 +364,7 @@ static int __init qi_lb60_init_platform_devices(void) jz4740_framebuffer_device.dev.platform_data = &qi_lb60_fb_pdata; jz4740_nand_device.dev.platform_data = &qi_lb60_nand_pdata; jz4740_battery_device.dev.platform_data = &qi_lb60_battery_pdata; -/* jz4740_mmc_device.dev.platform_data = &qi_lb60_mmc_pdata;*/ + jz4740_mmc_device.dev.platform_data = &qi_lb60_mmc_pdata; spi_register_board_info(qi_lb60_spi_board_info, ARRAY_SIZE(qi_lb60_spi_board_info)); diff --git a/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c b/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c index 589b9c7b3..4d21674d5 100644 --- a/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c +++ b/target/linux/xburst/files-2.6.31/drivers/mmc/host/jz_mmc.c @@ -226,7 +226,7 @@ err: static void jz4740_mmc_timeout(unsigned long data) { - struct jz4740_mmc_host *host = (struct jz4740_mmc_host*)host; + struct jz4740_mmc_host *host = (struct jz4740_mmc_host*)data; unsigned long flags; spin_lock_irqsave(&host->lock, flags); @@ -350,8 +350,6 @@ static irqreturn_t jz_mmc_irq(int irq, void *devid) writew(JZ_MMC_IRQ_SDIO, host->base + JZ_REG_MMC_IREG); mmc_signal_sdio_irq(host->mmc); } - writew(0xff, host->base + JZ_REG_MMC_IREG); - return ret; } @@ -470,7 +468,7 @@ static void jz4740_mmc_request(struct mmc_host *mmc, struct mmc_request *req) host->req = req; - writel(0xffffffff, host->base + JZ_REG_MMC_IREG); + writew(0xffff, host->base + JZ_REG_MMC_IREG); writew(JZ_MMC_IRQ_END_CMD_RES, host->base + JZ_REG_MMC_IREG); jz4740_mmc_enable_irq(host, JZ_MMC_IRQ_END_CMD_RES); @@ -487,7 +485,8 @@ static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) switch(ios->power_mode) { case MMC_POWER_UP: if (gpio_is_valid(host->pdata->gpio_power)) - gpio_set_value(host->pdata->gpio_power, 0); + gpio_set_value(host->pdata->gpio_power, + !host->pdata->power_active_low); host->cmdat |= JZ_MMC_CMDAT_INIT; clk_enable(host->clk); break; @@ -495,7 +494,8 @@ static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) break; default: if (gpio_is_valid(host->pdata->gpio_power)) - gpio_set_value(host->pdata->gpio_power, 1); + gpio_set_value(host->pdata->gpio_power, + host->pdata->power_active_low); clk_disable(host->clk); break; } @@ -599,7 +599,7 @@ static int __devinit jz4740_mmc_request_gpios(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to request power gpio: %d\n", ret); goto err_free_gpio_read_only; } - gpio_direction_output(pdata->gpio_card_detect, 1); + gpio_direction_output(pdata->gpio_power, pdata->power_active_low); } return 0; @@ -706,8 +706,9 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev) mmc->f_max = JZ_MMC_CLK_RATE; mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; mmc->caps = (pdata && pdata->data_1bit) ? 0 : MMC_CAP_4_BIT_DATA; + mmc->caps |= MMC_CAP_SDIO_IRQ; mmc->max_seg_size = 4096; - mmc->max_phys_segs = 10; + mmc->max_phys_segs = 128; mmc->max_blk_size = (1 << 10) - 1; mmc->max_blk_count = (1 << 15) - 1; @@ -717,6 +718,7 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev) host->pdev = pdev; host->pdata = pdata; host->max_clock = JZ_MMC_CLK_RATE; + spin_lock_init(&host->lock); host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect); diff --git a/target/linux/xburst/files-2.6.31/include/linux/mmc/jz4740_mmc.h b/target/linux/xburst/files-2.6.31/include/linux/mmc/jz4740_mmc.h index 87928a5c6..8543f432b 100644 --- a/target/linux/xburst/files-2.6.31/include/linux/mmc/jz4740_mmc.h +++ b/target/linux/xburst/files-2.6.31/include/linux/mmc/jz4740_mmc.h @@ -2,11 +2,12 @@ #define __LINUX_MMC_JZ4740_MMC struct jz4740_mmc_platform_data { - int gpio_power; - int gpio_card_detect; - int gpio_read_only; - unsigned card_detect_active_low:1; - unsigned read_only_active_low:1; + int gpio_power; + int gpio_card_detect; + int gpio_read_only; + unsigned card_detect_active_low:1; + unsigned read_only_active_low:1; + unsigned power_active_low:1; unsigned data_1bit:1; };