Lines Matching +full:we +full:- +full:extra +full:- +full:delay
1 // SPDX-License-Identifier: GPL-2.0+
5 * Author: Shan-Chun Hung <shanchun1218@gmail.com>
13 #include <linux/delay.h>
16 #include <linux/dma-mapping.h>
32 #include "sdhci-pltfm.h"
69 * If DMA addr spans 128MB boundary, we split the DMA transfer into two
77 if (likely(!len || (ALIGN(addr, SZ_128M) == ALIGN(addr + len - 1, SZ_128M)))) { in ma35_adma_write_desc()
82 offset = addr & (SZ_128M - 1); in ma35_adma_write_desc()
83 tmplen = SZ_128M - offset; in ma35_adma_write_desc()
87 len -= tmplen; in ma35_adma_write_desc()
115 switch (ios->signal_voltage) { in ma35_start_signal_voltage_switch()
117 if (!IS_ERR(priv->pinctrl) && !IS_ERR(priv->pins_uhs)) in ma35_start_signal_voltage_switch()
118 pinctrl_select_state(priv->pinctrl, priv->pins_uhs); in ma35_start_signal_voltage_switch()
121 if (!IS_ERR(priv->pinctrl) && !IS_ERR(priv->pins_default)) in ma35_start_signal_voltage_switch()
122 pinctrl_select_state(priv->pinctrl, priv->pins_default); in ma35_start_signal_voltage_switch()
125 dev_err(mmc_dev(host->mmc), "Unsupported signal voltage!\n"); in ma35_start_signal_voltage_switch()
126 return -EINVAL; in ma35_start_signal_voltage_switch()
160 reset_control_assert(priv->rst); in ma35_execute_tuning()
161 reset_control_deassert(priv->rst); in ma35_execute_tuning()
194 struct device *dev = &pdev->dev; in ma35_probe()
199 u32 extra, ctl; in ma35_probe() local
205 /* Extra adma table cnt for cross 128M boundary handling. */ in ma35_probe()
206 extra = DIV_ROUND_UP_ULL(dma_get_required_mask(dev), SZ_128M); in ma35_probe()
207 extra = min(extra, SDHCI_MAX_SEGS); in ma35_probe()
209 host->adma_table_cnt += extra; in ma35_probe()
213 pltfm_host->clk = devm_clk_get_optional_enabled(dev, NULL); in ma35_probe()
214 if (IS_ERR(pltfm_host->clk)) { in ma35_probe()
215 err = dev_err_probe(dev, PTR_ERR(pltfm_host->clk), "failed to get clk\n"); in ma35_probe()
219 err = mmc_of_parse(host->mmc); in ma35_probe()
223 priv->rst = devm_reset_control_get_exclusive(dev, NULL); in ma35_probe()
224 if (IS_ERR(priv->rst)) { in ma35_probe()
225 err = dev_err_probe(dev, PTR_ERR(priv->rst), "failed to get reset control\n"); in ma35_probe()
231 priv->pinctrl = devm_pinctrl_get(dev); in ma35_probe()
232 if (!IS_ERR(priv->pinctrl)) { in ma35_probe()
233 priv->pins_default = pinctrl_lookup_state(priv->pinctrl, "default"); in ma35_probe()
234 priv->pins_uhs = pinctrl_lookup_state(priv->pinctrl, "state_uhs"); in ma35_probe()
235 pinctrl_select_state(priv->pinctrl, priv->pins_default); in ma35_probe()
238 if (!(host->quirks2 & SDHCI_QUIRK2_NO_1_8_V)) { in ma35_probe()
250 host->mmc_host_ops.start_signal_voltage_switch = in ma35_probe()
254 host->mmc_host_ops.execute_tuning = ma35_execute_tuning; in ma35_probe()
298 { .compatible = "nuvoton,ma35d1-sdhci" },
304 .name = "sdhci-ma35",
313 MODULE_AUTHOR("Shan-Chun Hung <shanchun1218@gmail.com>");