From: Long Yu Date: Tue, 26 Jun 2018 11:19:54 +0000 (+0800) Subject: emmc: Modify txlx latest data for data6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b89c036c228963d668ee7d9d0c335336ca70cb6;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git emmc: Modify txlx latest data for data6 PD#169386: emmc: modify txlx latest data for data6 Change-Id: I5bbfa5fa7fa7641a3a532ef74f5e5450b518135c Signed-off-by: Long Yu --- diff --git a/drivers/amlogic/mmc/aml_sd_emmc.c b/drivers/amlogic/mmc/aml_sd_emmc.c index c276beefaff9..097d2a29314a 100644 --- a/drivers/amlogic/mmc/aml_sd_emmc.c +++ b/drivers/amlogic/mmc/aml_sd_emmc.c @@ -3453,7 +3453,7 @@ static struct meson_mmc_data mmc_data_txlx = { .ds_pin_poll = 0x3c, .ds_pin_poll_en = 0x4a, .ds_pin_poll_bit = 11, - .latest_dat = 7, + .latest_dat = 6, .sdmmc.init.core_phase = 3, .sdmmc.init.tx_phase = 0, .sdmmc.init.rx_phase = 0, diff --git a/drivers/amlogic/mmc/aml_sd_emmc_v3.c b/drivers/amlogic/mmc/aml_sd_emmc_v3.c index 5241cd4a1671..cdce99b87b1e 100644 --- a/drivers/amlogic/mmc/aml_sd_emmc_v3.c +++ b/drivers/amlogic/mmc/aml_sd_emmc_v3.c @@ -1204,7 +1204,7 @@ int aml_emmc_hs200_timming(struct mmc_host *mmc) struct amlsd_host *host = pdata->host; u32 count = 0, delay1 = 0, delay2 = 0; u32 dat = host->data->latest_dat; - int ret = 0; + int ret = 0, add = 0; ret = aml_get_data_eyetest(mmc); if (ret) { @@ -1216,21 +1216,27 @@ int aml_emmc_hs200_timming(struct mmc_host *mmc) delay2 = readl(host->base + SD_EMMC_DELAY2_V3); if (pdata->latest_dat != 0) dat = pdata->latest_dat; + if (dat < 5) + add = (delay1 >> (dat * 6)) & 0x3f; + else + add = (delay2 >> (dat * 6)) & 0x3f; count = fbinary(pdata->align[dat]); - if (count <= pdata->count/3) + if (count <= pdata->count/3) { count = pdata->count/3 - count; - else if (count <= (pdata->count*2)/3) + if (add) + count += add; + } else if (count <= (pdata->count*2)/3) count = 0; else - count = pdata->count/2; + count = (pdata->count - count) + pdata->count/3; delay1 = (count<<0)|(count<<6)|(count<<12) |(count<<18)|(count<<24); writel(delay1, (host->base + SD_EMMC_DELAY1_V3)); delay2 = (count<<0)|(count<<6)|(count<<12); writel(delay2, (host->base + SD_EMMC_DELAY2_V3)); - pr_info("delay1: 0x%x , delay2: 0x%x\n", + pr_info("delay1: 0x%x, delay2: 0x%x, add:%d\n", readl(host->base + SD_EMMC_DELAY1_V3), - readl(host->base + SD_EMMC_DELAY2_V3)); + readl(host->base + SD_EMMC_DELAY2_V3), add); count = fbinary(pdata->align[9]); if (count <= pdata->count/4)