Lines Matching +full:uniphier +full:- +full:pro4 +full:- +full:usb2 +full:- +full:phy
1 // SPDX-License-Identifier: GPL-2.0
3 * phy-uniphier-usb2.c - PHY driver for UniPhier USB2 controller
4 * Copyright 2015-2018 Socionext Inc.
13 #include <linux/phy/phy.h>
22 #define SG_USBPHY12PLL 0x50c /* Pro4 */
25 #define SG_USBPHY4CTRL 0x518 /* Pro4 */
26 #define SG_USBPHY4CTRL2 0x51c /* Pro4 */
27 #define SG_USBPHY34PLL 0x51c /* Pro4 */
41 struct phy *phy; member
47 static int uniphier_u2phy_power_on(struct phy *phy) in uniphier_u2phy_power_on() argument
49 struct uniphier_u2phy_priv *priv = phy_get_drvdata(phy); in uniphier_u2phy_power_on()
52 if (priv->vbus) in uniphier_u2phy_power_on()
53 ret = regulator_enable(priv->vbus); in uniphier_u2phy_power_on()
58 static int uniphier_u2phy_power_off(struct phy *phy) in uniphier_u2phy_power_off() argument
60 struct uniphier_u2phy_priv *priv = phy_get_drvdata(phy); in uniphier_u2phy_power_off()
62 if (priv->vbus) in uniphier_u2phy_power_off()
63 regulator_disable(priv->vbus); in uniphier_u2phy_power_off()
68 static int uniphier_u2phy_init(struct phy *phy) in uniphier_u2phy_init() argument
70 struct uniphier_u2phy_priv *priv = phy_get_drvdata(phy); in uniphier_u2phy_init()
72 if (!priv->data) in uniphier_u2phy_init()
75 regmap_write(priv->regmap, priv->data->config0.offset, in uniphier_u2phy_init()
76 priv->data->config0.value); in uniphier_u2phy_init()
77 regmap_write(priv->regmap, priv->data->config1.offset, in uniphier_u2phy_init()
78 priv->data->config1.value); in uniphier_u2phy_init()
83 static struct phy *uniphier_u2phy_xlate(struct device *dev, in uniphier_u2phy_xlate()
88 while (priv && args->np != priv->phy->dev.of_node) in uniphier_u2phy_xlate()
89 priv = priv->next; in uniphier_u2phy_xlate()
92 dev_err(dev, "Failed to find appropriate phy\n"); in uniphier_u2phy_xlate()
93 return ERR_PTR(-EINVAL); in uniphier_u2phy_xlate()
96 return priv->phy; in uniphier_u2phy_xlate()
108 struct device *dev = &pdev->dev; in uniphier_u2phy_probe()
118 return -EINVAL; in uniphier_u2phy_probe()
124 parent = of_get_parent(dev->of_node); in uniphier_u2phy_probe()
132 for_each_child_of_node(dev->of_node, child) { in uniphier_u2phy_probe()
135 ret = -ENOMEM; in uniphier_u2phy_probe()
138 priv->regmap = regmap; in uniphier_u2phy_probe()
140 priv->vbus = devm_regulator_get_optional(dev, "vbus"); in uniphier_u2phy_probe()
141 if (IS_ERR(priv->vbus)) { in uniphier_u2phy_probe()
142 if (PTR_ERR(priv->vbus) == -EPROBE_DEFER) { in uniphier_u2phy_probe()
143 ret = PTR_ERR(priv->vbus); in uniphier_u2phy_probe()
146 priv->vbus = NULL; in uniphier_u2phy_probe()
149 priv->phy = devm_phy_create(dev, child, &uniphier_u2phy_ops); in uniphier_u2phy_probe()
150 if (IS_ERR(priv->phy)) { in uniphier_u2phy_probe()
151 dev_err(dev, "Failed to create phy\n"); in uniphier_u2phy_probe()
152 ret = PTR_ERR(priv->phy); in uniphier_u2phy_probe()
163 priv->data = &data[data_idx]; in uniphier_u2phy_probe()
165 dev_warn(dev, "No phy configuration: %s\n", in uniphier_u2phy_probe()
166 child->full_name); in uniphier_u2phy_probe()
168 phy_set_drvdata(priv->phy, priv); in uniphier_u2phy_probe()
169 priv->next = next; in uniphier_u2phy_probe()
222 .compatible = "socionext,uniphier-pro4-usb2-phy",
226 .compatible = "socionext,uniphier-ld11-usb2-phy",
236 .name = "uniphier-usb2-phy",
243 MODULE_DESCRIPTION("UniPhier PHY driver for USB2 controller");