misc: rtsx: Fix clock timing for RTS5261
authorRui Feng <rui_feng@realsil.com.cn>
Tue, 3 Nov 2020 09:55:21 +0000 (17:55 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 16 Nov 2020 10:59:30 +0000 (11:59 +0100)
This patch fix clock timing for RTS5261, using 256 divide
for the version higher than version C.

Signed-off-by: Rui Feng <rui_feng@realsil.com.cn>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/1604397321-3026-1-git-send-email-rui_feng@realsil.com.cn
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/misc/cardreader/rts5261.c

index 2ada973a0f33d2f8931222df14765deefd43cf35..6c64dade8e1af58d207429323f96cd6fb4f04d7f 100644 (file)
@@ -649,7 +649,7 @@ int rts5261_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
 
        if (initial_mode) {
                /* We use 250k(around) here, in initial stage */
-               if (is_version(pcr, PID_5261, IC_VER_D)) {
+               if (is_version_higher_than(pcr, PID_5261, IC_VER_C)) {
                        clk_divider = SD_CLK_DIVIDE_256;
                        card_clock = 60000000;
                } else {
@@ -700,7 +700,7 @@ int rts5261_pci_switch_clock(struct rtsx_pcr *pcr, unsigned int card_clock,
                div++;
        }
 
-       n = (n / 2);
+       n = (n / 2) - 1;
        pcr_dbg(pcr, "n = %d, div = %d\n", n, div);
 
        ssc_depth = depth[ssc_depth];