Lines Matching +full:m10v +full:- +full:clk +full:- +full:ctrl
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2013 - 2015 Fujitsu Semiconductor, Ltd
11 #include <linux/clk.h>
19 #include "sdhci-pltfm.h"
54 struct clk *clk_iface;
55 struct clk *clk; member
62 u32 ctrl = 0; in sdhci_milbeaut_soft_voltage_switch() local
65 ctrl = sdhci_readl(host, F_SDH30_IO_CONTROL2); in sdhci_milbeaut_soft_voltage_switch()
66 ctrl |= F_SDH30_CRES_O_DN; in sdhci_milbeaut_soft_voltage_switch()
67 sdhci_writel(host, ctrl, F_SDH30_IO_CONTROL2); in sdhci_milbeaut_soft_voltage_switch()
68 ctrl |= F_SDH30_MSEL_O_1_8; in sdhci_milbeaut_soft_voltage_switch()
69 sdhci_writel(host, ctrl, F_SDH30_IO_CONTROL2); in sdhci_milbeaut_soft_voltage_switch()
71 ctrl &= ~F_SDH30_CRES_O_DN; in sdhci_milbeaut_soft_voltage_switch()
72 sdhci_writel(host, ctrl, F_SDH30_IO_CONTROL2); in sdhci_milbeaut_soft_voltage_switch()
75 ctrl = sdhci_readl(host, F_SDH30_TUNING_SETTING); in sdhci_milbeaut_soft_voltage_switch()
76 ctrl |= F_SDH30_CMD_CHK_DIS; in sdhci_milbeaut_soft_voltage_switch()
77 sdhci_writel(host, ctrl, F_SDH30_TUNING_SETTING); in sdhci_milbeaut_soft_voltage_switch()
88 u16 clk; in sdhci_milbeaut_reset() local
92 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); in sdhci_milbeaut_reset()
93 clk = (clk & ~SDHCI_CLOCK_CARD_EN) | SDHCI_CLOCK_INT_EN; in sdhci_milbeaut_reset()
94 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); in sdhci_milbeaut_reset()
98 clk |= SDHCI_CLOCK_CARD_EN; in sdhci_milbeaut_reset()
99 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); in sdhci_milbeaut_reset()
105 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); in sdhci_milbeaut_reset()
106 if (clk & SDHCI_CLOCK_INT_STABLE) in sdhci_milbeaut_reset()
110 mmc_hostname(host->mmc)); in sdhci_milbeaut_reset()
117 if (priv->enable_cmd_dat_delay) { in sdhci_milbeaut_reset()
146 u32 val, clk; in sdhci_milbeaut_bridge_init() local
153 clk = MLB_CAL_TOCLKFREQ_MHZ(rate); in sdhci_milbeaut_bridge_init()
154 clk = min_t(u32, MLB_TOCLKFREQ_MAX, clk); in sdhci_milbeaut_bridge_init()
156 (clk << MLB_CR_SET_CR_TOCLKFREQ_SFT); in sdhci_milbeaut_bridge_init()
158 clk = MLB_CAL_TOCLKFREQ_KHZ(rate); in sdhci_milbeaut_bridge_init()
159 clk = min_t(u32, MLB_TOCLKFREQ_MAX, clk); in sdhci_milbeaut_bridge_init()
160 clk = max_t(u32, MLB_TOCLKFREQ_MIN, clk); in sdhci_milbeaut_bridge_init()
161 val |= clk << MLB_CR_SET_CR_TOCLKFREQ_SFT; in sdhci_milbeaut_bridge_init()
164 clk = MLB_CAL_BCLKFREQ(rate); in sdhci_milbeaut_bridge_init()
165 clk = min_t(u32, MLB_BCLKFREQ_MAX, clk); in sdhci_milbeaut_bridge_init()
166 clk = max_t(u32, MLB_BCLKFREQ_MIN, clk); in sdhci_milbeaut_bridge_init()
167 val |= clk << MLB_CR_SET_CR_BCLKFREQ_SFT; in sdhci_milbeaut_bridge_init()
195 if (priv->enable_cmd_dat_delay) { in sdhci_milbeaut_vendor_init()
204 .compatible = "socionext,milbeaut-m10v-sdhci-3.0",
213 int rate = clk_get_rate(priv->clk); in sdhci_milbeaut_init()
233 struct device *dev = &pdev->dev; in sdhci_milbeaut_probe()
246 priv->dev = dev; in sdhci_milbeaut_probe()
248 host->quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC | in sdhci_milbeaut_probe()
252 host->quirks2 = SDHCI_QUIRK2_SUPPORT_SINGLE | in sdhci_milbeaut_probe()
256 priv->enable_cmd_dat_delay = device_property_read_bool(dev, in sdhci_milbeaut_probe()
257 "fujitsu,cmd-dat-delay-select"); in sdhci_milbeaut_probe()
259 ret = mmc_of_parse(host->mmc); in sdhci_milbeaut_probe()
265 host->hw_name = "f_sdh30"; in sdhci_milbeaut_probe()
266 host->ops = &sdhci_milbeaut_ops; in sdhci_milbeaut_probe()
267 host->irq = irq; in sdhci_milbeaut_probe()
269 host->ioaddr = devm_platform_ioremap_resource(pdev, 0); in sdhci_milbeaut_probe()
270 if (IS_ERR(host->ioaddr)) { in sdhci_milbeaut_probe()
271 ret = PTR_ERR(host->ioaddr); in sdhci_milbeaut_probe()
278 priv->clk_iface = devm_clk_get(&pdev->dev, "iface"); in sdhci_milbeaut_probe()
279 if (IS_ERR(priv->clk_iface)) { in sdhci_milbeaut_probe()
280 ret = PTR_ERR(priv->clk_iface); in sdhci_milbeaut_probe()
284 ret = clk_prepare_enable(priv->clk_iface); in sdhci_milbeaut_probe()
288 priv->clk = devm_clk_get(&pdev->dev, "core"); in sdhci_milbeaut_probe()
289 if (IS_ERR(priv->clk)) { in sdhci_milbeaut_probe()
290 ret = PTR_ERR(priv->clk); in sdhci_milbeaut_probe()
294 ret = clk_prepare_enable(priv->clk); in sdhci_milbeaut_probe()
308 clk_disable_unprepare(priv->clk); in sdhci_milbeaut_probe()
310 clk_disable_unprepare(priv->clk_iface); in sdhci_milbeaut_probe()
321 sdhci_remove_host(host, readl(host->ioaddr + SDHCI_INT_STATUS) == in sdhci_milbeaut_remove()
324 clk_disable_unprepare(priv->clk_iface); in sdhci_milbeaut_remove()
325 clk_disable_unprepare(priv->clk); in sdhci_milbeaut_remove()
333 .name = "sdhci-milbeaut",
346 MODULE_ALIAS("platform:sdhci-milbeaut");