Skip to content

Commit 1649904

Browse files
AngeloGioacchino Del RegnoUlf Hansson
authored andcommitted
mmc: mtk-sd: Do single write in function msdc_new_tx_setting
Instead of reading and writing the LOOP_TEST_CONTROL register for each set or cleared bit, read it once, modify the contents in a local variable, and then write once. Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://lore.kernel.org/r/20250325110701.52623-4-angelogioacchino.delregno@collabora.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 091bf79 commit 1649904

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

drivers/mmc/host/mtk-sd.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -942,15 +942,15 @@ static int msdc_ungate_clock(struct msdc_host *host)
942942

943943
static void msdc_new_tx_setting(struct msdc_host *host)
944944
{
945+
u32 val;
946+
945947
if (!host->top_base)
946948
return;
947949

948-
sdr_set_bits(host->top_base + LOOP_TEST_CONTROL,
949-
TEST_LOOP_DSCLK_MUX_SEL);
950-
sdr_set_bits(host->top_base + LOOP_TEST_CONTROL,
951-
TEST_LOOP_LATCH_MUX_SEL);
952-
sdr_clr_bits(host->top_base + LOOP_TEST_CONTROL,
953-
TEST_HS400_CMD_LOOP_MUX_SEL);
950+
val = readl(host->top_base + LOOP_TEST_CONTROL);
951+
val |= TEST_LOOP_DSCLK_MUX_SEL;
952+
val |= TEST_LOOP_LATCH_MUX_SEL;
953+
val &= ~TEST_HS400_CMD_LOOP_MUX_SEL;
954954

955955
switch (host->timing) {
956956
case MMC_TIMING_LEGACY:
@@ -960,19 +960,18 @@ static void msdc_new_tx_setting(struct msdc_host *host)
960960
case MMC_TIMING_UHS_SDR25:
961961
case MMC_TIMING_UHS_DDR50:
962962
case MMC_TIMING_MMC_DDR52:
963-
sdr_clr_bits(host->top_base + LOOP_TEST_CONTROL,
964-
LOOP_EN_SEL_CLK);
963+
val &= ~LOOP_EN_SEL_CLK;
965964
break;
966965
case MMC_TIMING_UHS_SDR50:
967966
case MMC_TIMING_UHS_SDR104:
968967
case MMC_TIMING_MMC_HS200:
969968
case MMC_TIMING_MMC_HS400:
970-
sdr_set_bits(host->top_base + LOOP_TEST_CONTROL,
971-
LOOP_EN_SEL_CLK);
969+
val |= LOOP_EN_SEL_CLK;
972970
break;
973971
default:
974972
break;
975973
}
974+
writel(val, host->top_base + LOOP_TEST_CONTROL);
976975
}
977976

978977
static void msdc_set_mclk(struct msdc_host *host, unsigned char timing, u32 hz)

0 commit comments

Comments
 (0)