Lines Matching full:phy
15 #include <linux/phy/phy.h>
23 * phy as being SR70LX Synopsys USB 2.0 OTG nanoPHY. It also seems at
33 * Finally, the phy on dm814x and am335x is different from dm816x.
36 #define DM816X_USB_CTRL_PHYSLEEP1 BIT(1) /* Enable the first phy */
37 #define DM816X_USB_CTRL_PHYSLEEP0 BIT(0) /* Enable the second phy */
48 struct usb_phy phy; member
72 static int dm816x_usb_phy_init(struct phy *x) in dm816x_usb_phy_init()
74 struct dm816x_usb_phy *phy = phy_get_drvdata(x); in dm816x_usb_phy_init() local
77 if (clk_get_rate(phy->refclk) != 24000000) in dm816x_usb_phy_init()
78 dev_warn(phy->dev, "nonstandard phy refclk\n"); in dm816x_usb_phy_init()
81 regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_init()
86 regmap_read(phy->syscon, phy->usb_ctrl, &val); in dm816x_usb_phy_init()
88 dev_info(phy->dev, in dm816x_usb_phy_init()
97 regmap_read(phy->syscon, phy->usbphy_ctrl, &val); in dm816x_usb_phy_init()
101 regmap_write(phy->syscon, phy->usbphy_ctrl, val); in dm816x_usb_phy_init()
113 struct dm816x_usb_phy *phy = dev_get_drvdata(dev); in dm816x_usb_phy_runtime_suspend() local
117 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
118 val = ~BIT(phy->instance); in dm816x_usb_phy_runtime_suspend()
119 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_suspend()
122 dev_err(phy->dev, "phy%i failed to power off\n", in dm816x_usb_phy_runtime_suspend()
123 phy->instance); in dm816x_usb_phy_runtime_suspend()
124 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_suspend()
131 struct dm816x_usb_phy *phy = dev_get_drvdata(dev); in dm816x_usb_phy_runtime_resume() local
135 error = clk_enable(phy->refclk); in dm816x_usb_phy_runtime_resume()
145 mask = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
146 val = BIT(phy->instance); in dm816x_usb_phy_runtime_resume()
147 error = regmap_update_bits(phy->syscon, phy->usb_ctrl, in dm816x_usb_phy_runtime_resume()
150 dev_err(phy->dev, "phy%i failed to power on\n", in dm816x_usb_phy_runtime_resume()
151 phy->instance); in dm816x_usb_phy_runtime_resume()
152 clk_disable(phy->refclk); in dm816x_usb_phy_runtime_resume()
167 .compatible = "ti,dm8168-usb-phy",
176 struct dm816x_usb_phy *phy; in dm816x_usb_phy_probe() local
178 struct phy *generic_phy; in dm816x_usb_phy_probe()
189 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); in dm816x_usb_phy_probe()
190 if (!phy) in dm816x_usb_phy_probe()
197 phy->syscon = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, in dm816x_usb_phy_probe()
199 if (IS_ERR(phy->syscon)) in dm816x_usb_phy_probe()
200 return PTR_ERR(phy->syscon); in dm816x_usb_phy_probe()
207 phy->usb_ctrl = 0x20; in dm816x_usb_phy_probe()
208 phy->usbphy_ctrl = (res->start & 0xff) + 4; in dm816x_usb_phy_probe()
209 if (phy->usbphy_ctrl == 0x2c) in dm816x_usb_phy_probe()
210 phy->instance = 1; in dm816x_usb_phy_probe()
216 phy->dev = &pdev->dev; in dm816x_usb_phy_probe()
217 phy->phy.dev = phy->dev; in dm816x_usb_phy_probe()
218 phy->phy.label = "dm8168_usb_phy"; in dm816x_usb_phy_probe()
219 phy->phy.otg = otg; in dm816x_usb_phy_probe()
220 phy->phy.type = USB_PHY_TYPE_USB2; in dm816x_usb_phy_probe()
223 otg->usb_phy = &phy->phy; in dm816x_usb_phy_probe()
225 platform_set_drvdata(pdev, phy); in dm816x_usb_phy_probe()
227 phy->refclk = devm_clk_get(phy->dev, "refclk"); in dm816x_usb_phy_probe()
228 if (IS_ERR(phy->refclk)) in dm816x_usb_phy_probe()
229 return PTR_ERR(phy->refclk); in dm816x_usb_phy_probe()
230 error = clk_prepare(phy->refclk); in dm816x_usb_phy_probe()
234 pm_runtime_enable(phy->dev); in dm816x_usb_phy_probe()
235 generic_phy = devm_phy_create(phy->dev, NULL, &ops); in dm816x_usb_phy_probe()
241 phy_set_drvdata(generic_phy, phy); in dm816x_usb_phy_probe()
243 phy_provider = devm_of_phy_provider_register(phy->dev, in dm816x_usb_phy_probe()
250 usb_add_phy_dev(&phy->phy); in dm816x_usb_phy_probe()
255 pm_runtime_disable(phy->dev); in dm816x_usb_phy_probe()
256 clk_unprepare(phy->refclk); 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()
273 .name = "dm816x-usb-phy",
283 MODULE_DESCRIPTION("dm816x usb phy driver");