Skip to content

Commit 7b222e7

Browse files
committed
Merge pull request torvalds#153 from kongzizaixian/hikey
SD: hisi: add this support for high speed sd card
2 parents 83e5381 + 9c0ce69 commit 7b222e7

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

arch/arm64/boot/dts/hi6220.dtsi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,9 @@
10461046
card-detect-delay = <200>;
10471047
hisilicon,peripheral-syscon = <&ao_ctrl>;
10481048
cap-sd-highspeed;
1049+
sd-uhs-sdr12;
1050+
sd-uhs-sdr25;
1051+
sd-uhs-sdr50;
10491052
reg = <0x0 0xf723e000 0x0 0x1000>;
10501053
interrupts = <0x0 0x49 0x4>;
10511054
clocks = <&clock_sys HI6220_MMC1_CIUCLK>, <&clock_sys HI6220_MMC1_CLK>;

drivers/mmc/host/dw_mmc-k3.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,16 @@ static void dw_mci_hi6220_set_ios(struct dw_mci *host, struct mmc_ios *ios)
122122
host->bus_hz = clk_get_rate(host->biu_clk);
123123
}
124124

125+
static void dw_mci_hi6220_prepare_command(struct dw_mci *host, u32 *cmdr)
126+
{
127+
*cmdr |= SDMMC_CMD_USE_HOLD_REG;
128+
}
129+
125130
static const struct dw_mci_drv_data hi6220_data = {
126131
.switch_voltage = dw_mci_hi6220_switch_voltage,
127132
.set_ios = dw_mci_hi6220_set_ios,
128133
.parse_dt = dw_mci_hi6220_parse_dt,
134+
.prepare_command = dw_mci_hi6220_prepare_command,
129135
};
130136

131137
static const struct of_device_id dw_mci_k3_match[] = {

drivers/mmc/host/dw_mmc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
213213
{
214214
struct mmc_data *data;
215215
struct dw_mci_slot *slot = mmc_priv(mmc);
216-
struct dw_mci *host = slot->host;
217216
const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
218217
u32 cmdr;
219218
cmd->error = -EINPROGRESS;
@@ -230,7 +229,6 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
230229
cmdr |= SDMMC_CMD_PRV_DAT_WAIT;
231230

232231
if (cmd->opcode == SD_SWITCH_VOLTAGE) {
233-
u32 clk_en_a;
234232

235233
/* Special bit makes CMD11 not die */
236234
cmdr |= SDMMC_CMD_VOLT_SWITCH;
@@ -250,11 +248,6 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
250248
* ever called with a non-zero clock. That shouldn't happen
251249
* until the voltage change is all done.
252250
*/
253-
clk_en_a = mci_readl(host, CLKENA);
254-
clk_en_a &= ~(SDMMC_CLKEN_LOW_PWR << slot->id);
255-
mci_writel(host, CLKENA, clk_en_a);
256-
mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
257-
SDMMC_CMD_PRV_DAT_WAIT, 0);
258251
}
259252

260253
if (cmd->flags & MMC_RSP_PRESENT) {
@@ -870,7 +863,8 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
870863

871864
/* enable clock; only low power if no SDIO */
872865
clk_en_a = SDMMC_CLKEN_ENABLE << slot->id;
873-
if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags))
866+
if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)
867+
&& (slot->mmc->index != 1))
874868
clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id;
875869
mci_writel(host, CLKENA, clk_en_a);
876870

@@ -1024,6 +1018,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
10241018
else
10251019
regs &= ~((0x1 << slot->id) << 16);
10261020

1021+
if (mmc->index == 1)
1022+
regs |= (0x1 << slot->id);
1023+
10271024
mci_writel(slot->host, UHS_REG, regs);
10281025
slot->host->timing = ios->timing;
10291026

@@ -1275,6 +1272,9 @@ static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
12751272

12761273
if (drv_data && drv_data->execute_tuning)
12771274
err = drv_data->execute_tuning(slot);
1275+
else
1276+
err = 0;
1277+
12781278
return err;
12791279
}
12801280

0 commit comments

Comments
 (0)