Skip to content

Commit

Permalink
Merge pull request torvalds#153 from kongzizaixian/hikey
Browse files Browse the repository at this point in the history
SD: hisi: add this support for high speed sd card
  • Loading branch information
docularxu committed Nov 23, 2015
2 parents 83e5381 + 9c0ce69 commit 7b222e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions arch/arm64/boot/dts/hi6220.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,9 @@
card-detect-delay = <200>;
hisilicon,peripheral-syscon = <&ao_ctrl>;
cap-sd-highspeed;
sd-uhs-sdr12;
sd-uhs-sdr25;
sd-uhs-sdr50;
reg = <0x0 0xf723e000 0x0 0x1000>;
interrupts = <0x0 0x49 0x4>;
clocks = <&clock_sys HI6220_MMC1_CIUCLK>, <&clock_sys HI6220_MMC1_CLK>;
Expand Down
6 changes: 6 additions & 0 deletions drivers/mmc/host/dw_mmc-k3.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,16 @@ static void dw_mci_hi6220_set_ios(struct dw_mci *host, struct mmc_ios *ios)
host->bus_hz = clk_get_rate(host->biu_clk);
}

static void dw_mci_hi6220_prepare_command(struct dw_mci *host, u32 *cmdr)
{
*cmdr |= SDMMC_CMD_USE_HOLD_REG;
}

static const struct dw_mci_drv_data hi6220_data = {
.switch_voltage = dw_mci_hi6220_switch_voltage,
.set_ios = dw_mci_hi6220_set_ios,
.parse_dt = dw_mci_hi6220_parse_dt,
.prepare_command = dw_mci_hi6220_prepare_command,
};

static const struct of_device_id dw_mci_k3_match[] = {
Expand Down
16 changes: 8 additions & 8 deletions drivers/mmc/host/dw_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
{
struct mmc_data *data;
struct dw_mci_slot *slot = mmc_priv(mmc);
struct dw_mci *host = slot->host;
const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
u32 cmdr;
cmd->error = -EINPROGRESS;
Expand All @@ -230,7 +229,6 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd)
cmdr |= SDMMC_CMD_PRV_DAT_WAIT;

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

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

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

/* enable clock; only low power if no SDIO */
clk_en_a = SDMMC_CLKEN_ENABLE << slot->id;
if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags))
if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags)
&& (slot->mmc->index != 1))
clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id;
mci_writel(host, CLKENA, clk_en_a);

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

if (mmc->index == 1)
regs |= (0x1 << slot->id);

mci_writel(slot->host, UHS_REG, regs);
slot->host->timing = ios->timing;

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

if (drv_data && drv_data->execute_tuning)
err = drv_data->execute_tuning(slot);
else
err = 0;

return err;
}

Expand Down

0 comments on commit 7b222e7

Please sign in to comment.