Skip to content

Commit 4686392

Browse files
Ricky Wustorulf
authored andcommitted
mmc: rtsx_pci: Fix support for speed-modes that relies on tuning
The TX/RX register should not be treated the same way to allow for better support of tuning. Fix this by using a default initial value for TX. Signed-off-by: Ricky Wu <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] [Ulf: Updated changelog] Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]>
1 parent 53dd0a7 commit 4686392

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

drivers/misc/cardreader/rts5227.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static const struct pcr_ops rts522a_pcr_ops = {
394394
void rts522a_init_params(struct rtsx_pcr *pcr)
395395
{
396396
rts5227_init_params(pcr);
397-
397+
pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
398398
pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
399399

400400
pcr->option.ocp_en = 1;

drivers/misc/cardreader/rts5249.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ static const struct pcr_ops rts524a_pcr_ops = {
618618
void rts524a_init_params(struct rtsx_pcr *pcr)
619619
{
620620
rts5249_init_params(pcr);
621+
pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
621622
pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
622623
pcr->option.ltr_l1off_snooze_sspwrgate =
623624
LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;
@@ -733,6 +734,7 @@ static const struct pcr_ops rts525a_pcr_ops = {
733734
void rts525a_init_params(struct rtsx_pcr *pcr)
734735
{
735736
rts5249_init_params(pcr);
737+
pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11);
736738
pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
737739
pcr->option.ltr_l1off_snooze_sspwrgate =
738740
LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;

drivers/misc/cardreader/rts5260.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr)
662662
pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
663663
pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
664664
pcr->aspm_en = ASPM_L1_EN;
665-
pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
665+
pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
666666
pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
667667

668668
pcr->ic_version = rts5260_get_ic_version(pcr);

drivers/misc/cardreader/rts5261.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ void rts5261_init_params(struct rtsx_pcr *pcr)
764764
pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
765765
pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
766766
pcr->aspm_en = ASPM_L1_EN;
767-
pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 27, 16);
767+
pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11);
768768
pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
769769

770770
pcr->ic_version = rts5261_get_ic_version(pcr);

drivers/mmc/host/rtsx_pci_sdmmc.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -606,19 +606,22 @@ static int sd_change_phase(struct realtek_pci_sdmmc *host,
606606
u8 sample_point, bool rx)
607607
{
608608
struct rtsx_pcr *pcr = host->pcr;
609-
609+
u16 SD_VP_CTL = 0;
610610
dev_dbg(sdmmc_dev(host), "%s(%s): sample_point = %d\n",
611611
__func__, rx ? "RX" : "TX", sample_point);
612612

613613
rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, CHANGE_CLK);
614-
if (rx)
614+
if (rx) {
615+
SD_VP_CTL = SD_VPRX_CTL;
615616
rtsx_pci_write_register(pcr, SD_VPRX_CTL,
616617
PHASE_SELECT_MASK, sample_point);
617-
else
618+
} else {
619+
SD_VP_CTL = SD_VPTX_CTL;
618620
rtsx_pci_write_register(pcr, SD_VPTX_CTL,
619621
PHASE_SELECT_MASK, sample_point);
620-
rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET, 0);
621-
rtsx_pci_write_register(pcr, SD_VPCLK0_CTL, PHASE_NOT_RESET,
622+
}
623+
rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET, 0);
624+
rtsx_pci_write_register(pcr, SD_VP_CTL, PHASE_NOT_RESET,
622625
PHASE_NOT_RESET);
623626
rtsx_pci_write_register(pcr, CLK_CTL, CHANGE_CLK, 0);
624627
rtsx_pci_write_register(pcr, SD_CFG1, SD_ASYNC_FIFO_NOT_RST, 0);

0 commit comments

Comments
 (0)