Lines Matching +full:axg +full:- +full:pcie +full:- +full:phy

1 // SPDX-License-Identifier: GPL-2.0
3 * Amlogic AXG PCIE PHY driver
8 #include <linux/phy/phy.h>
13 #include <dt-bindings/phy/phy.h>
28 struct phy *phy; member
29 struct phy *analog;
41 static int phy_axg_pcie_power_on(struct phy *phy) in phy_axg_pcie_power_on() argument
43 struct phy_axg_pcie_priv *priv = phy_get_drvdata(phy); in phy_axg_pcie_power_on()
46 ret = phy_power_on(priv->analog); in phy_axg_pcie_power_on()
50 regmap_update_bits(priv->regmap, MESON_PCIE_REG0, in phy_axg_pcie_power_on()
55 static int phy_axg_pcie_power_off(struct phy *phy) in phy_axg_pcie_power_off() argument
57 struct phy_axg_pcie_priv *priv = phy_get_drvdata(phy); in phy_axg_pcie_power_off()
60 ret = phy_power_off(priv->analog); in phy_axg_pcie_power_off()
64 regmap_update_bits(priv->regmap, MESON_PCIE_REG0, in phy_axg_pcie_power_off()
69 static int phy_axg_pcie_init(struct phy *phy) in phy_axg_pcie_init() argument
71 struct phy_axg_pcie_priv *priv = phy_get_drvdata(phy); in phy_axg_pcie_init()
74 ret = phy_init(priv->analog); in phy_axg_pcie_init()
78 regmap_write(priv->regmap, MESON_PCIE_REG0, MESON_PCIE_PHY_INIT); in phy_axg_pcie_init()
79 return reset_control_reset(priv->reset); in phy_axg_pcie_init()
82 static int phy_axg_pcie_exit(struct phy *phy) in phy_axg_pcie_exit() argument
84 struct phy_axg_pcie_priv *priv = phy_get_drvdata(phy); in phy_axg_pcie_exit()
87 ret = phy_exit(priv->analog); in phy_axg_pcie_exit()
91 return reset_control_reset(priv->reset); in phy_axg_pcie_exit()
94 static int phy_axg_pcie_reset(struct phy *phy) in phy_axg_pcie_reset() argument
96 struct phy_axg_pcie_priv *priv = phy_get_drvdata(phy); in phy_axg_pcie_reset()
99 ret = phy_reset(priv->analog); in phy_axg_pcie_reset()
103 ret = reset_control_assert(priv->reset); in phy_axg_pcie_reset()
108 ret = reset_control_deassert(priv->reset); in phy_axg_pcie_reset()
129 struct device *dev = &pdev->dev; in phy_axg_pcie_probe()
131 struct device_node *np = dev->of_node; in phy_axg_pcie_probe()
137 return -ENOMEM; in phy_axg_pcie_probe()
139 priv->phy = devm_phy_create(dev, np, &phy_axg_pcie_ops); in phy_axg_pcie_probe()
140 if (IS_ERR(priv->phy)) { in phy_axg_pcie_probe()
141 ret = PTR_ERR(priv->phy); in phy_axg_pcie_probe()
142 if (ret != -EPROBE_DEFER) in phy_axg_pcie_probe()
143 dev_err(dev, "failed to create PHY\n"); in phy_axg_pcie_probe()
151 priv->regmap = devm_regmap_init_mmio(dev, base, in phy_axg_pcie_probe()
153 if (IS_ERR(priv->regmap)) in phy_axg_pcie_probe()
154 return PTR_ERR(priv->regmap); in phy_axg_pcie_probe()
156 priv->reset = devm_reset_control_array_get_exclusive(dev); in phy_axg_pcie_probe()
157 if (IS_ERR(priv->reset)) in phy_axg_pcie_probe()
158 return PTR_ERR(priv->reset); in phy_axg_pcie_probe()
160 priv->analog = devm_phy_get(dev, "analog"); in phy_axg_pcie_probe()
161 if (IS_ERR(priv->analog)) in phy_axg_pcie_probe()
162 return PTR_ERR(priv->analog); in phy_axg_pcie_probe()
164 phy_set_drvdata(priv->phy, priv); in phy_axg_pcie_probe()
173 .compatible = "amlogic,axg-pcie-phy",
182 .name = "phy-axg-pcie",
189 MODULE_DESCRIPTION("Amlogic AXG PCIE PHY driver");