Skip to content

Commit 11b211e

Browse files
committed
Merge tag 'mmc-v4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - kmalloc sdio scratch buffer to make it DMA-friendly MMC host: - dw_mmc: Fix behaviour for SDIO IRQs when runtime PM is used - sdhci-esdhc-imx: Correct pad I/O drive strength for UHS-DDR50 cards" * tag 'mmc-v4.11-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for DDR50 card mmc: dw_mmc: Don't allow Runtime PM for SDIO cards mmc: sdio: fix alignment issue in struct sdio_func
2 parents 4d4dfc1 + 9f32784 commit 11b211e

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

drivers/mmc/core/sdio_bus.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static void sdio_release_func(struct device *dev)
267267
sdio_free_func_cis(func);
268268

269269
kfree(func->info);
270-
270+
kfree(func->tmpbuf);
271271
kfree(func);
272272
}
273273

@@ -282,6 +282,16 @@ struct sdio_func *sdio_alloc_func(struct mmc_card *card)
282282
if (!func)
283283
return ERR_PTR(-ENOMEM);
284284

285+
/*
286+
* allocate buffer separately to make sure it's properly aligned for
287+
* DMA usage (incl. 64 bit DMA)
288+
*/
289+
func->tmpbuf = kmalloc(4, GFP_KERNEL);
290+
if (!func->tmpbuf) {
291+
kfree(func);
292+
return ERR_PTR(-ENOMEM);
293+
}
294+
285295
func->card = card;
286296

287297
device_initialize(&func->dev);

drivers/mmc/host/dw_mmc.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/ioport.h>
2323
#include <linux/module.h>
2424
#include <linux/platform_device.h>
25+
#include <linux/pm_runtime.h>
2526
#include <linux/seq_file.h>
2627
#include <linux/slab.h>
2728
#include <linux/stat.h>
@@ -1621,10 +1622,16 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
16211622

16221623
if (card->type == MMC_TYPE_SDIO ||
16231624
card->type == MMC_TYPE_SD_COMBO) {
1624-
set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
1625+
if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) {
1626+
pm_runtime_get_noresume(mmc->parent);
1627+
set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
1628+
}
16251629
clk_en_a = clk_en_a_old & ~clken_low_pwr;
16261630
} else {
1627-
clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
1631+
if (test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)) {
1632+
pm_runtime_put_noidle(mmc->parent);
1633+
clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
1634+
}
16281635
clk_en_a = clk_en_a_old | clken_low_pwr;
16291636
}
16301637

drivers/mmc/host/sdhci-esdhc-imx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,7 @@ static int esdhc_change_pinstate(struct sdhci_host *host,
830830

831831
switch (uhs) {
832832
case MMC_TIMING_UHS_SDR50:
833+
case MMC_TIMING_UHS_DDR50:
833834
pinctrl = imx_data->pins_100mhz;
834835
break;
835836
case MMC_TIMING_UHS_SDR104:

include/linux/mmc/sdio_func.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct sdio_func {
5353
unsigned int state; /* function state */
5454
#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
5555

56-
u8 tmpbuf[4]; /* DMA:able scratch buffer */
56+
u8 *tmpbuf; /* DMA:able scratch buffer */
5757

5858
unsigned num_info; /* number of info strings */
5959
const char **info; /* info strings */

0 commit comments

Comments
 (0)