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

1 // SPDX-License-Identifier: GPL-2.0
3 * Amlogic AXG MIPI + PCIE analog PHY driver
10 #include <linux/phy/phy.h>
16 #include <dt-bindings/phy/phy.h>
49 struct phy *phy; member
59 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_bandgap_enable()
62 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_bandgap_enable()
68 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_bandgap_disable()
70 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_bandgap_disable()
78 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_dsi_analog_enable()
81 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_dsi_analog_enable()
83 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_dsi_analog_enable()
87 regmap_write(priv->regmap, HHI_MIPI_CNTL1, 0x001e); in phy_dsi_analog_enable()
89 regmap_write(priv->regmap, HHI_MIPI_CNTL2, in phy_dsi_analog_enable()
93 switch (priv->config.lanes) { in phy_dsi_analog_enable()
110 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL2, in phy_dsi_analog_enable()
114 priv->dsi_enabled = true; in phy_dsi_analog_enable()
119 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_dsi_analog_disable()
122 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, BIT(31), 0); in phy_dsi_analog_disable()
123 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_dsi_analog_disable()
126 regmap_write(priv->regmap, HHI_MIPI_CNTL1, 0x6); in phy_dsi_analog_disable()
128 regmap_write(priv->regmap, HHI_MIPI_CNTL2, 0x00200000); in phy_dsi_analog_disable()
130 priv->dsi_enabled = false; in phy_dsi_analog_disable()
133 static int phy_axg_mipi_pcie_analog_configure(struct phy *phy, in phy_axg_mipi_pcie_analog_configure() argument
136 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); in phy_axg_mipi_pcie_analog_configure()
139 ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy); in phy_axg_mipi_pcie_analog_configure()
143 memcpy(&priv->config, opts, sizeof(priv->config)); in phy_axg_mipi_pcie_analog_configure()
145 priv->dsi_configured = true; in phy_axg_mipi_pcie_analog_configure()
147 /* If PHY was already powered on, setup the DSI analog part */ in phy_axg_mipi_pcie_analog_configure()
148 if (priv->powered) { in phy_axg_mipi_pcie_analog_configure()
150 if (priv->dsi_enabled) in phy_axg_mipi_pcie_analog_configure()
161 static int phy_axg_mipi_pcie_analog_power_on(struct phy *phy) in phy_axg_mipi_pcie_analog_power_on() argument
163 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); in phy_axg_mipi_pcie_analog_power_on()
167 if (priv->dsi_configured) in phy_axg_mipi_pcie_analog_power_on()
170 priv->powered = true; in phy_axg_mipi_pcie_analog_power_on()
175 static int phy_axg_mipi_pcie_analog_power_off(struct phy *phy) in phy_axg_mipi_pcie_analog_power_off() argument
177 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); in phy_axg_mipi_pcie_analog_power_off()
181 if (priv->dsi_enabled) in phy_axg_mipi_pcie_analog_power_off()
184 priv->powered = false; in phy_axg_mipi_pcie_analog_power_off()
198 struct phy_provider *phy; in phy_axg_mipi_pcie_analog_probe() local
199 struct device *dev = &pdev->dev; in phy_axg_mipi_pcie_analog_probe()
201 struct device_node *np = dev->of_node, *parent_np; in phy_axg_mipi_pcie_analog_probe()
207 return -ENOMEM; in phy_axg_mipi_pcie_analog_probe()
210 parent_np = of_get_parent(dev->of_node); in phy_axg_mipi_pcie_analog_probe()
219 priv->regmap = map; in phy_axg_mipi_pcie_analog_probe()
221 priv->phy = devm_phy_create(dev, np, &phy_axg_mipi_pcie_analog_ops); in phy_axg_mipi_pcie_analog_probe()
222 if (IS_ERR(priv->phy)) { in phy_axg_mipi_pcie_analog_probe()
223 ret = PTR_ERR(priv->phy); in phy_axg_mipi_pcie_analog_probe()
224 if (ret != -EPROBE_DEFER) in phy_axg_mipi_pcie_analog_probe()
225 dev_err(dev, "failed to create PHY\n"); in phy_axg_mipi_pcie_analog_probe()
229 phy_set_drvdata(priv->phy, priv); in phy_axg_mipi_pcie_analog_probe()
232 phy = devm_of_phy_provider_register(dev, of_phy_simple_xlate); in phy_axg_mipi_pcie_analog_probe()
234 return PTR_ERR_OR_ZERO(phy); in phy_axg_mipi_pcie_analog_probe()
239 .compatible = "amlogic,axg-mipi-pcie-analog-phy",
248 .name = "phy-axg-mipi-pcie-analog",
255 MODULE_DESCRIPTION("Amlogic AXG MIPI + PCIE analog PHY driver");