Skip to content
This repository was archived by the owner on Oct 5, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions arch/arm64/boot/dts/hi6220.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,8 @@
compatible = "hisilicon,hi6220-dw-mshc";
num-slots = <0x1>;
board-mmc-bus-clk = <0x0>;
broken-cd;
cap-mmc-highspeed;
non-removable;
reg = <0x0 0xf723d000 0x0 0x1000>;
interrupts = <0x0 0x48 0x4>;
clocks = <&clock_sys HI6220_MMC0_CIUCLK>, <&clock_sys HI6220_MMC0_CLK>;
Expand All @@ -1002,10 +1003,11 @@
board-mmc-bus-clk = <0x0>;
card-detect-delay = <200>;
hisilicon,peripheral-syscon = <&ao_ctrl>;
cap-sd-highspeed;
sd-uhs-sdr12;
sd-uhs-sdr25;
reg = <0x0 0xf723e000 0x0 0x1000>;
interrupts = <0x0 0x49 0x4>;
#address-cells = <0x1>;
#size-cells = <0x0>;
clocks = <&clock_sys HI6220_MMC1_CIUCLK>, <&clock_sys HI6220_MMC1_CLK>;
clock-names = "ciu", "biu";
vqmmc-supply = <&ldo7>;
Expand Down
36 changes: 16 additions & 20 deletions drivers/mmc/host/dw_mmc-k3.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/

#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/mmc/host.h>
#include <linux/mmc/dw_mmc.h>
Expand Down Expand Up @@ -77,18 +76,24 @@ static int dw_mci_hi6220_switch_voltage(struct mmc_host *mmc, struct mmc_ios *io
if (!priv || !priv->reg)
return 0;

min_uv = 1800000;
max_uv = 1800000;

if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) {
ret = regmap_update_bits(priv->reg, AO_SCTRL_CTRL3,
AO_SCTRL_SEL18, 0);
if (ret) {
dev_dbg(host->dev, "switch voltage failed\n");
return ret;
}
min_uv = 3000000;
max_uv = 3000000;
} else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
ret = regmap_update_bits(priv->reg, AO_SCTRL_CTRL3,
AO_SCTRL_SEL18, AO_SCTRL_SEL18);
min_uv = 1800000;
max_uv = 1800000;
} else {
dev_dbg(host->dev, "voltage not supported\n");
return -EINVAL;
}

if (ret) {
dev_dbg(host->dev, "switch voltage failed\n");
return ret;
}

if (IS_ERR_OR_NULL(mmc->supply.vqmmc))
Expand All @@ -100,24 +105,15 @@ static int dw_mci_hi6220_switch_voltage(struct mmc_host *mmc, struct mmc_ios *io
ret, min_uv, max_uv);
return ret;
}

ret = regulator_enable(mmc->supply.vqmmc);
if (ret) {
dev_dbg(host->dev, "Regulator enable error %d\n", ret);
return ret;
}

usleep_range(5000, 5500);

return 0;
}
}

static void dw_mci_hi6220_set_ios(struct dw_mci *host, struct mmc_ios *ios)
{
int ret;
unsigned int clock;

clock = (ios->clock <= 25000000) ? 25000000: ios->clock;
clock = (ios->clock <= 25000000) ? 25000000 : ios->clock;

ret = clk_set_rate(host->biu_clk, clock);
if (ret)
Expand All @@ -134,7 +130,7 @@ static const struct dw_mci_drv_data hi6220_data = {

static const struct of_device_id dw_mci_k3_match[] = {
{ .compatible = "hisilicon,hi4511-dw-mshc", .data = &k3_drv_data, },
{ .compatible = "hisilicon,hi6220-dw-mshc", .data = &hi6220_data, },
{ .compatible = "hisilicon,hi6220-dw-mshc", .data = &hi6220_data, },
{},
};
MODULE_DEVICE_TABLE(of, dw_mci_k3_match);
Expand Down
3 changes: 2 additions & 1 deletion drivers/mmc/host/dw_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,8 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
int gpio_cd = mmc_gpio_get_cd(mmc);

/* Use platform get_cd function, else try onboard card detect */
if (brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION)
if ((brd->quirks & DW_MCI_QUIRK_BROKEN_CARD_DETECTION) ||
(mmc->caps & MMC_CAP_NONREMOVABLE))
present = 1;
else if (!IS_ERR_VALUE(gpio_cd))
present = gpio_cd;
Expand Down