Lines Matching +full:output +full:- +full:tapdelay +full:- +full:select

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2016 Shawn Lin <shawn.lin@rock-chips.com>
20 * The higher 16-bit of this register is used for write protection
106 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power()
107 rk_phy->reg_offset + GRF_EMMCPHY_CON6, in rockchip_emmc_phy_power()
111 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power()
112 rk_phy->reg_offset + GRF_EMMCPHY_CON6, in rockchip_emmc_phy_power()
121 rate = clk_get_rate(rk_phy->emmcclk); in rockchip_emmc_phy_power()
146 rate - ideal_rate : ideal_rate - rate; in rockchip_emmc_phy_power()
155 dev_warn(&phy->dev, "Unsupported rate: %lu\n", rate); in rockchip_emmc_phy_power()
164 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power()
165 rk_phy->reg_offset + GRF_EMMCPHY_CON6, in rockchip_emmc_phy_power()
177 ret = regmap_read_poll_timeout(rk_phy->reg_base, in rockchip_emmc_phy_power()
178 rk_phy->reg_offset + GRF_EMMCPHY_STATUS, in rockchip_emmc_phy_power()
187 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power()
188 rk_phy->reg_offset + GRF_EMMCPHY_CON0, in rockchip_emmc_phy_power()
193 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power()
194 rk_phy->reg_offset + GRF_EMMCPHY_CON6, in rockchip_emmc_phy_power()
225 ret = regmap_read_poll_timeout(rk_phy->reg_base, in rockchip_emmc_phy_power()
226 rk_phy->reg_offset + GRF_EMMCPHY_STATUS, in rockchip_emmc_phy_power()
245 * - PHY driver to probe in rockchip_emmc_phy_init()
246 * - SDHCI driver to start probe in rockchip_emmc_phy_init()
247 * - SDHCI driver to register it's clock in rockchip_emmc_phy_init()
248 * - SDHCI driver to get the PHY in rockchip_emmc_phy_init()
249 * - SDHCI driver to init the PHY in rockchip_emmc_phy_init()
258 rk_phy->emmcclk = clk_get_optional(&phy->dev, "emmcclk"); in rockchip_emmc_phy_init()
259 if (IS_ERR(rk_phy->emmcclk)) { in rockchip_emmc_phy_init()
260 ret = PTR_ERR(rk_phy->emmcclk); in rockchip_emmc_phy_init()
261 dev_err(&phy->dev, "Error getting emmcclk: %d\n", ret); in rockchip_emmc_phy_init()
262 rk_phy->emmcclk = NULL; in rockchip_emmc_phy_init()
272 clk_put(rk_phy->emmcclk); in rockchip_emmc_phy_exit()
288 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power_on()
289 rk_phy->reg_offset + GRF_EMMCPHY_CON6, in rockchip_emmc_phy_power_on()
290 HIWORD_UPDATE(rk_phy->drive_impedance, in rockchip_emmc_phy_power_on()
294 /* Output tap delay: enable */ in rockchip_emmc_phy_power_on()
295 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power_on()
296 rk_phy->reg_offset + GRF_EMMCPHY_CON0, in rockchip_emmc_phy_power_on()
301 /* Output tap delay */ in rockchip_emmc_phy_power_on()
302 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power_on()
303 rk_phy->reg_offset + GRF_EMMCPHY_CON0, in rockchip_emmc_phy_power_on()
304 HIWORD_UPDATE(rk_phy->output_tapdelay_select, in rockchip_emmc_phy_power_on()
308 /* Internal pull-down for strobe line */ in rockchip_emmc_phy_power_on()
309 regmap_write(rk_phy->reg_base, in rockchip_emmc_phy_power_on()
310 rk_phy->reg_offset + GRF_EMMCPHY_CON2, in rockchip_emmc_phy_power_on()
311 HIWORD_UPDATE(rk_phy->enable_strobe_pulldown, in rockchip_emmc_phy_power_on()
342 dev_warn(&pdev->dev, "Invalid value %u for drive-impedance-ohm.\n", in convert_drive_impedance_ohm()
349 struct device *dev = &pdev->dev; in rockchip_emmc_phy_probe()
357 if (!dev->parent || !dev->parent->of_node) in rockchip_emmc_phy_probe()
358 return -ENODEV; in rockchip_emmc_phy_probe()
360 grf = syscon_node_to_regmap(dev->parent->of_node); in rockchip_emmc_phy_probe()
368 return -ENOMEM; in rockchip_emmc_phy_probe()
370 if (of_property_read_u32(dev->of_node, "reg", &reg_offset)) { in rockchip_emmc_phy_probe()
372 dev->of_node); in rockchip_emmc_phy_probe()
373 return -EINVAL; in rockchip_emmc_phy_probe()
376 rk_phy->reg_offset = reg_offset; in rockchip_emmc_phy_probe()
377 rk_phy->reg_base = grf; in rockchip_emmc_phy_probe()
378 rk_phy->drive_impedance = PHYCTRL_DR_50OHM; in rockchip_emmc_phy_probe()
379 rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_DISABLE; in rockchip_emmc_phy_probe()
380 rk_phy->output_tapdelay_select = PHYCTRL_OTAPDLYSEL_DEFAULT; in rockchip_emmc_phy_probe()
382 if (!of_property_read_u32(dev->of_node, "drive-impedance-ohm", &val)) in rockchip_emmc_phy_probe()
383 rk_phy->drive_impedance = convert_drive_impedance_ohm(pdev, val); in rockchip_emmc_phy_probe()
385 if (of_property_read_bool(dev->of_node, "rockchip,enable-strobe-pulldown")) in rockchip_emmc_phy_probe()
386 rk_phy->enable_strobe_pulldown = PHYCTRL_REN_STRB_ENABLE; in rockchip_emmc_phy_probe()
388 if (!of_property_read_u32(dev->of_node, "rockchip,output-tapdelay-select", &val)) { in rockchip_emmc_phy_probe()
390 rk_phy->output_tapdelay_select = val; in rockchip_emmc_phy_probe()
392 dev_err(dev, "output-tapdelay-select exceeds limit, apply default\n"); in rockchip_emmc_phy_probe()
395 generic_phy = devm_phy_create(dev, dev->of_node, &ops); in rockchip_emmc_phy_probe()
408 { .compatible = "rockchip,rk3399-emmc-phy" },
417 .name = "rockchip-emmc-phy",
424 MODULE_AUTHOR("Shawn Lin <shawn.lin@rock-chips.com>");