0158-mmc-mediatek-add-latch-ck-support.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From de14d1d0dc7ecf5c3e7e2a591b4f14e688fa52e6 Mon Sep 17 00:00:00 2001
  2. From: Chaotian Jing <[email protected]>
  3. Date: Mon, 16 Oct 2017 09:46:37 +0800
  4. Subject: [PATCH 158/224] mmc: mediatek: add latch-ck support
  5. some platform(eg.mt2701) does not support "stop clk fix", in
  6. this case, need set correct latch-ck to avoid crc error caused
  7. by stop clock block-internally.
  8. Signed-off-by: Chaotian Jing <[email protected]>
  9. Tested-by: Sean Wang <[email protected]>
  10. Signed-off-by: Ulf Hansson <[email protected]>
  11. ---
  12. drivers/mmc/host/mtk-sd.c | 6 ++++++
  13. 1 file changed, 6 insertions(+)
  14. diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
  15. index a2f26c9b17b4..d75a93d6803f 100644
  16. --- a/drivers/mmc/host/mtk-sd.c
  17. +++ b/drivers/mmc/host/mtk-sd.c
  18. @@ -378,6 +378,7 @@ struct msdc_host {
  19. u32 sclk; /* SD/MS bus clock frequency */
  20. unsigned char timing;
  21. bool vqmmc_enabled;
  22. + u32 latch_ck;
  23. u32 hs400_ds_delay;
  24. u32 hs200_cmd_int_delay; /* cmd internal delay for HS200/SDR104 */
  25. u32 hs400_cmd_int_delay; /* cmd internal delay for HS400 */
  26. @@ -1661,6 +1662,8 @@ static int msdc_tune_data(struct mmc_host *mmc, u32 opcode)
  27. u32 tune_reg = host->dev_comp->pad_tune_reg;
  28. int i, ret;
  29. + sdr_set_field(host->base + MSDC_PATCH_BIT, MSDC_INT_DAT_LATCH_CK_SEL,
  30. + host->latch_ck);
  31. sdr_clr_bits(host->base + MSDC_IOCON, MSDC_IOCON_DSPL);
  32. sdr_clr_bits(host->base + MSDC_IOCON, MSDC_IOCON_W_DSPL);
  33. for (i = 0 ; i < PAD_DELAY_MAX; i++) {
  34. @@ -1773,6 +1776,9 @@ static const struct mmc_host_ops mt_msdc_ops = {
  35. static void msdc_of_property_parse(struct platform_device *pdev,
  36. struct msdc_host *host)
  37. {
  38. + of_property_read_u32(pdev->dev.of_node, "mediatek,latch-ck",
  39. + &host->latch_ck);
  40. +
  41. of_property_read_u32(pdev->dev.of_node, "hs400-ds-delay",
  42. &host->hs400_ds_delay);
  43. --
  44. 2.11.0