Lines Matching +full:phy +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
3 * ST spear1340-miphy driver
12 #include <linux/dma-mapping.h>
17 #include <linux/phy/phy.h>
32 /* PCIE - SATA configuration registers */
80 /* phy mode: 0 for SATA 1 for PCIe */
81 enum spear1340_miphy_mode mode; member
84 /* phy struct pointer */
85 struct phy *phy; member
90 regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG, in spear1340_miphy_sata_init()
93 regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG, in spear1340_miphy_sata_init()
97 regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG, in spear1340_miphy_sata_init()
104 regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST, in spear1340_miphy_sata_init()
106 /* Wait for SATA reset de-assert completion */ in spear1340_miphy_sata_init()
114 regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG, in spear1340_miphy_sata_exit()
116 regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG, in spear1340_miphy_sata_exit()
120 regmap_update_bits(priv->misc, SPEAR1340_PERIP1_SW_RST, in spear1340_miphy_sata_exit()
126 regmap_update_bits(priv->misc, SPEAR1340_PCM_CFG, in spear1340_miphy_sata_exit()
136 regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG, in spear1340_miphy_pcie_init()
139 regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG, in spear1340_miphy_pcie_init()
148 regmap_update_bits(priv->misc, SPEAR1340_PCIE_MIPHY_CFG, in spear1340_miphy_pcie_exit()
150 regmap_update_bits(priv->misc, SPEAR1340_PCIE_SATA_CFG, in spear1340_miphy_pcie_exit()
156 static int spear1340_miphy_init(struct phy *phy) in spear1340_miphy_init() argument
158 struct spear1340_miphy_priv *priv = phy_get_drvdata(phy); in spear1340_miphy_init()
161 if (priv->mode == SATA) in spear1340_miphy_init()
163 else if (priv->mode == PCIE) in spear1340_miphy_init()
169 static int spear1340_miphy_exit(struct phy *phy) in spear1340_miphy_exit() argument
171 struct spear1340_miphy_priv *priv = phy_get_drvdata(phy); in spear1340_miphy_exit()
174 if (priv->mode == SATA) in spear1340_miphy_exit()
176 else if (priv->mode == PCIE) in spear1340_miphy_exit()
183 { .compatible = "st,spear1340-miphy" },
200 if (priv->mode == SATA) in spear1340_miphy_suspend()
211 if (priv->mode == SATA) in spear1340_miphy_resume()
221 static struct phy *spear1340_miphy_xlate(struct device *dev, in spear1340_miphy_xlate()
226 if (args->args_count < 1) { in spear1340_miphy_xlate()
228 return ERR_PTR(-ENODEV); in spear1340_miphy_xlate()
231 priv->mode = args->args[0]; in spear1340_miphy_xlate()
233 if (priv->mode != SATA && priv->mode != PCIE) { in spear1340_miphy_xlate()
234 dev_err(dev, "DT did not pass correct phy mode\n"); in spear1340_miphy_xlate()
235 return ERR_PTR(-ENODEV); in spear1340_miphy_xlate()
238 return priv->phy; in spear1340_miphy_xlate()
243 struct device *dev = &pdev->dev; in spear1340_miphy_probe()
249 return -ENOMEM; in spear1340_miphy_probe()
251 priv->misc = in spear1340_miphy_probe()
252 syscon_regmap_lookup_by_phandle(dev->of_node, "misc"); in spear1340_miphy_probe()
253 if (IS_ERR(priv->misc)) { in spear1340_miphy_probe()
255 return PTR_ERR(priv->misc); in spear1340_miphy_probe()
258 priv->phy = devm_phy_create(dev, NULL, &spear1340_miphy_ops); in spear1340_miphy_probe()
259 if (IS_ERR(priv->phy)) { in spear1340_miphy_probe()
260 dev_err(dev, "failed to create SATA PCIe PHY\n"); in spear1340_miphy_probe()
261 return PTR_ERR(priv->phy); in spear1340_miphy_probe()
265 phy_set_drvdata(priv->phy, priv); in spear1340_miphy_probe()
270 dev_err(dev, "failed to register phy provider\n"); in spear1340_miphy_probe()
280 .name = "spear1340-miphy",
288 MODULE_DESCRIPTION("ST SPEAR1340-MIPHY driver");