|
30 | 30 | #define SDHCI_ARASAN_VENDOR_REGISTER 0x78 |
31 | 31 |
|
32 | 32 | #define SDHCI_ARASAN_ITAPDLY_REGISTER 0xF0F8 |
| 33 | +#define SDHCI_ARASAN_ITAPDLY_SEL_MASK 0xFF |
| 34 | + |
33 | 35 | #define SDHCI_ARASAN_OTAPDLY_REGISTER 0xF0FC |
| 36 | +#define SDHCI_ARASAN_OTAPDLY_SEL_MASK 0x3F |
34 | 37 |
|
35 | 38 | #define SDHCI_ARASAN_CQE_BASE_ADDR 0x200 |
36 | 39 | #define VENDOR_ENHANCED_STROBE BIT(0) |
@@ -600,14 +603,8 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees) |
600 | 603 | u8 tap_delay, tap_max = 0; |
601 | 604 | int ret; |
602 | 605 |
|
603 | | - /* |
604 | | - * This is applicable for SDHCI_SPEC_300 and above |
605 | | - * ZynqMP does not set phase for <=25MHz clock. |
606 | | - * If degrees is zero, no need to do anything. |
607 | | - */ |
608 | | - if (host->version < SDHCI_SPEC_300 || |
609 | | - host->timing == MMC_TIMING_LEGACY || |
610 | | - host->timing == MMC_TIMING_UHS_SDR12 || !degrees) |
| 606 | + /* This is applicable for SDHCI_SPEC_300 and above */ |
| 607 | + if (host->version < SDHCI_SPEC_300) |
611 | 608 | return 0; |
612 | 609 |
|
613 | 610 | switch (host->timing) { |
@@ -638,6 +635,9 @@ static int sdhci_zynqmp_sdcardclk_set_phase(struct clk_hw *hw, int degrees) |
638 | 635 | if (ret) |
639 | 636 | pr_err("Error setting Output Tap Delay\n"); |
640 | 637 |
|
| 638 | + /* Release DLL Reset */ |
| 639 | + zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_RELEASE); |
| 640 | + |
641 | 641 | return ret; |
642 | 642 | } |
643 | 643 |
|
@@ -668,16 +668,13 @@ static int sdhci_zynqmp_sampleclk_set_phase(struct clk_hw *hw, int degrees) |
668 | 668 | u8 tap_delay, tap_max = 0; |
669 | 669 | int ret; |
670 | 670 |
|
671 | | - /* |
672 | | - * This is applicable for SDHCI_SPEC_300 and above |
673 | | - * ZynqMP does not set phase for <=25MHz clock. |
674 | | - * If degrees is zero, no need to do anything. |
675 | | - */ |
676 | | - if (host->version < SDHCI_SPEC_300 || |
677 | | - host->timing == MMC_TIMING_LEGACY || |
678 | | - host->timing == MMC_TIMING_UHS_SDR12 || !degrees) |
| 671 | + /* This is applicable for SDHCI_SPEC_300 and above */ |
| 672 | + if (host->version < SDHCI_SPEC_300) |
679 | 673 | return 0; |
680 | 674 |
|
| 675 | + /* Assert DLL Reset */ |
| 676 | + zynqmp_pm_sd_dll_reset(node_id, PM_DLL_RESET_ASSERT); |
| 677 | + |
681 | 678 | switch (host->timing) { |
682 | 679 | case MMC_TIMING_MMC_HS: |
683 | 680 | case MMC_TIMING_SD_HS: |
@@ -733,14 +730,8 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees) |
733 | 730 | struct sdhci_host *host = sdhci_arasan->host; |
734 | 731 | u8 tap_delay, tap_max = 0; |
735 | 732 |
|
736 | | - /* |
737 | | - * This is applicable for SDHCI_SPEC_300 and above |
738 | | - * Versal does not set phase for <=25MHz clock. |
739 | | - * If degrees is zero, no need to do anything. |
740 | | - */ |
741 | | - if (host->version < SDHCI_SPEC_300 || |
742 | | - host->timing == MMC_TIMING_LEGACY || |
743 | | - host->timing == MMC_TIMING_UHS_SDR12 || !degrees) |
| 733 | + /* This is applicable for SDHCI_SPEC_300 and above */ |
| 734 | + if (host->version < SDHCI_SPEC_300) |
744 | 735 | return 0; |
745 | 736 |
|
746 | 737 | switch (host->timing) { |
@@ -773,6 +764,7 @@ static int sdhci_versal_sdcardclk_set_phase(struct clk_hw *hw, int degrees) |
773 | 764 | regval = sdhci_readl(host, SDHCI_ARASAN_OTAPDLY_REGISTER); |
774 | 765 | regval |= SDHCI_OTAPDLY_ENABLE; |
775 | 766 | sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER); |
| 767 | + regval &= ~SDHCI_ARASAN_OTAPDLY_SEL_MASK; |
776 | 768 | regval |= tap_delay; |
777 | 769 | sdhci_writel(host, regval, SDHCI_ARASAN_OTAPDLY_REGISTER); |
778 | 770 | } |
@@ -804,14 +796,8 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees) |
804 | 796 | struct sdhci_host *host = sdhci_arasan->host; |
805 | 797 | u8 tap_delay, tap_max = 0; |
806 | 798 |
|
807 | | - /* |
808 | | - * This is applicable for SDHCI_SPEC_300 and above |
809 | | - * Versal does not set phase for <=25MHz clock. |
810 | | - * If degrees is zero, no need to do anything. |
811 | | - */ |
812 | | - if (host->version < SDHCI_SPEC_300 || |
813 | | - host->timing == MMC_TIMING_LEGACY || |
814 | | - host->timing == MMC_TIMING_UHS_SDR12 || !degrees) |
| 799 | + /* This is applicable for SDHCI_SPEC_300 and above */ |
| 800 | + if (host->version < SDHCI_SPEC_300) |
815 | 801 | return 0; |
816 | 802 |
|
817 | 803 | switch (host->timing) { |
@@ -846,6 +832,7 @@ static int sdhci_versal_sampleclk_set_phase(struct clk_hw *hw, int degrees) |
846 | 832 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
847 | 833 | regval |= SDHCI_ITAPDLY_ENABLE; |
848 | 834 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
| 835 | + regval &= ~SDHCI_ARASAN_ITAPDLY_SEL_MASK; |
849 | 836 | regval |= tap_delay; |
850 | 837 | sdhci_writel(host, regval, SDHCI_ARASAN_ITAPDLY_REGISTER); |
851 | 838 | regval &= ~SDHCI_ITAPDLY_CHGWIN; |
|
0 commit comments