mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
MMC fixes for 3.5-rc4:
- atmel-mci: Fixes for NULL timer and DMA burst/chunk size - dw_mmc: Fix DMA ordering, clkdiv calculation, NULL host->data - mxs_mmc: Compile fix for CONFIG_OF=y && CONFIG_PM=n - omap: Fix NULL deref in mmc_omap_remove_slot(), reg_shift initialization - sdhci-s3c: Fix boot regression by adding IRQF_ONESHOT flag - Small fixes to core/sd, core/sdio, sdhci -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJP3iO/AAoJEHNBYZ7TNxYMm2YQAJCfvLk5a9N+3QUcWPOeJngs yb+JFmGb4rOajrfVQu47d5hcWkC3ovySIxrHJbpNUyTVTttsxwL3agRJUsdh3zvx s3XFvzXBIH0CXD889SyX3i09IIqQ3gRhk185O2b7x+5IlVfgMv6XRjZGvRDCWXVH elSwLUbL0M/wgEa5rsXceNiuz9ok4p19LsRzOIP1AEijLKweUuyzJl9P0CIICG9x ZqvWCDmDKc6APHlx4zAhAP+yOSUEHDASe22lfZYoyOhqDhJ8iyqFsW8zYVj/Y1j/ E3BnhNaNJsBrDncYCzw8r3xRE7Dzvl24rc0CqmVuHJ2PgldDv8i7CjtccZ6/C/Fg Qou68g6/kM48CuEavu8xNoM4jLgHDes3UILvSZ1Tp5VxYhnQfQTovppUvO4vfDFi 5JXeIH9nq9f9xxc3Qs6/6ZrqNqw7gjtBDmN804Ptr0VzP9Ax7CMRTsnmVwlUlQdH Vxhr+lyZkEGoMF48r/DnieFZAVLtYUkGczOK4cPVFZ0n2eAu/IlvRhbC/+w3ym3F DRt9/4kwXJkrKnXSNSuYL2UHnenJxVZoqt+zqMZhH8FzJd8quqt8nf3BAyGeFxav ZdbTG+Bb61BZF10suWk8O0nV6piyQPw1jJwdlw18ujtt5Lgpu1Dvn6jSV/cnvaMa oAV9cgk3PL7OFpDg3ESM =x1JZ -----END PGP SIGNATURE----- Merge tag 'mmc-fixes-for-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC fixes from Chris Ball: - atmel-mci: Fixes for NULL timer and DMA burst/chunk size - dw_mmc: Fix DMA ordering, clkdiv calculation, NULL host->data - mxs_mmc: Compile fix for CONFIG_OF=y && CONFIG_PM=n - omap: Fix NULL deref in mmc_omap_remove_slot(), reg_shift initialization - sdhci-s3c: Fix boot regression by adding IRQF_ONESHOT flag - Small fixes to core/sd, core/sdio, sdhci * tag 'mmc-fixes-for-3.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: mmc: mxs-mmc: Move of_match_table out of CONFIG_PM mmc: sdhci-s3c: pass IRQF ONESHOT to request threaded irq mmc: core: return an error on suspend if mmc_deselect_cards fails mmc: omap: Fix broken reg_shift initialization mmc: omap: Fix NULL pointer dereference if mmc_omap_new_slot() fails mmc: omap: Fix a section warning regression mmc: dw_mmc: correct the calculation for CLKDIV mmc: dw_mmc: fix incorrect setting of host->data of NULL mmc: dw_mmc: fix the IDMAC sw reset mmc: dw_mmc: fix the transmission handling in IDMAC mmc: sdio: fix setting card data bus width as 4-bit mmc: atmel-mci: fix burst/chunk size modification mmc: atmel-mci: fix data timeout issue mmc: sdhci: Use DBG() instead of pr_warning() on large timeout
This commit is contained in:
commit
9023a4093d
@ -1326,7 +1326,7 @@ static int mmc_suspend(struct mmc_host *host)
|
||||
if (!err)
|
||||
mmc_card_set_sleep(host->card);
|
||||
} else if (!mmc_host_is_spi(host))
|
||||
mmc_deselect_cards(host);
|
||||
err = mmc_deselect_cards(host);
|
||||
host->card->state &= ~(MMC_STATE_HIGHSPEED | MMC_STATE_HIGHSPEED_200);
|
||||
mmc_release_host(host);
|
||||
|
||||
|
@ -1075,16 +1075,18 @@ static void mmc_sd_detect(struct mmc_host *host)
|
||||
*/
|
||||
static int mmc_sd_suspend(struct mmc_host *host)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
BUG_ON(!host);
|
||||
BUG_ON(!host->card);
|
||||
|
||||
mmc_claim_host(host);
|
||||
if (!mmc_host_is_spi(host))
|
||||
mmc_deselect_cards(host);
|
||||
err = mmc_deselect_cards(host);
|
||||
host->card->state &= ~MMC_STATE_HIGHSPEED;
|
||||
mmc_release_host(host);
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -218,6 +218,12 @@ static int sdio_enable_wide(struct mmc_card *card)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if ((ctrl & SDIO_BUS_WIDTH_MASK) == SDIO_BUS_WIDTH_RESERVED)
|
||||
pr_warning("%s: SDIO_CCCR_IF is invalid: 0x%02x\n",
|
||||
mmc_hostname(card->host), ctrl);
|
||||
|
||||
/* set as 4-bit bus width */
|
||||
ctrl &= ~SDIO_BUS_WIDTH_MASK;
|
||||
ctrl |= SDIO_BUS_WIDTH_4BIT;
|
||||
|
||||
ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
|
||||
|
@ -140,4 +140,18 @@
|
||||
#define atmci_writel(port,reg,value) \
|
||||
__raw_writel((value), (port)->regs + reg)
|
||||
|
||||
/*
|
||||
* Fix sconfig's burst size according to atmel MCI. We need to convert them as:
|
||||
* 1 -> 0, 4 -> 1, 8 -> 2, 16 -> 3.
|
||||
*
|
||||
* This can be done by finding most significant bit set.
|
||||
*/
|
||||
static inline unsigned int atmci_convert_chksize(unsigned int maxburst)
|
||||
{
|
||||
if (maxburst > 1)
|
||||
return fls(maxburst) - 2;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* __DRIVERS_MMC_ATMEL_MCI_H__ */
|
||||
|
@ -910,6 +910,7 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
||||
enum dma_data_direction direction;
|
||||
enum dma_transfer_direction slave_dirn;
|
||||
unsigned int sglen;
|
||||
u32 maxburst;
|
||||
u32 iflags;
|
||||
|
||||
data->error = -EINPROGRESS;
|
||||
@ -943,17 +944,18 @@ atmci_prepare_data_dma(struct atmel_mci *host, struct mmc_data *data)
|
||||
if (!chan)
|
||||
return -ENODEV;
|
||||
|
||||
if (host->caps.has_dma)
|
||||
atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(3) | ATMCI_DMAEN);
|
||||
|
||||
if (data->flags & MMC_DATA_READ) {
|
||||
direction = DMA_FROM_DEVICE;
|
||||
host->dma_conf.direction = slave_dirn = DMA_DEV_TO_MEM;
|
||||
maxburst = atmci_convert_chksize(host->dma_conf.src_maxburst);
|
||||
} else {
|
||||
direction = DMA_TO_DEVICE;
|
||||
host->dma_conf.direction = slave_dirn = DMA_MEM_TO_DEV;
|
||||
maxburst = atmci_convert_chksize(host->dma_conf.dst_maxburst);
|
||||
}
|
||||
|
||||
atmci_writel(host, ATMCI_DMA, ATMCI_DMA_CHKSIZE(maxburst) | ATMCI_DMAEN);
|
||||
|
||||
sglen = dma_map_sg(chan->device->dev, data->sg,
|
||||
data->sg_len, direction);
|
||||
|
||||
@ -2314,6 +2316,8 @@ static int __init atmci_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, host);
|
||||
|
||||
setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host);
|
||||
|
||||
/* We need at least one slot to succeed */
|
||||
nr_slots = 0;
|
||||
ret = -ENODEV;
|
||||
@ -2352,8 +2356,6 @@ static int __init atmci_probe(struct platform_device *pdev)
|
||||
}
|
||||
}
|
||||
|
||||
setup_timer(&host->timer, atmci_timeout_timer, (unsigned long)host);
|
||||
|
||||
dev_info(&pdev->dev,
|
||||
"Atmel MCI controller at 0x%08lx irq %d, %u slots\n",
|
||||
host->mapbase, irq, nr_slots);
|
||||
|
@ -418,6 +418,8 @@ static int dw_mci_idmac_init(struct dw_mci *host)
|
||||
p->des3 = host->sg_dma;
|
||||
p->des0 = IDMAC_DES0_ER;
|
||||
|
||||
mci_writel(host, BMOD, SDMMC_IDMAC_SWRESET);
|
||||
|
||||
/* Mask out interrupts - get Tx & Rx complete only */
|
||||
mci_writel(host, IDINTEN, SDMMC_IDMAC_INT_NI | SDMMC_IDMAC_INT_RI |
|
||||
SDMMC_IDMAC_INT_TI);
|
||||
@ -615,14 +617,15 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot)
|
||||
u32 div;
|
||||
|
||||
if (slot->clock != host->current_speed) {
|
||||
if (host->bus_hz % slot->clock)
|
||||
div = host->bus_hz / slot->clock;
|
||||
if (host->bus_hz % slot->clock && host->bus_hz > slot->clock)
|
||||
/*
|
||||
* move the + 1 after the divide to prevent
|
||||
* over-clocking the card.
|
||||
*/
|
||||
div = ((host->bus_hz / slot->clock) >> 1) + 1;
|
||||
else
|
||||
div = (host->bus_hz / slot->clock) >> 1;
|
||||
div += 1;
|
||||
|
||||
div = (host->bus_hz != slot->clock) ? DIV_ROUND_UP(div, 2) : 0;
|
||||
|
||||
dev_info(&slot->mmc->class_dev,
|
||||
"Bus speed (slot %d) = %dHz (slot req %dHz, actual %dHZ"
|
||||
@ -939,8 +942,8 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd
|
||||
mdelay(20);
|
||||
|
||||
if (cmd->data) {
|
||||
host->data = NULL;
|
||||
dw_mci_stop_dma(host);
|
||||
host->data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1623,7 +1626,6 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
|
||||
if (pending & (SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI)) {
|
||||
mci_writel(host, IDSTS, SDMMC_IDMAC_INT_TI | SDMMC_IDMAC_INT_RI);
|
||||
mci_writel(host, IDSTS, SDMMC_IDMAC_INT_NI);
|
||||
set_bit(EVENT_DATA_COMPLETE, &host->pending_events);
|
||||
host->dma_ops->complete(host);
|
||||
}
|
||||
#endif
|
||||
@ -1725,7 +1727,8 @@ static void dw_mci_work_routine_card(struct work_struct *work)
|
||||
|
||||
#ifdef CONFIG_MMC_DW_IDMAC
|
||||
ctrl = mci_readl(host, BMOD);
|
||||
ctrl |= 0x01; /* Software reset of DMA */
|
||||
/* Software reset of DMA */
|
||||
ctrl |= SDMMC_IDMAC_SWRESET;
|
||||
mci_writel(host, BMOD, ctrl);
|
||||
#endif
|
||||
|
||||
@ -1950,10 +1953,6 @@ int dw_mci_probe(struct dw_mci *host)
|
||||
spin_lock_init(&host->lock);
|
||||
INIT_LIST_HEAD(&host->queue);
|
||||
|
||||
|
||||
host->dma_ops = host->pdata->dma_ops;
|
||||
dw_mci_init_dma(host);
|
||||
|
||||
/*
|
||||
* Get the host data width - this assumes that HCON has been set with
|
||||
* the correct values.
|
||||
@ -1981,10 +1980,11 @@ int dw_mci_probe(struct dw_mci *host)
|
||||
}
|
||||
|
||||
/* Reset all blocks */
|
||||
if (!mci_wait_reset(&host->dev, host)) {
|
||||
ret = -ENODEV;
|
||||
goto err_dmaunmap;
|
||||
}
|
||||
if (!mci_wait_reset(&host->dev, host))
|
||||
return -ENODEV;
|
||||
|
||||
host->dma_ops = host->pdata->dma_ops;
|
||||
dw_mci_init_dma(host);
|
||||
|
||||
/* Clear the interrupts for the host controller */
|
||||
mci_writel(host, RINTSTS, 0xFFFFFFFF);
|
||||
@ -2170,14 +2170,14 @@ int dw_mci_resume(struct dw_mci *host)
|
||||
if (host->vmmc)
|
||||
regulator_enable(host->vmmc);
|
||||
|
||||
if (host->dma_ops->init)
|
||||
host->dma_ops->init(host);
|
||||
|
||||
if (!mci_wait_reset(&host->dev, host)) {
|
||||
ret = -ENODEV;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (host->dma_ops->init)
|
||||
host->dma_ops->init(host);
|
||||
|
||||
/* Restore the old value at FIFOTH register */
|
||||
mci_writel(host, FIFOTH, host->fifoth_val);
|
||||
|
||||
|
@ -894,8 +894,8 @@ static struct platform_driver mxs_mmc_driver = {
|
||||
.owner = THIS_MODULE,
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &mxs_mmc_pm_ops,
|
||||
.of_match_table = mxs_mmc_dt_ids,
|
||||
#endif
|
||||
.of_match_table = mxs_mmc_dt_ids,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ static const struct mmc_host_ops mmc_omap_ops = {
|
||||
.set_ios = mmc_omap_set_ios,
|
||||
};
|
||||
|
||||
static int __init mmc_omap_new_slot(struct mmc_omap_host *host, int id)
|
||||
static int __devinit mmc_omap_new_slot(struct mmc_omap_host *host, int id)
|
||||
{
|
||||
struct mmc_omap_slot *slot = NULL;
|
||||
struct mmc_host *mmc;
|
||||
@ -1485,24 +1485,26 @@ static int __devinit mmc_omap_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
host->nr_slots = pdata->nr_slots;
|
||||
for (i = 0; i < pdata->nr_slots; i++) {
|
||||
ret = mmc_omap_new_slot(host, i);
|
||||
if (ret < 0) {
|
||||
while (--i >= 0)
|
||||
mmc_omap_remove_slot(host->slots[i]);
|
||||
|
||||
goto err_plat_cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
|
||||
|
||||
host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
|
||||
if (!host->mmc_omap_wq)
|
||||
goto err_plat_cleanup;
|
||||
|
||||
for (i = 0; i < pdata->nr_slots; i++) {
|
||||
ret = mmc_omap_new_slot(host, i);
|
||||
if (ret < 0) {
|
||||
while (--i >= 0)
|
||||
mmc_omap_remove_slot(host->slots[i]);
|
||||
|
||||
goto err_destroy_wq;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_destroy_wq:
|
||||
destroy_workqueue(host->mmc_omap_wq);
|
||||
err_plat_cleanup:
|
||||
if (pdata->cleanup)
|
||||
pdata->cleanup(&pdev->dev);
|
||||
|
@ -404,7 +404,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
|
||||
if (sc->ext_cd_irq &&
|
||||
request_threaded_irq(sc->ext_cd_irq, NULL,
|
||||
sdhci_s3c_gpio_card_detect_thread,
|
||||
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
||||
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
|
||||
dev_name(dev), sc) == 0) {
|
||||
int status = gpio_get_value(sc->ext_cd_gpio);
|
||||
if (pdata->ext_cd_gpio_invert)
|
||||
|
@ -680,8 +680,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
|
||||
}
|
||||
|
||||
if (count >= 0xF) {
|
||||
pr_warning("%s: Too large timeout 0x%x requested for CMD%d!\n",
|
||||
mmc_hostname(host->mmc), count, cmd->opcode);
|
||||
DBG("%s: Too large timeout 0x%x requested for CMD%d!\n",
|
||||
mmc_hostname(host->mmc), count, cmd->opcode);
|
||||
count = 0xE;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,9 @@
|
||||
|
||||
#define SDIO_CCCR_IF 0x07 /* bus interface controls */
|
||||
|
||||
#define SDIO_BUS_WIDTH_MASK 0x03 /* data bus width setting */
|
||||
#define SDIO_BUS_WIDTH_1BIT 0x00
|
||||
#define SDIO_BUS_WIDTH_RESERVED 0x01
|
||||
#define SDIO_BUS_WIDTH_4BIT 0x02
|
||||
#define SDIO_BUS_ECSI 0x20 /* Enable continuous SPI interrupt */
|
||||
#define SDIO_BUS_SCSI 0x40 /* Support continuous SPI interrupt */
|
||||
|
Loading…
Reference in New Issue
Block a user