From 8f2b19887ef6394fd4d6a8135c4059a5d4586518 Mon Sep 17 00:00:00 2001 From: liangshuang Date: Thu, 30 May 2024 09:50:56 +0800 Subject: [PATCH 040/222] refactor:remove useless code in emmc/sd driver. Changelogs: 1.Remove useless code related to HAPS/ZEBU. 2.Add type attributes in dts. --- arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts | 4 ++++ arch/riscv/boot/dts/eswin/eic7700-evb.dts | 4 ++++ .../boot/dts/eswin/hifive-premier-550.dts | 6 +++++- drivers/mmc/host/sdhci-of-eswin-sdio.c | 17 ---------------- drivers/mmc/host/sdhci-of-eswin.c | 20 ------------------- 5 files changed, 13 insertions(+), 38 deletions(-) diff --git a/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts b/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts index 584338c8ad4c..008c21b95a6f 100644 --- a/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts +++ b/arch/riscv/boot/dts/eswin/eic7700-evb-a2.dts @@ -482,6 +482,8 @@ &sdhci_emmc { enable-data-pullup; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_emmc_led_control_default>; + no-sdio; + no-sd; }; &sdio0 { @@ -494,6 +496,7 @@ &sdio0 { enable-data-pullup; enable_sw_tuning; no-sdio; + no-mmc; }; &sdio1 { @@ -507,6 +510,7 @@ &sdio1 { enable_sw_tuning; non-removable; no-sd; + no-mmc; }; &d0_gmac0 { diff --git a/arch/riscv/boot/dts/eswin/eic7700-evb.dts b/arch/riscv/boot/dts/eswin/eic7700-evb.dts index 4ed625ef7bd3..4d9aeafa93f7 100644 --- a/arch/riscv/boot/dts/eswin/eic7700-evb.dts +++ b/arch/riscv/boot/dts/eswin/eic7700-evb.dts @@ -453,6 +453,8 @@ &sdhci_emmc { drive-impedance-ohm = <50>; enable-cmd-pullup; enable-data-pullup; + no-sdio; + no-sd; }; &sdio0 { @@ -464,6 +466,7 @@ &sdio0 { enable-data-pullup; enable_sw_tuning; no-sdio; + no-mmc; }; &sdio1 { @@ -476,6 +479,7 @@ &sdio1 { enable_sw_tuning; non-removable; no-sd; + no-mmc; }; &d0_gmac0 { diff --git a/arch/riscv/boot/dts/eswin/hifive-premier-550.dts b/arch/riscv/boot/dts/eswin/hifive-premier-550.dts index f0883f403393..e2a203812d12 100644 --- a/arch/riscv/boot/dts/eswin/hifive-premier-550.dts +++ b/arch/riscv/boot/dts/eswin/hifive-premier-550.dts @@ -394,6 +394,8 @@ &sdhci_emmc { enable-data-pullup; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_emmc_led_control_default>; + no-sdio; + no-sd; }; &sdio0 { @@ -406,11 +408,12 @@ &sdio0 { enable-data-pullup; enable_sw_tuning; no-sdio; + no-mmc; }; &sdio1 { /* wifi module */ - status = "disabled"; + status = "okay"; delay_code = <0x21>; drive-impedance-ohm = <33>; enable-cmd-pullup; @@ -418,6 +421,7 @@ &sdio1 { enable_sw_tuning; non-removable; no-sd; + no-mmc; }; &d0_gmac0 { diff --git a/drivers/mmc/host/sdhci-of-eswin-sdio.c b/drivers/mmc/host/sdhci-of-eswin-sdio.c index fa23d1ded51c..83cbdb61c936 100644 --- a/drivers/mmc/host/sdhci-of-eswin-sdio.c +++ b/drivers/mmc/host/sdhci-of-eswin-sdio.c @@ -851,23 +851,6 @@ static int eswin_sdhci_sdio_probe(struct platform_device *pdev) goto err_pltfm_free; } -#if defined(__SDIO_HAPS) || defined(__SDIO_ZEBU) -#if !defined(__SDIO_UHS) - /* This macro is only for setting 3.3v speed mode(HAPS) , you can delete it later*/ - eswin_sdhci_sdio->host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V; -#endif -#if defined(__SDIO_PIO) - /* This macro is only for testing PIO , you can delete it later*/ - eswin_sdhci_sdio->host->quirks |= SDHCI_QUIRK_BROKEN_DMA | - SDHCI_QUIRK_BROKEN_ADMA; -#elif defined(__SDIO_SDMA) - /* This macro is only for testing SDMA ,you can delete it later*/ - eswin_sdhci_sdio->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; -#elif defined(__SDIO_ADMA3) - /* This macro is only for testing ADMA3 ,you can delete it later*/ - sdhci_enable_v4_mode(eswin_sdhci_sdio->host); -#endif -#endif sdhci_get_of_property(pdev); eswin_sdhci_sdio->clk_ops = data->clk_ops; diff --git a/drivers/mmc/host/sdhci-of-eswin.c b/drivers/mmc/host/sdhci-of-eswin.c index 591315f48cbc..41aa80f8dbe3 100644 --- a/drivers/mmc/host/sdhci-of-eswin.c +++ b/drivers/mmc/host/sdhci-of-eswin.c @@ -87,7 +87,6 @@ static void eswin_sdhci_set_clock(struct sdhci_host *host, unsigned int clock) msleep(20); } -#if !defined(__FPGA) && !defined(__ZEBU) static void eswin_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, struct mmc_ios *ios) { @@ -102,7 +101,6 @@ static void eswin_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc, sdhci_writel(host, vendor, eswin_sdhci_VENDOR_EMMC_CTRL_REGISTER); } -#endif static void eswin_sdhci_config_phy_delay(struct sdhci_host *host, int delay) { @@ -890,20 +888,6 @@ static int eswin_sdhci_probe(struct platform_device *pdev) goto err_pltfm_free; } -#if defined(__FPGA) || defined(__ZEBU) -#if defined __SDMA - eswin_sdhci->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA; -#elif defined(__ADMA2) || defined(__ADMA3) -#else - eswin_sdhci->host->quirks |= SDHCI_QUIRK_BROKEN_ADMA | - SDHCI_QUIRK_BROKEN_DMA; -#endif -#endif - -#if defined(__FORCE_1BIT) - eswin_sdhci->host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; -#endif - eswin_sdhci->clk_ahb = devm_clk_get(dev, "clk_ahb"); if (IS_ERR(eswin_sdhci->clk_ahb)) { ret = dev_err_probe(dev, PTR_ERR(eswin_sdhci->clk_ahb), @@ -990,7 +974,6 @@ static int eswin_sdhci_probe(struct platform_device *pdev) goto unreg_clk; } -#if !defined(__FPGA) && !defined(__ZEBU) if (of_device_is_compatible(dev->of_node, "eswin,sdhci-5.1")) { host->mmc_host_ops.hs400_enhanced_strobe = eswin_sdhci_hs400_enhanced_strobe; @@ -1000,11 +983,8 @@ static int eswin_sdhci_probe(struct platform_device *pdev) if (!of_property_read_bool(dev->of_node, "disable-cqe-dcmd")) host->mmc->caps2 |= MMC_CAP2_CQE_DCMD; } -#endif -#if !defined(__ADMA3_DISABLE) sdhci_enable_v4_mode(eswin_sdhci->host); -#endif ret = eswin_sdhci_add_host(eswin_sdhci); if (ret) -- 2.47.0