Skip to content

Commit 6ee5233

Browse files
wensstorulf
authored andcommitted
mmc: mtk-sd: Limit getting top_base to SoCs that require it
Currently the mtk-sd driver tries to get and map the second register base, named top_base in the code, regardless of whether the SoC model actually has it or not. This produces confusing big error messages on the platforms that don't need it: mtk-msdc 11260000.mmc: error -EINVAL: invalid resource (null) Limit it to the platforms that actually require it, based on their device tree entries, and properly fail if it is missing. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Message-ID: <20241210073212.3917912-3-wenst@chromium.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 6af057a commit 6ee5233

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/mmc/host/mtk-sd.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ struct mtk_mmc_compatible {
414414
u8 clk_div_bits;
415415
bool recheck_sdio_irq;
416416
bool hs400_tune; /* only used for MT8173 */
417+
bool needs_top_base;
417418
u32 pad_tune_reg;
418419
bool async_fifo;
419420
bool data_tune;
@@ -587,6 +588,7 @@ static const struct mtk_mmc_compatible mt7986_compat = {
587588
.clk_div_bits = 12,
588589
.recheck_sdio_irq = true,
589590
.hs400_tune = false,
591+
.needs_top_base = true,
590592
.pad_tune_reg = MSDC_PAD_TUNE0,
591593
.async_fifo = true,
592594
.data_tune = true,
@@ -627,6 +629,7 @@ static const struct mtk_mmc_compatible mt8183_compat = {
627629
.clk_div_bits = 12,
628630
.recheck_sdio_irq = false,
629631
.hs400_tune = false,
632+
.needs_top_base = true,
630633
.pad_tune_reg = MSDC_PAD_TUNE0,
631634
.async_fifo = true,
632635
.data_tune = true,
@@ -653,6 +656,7 @@ static const struct mtk_mmc_compatible mt8196_compat = {
653656
.clk_div_bits = 12,
654657
.recheck_sdio_irq = false,
655658
.hs400_tune = false,
659+
.needs_top_base = true,
656660
.pad_tune_reg = MSDC_PAD_TUNE0,
657661
.async_fifo = true,
658662
.data_tune = true,
@@ -2887,9 +2891,13 @@ static int msdc_drv_probe(struct platform_device *pdev)
28872891
if (IS_ERR(host->base))
28882892
return PTR_ERR(host->base);
28892893

2890-
host->top_base = devm_platform_ioremap_resource(pdev, 1);
2891-
if (IS_ERR(host->top_base))
2892-
host->top_base = NULL;
2894+
host->dev_comp = of_device_get_match_data(&pdev->dev);
2895+
2896+
if (host->dev_comp->needs_top_base) {
2897+
host->top_base = devm_platform_ioremap_resource(pdev, 1);
2898+
if (IS_ERR(host->top_base))
2899+
return PTR_ERR(host->top_base);
2900+
}
28932901

28942902
ret = mmc_regulator_get_supply(mmc);
28952903
if (ret)
@@ -2951,7 +2959,6 @@ static int msdc_drv_probe(struct platform_device *pdev)
29512959
msdc_of_property_parse(pdev, host);
29522960

29532961
host->dev = &pdev->dev;
2954-
host->dev_comp = of_device_get_match_data(&pdev->dev);
29552962
host->src_clk_freq = clk_get_rate(host->src_clk);
29562963
/* Set host parameters to mmc */
29572964
mmc->ops = &mt_msdc_ops;

0 commit comments

Comments
 (0)