Skip to content

Commit f287fe3

Browse files
committed
Merge tag 'mmc-v4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
Pull MMC fixes from Ulf Hansson: "MMC core: - Propagate correct error code for RPMB requests MMC host: - sdhci-iproc: Drop hard coded cap for 1.8v - sdhci-iproc: Fix 32bit writes for transfer mode - sdhci-iproc: Enable SDHCI_QUIRK2_HOST_OFF_CARD_ON for cygnus" * tag 'mmc-v4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: mmc: sdhci-iproc: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for cygnus mmc: sdhci-iproc: fix 32bit writes for TRANSFER_MODE register mmc: sdhci-iproc: remove hard coded mmc cap 1.8v mmc: block: propagate correct returned value in mmc_rpmb_ioctl
2 parents b9f5701 + 3de06d5 commit f287fe3

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

drivers/mmc/core/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2485,7 +2485,7 @@ static long mmc_rpmb_ioctl(struct file *filp, unsigned int cmd,
24852485
break;
24862486
}
24872487

2488-
return 0;
2488+
return ret;
24892489
}
24902490

24912491
#ifdef CONFIG_COMPAT

drivers/mmc/host/sdhci-iproc.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ struct sdhci_iproc_host {
3333
const struct sdhci_iproc_data *data;
3434
u32 shadow_cmd;
3535
u32 shadow_blk;
36+
bool is_cmd_shadowed;
37+
bool is_blk_shadowed;
3638
};
3739

3840
#define REG_OFFSET_IN_BITS(reg) ((reg) << 3 & 0x18)
@@ -48,8 +50,22 @@ static inline u32 sdhci_iproc_readl(struct sdhci_host *host, int reg)
4850

4951
static u16 sdhci_iproc_readw(struct sdhci_host *host, int reg)
5052
{
51-
u32 val = sdhci_iproc_readl(host, (reg & ~3));
52-
u16 word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff;
53+
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
54+
struct sdhci_iproc_host *iproc_host = sdhci_pltfm_priv(pltfm_host);
55+
u32 val;
56+
u16 word;
57+
58+
if ((reg == SDHCI_TRANSFER_MODE) && iproc_host->is_cmd_shadowed) {
59+
/* Get the saved transfer mode */
60+
val = iproc_host->shadow_cmd;
61+
} else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) &&
62+
iproc_host->is_blk_shadowed) {
63+
/* Get the saved block info */
64+
val = iproc_host->shadow_blk;
65+
} else {
66+
val = sdhci_iproc_readl(host, (reg & ~3));
67+
}
68+
word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff;
5369
return word;
5470
}
5571

@@ -105,13 +121,15 @@ static void sdhci_iproc_writew(struct sdhci_host *host, u16 val, int reg)
105121

106122
if (reg == SDHCI_COMMAND) {
107123
/* Write the block now as we are issuing a command */
108-
if (iproc_host->shadow_blk != 0) {
124+
if (iproc_host->is_blk_shadowed) {
109125
sdhci_iproc_writel(host, iproc_host->shadow_blk,
110126
SDHCI_BLOCK_SIZE);
111-
iproc_host->shadow_blk = 0;
127+
iproc_host->is_blk_shadowed = false;
112128
}
113129
oldval = iproc_host->shadow_cmd;
114-
} else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) {
130+
iproc_host->is_cmd_shadowed = false;
131+
} else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) &&
132+
iproc_host->is_blk_shadowed) {
115133
/* Block size and count are stored in shadow reg */
116134
oldval = iproc_host->shadow_blk;
117135
} else {
@@ -123,9 +141,11 @@ static void sdhci_iproc_writew(struct sdhci_host *host, u16 val, int reg)
123141
if (reg == SDHCI_TRANSFER_MODE) {
124142
/* Save the transfer mode until the command is issued */
125143
iproc_host->shadow_cmd = newval;
144+
iproc_host->is_cmd_shadowed = true;
126145
} else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) {
127146
/* Save the block info until the command is issued */
128147
iproc_host->shadow_blk = newval;
148+
iproc_host->is_blk_shadowed = true;
129149
} else {
130150
/* Command or other regular 32-bit write */
131151
sdhci_iproc_writel(host, newval, reg & ~3);
@@ -166,7 +186,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
166186

167187
static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = {
168188
.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
169-
.quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
189+
.quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | SDHCI_QUIRK2_HOST_OFF_CARD_ON,
170190
.ops = &sdhci_iproc_32only_ops,
171191
};
172192

@@ -206,7 +226,6 @@ static const struct sdhci_iproc_data iproc_data = {
206226
.caps1 = SDHCI_DRIVER_TYPE_C |
207227
SDHCI_DRIVER_TYPE_D |
208228
SDHCI_SUPPORT_DDR50,
209-
.mmc_caps = MMC_CAP_1_8V_DDR,
210229
};
211230

212231
static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {

0 commit comments

Comments
 (0)