Lines Matching +full:off +full:- +full:on +full:- +full:delay +full:- +full:us
1 // SPDX-License-Identifier: GPL-2.0-only
9 #include <linux/delay.h>
66 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, PWR_DOWN_MASK, in keembay_emmc_phy_power()
69 dev_err(&phy->dev, "CALIO power down bar failed: %d\n", ret); in keembay_emmc_phy_power()
73 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, DLL_EN_MASK, in keembay_emmc_phy_power()
76 dev_err(&phy->dev, "turn off the dll failed: %d\n", ret); in keembay_emmc_phy_power()
80 /* Already finish power off above */ in keembay_emmc_phy_power()
84 mhz = DIV_ROUND_CLOSEST(clk_get_rate(priv->emmcclk), 1000000); in keembay_emmc_phy_power()
100 dev_warn(&phy->dev, "Unsupported rate: %d MHz\n", mhz); in keembay_emmc_phy_power()
104 * cycle takes more than 2us without the minimal recommended in keembay_emmc_phy_power()
109 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, PWR_DOWN_MASK, in keembay_emmc_phy_power()
112 dev_err(&phy->dev, "CALIO power down bar failed: %d\n", ret); in keembay_emmc_phy_power()
117 * According to the user manual, it asks driver to wait 5us for in keembay_emmc_phy_power()
123 ret = regmap_read_poll_timeout(priv->syscfg, PHY_STAT, in keembay_emmc_phy_power()
127 dev_err(&phy->dev, "caldone failed, ret=%d\n", ret); in keembay_emmc_phy_power()
132 ret = regmap_update_bits(priv->syscfg, PHY_CFG_2, SEL_FREQ_MASK, in keembay_emmc_phy_power()
135 dev_err(&phy->dev, "set the frequency of dll failed:%d\n", ret); in keembay_emmc_phy_power()
139 /* Turn on the DLL */ in keembay_emmc_phy_power()
140 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, DLL_EN_MASK, in keembay_emmc_phy_power()
143 dev_err(&phy->dev, "turn on the dll failed: %d\n", ret); in keembay_emmc_phy_power()
148 * We turned on the DLL even though the rate was 0 because we the in keembay_emmc_phy_power()
149 * clock might be turned on later. ...but we can't wait for the DLL in keembay_emmc_phy_power()
154 * is turned on, but for now we won't. in keembay_emmc_phy_power()
160 * After enabling analog DLL circuits docs say that we need 10.2 us if in keembay_emmc_phy_power()
162 * with clock speed. If we are powering on the PHY and the card clock in keembay_emmc_phy_power()
164 * per the math: 10.2 us * (50000000 Hz / 100000 Hz) => 5.1 ms in keembay_emmc_phy_power()
173 ret = regmap_read_poll_timeout(priv->syscfg, PHY_STAT, in keembay_emmc_phy_power()
177 dev_err(&phy->dev, "dllrdy failed, ret=%d\n", ret); in keembay_emmc_phy_power()
189 * - PHY driver to probe in keembay_emmc_phy_init()
190 * - SDHCI driver to start probe in keembay_emmc_phy_init()
191 * - SDHCI driver to register it's clock in keembay_emmc_phy_init()
192 * - SDHCI driver to get the PHY in keembay_emmc_phy_init()
193 * - SDHCI driver to init the PHY in keembay_emmc_phy_init()
198 priv->emmcclk = clk_get_optional(&phy->dev, "emmcclk"); in keembay_emmc_phy_init()
200 return PTR_ERR_OR_ZERO(priv->emmcclk); in keembay_emmc_phy_init()
207 clk_put(priv->emmcclk); in keembay_emmc_phy_exit()
217 /* Delay chain based txclk: enable */ in keembay_emmc_phy_power_on()
218 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, SEL_DLY_TXCLK_MASK, in keembay_emmc_phy_power_on()
221 dev_err(&phy->dev, "ERROR: delay chain txclk set: %d\n", ret); in keembay_emmc_phy_power_on()
225 /* Output tap delay: enable */ in keembay_emmc_phy_power_on()
226 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, OTAP_DLY_ENA_MASK, in keembay_emmc_phy_power_on()
229 dev_err(&phy->dev, "ERROR: output tap delay set: %d\n", ret); in keembay_emmc_phy_power_on()
233 /* Output tap delay */ in keembay_emmc_phy_power_on()
234 ret = regmap_update_bits(priv->syscfg, PHY_CFG_0, OTAP_DLY_SEL_MASK, in keembay_emmc_phy_power_on()
237 dev_err(&phy->dev, "ERROR: output tap delay select: %d\n", ret); in keembay_emmc_phy_power_on()
261 struct device *dev = &pdev->dev; in keembay_emmc_phy_probe()
262 struct device_node *np = dev->of_node; in keembay_emmc_phy_probe()
270 return -ENOMEM; in keembay_emmc_phy_probe()
276 priv->syscfg = devm_regmap_init_mmio(dev, base, &keembay_regmap_config); in keembay_emmc_phy_probe()
277 if (IS_ERR(priv->syscfg)) in keembay_emmc_phy_probe()
278 return PTR_ERR(priv->syscfg); in keembay_emmc_phy_probe()
292 { .compatible = "intel,keembay-emmc-phy" },
300 .name = "keembay-emmc-phy",