Lines Matching full:phy
24 #include <linux/phy/phy.h>
32 * phy as being SR70LX Synopsys USB 2.0 OTG nanoPHY. It also seems at
42 * Finally, the phy on dm814x and am335x is different from dm816x.
45 #define DM816X_USB_CTRL_PHYSLEEP1 BIT(1) /* Enable the first phy */
46 #define DM816X_USB_CTRL_PHYSLEEP0 BIT(0) /* Enable the second phy */
57 struct usb_phy phy; member
81 static int dm816x_usb_phy_init(struct phy *x) in dm816x_usb_phy_init()
83 struct dm816x_usb_phy *phy = phy_get_drvdata(x); in dm816x_usb_phy_init() local
86 if (clk_get_rate(phy->refclk) != 24000000) in dm816x_usb_phy_init()
87 dev_warn(phy->dev, "nonstandard phy refclk\n"); in dm816x_usb_phy_init()
90 regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_init()
95 regmap_read(phy->syscon, phy->usb_ctrl, &val); in dm816x_usb_phy_init()
97 dev_info(phy->dev, in dm816x_usb_phy_init()
106 regmap_read(phy->syscon, phy->usbphy_ctrl, &val); in dm816x_usb_phy_init()
110 regmap_write(phy->syscon, phy->usbphy_ctrl, val); in dm816x_usb_phy_init()
122 struct dm816x_usb_phy *phy = dev_get_drvdata(dev); in dm816x_usb_phy_runtime_suspend() local
126 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
127 val = ~BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
128 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_suspend()
131 dev_err(phy->dev, "phy%i failed to power off\n", in dm816x_usb_phy_runtime_suspend()
132 phy->instance); in dm816x_usb_phy_runtime_suspend()
133 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_suspend()
140 struct dm816x_usb_phy *phy = dev_get_drvdata(dev); in dm816x_usb_phy_runtime_resume() local
144 error = clk_enable(phy->refclk); in dm816x_usb_phy_runtime_resume()
154 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
155 val = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
156 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_resume()
159 dev_err(phy->dev, "phy%i failed to power on\n", in dm816x_usb_phy_runtime_resume()
160 phy->instance); in dm816x_usb_phy_runtime_resume()
161 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_resume()
176 .compatible = "ti,dm8168-usb-phy",
185 struct dm816x_usb_phy *phy; in dm816x_usb_phy_probe() local
187 struct phy *generic_phy; in dm816x_usb_phy_probe()
198 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); in dm816x_usb_phy_probe()
199 if (!phy) in dm816x_usb_phy_probe()
206 phy->syscon = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, in dm816x_usb_phy_probe()
208 if (IS_ERR(phy->syscon)) in dm816x_usb_phy_probe()
209 return PTR_ERR(phy->syscon); in dm816x_usb_phy_probe()
216 phy->usb_ctrl = 0x20; in dm816x_usb_phy_probe()
217 phy->usbphy_ctrl = (res->start & 0xff) + 4; in dm816x_usb_phy_probe()
218 if (phy->usbphy_ctrl == 0x2c) in dm816x_usb_phy_probe()
219 phy->instance = 1; in dm816x_usb_phy_probe()
225 phy->dev = &pdev->dev; in dm816x_usb_phy_probe()
226 phy->phy.dev = phy->dev; in dm816x_usb_phy_probe()
227 phy->phy.label = "dm8168_usb_phy"; in dm816x_usb_phy_probe()
228 phy->phy.otg = otg; in dm816x_usb_phy_probe()
229 phy->phy.type = USB_PHY_TYPE_USB2; in dm816x_usb_phy_probe()
232 otg->usb_phy = &phy->phy; in dm816x_usb_phy_probe()
234 platform_set_drvdata(pdev, phy); in dm816x_usb_phy_probe()
236 phy->refclk = devm_clk_get(phy->dev, "refclk"); in dm816x_usb_phy_probe()
237 if (IS_ERR(phy->refclk)) in dm816x_usb_phy_probe()
238 return PTR_ERR(phy->refclk); in dm816x_usb_phy_probe()
239 error = clk_prepare(phy->refclk); in dm816x_usb_phy_probe()
243 pm_runtime_enable(phy->dev); in dm816x_usb_phy_probe()
244 generic_phy = devm_phy_create(phy->dev, NULL, &ops); in dm816x_usb_phy_probe()
248 phy_set_drvdata(generic_phy, phy); in dm816x_usb_phy_probe()
250 phy_provider = devm_of_phy_provider_register(phy->dev, in dm816x_usb_phy_probe()
255 usb_add_phy_dev(&phy->phy); in dm816x_usb_phy_probe()
262 struct dm816x_usb_phy *phy = platform_get_drvdata(pdev); in dm816x_usb_phy_remove() local
264 usb_remove_phy(&phy->phy); in dm816x_usb_phy_remove()
265 pm_runtime_disable(phy->dev); in dm816x_usb_phy_remove()
266 clk_unprepare(phy->refclk); in dm816x_usb_phy_remove()
275 .name = "dm816x-usb-phy",
285 MODULE_DESCRIPTION("dm816x usb phy driver");