mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-01-14 19:21:06 +02:00
jz4740-mmc: Some minor fixes.
This commit is contained in:
parent
58eb7333af
commit
a37293414f
@ -7,7 +7,7 @@
|
|||||||
* Author: Xiangfu Liu <xiangfu@qi-hardware.com>
|
* Author: Xiangfu Liu <xiangfu@qi-hardware.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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.
|
* 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 = {
|
static struct jz4740_mmc_platform_data qi_lb60_mmc_pdata = {
|
||||||
.gpio_card_detect = JZ_GPIO_PORTD(0),
|
.gpio_card_detect = JZ_GPIO_PORTD(0),
|
||||||
.gpio_read_only = JZ_GPIO_PORTD(16),
|
.gpio_read_only = -1,
|
||||||
.gpio_power = JZ_GPIO_PORTD(2),
|
.gpio_power = JZ_GPIO_PORTD(2),
|
||||||
|
.power_active_low = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct platform_device *jz_platform_devices[] __initdata = {
|
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_framebuffer_device.dev.platform_data = &qi_lb60_fb_pdata;
|
||||||
jz4740_nand_device.dev.platform_data = &qi_lb60_nand_pdata;
|
jz4740_nand_device.dev.platform_data = &qi_lb60_nand_pdata;
|
||||||
jz4740_battery_device.dev.platform_data = &qi_lb60_battery_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,
|
spi_register_board_info(qi_lb60_spi_board_info,
|
||||||
ARRAY_SIZE(qi_lb60_spi_board_info));
|
ARRAY_SIZE(qi_lb60_spi_board_info));
|
||||||
|
@ -226,7 +226,7 @@ err:
|
|||||||
|
|
||||||
static void jz4740_mmc_timeout(unsigned long data)
|
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;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&host->lock, 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);
|
writew(JZ_MMC_IRQ_SDIO, host->base + JZ_REG_MMC_IREG);
|
||||||
mmc_signal_sdio_irq(host->mmc);
|
mmc_signal_sdio_irq(host->mmc);
|
||||||
}
|
}
|
||||||
writew(0xff, host->base + JZ_REG_MMC_IREG);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +468,7 @@ static void jz4740_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
|
|||||||
|
|
||||||
host->req = 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);
|
writew(JZ_MMC_IRQ_END_CMD_RES, host->base + JZ_REG_MMC_IREG);
|
||||||
jz4740_mmc_enable_irq(host, JZ_MMC_IRQ_END_CMD_RES);
|
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) {
|
switch(ios->power_mode) {
|
||||||
case MMC_POWER_UP:
|
case MMC_POWER_UP:
|
||||||
if (gpio_is_valid(host->pdata->gpio_power))
|
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;
|
host->cmdat |= JZ_MMC_CMDAT_INIT;
|
||||||
clk_enable(host->clk);
|
clk_enable(host->clk);
|
||||||
break;
|
break;
|
||||||
@ -495,7 +494,8 @@ static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (gpio_is_valid(host->pdata->gpio_power))
|
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);
|
clk_disable(host->clk);
|
||||||
break;
|
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);
|
dev_err(&pdev->dev, "Failed to request power gpio: %d\n", ret);
|
||||||
goto err_free_gpio_read_only;
|
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;
|
return 0;
|
||||||
@ -706,8 +706,9 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev)
|
|||||||
mmc->f_max = JZ_MMC_CLK_RATE;
|
mmc->f_max = JZ_MMC_CLK_RATE;
|
||||||
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
|
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 = (pdata && pdata->data_1bit) ? 0 : MMC_CAP_4_BIT_DATA;
|
||||||
|
mmc->caps |= MMC_CAP_SDIO_IRQ;
|
||||||
mmc->max_seg_size = 4096;
|
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_size = (1 << 10) - 1;
|
||||||
mmc->max_blk_count = (1 << 15) - 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->pdev = pdev;
|
||||||
host->pdata = pdata;
|
host->pdata = pdata;
|
||||||
host->max_clock = JZ_MMC_CLK_RATE;
|
host->max_clock = JZ_MMC_CLK_RATE;
|
||||||
|
spin_lock_init(&host->lock);
|
||||||
|
|
||||||
host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
|
host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
#define __LINUX_MMC_JZ4740_MMC
|
#define __LINUX_MMC_JZ4740_MMC
|
||||||
|
|
||||||
struct jz4740_mmc_platform_data {
|
struct jz4740_mmc_platform_data {
|
||||||
int gpio_power;
|
int gpio_power;
|
||||||
int gpio_card_detect;
|
int gpio_card_detect;
|
||||||
int gpio_read_only;
|
int gpio_read_only;
|
||||||
unsigned card_detect_active_low:1;
|
unsigned card_detect_active_low:1;
|
||||||
unsigned read_only_active_low:1;
|
unsigned read_only_active_low:1;
|
||||||
|
unsigned power_active_low:1;
|
||||||
|
|
||||||
unsigned data_1bit:1;
|
unsigned data_1bit:1;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user