Lines Matching +full:axg +full:- +full:mipi +full:- +full:pcie +full:- +full:analog +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0
3 * Amlogic AXG MIPI + PCIE analog PHY driver
8 #include <linux/phy/phy.h>
11 #include <dt-bindings/phy/phy.h>
34 #define HHI_MIPI_CNTL2_CH_EN(n) BIT(15 - (n))
38 struct phy *phy; member
50 static int phy_axg_mipi_pcie_analog_power_on(struct phy *phy) in phy_axg_mipi_pcie_analog_power_on() argument
52 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); in phy_axg_mipi_pcie_analog_power_on()
54 /* MIPI not supported yet */ in phy_axg_mipi_pcie_analog_power_on()
55 if (priv->mode != PHY_TYPE_PCIE) in phy_axg_mipi_pcie_analog_power_on()
56 return -EINVAL; in phy_axg_mipi_pcie_analog_power_on()
58 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_axg_mipi_pcie_analog_power_on()
61 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_axg_mipi_pcie_analog_power_on()
66 static int phy_axg_mipi_pcie_analog_power_off(struct phy *phy) in phy_axg_mipi_pcie_analog_power_off() argument
68 struct phy_axg_mipi_pcie_analog_priv *priv = phy_get_drvdata(phy); in phy_axg_mipi_pcie_analog_power_off()
70 /* MIPI not supported yet */ in phy_axg_mipi_pcie_analog_power_off()
71 if (priv->mode != PHY_TYPE_PCIE) in phy_axg_mipi_pcie_analog_power_off()
72 return -EINVAL; in phy_axg_mipi_pcie_analog_power_off()
74 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_axg_mipi_pcie_analog_power_off()
76 regmap_update_bits(priv->regmap, HHI_MIPI_CNTL0, in phy_axg_mipi_pcie_analog_power_off()
81 static int phy_axg_mipi_pcie_analog_init(struct phy *phy) in phy_axg_mipi_pcie_analog_init() argument
86 static int phy_axg_mipi_pcie_analog_exit(struct phy *phy) in phy_axg_mipi_pcie_analog_exit() argument
99 static struct phy *phy_axg_mipi_pcie_analog_xlate(struct device *dev, in phy_axg_mipi_pcie_analog_xlate()
105 if (args->args_count != 1) { in phy_axg_mipi_pcie_analog_xlate()
107 return ERR_PTR(-EINVAL); in phy_axg_mipi_pcie_analog_xlate()
110 mode = args->args[0]; in phy_axg_mipi_pcie_analog_xlate()
112 /* MIPI mode is not supported yet */ in phy_axg_mipi_pcie_analog_xlate()
114 dev_err(dev, "invalid phy mode select argument\n"); in phy_axg_mipi_pcie_analog_xlate()
115 return ERR_PTR(-EINVAL); in phy_axg_mipi_pcie_analog_xlate()
118 priv->mode = mode; in phy_axg_mipi_pcie_analog_xlate()
119 return priv->phy; in phy_axg_mipi_pcie_analog_xlate()
124 struct phy_provider *phy; in phy_axg_mipi_pcie_analog_probe() local
125 struct device *dev = &pdev->dev; in phy_axg_mipi_pcie_analog_probe()
127 struct device_node *np = dev->of_node; in phy_axg_mipi_pcie_analog_probe()
135 return -ENOMEM; in phy_axg_mipi_pcie_analog_probe()
150 priv->regmap = map; in phy_axg_mipi_pcie_analog_probe()
152 priv->phy = devm_phy_create(dev, np, &phy_axg_mipi_pcie_analog_ops); in phy_axg_mipi_pcie_analog_probe()
153 if (IS_ERR(priv->phy)) { in phy_axg_mipi_pcie_analog_probe()
154 ret = PTR_ERR(priv->phy); in phy_axg_mipi_pcie_analog_probe()
155 if (ret != -EPROBE_DEFER) in phy_axg_mipi_pcie_analog_probe()
156 dev_err(dev, "failed to create PHY\n"); in phy_axg_mipi_pcie_analog_probe()
160 phy_set_drvdata(priv->phy, priv); in phy_axg_mipi_pcie_analog_probe()
163 phy = devm_of_phy_provider_register(dev, in phy_axg_mipi_pcie_analog_probe()
166 return PTR_ERR_OR_ZERO(phy); in phy_axg_mipi_pcie_analog_probe()
171 .compatible = "amlogic,axg-mipi-pcie-analog-phy",
180 .name = "phy-axg-mipi-pcie-analog",
187 MODULE_DESCRIPTION("Amlogic AXG MIPI + PCIE analog PHY driver");