Lines Matching +full:dual +full:- +full:lane

1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
11 * chromeos-4.4 branch.
14 * Jacob Chen <jacob2.chen@rock-chips.com>
15 * Shunqian Zheng <zhengsq@rock-chips.com>
26 #include <linux/phy/phy-mipi-dphy.h>
65 "dphy-ref",
66 "dphy-cfg",
111 { .offset = _offset, .mask = BIT(_width) - 1, .shift = _shift, }
163 const struct dphy_reg *reg = &priv->drv_data->regs[index]; in rk_dphy_write_grf()
165 unsigned int val = (value << reg->shift) | in rk_dphy_write_grf()
166 (reg->mask << (reg->shift + 16)); in rk_dphy_write_grf()
168 if (WARN_ON(!reg->offset)) in rk_dphy_write_grf()
170 regmap_write(priv->grf, reg->offset, val); in rk_dphy_write_grf()
194 /* Disable lane turn around, which is ignored in receive mode */ in rk_dphy_enable()
199 GENMASK(priv->config.lanes - 1, 0)); in rk_dphy_enable()
208 /* set clock lane */ in rk_dphy_enable()
209 /* HS hsfreq_range & lane 0 settle bypass */ in rk_dphy_enable()
212 rk_dphy_write(priv, LANE0_HS_RX_CONTROL, priv->hsfreq << 1); in rk_dphy_enable()
214 rk_dphy_write(priv, LANE1_HS_RX_CONTROL, priv->hsfreq << 1); in rk_dphy_enable()
216 rk_dphy_write(priv, LANE2_HS_RX_CONTROL, priv->hsfreq << 1); in rk_dphy_enable()
218 rk_dphy_write(priv, LANE3_HS_RX_CONTROL, priv->hsfreq << 1); in rk_dphy_enable()
230 const struct rk_dphy_drv_data *drv_data = priv->drv_data; in rk_dphy_configure()
231 struct phy_configure_opts_mipi_dphy *config = &opts->mipi_dphy; in rk_dphy_configure()
242 data_rate_mbps = div_u64(config->hs_clk_rate, 1000 * 1000); in rk_dphy_configure()
244 dev_dbg(priv->dev, "lanes %d - data_rate_mbps %llu\n", in rk_dphy_configure()
245 config->lanes, data_rate_mbps); in rk_dphy_configure()
246 for (i = 0; i < drv_data->num_hsfreq_ranges; i++) { in rk_dphy_configure()
247 if (drv_data->hsfreq_ranges[i].range_h >= data_rate_mbps) { in rk_dphy_configure()
248 hsfreq = drv_data->hsfreq_ranges[i].cfg_bit; in rk_dphy_configure()
253 return -EINVAL; in rk_dphy_configure()
255 priv->hsfreq = hsfreq; in rk_dphy_configure()
256 priv->config = *config; in rk_dphy_configure()
265 ret = clk_bulk_enable(priv->drv_data->num_clks, priv->clks); in rk_dphy_power_on()
279 clk_bulk_disable(priv->drv_data->num_clks, priv->clks); in rk_dphy_power_off()
287 return clk_bulk_prepare(priv->drv_data->num_clks, priv->clks); in rk_dphy_init()
294 clk_bulk_unprepare(priv->drv_data->num_clks, priv->clks); in rk_dphy_exit()
317 .compatible = "rockchip,rk3399-mipi-dphy-rx0",
326 struct device *dev = &pdev->dev; in rk_dphy_probe()
327 struct device_node *np = dev->of_node; in rk_dphy_probe()
335 if (!dev->parent || !dev->parent->of_node) in rk_dphy_probe()
336 return -ENODEV; in rk_dphy_probe()
340 return -ENOMEM; in rk_dphy_probe()
341 priv->dev = dev; in rk_dphy_probe()
343 priv->grf = syscon_node_to_regmap(dev->parent->of_node); in rk_dphy_probe()
344 if (IS_ERR(priv->grf)) { in rk_dphy_probe()
346 return -ENODEV; in rk_dphy_probe()
350 priv->drv_data = drv_data; in rk_dphy_probe()
351 priv->clks = devm_kcalloc(&pdev->dev, drv_data->num_clks, in rk_dphy_probe()
352 sizeof(*priv->clks), GFP_KERNEL); in rk_dphy_probe()
353 if (!priv->clks) in rk_dphy_probe()
354 return -ENOMEM; in rk_dphy_probe()
355 for (i = 0; i < drv_data->num_clks; i++) in rk_dphy_probe()
356 priv->clks[i].id = drv_data->clks[i]; in rk_dphy_probe()
357 ret = devm_clk_bulk_get(&pdev->dev, drv_data->num_clks, priv->clks); in rk_dphy_probe()
376 .name = "rockchip-mipi-dphy-rx0",
384 MODULE_LICENSE("Dual MIT/GPL");