Skip to content

Commit 599beed

Browse files
committed
Merge tag 'mmc-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "A couple of MMC host fixes intended for v5.1: - alcor: Fix DMA reads - renesas_sdhi: Limit block count to 16-bit for old revisions - sdhci-omap: Fixup support for read-only pins - mxcmmc: Revert support for highmem pages - davinci/pxamci: Fix clang build warnings" * tag 'mmc-v5.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: renesas_sdhi: limit block count to 16 bit for old revisions mmc: alcor: fix DMA reads mmc: sdhci-omap: Set caps2 to indicate no physical write protect pin mmc: mxcmmc: "Revert mmc: mxcmmc: handle highmem pages" mmc: davinci: remove extraneous __init annotation mmc: pxamci: fix enum type confusion
2 parents fd1f297 + c9a9497 commit 599beed

File tree

6 files changed

+35
-21
lines changed

6 files changed

+35
-21
lines changed

drivers/mmc/host/alcor.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,14 +1044,27 @@ static void alcor_init_mmc(struct alcor_sdmmc_host *host)
10441044
mmc->caps2 = MMC_CAP2_NO_SDIO;
10451045
mmc->ops = &alcor_sdc_ops;
10461046

1047-
/* Hardware cannot do scatter lists */
1047+
/* The hardware does DMA data transfer of 4096 bytes to/from a single
1048+
* buffer address. Scatterlists are not supported, but upon DMA
1049+
* completion (signalled via IRQ), the original vendor driver does
1050+
* then immediately set up another DMA transfer of the next 4096
1051+
* bytes.
1052+
*
1053+
* This means that we need to handle the I/O in 4096 byte chunks.
1054+
* Lacking a way to limit the sglist entries to 4096 bytes, we instead
1055+
* impose that only one segment is provided, with maximum size 4096,
1056+
* which also happens to be the minimum size. This means that the
1057+
* single-entry sglist handled by this driver can be handed directly
1058+
* to the hardware, nice and simple.
1059+
*
1060+
* Unfortunately though, that means we only do 4096 bytes I/O per
1061+
* MMC command. A future improvement would be to make the driver
1062+
* accept sg lists and entries of any size, and simply iterate
1063+
* through them 4096 bytes at a time.
1064+
*/
10481065
mmc->max_segs = AU6601_MAX_DMA_SEGMENTS;
10491066
mmc->max_seg_size = AU6601_MAX_DMA_BLOCK_SIZE;
1050-
1051-
mmc->max_blk_size = mmc->max_seg_size;
1052-
mmc->max_blk_count = mmc->max_segs;
1053-
1054-
mmc->max_req_size = mmc->max_seg_size * mmc->max_segs;
1067+
mmc->max_req_size = mmc->max_seg_size;
10551068
}
10561069

10571070
static int alcor_pci_sdmmc_drv_probe(struct platform_device *pdev)

drivers/mmc/host/davinci_mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host)
11171117
{
11181118
}
11191119
#endif
1120-
static void __init init_mmcsd_host(struct mmc_davinci_host *host)
1120+
static void init_mmcsd_host(struct mmc_davinci_host *host)
11211121
{
11221122

11231123
mmc_davinci_reset_ctrl(host, 1);

drivers/mmc/host/mxcmmc.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,8 @@ static void mxcmci_swap_buffers(struct mmc_data *data)
290290
struct scatterlist *sg;
291291
int i;
292292

293-
for_each_sg(data->sg, sg, data->sg_len, i) {
294-
void *buf = kmap_atomic(sg_page(sg) + sg->offset);
295-
buffer_swap32(buf, sg->length);
296-
kunmap_atomic(buf);
297-
}
293+
for_each_sg(data->sg, sg, data->sg_len, i)
294+
buffer_swap32(sg_virt(sg), sg->length);
298295
}
299296
#else
300297
static inline void mxcmci_swap_buffers(struct mmc_data *data) {}
@@ -611,26 +608,21 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
611608
{
612609
struct mmc_data *data = host->req->data;
613610
struct scatterlist *sg;
614-
void *buf;
615611
int stat, i;
616612

617613
host->data = data;
618614
host->datasize = 0;
619615

620616
if (data->flags & MMC_DATA_READ) {
621617
for_each_sg(data->sg, sg, data->sg_len, i) {
622-
buf = kmap_atomic(sg_page(sg) + sg->offset);
623-
stat = mxcmci_pull(host, buf, sg->length);
624-
kunmap(buf);
618+
stat = mxcmci_pull(host, sg_virt(sg), sg->length);
625619
if (stat)
626620
return stat;
627621
host->datasize += sg->length;
628622
}
629623
} else {
630624
for_each_sg(data->sg, sg, data->sg_len, i) {
631-
buf = kmap_atomic(sg_page(sg) + sg->offset);
632-
stat = mxcmci_push(host, buf, sg->length);
633-
kunmap(buf);
625+
stat = mxcmci_push(host, sg_virt(sg), sg->length);
634626
if (stat)
635627
return stat;
636628
host->datasize += sg->length;

drivers/mmc/host/pxamci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static void pxamci_dma_irq(void *param);
162162
static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
163163
{
164164
struct dma_async_tx_descriptor *tx;
165-
enum dma_data_direction direction;
165+
enum dma_transfer_direction direction;
166166
struct dma_slave_config config;
167167
struct dma_chan *chan;
168168
unsigned int nob = data->blocks;

drivers/mmc/host/renesas_sdhi_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
641641
struct renesas_sdhi *priv;
642642
struct resource *res;
643643
int irq, ret, i;
644+
u16 ver;
644645

645646
of_data = of_device_get_match_data(&pdev->dev);
646647

@@ -773,12 +774,17 @@ int renesas_sdhi_probe(struct platform_device *pdev,
773774
if (ret)
774775
goto efree;
775776

777+
ver = sd_ctrl_read16(host, CTL_VERSION);
778+
/* GEN2_SDR104 is first known SDHI to use 32bit block count */
779+
if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
780+
mmc_data->max_blk_count = U16_MAX;
781+
776782
ret = tmio_mmc_host_probe(host);
777783
if (ret < 0)
778784
goto edisclk;
779785

780786
/* One Gen2 SDHI incarnation does NOT have a CBSY bit */
781-
if (sd_ctrl_read16(host, CTL_VERSION) == SDHI_VER_GEN2_SDR50)
787+
if (ver == SDHI_VER_GEN2_SDR50)
782788
mmc_data->flags &= ~TMIO_MMC_HAVE_CBSY;
783789

784790
/* Enable tuning iff we have an SCC and a supported mode */

drivers/mmc/host/sdhci-omap.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,9 @@ static int sdhci_omap_probe(struct platform_device *pdev)
10561056
mmc->f_max = 48000000;
10571057
}
10581058

1059+
if (!mmc_can_gpio_ro(mmc))
1060+
mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT;
1061+
10591062
pltfm_host->clk = devm_clk_get(dev, "fck");
10601063
if (IS_ERR(pltfm_host->clk)) {
10611064
ret = PTR_ERR(pltfm_host->clk);

0 commit comments

Comments
 (0)