Commit 6fc0ca17 authored by Ulf Hansson's avatar Ulf Hansson

mmc: Merge branch fixes into next

Merge the mmc fixes for v6.7-rc[n] into the next branch, to allow them to
get tested together with the new mmc changes that are targeted for v6.8.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parents 9463571b e7794c14
...@@ -874,9 +874,10 @@ static const struct block_device_operations mmc_bdops = { ...@@ -874,9 +874,10 @@ static const struct block_device_operations mmc_bdops = {
static int mmc_blk_part_switch_pre(struct mmc_card *card, static int mmc_blk_part_switch_pre(struct mmc_card *card,
unsigned int part_type) unsigned int part_type)
{ {
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
int ret = 0; int ret = 0;
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { if ((part_type & mask) == mask) {
if (card->ext_csd.cmdq_en) { if (card->ext_csd.cmdq_en) {
ret = mmc_cmdq_disable(card); ret = mmc_cmdq_disable(card);
if (ret) if (ret)
...@@ -891,9 +892,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card, ...@@ -891,9 +892,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
static int mmc_blk_part_switch_post(struct mmc_card *card, static int mmc_blk_part_switch_post(struct mmc_card *card,
unsigned int part_type) unsigned int part_type)
{ {
const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB;
int ret = 0; int ret = 0;
if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { if ((part_type & mask) == mask) {
mmc_retune_unpause(card->host); mmc_retune_unpause(card->host);
if (card->reenable_cmdq && !card->ext_csd.cmdq_en) if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
ret = mmc_cmdq_enable(card); ret = mmc_cmdq_enable(card);
...@@ -3185,4 +3187,3 @@ module_exit(mmc_blk_exit); ...@@ -3185,4 +3187,3 @@ module_exit(mmc_blk_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver"); MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
...@@ -269,7 +269,7 @@ static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc) ...@@ -269,7 +269,7 @@ static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc)
static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios) static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios)
{ {
struct meson_mx_sdhc_host *host = mmc_priv(mmc); struct meson_mx_sdhc_host *host = mmc_priv(mmc);
u32 rx_clk_phase; u32 val, rx_clk_phase;
int ret; int ret;
meson_mx_sdhc_disable_clks(mmc); meson_mx_sdhc_disable_clks(mmc);
...@@ -290,27 +290,11 @@ static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -290,27 +290,11 @@ static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios)
mmc->actual_clock = clk_get_rate(host->sd_clk); mmc->actual_clock = clk_get_rate(host->sd_clk);
/* /*
* according to Amlogic the following latching points are * Phase 90 should work in most cases. For data transmission,
* selected with empirical values, there is no (known) formula * meson_mx_sdhc_execute_tuning() will find a accurate value
* to calculate these.
*/ */
if (mmc->actual_clock > 100000000) { regmap_read(host->regmap, MESON_SDHC_CLKC, &val);
rx_clk_phase = 1; rx_clk_phase = FIELD_GET(MESON_SDHC_CLKC_CLK_DIV, val) / 4;
} else if (mmc->actual_clock > 45000000) {
if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330)
rx_clk_phase = 15;
else
rx_clk_phase = 11;
} else if (mmc->actual_clock >= 25000000) {
rx_clk_phase = 15;
} else if (mmc->actual_clock > 5000000) {
rx_clk_phase = 23;
} else if (mmc->actual_clock > 1000000) {
rx_clk_phase = 55;
} else {
rx_clk_phase = 1061;
}
regmap_update_bits(host->regmap, MESON_SDHC_CLK2, regmap_update_bits(host->regmap, MESON_SDHC_CLK2,
MESON_SDHC_CLK2_RX_CLK_PHASE, MESON_SDHC_CLK2_RX_CLK_PHASE,
FIELD_PREP(MESON_SDHC_CLK2_RX_CLK_PHASE, FIELD_PREP(MESON_SDHC_CLK2_RX_CLK_PHASE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment