Lines Matching refs:imx_phy

140 static void imx8m_get_phy_tuning_data(struct imx8mq_usb_phy *imx_phy)
142 struct device *dev = imx_phy->phy->dev.parent;
145 &imx_phy->tx_vref_tune))
146 imx_phy->tx_vref_tune = PHY_TUNE_DEFAULT;
148 imx_phy->tx_vref_tune =
149 phy_tx_vref_tune_from_property(imx_phy->tx_vref_tune);
152 &imx_phy->tx_rise_tune))
153 imx_phy->tx_rise_tune = PHY_TUNE_DEFAULT;
155 imx_phy->tx_rise_tune =
156 phy_tx_rise_tune_from_property(imx_phy->tx_rise_tune);
159 &imx_phy->tx_preemp_amp_tune))
160 imx_phy->tx_preemp_amp_tune = PHY_TUNE_DEFAULT;
162 imx_phy->tx_preemp_amp_tune =
163 phy_tx_preemp_amp_tune_from_property(imx_phy->tx_preemp_amp_tune);
166 &imx_phy->tx_vboost_level))
167 imx_phy->tx_vboost_level = PHY_TUNE_DEFAULT;
169 imx_phy->tx_vboost_level =
170 phy_tx_vboost_level_from_property(imx_phy->tx_vboost_level);
173 &imx_phy->comp_dis_tune))
174 imx_phy->comp_dis_tune = PHY_TUNE_DEFAULT;
176 imx_phy->comp_dis_tune =
177 phy_comp_dis_tune_from_property(imx_phy->comp_dis_tune);
180 &imx_phy->pcs_tx_deemph_3p5db))
181 imx_phy->pcs_tx_deemph_3p5db = PHY_TUNE_DEFAULT;
183 imx_phy->pcs_tx_deemph_3p5db =
184 phy_pcs_tx_deemph_3p5db_from_property(imx_phy->pcs_tx_deemph_3p5db);
187 &imx_phy->pcs_tx_swing_full))
188 imx_phy->pcs_tx_swing_full = PHY_TUNE_DEFAULT;
190 imx_phy->pcs_tx_swing_full =
191 phy_pcs_tx_swing_full_from_property(imx_phy->pcs_tx_swing_full);
194 static void imx8m_phy_tune(struct imx8mq_usb_phy *imx_phy)
199 if (imx_phy->pcs_tx_deemph_3p5db != PHY_TUNE_DEFAULT) {
200 value = readl(imx_phy->base + PHY_CTRL4);
203 imx_phy->pcs_tx_deemph_3p5db);
204 writel(value, imx_phy->base + PHY_CTRL4);
207 if (imx_phy->pcs_tx_swing_full != PHY_TUNE_DEFAULT) {
208 value = readl(imx_phy->base + PHY_CTRL5);
210 imx_phy->pcs_tx_swing_full);
211 writel(value, imx_phy->base + PHY_CTRL5);
214 if ((imx_phy->tx_vref_tune & imx_phy->tx_rise_tune &
215 imx_phy->tx_preemp_amp_tune & imx_phy->comp_dis_tune &
216 imx_phy->tx_vboost_level) == PHY_TUNE_DEFAULT)
220 value = readl(imx_phy->base + PHY_CTRL3);
222 if (imx_phy->tx_vref_tune != PHY_TUNE_DEFAULT) {
225 imx_phy->tx_vref_tune);
228 if (imx_phy->tx_rise_tune != PHY_TUNE_DEFAULT) {
231 imx_phy->tx_rise_tune);
234 if (imx_phy->tx_preemp_amp_tune != PHY_TUNE_DEFAULT) {
237 imx_phy->tx_preemp_amp_tune);
240 if (imx_phy->comp_dis_tune != PHY_TUNE_DEFAULT) {
243 imx_phy->comp_dis_tune);
246 if (imx_phy->tx_vboost_level != PHY_TUNE_DEFAULT) {
249 imx_phy->tx_vboost_level);
252 writel(value, imx_phy->base + PHY_CTRL3);
257 struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
260 value = readl(imx_phy->base + PHY_CTRL1);
264 writel(value, imx_phy->base + PHY_CTRL1);
266 value = readl(imx_phy->base + PHY_CTRL0);
268 writel(value, imx_phy->base + PHY_CTRL0);
270 value = readl(imx_phy->base + PHY_CTRL2);
272 writel(value, imx_phy->base + PHY_CTRL2);
274 value = readl(imx_phy->base + PHY_CTRL1);
276 writel(value, imx_phy->base + PHY_CTRL1);
283 struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
287 value = readl(imx_phy->base + PHY_CTRL0);
290 writel(value, imx_phy->base + PHY_CTRL0);
293 value = readl(imx_phy->base + PHY_CTRL6);
295 writel(value, imx_phy->base + PHY_CTRL6);
297 value = readl(imx_phy->base + PHY_CTRL1);
300 writel(value, imx_phy->base + PHY_CTRL1);
302 value = readl(imx_phy->base + PHY_CTRL0);
304 writel(value, imx_phy->base + PHY_CTRL0);
306 value = readl(imx_phy->base + PHY_CTRL2);
308 writel(value, imx_phy->base + PHY_CTRL2);
312 value = readl(imx_phy->base + PHY_CTRL1);
314 writel(value, imx_phy->base + PHY_CTRL1);
316 imx8m_phy_tune(imx_phy);
323 struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
326 ret = regulator_enable(imx_phy->vbus);
330 return clk_prepare_enable(imx_phy->clk);
335 struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
337 clk_disable_unprepare(imx_phy->clk);
338 regulator_disable(imx_phy->vbus);
370 struct imx8mq_usb_phy *imx_phy;
373 imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL);
374 if (!imx_phy)
377 imx_phy->clk = devm_clk_get(dev, "phy");
378 if (IS_ERR(imx_phy->clk)) {
380 return PTR_ERR(imx_phy->clk);
383 imx_phy->base = devm_platform_ioremap_resource(pdev, 0);
384 if (IS_ERR(imx_phy->base))
385 return PTR_ERR(imx_phy->base);
391 imx_phy->phy = devm_phy_create(dev, NULL, phy_ops);
392 if (IS_ERR(imx_phy->phy))
393 return PTR_ERR(imx_phy->phy);
395 imx_phy->vbus = devm_regulator_get(dev, "vbus");
396 if (IS_ERR(imx_phy->vbus))
397 return dev_err_probe(dev, PTR_ERR(imx_phy->vbus), "failed to get vbus\n");
399 phy_set_drvdata(imx_phy->phy, imx_phy);
401 imx8m_get_phy_tuning_data(imx_phy);