vcfg = readl(host->base + SD_EMMC_CFG);
conf->stop_clk = 1;
writel(vcfg, host->base + SD_EMMC_CFG);
+ pdata->stop_clk = 1;
host->is_gated = true;
}
struct amlsd_host *host = pdata->host;
unsigned long clk_ios;
- strcpy(host->cur_dev, pdata->pinname);
- host->val_f = 0;
-
clk_ios = clk_get_rate(host->cfg_div_clk);
vconf = readl(host->base + SD_EMMC_CFG);
adj = readl(host->base + SD_EMMC_ADJUST_V3);
if ((pconf->bus_width == pdata->bus_width)
&& (pconf->bl_len == pdata->bl_len)
+ && (pconf->stop_clk == pdata->stop_clk)
&& (mmc->actual_clock == clk_ios)
&& (adj == pdata->adj)
&& (dly1 == pdata->dly1)
&& (intf3 == pdata->intf3))
return;
+ if (aml_card_type_non_sdio(pdata))
+ vconf = pdata->ctrl;
clk_ios = mmc->actual_clock;
pconf->bus_width = pdata->bus_width;
pconf->bl_len = pdata->bl_len;
+ pconf->stop_clk = pdata->stop_clk;
adj = pdata->adj;
dly1 = pdata->dly1;
dly2 = pdata->dly2;
mmc_request_done(host->mmc, mrq);
#ifdef AML_MMC_TDMA
if ((host->mem->start == host->data->port_b_base)
- && (host->data->chip_type == MMC_CHIP_G12A))
+ && (host->data->chip_type == MMC_CHIP_G12A)
+ && (host->is_tunning == 0))
complete(&host->drv_completion);
#endif
host = pdata->host;
#ifdef AML_MMC_TDMA
if ((host->mem->start == host->data->port_b_base)
- && (host->data->chip_type == MMC_CHIP_G12A))
+ && (host->data->chip_type == MMC_CHIP_G12A)
+ && (mrq->cmd->opcode != MMC_SEND_TUNING_BLOCK))
wait_for_completion(&host->drv_completion);
#endif
if (aml_check_unsupport_cmd(mmc, mrq)) {
#ifdef AML_MMC_TDMA
if ((host->mem->start == host->data->port_b_base)
- && (host->data->chip_type == MMC_CHIP_G12A))
+ && (host->data->chip_type == MMC_CHIP_G12A)
+ && (mrq->cmd->opcode != MMC_SEND_TUNING_BLOCK))
complete(&host->drv_completion);
#endif
return;
pdata->xfer_pre(pdata);
#ifdef AML_MMC_TDMA
- if ((aml_card_type_sdio(pdata)
- || aml_card_type_non_sdio(pdata))
+ if ((host->mem->start == host->data->port_b_base)
&& (host->data->chip_type == MMC_CHIP_G12A)) {
- if (strcmp(host->cur_dev, pdata->pinname) || host->val_f)
aml_sd_emmc_save_host_val(mmc);
}
#endif
goto fail_init_host;
}
- if (host->ctrl_ver >= 3)
- ret = devm_request_threaded_irq(&pdev->dev, host->irq,
- meson_mmc_irq, meson_mmc_irq_thread_v3,
- IRQF_SHARED, "meson-aml-mmc", host);
- else
+ if (host->ctrl_ver >= 3) {
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ ret = devm_request_threaded_irq(&pdev->dev, host->irq,
+ meson_mmc_irq, meson_mmc_irq_thread_v3,
+ IRQF_ONESHOT, "meson-aml-mmc", host);
+ else
+ ret = devm_request_threaded_irq(&pdev->dev, host->irq,
+ meson_mmc_irq, meson_mmc_irq_thread_v3,
+ IRQF_SHARED, "meson-aml-mmc", host);
+ } else
ret = devm_request_threaded_irq(&pdev->dev, host->irq,
meson_mmc_irq, meson_mmc_irq_thread,
IRQF_SHARED, "meson-aml-mmc", host);
/* save def clk & cfg */
pdata->clkc = clk;
pdata->ctrl = cfg;
+ pdata->bl_len = (cfg >> 4) & 0xf;
if (pdata->caps & MMC_CAP_NONREMOVABLE)
pdata->is_in = 1;
if (!conf->stop_clk) {
conf->stop_clk = 1;
writel(vcfg, host->base + SD_EMMC_CFG);
+ pdata->stop_clk = 1;
}
if (aml_card_type_mmc(pdata)) {
conf->stop_clk = 0;
writel(vcfg, host->base + SD_EMMC_CFG);
pdata->clkc = readl(host->base + SD_EMMC_CLOCK_V3);
+ pdata->stop_clk = 0;
}
#endif
pr_debug("actual_clock :%u, HHI_nand: 0x%x\n",
return;
}
- if ((aml_card_type_sdio(pdata)
- || aml_card_type_non_sdio(pdata))
- && (host->data->chip_type == MMC_CHIP_G12A))
- host->val_f = 1;
-
/*Set Power*/
aml_sd_emmc_set_power_v3(pdata, ios->power_mode);
int curr_win_start, curr_win_size;
u32 rxdly[3] = {0xA28A28A, 0x15500514, 0x1FF8079E};
+#ifdef AML_MMC_TDMA
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ wait_for_completion(&host->drv_completion);
+#endif
writel(0, host->base + SD_EMMC_ADJUST_V3);
tunning:
|| (clkc->div >= 10)) {
pr_info("%s: final result of tuning failed\n",
mmc_hostname(host->mmc));
+#ifdef AML_MMC_TDMA
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ complete(&host->drv_completion);
+#endif
+
return -1;
}
clkc->div += 1;
writel(adjust, host->base + SD_EMMC_ADJUST_V3);
pdata->adj = adjust;
host->is_tunning = 0;
+#ifdef AML_MMC_TDMA
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ complete(&host->drv_completion);
+#endif
pr_info("%s: sd_emmc_regs->gclock=0x%x,sd_emmc_regs->gadjust=0x%x\n",
mmc_hostname(host->mmc),