Lines Matching refs:dphy

131 	struct sun6i_dphy *dphy = phy_get_drvdata(phy);  in sun6i_dphy_init()  local
133 reset_control_deassert(dphy->reset); in sun6i_dphy_init()
134 clk_prepare_enable(dphy->mod_clk); in sun6i_dphy_init()
135 clk_set_rate_exclusive(dphy->mod_clk, 150000000); in sun6i_dphy_init()
142 struct sun6i_dphy *dphy = phy_get_drvdata(phy); in sun6i_dphy_configure() local
149 memcpy(&dphy->config, opts, sizeof(dphy->config)); in sun6i_dphy_configure()
154 static int sun6i_dphy_tx_power_on(struct sun6i_dphy *dphy) in sun6i_dphy_tx_power_on() argument
156 u8 lanes_mask = GENMASK(dphy->config.lanes - 1, 0); in sun6i_dphy_tx_power_on()
158 regmap_write(dphy->regs, SUN6I_DPHY_TX_CTL_REG, in sun6i_dphy_tx_power_on()
161 regmap_write(dphy->regs, SUN6I_DPHY_TX_TIME0_REG, in sun6i_dphy_tx_power_on()
166 regmap_write(dphy->regs, SUN6I_DPHY_TX_TIME1_REG, in sun6i_dphy_tx_power_on()
172 regmap_write(dphy->regs, SUN6I_DPHY_TX_TIME2_REG, in sun6i_dphy_tx_power_on()
175 regmap_write(dphy->regs, SUN6I_DPHY_TX_TIME3_REG, 0); in sun6i_dphy_tx_power_on()
177 regmap_write(dphy->regs, SUN6I_DPHY_TX_TIME4_REG, in sun6i_dphy_tx_power_on()
181 regmap_write(dphy->regs, SUN6I_DPHY_GCTL_REG, in sun6i_dphy_tx_power_on()
182 SUN6I_DPHY_GCTL_LANE_NUM(dphy->config.lanes) | in sun6i_dphy_tx_power_on()
185 regmap_write(dphy->regs, SUN6I_DPHY_ANA0_REG, in sun6i_dphy_tx_power_on()
192 regmap_write(dphy->regs, SUN6I_DPHY_ANA1_REG, in sun6i_dphy_tx_power_on()
196 regmap_write(dphy->regs, SUN6I_DPHY_ANA4_REG, in sun6i_dphy_tx_power_on()
207 regmap_write(dphy->regs, SUN6I_DPHY_ANA2_REG, in sun6i_dphy_tx_power_on()
211 regmap_write(dphy->regs, SUN6I_DPHY_ANA3_REG, in sun6i_dphy_tx_power_on()
217 regmap_update_bits(dphy->regs, SUN6I_DPHY_ANA3_REG, in sun6i_dphy_tx_power_on()
224 regmap_update_bits(dphy->regs, SUN6I_DPHY_ANA3_REG, in sun6i_dphy_tx_power_on()
229 regmap_update_bits(dphy->regs, SUN6I_DPHY_ANA2_REG, in sun6i_dphy_tx_power_on()
234 regmap_update_bits(dphy->regs, SUN6I_DPHY_ANA1_REG, in sun6i_dphy_tx_power_on()
238 regmap_update_bits(dphy->regs, SUN6I_DPHY_ANA2_REG, in sun6i_dphy_tx_power_on()
245 static int sun6i_dphy_rx_power_on(struct sun6i_dphy *dphy) in sun6i_dphy_rx_power_on() argument
248 unsigned long mipi_symbol_rate = dphy->config.hs_clk_rate; in sun6i_dphy_rx_power_on()
254 dphy_clk_rate = clk_get_rate(dphy->mod_clk); in sun6i_dphy_rx_power_on()
259 regmap_write(dphy->regs, SUN6I_DPHY_RX_TIME0_REG, in sun6i_dphy_rx_power_on()
275 regmap_write(dphy->regs, SUN6I_DPHY_RX_TIME1_REG, in sun6i_dphy_rx_power_on()
280 regmap_write(dphy->regs, SUN6I_DPHY_RX_TIME2_REG, in sun6i_dphy_rx_power_on()
289 regmap_write(dphy->regs, SUN6I_DPHY_RX_TIME3_REG, in sun6i_dphy_rx_power_on()
293 regmap_write(dphy->regs, SUN6I_DPHY_ANA0_REG, in sun6i_dphy_rx_power_on()
298 regmap_write(dphy->regs, SUN6I_DPHY_ANA1_REG, in sun6i_dphy_rx_power_on()
301 regmap_write(dphy->regs, SUN6I_DPHY_ANA4_REG, in sun6i_dphy_rx_power_on()
305 regmap_write(dphy->regs, SUN6I_DPHY_ANA2_REG, in sun6i_dphy_rx_power_on()
308 regmap_write(dphy->regs, SUN6I_DPHY_ANA3_REG, in sun6i_dphy_rx_power_on()
325 if (dphy->config.lanes >= 1) in sun6i_dphy_rx_power_on()
327 if (dphy->config.lanes >= 2) in sun6i_dphy_rx_power_on()
329 if (dphy->config.lanes >= 3) in sun6i_dphy_rx_power_on()
331 if (dphy->config.lanes == 4) in sun6i_dphy_rx_power_on()
334 regmap_write(dphy->regs, SUN6I_DPHY_RX_CTL_REG, value); in sun6i_dphy_rx_power_on()
336 regmap_write(dphy->regs, SUN6I_DPHY_GCTL_REG, in sun6i_dphy_rx_power_on()
337 SUN6I_DPHY_GCTL_LANE_NUM(dphy->config.lanes) | in sun6i_dphy_rx_power_on()
345 struct sun6i_dphy *dphy = phy_get_drvdata(phy); in sun6i_dphy_power_on() local
347 switch (dphy->direction) { in sun6i_dphy_power_on()
349 return sun6i_dphy_tx_power_on(dphy); in sun6i_dphy_power_on()
351 return sun6i_dphy_rx_power_on(dphy); in sun6i_dphy_power_on()
359 struct sun6i_dphy *dphy = phy_get_drvdata(phy); in sun6i_dphy_power_off() local
361 regmap_write(dphy->regs, SUN6I_DPHY_GCTL_REG, 0); in sun6i_dphy_power_off()
363 regmap_write(dphy->regs, SUN6I_DPHY_ANA0_REG, 0); in sun6i_dphy_power_off()
364 regmap_write(dphy->regs, SUN6I_DPHY_ANA1_REG, 0); in sun6i_dphy_power_off()
365 regmap_write(dphy->regs, SUN6I_DPHY_ANA2_REG, 0); in sun6i_dphy_power_off()
366 regmap_write(dphy->regs, SUN6I_DPHY_ANA3_REG, 0); in sun6i_dphy_power_off()
367 regmap_write(dphy->regs, SUN6I_DPHY_ANA4_REG, 0); in sun6i_dphy_power_off()
374 struct sun6i_dphy *dphy = phy_get_drvdata(phy); in sun6i_dphy_exit() local
376 clk_rate_exclusive_put(dphy->mod_clk); in sun6i_dphy_exit()
377 clk_disable_unprepare(dphy->mod_clk); in sun6i_dphy_exit()
378 reset_control_assert(dphy->reset); in sun6i_dphy_exit()
403 struct sun6i_dphy *dphy; in sun6i_dphy_probe() local
408 dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); in sun6i_dphy_probe()
409 if (!dphy) in sun6i_dphy_probe()
418 dphy->regs = devm_regmap_init_mmio_clk(&pdev->dev, "bus", in sun6i_dphy_probe()
420 if (IS_ERR(dphy->regs)) { in sun6i_dphy_probe()
422 return PTR_ERR(dphy->regs); in sun6i_dphy_probe()
425 dphy->reset = devm_reset_control_get_shared(&pdev->dev, NULL); in sun6i_dphy_probe()
426 if (IS_ERR(dphy->reset)) { in sun6i_dphy_probe()
428 return PTR_ERR(dphy->reset); in sun6i_dphy_probe()
431 dphy->mod_clk = devm_clk_get(&pdev->dev, "mod"); in sun6i_dphy_probe()
432 if (IS_ERR(dphy->mod_clk)) { in sun6i_dphy_probe()
434 return PTR_ERR(dphy->mod_clk); in sun6i_dphy_probe()
437 dphy->phy = devm_phy_create(&pdev->dev, NULL, &sun6i_dphy_ops); in sun6i_dphy_probe()
438 if (IS_ERR(dphy->phy)) { in sun6i_dphy_probe()
440 return PTR_ERR(dphy->phy); in sun6i_dphy_probe()
443 dphy->direction = SUN6I_DPHY_DIRECTION_TX; in sun6i_dphy_probe()
449 dphy->direction = SUN6I_DPHY_DIRECTION_RX; in sun6i_dphy_probe()
451 phy_set_drvdata(dphy->phy, dphy); in sun6i_dphy_probe()