Lines Matching +full:usb2 +full:- +full:device +full:- +full:4

1 // SPDX-License-Identifier: GPL-2.0
3 * Meson G12A USB2 PHY driver
29 #define PHY_CTRL_R3_DISC_THRESH GENMASK(7, 4)
70 #define PHY_CTRL_R14_PG_RSTN BIT(4)
120 #define PHY_CTRL_R20_USB2_OTG_VBUSDET_EN BIT(4)
139 #define PHY_CTRL_R21_USB2_OTG_ACA_TRIM_1_0 GENMASK(5, 4)
155 struct device *dev;
165 .reg_stride = 4,
175 ret = reset_control_reset(priv->reset); in phy_meson_g12a_usb2_init()
182 regmap_update_bits(priv->regmap, PHY_CTRL_R21, in phy_meson_g12a_usb2_init()
186 regmap_write(priv->regmap, PHY_CTRL_R16, in phy_meson_g12a_usb2_init()
195 regmap_write(priv->regmap, PHY_CTRL_R17, in phy_meson_g12a_usb2_init()
214 if (priv->soc_id == MESON_SOC_A1) in phy_meson_g12a_usb2_init()
217 regmap_write(priv->regmap, PHY_CTRL_R18, value); in phy_meson_g12a_usb2_init()
222 regmap_write(priv->regmap, PHY_CTRL_R16, in phy_meson_g12a_usb2_init()
231 regmap_write(priv->regmap, PHY_CTRL_R20, in phy_meson_g12a_usb2_init()
232 FIELD_PREP(PHY_CTRL_R20_USB2_OTG_VBUS_TRIM_2_0, 4) | in phy_meson_g12a_usb2_init()
241 if (priv->soc_id == MESON_SOC_G12A) in phy_meson_g12a_usb2_init()
242 regmap_write(priv->regmap, PHY_CTRL_R4, in phy_meson_g12a_usb2_init()
249 else if (priv->soc_id == MESON_SOC_A1) { in phy_meson_g12a_usb2_init()
250 regmap_write(priv->regmap, PHY_CTRL_R21, in phy_meson_g12a_usb2_init()
256 regmap_write(priv->regmap, PHY_CTRL_R13, in phy_meson_g12a_usb2_init()
261 regmap_write(priv->regmap, PHY_CTRL_R3, in phy_meson_g12a_usb2_init()
266 if (priv->soc_id == MESON_SOC_G12A) { in phy_meson_g12a_usb2_init()
268 regmap_write(priv->regmap, PHY_CTRL_R14, 0); in phy_meson_g12a_usb2_init()
269 regmap_write(priv->regmap, PHY_CTRL_R13, in phy_meson_g12a_usb2_init()
281 return reset_control_reset(priv->reset); in phy_meson_g12a_usb2_exit()
293 struct device *dev = &pdev->dev; in phy_meson_g12a_usb2_probe()
302 return -ENOMEM; in phy_meson_g12a_usb2_probe()
304 priv->dev = dev; in phy_meson_g12a_usb2_probe()
311 priv->soc_id = (enum meson_soc_id)of_device_get_match_data(&pdev->dev); in phy_meson_g12a_usb2_probe()
313 priv->regmap = devm_regmap_init_mmio(dev, base, in phy_meson_g12a_usb2_probe()
315 if (IS_ERR(priv->regmap)) in phy_meson_g12a_usb2_probe()
316 return PTR_ERR(priv->regmap); in phy_meson_g12a_usb2_probe()
318 priv->clk = devm_clk_get(dev, "xtal"); in phy_meson_g12a_usb2_probe()
319 if (IS_ERR(priv->clk)) in phy_meson_g12a_usb2_probe()
320 return PTR_ERR(priv->clk); in phy_meson_g12a_usb2_probe()
322 priv->reset = devm_reset_control_get(dev, "phy"); in phy_meson_g12a_usb2_probe()
323 if (IS_ERR(priv->reset)) in phy_meson_g12a_usb2_probe()
324 return PTR_ERR(priv->reset); in phy_meson_g12a_usb2_probe()
326 ret = reset_control_deassert(priv->reset); in phy_meson_g12a_usb2_probe()
333 if (ret != -EPROBE_DEFER) in phy_meson_g12a_usb2_probe()
349 .compatible = "amlogic,g12a-usb2-phy",
353 .compatible = "amlogic,a1-usb2-phy",
363 .name = "phy-meson-g12a-usb2",
371 MODULE_DESCRIPTION("Meson G12A USB2 PHY driver");