Lines Matching refs:nop

10  *	This provides a "nop" transceiver for PHYs which are
48 struct usb_phy_generic *nop = dev_get_drvdata(x->dev);
50 if (!IS_ERR(nop->clk)) {
52 clk_disable_unprepare(nop->clk);
54 clk_prepare_enable(nop->clk);
60 static void nop_reset(struct usb_phy_generic *nop)
62 if (!nop->gpiod_reset)
65 gpiod_set_value_cansleep(nop->gpiod_reset, 1);
67 gpiod_set_value_cansleep(nop->gpiod_reset, 0);
71 static void nop_set_vbus_draw(struct usb_phy_generic *nop, unsigned mA)
73 struct regulator *vbus_draw = nop->vbus_draw;
80 enabled = nop->vbus_draw_enabled;
87 nop->vbus_draw_enabled = 1;
94 nop->vbus_draw_enabled = 0;
97 nop->mA = mA;
103 struct usb_phy_generic *nop = data;
104 struct usb_otg *otg = nop->phy.otg;
107 vbus = gpiod_get_value(nop->gpiod_vbus);
108 if ((vbus ^ nop->vbus) == 0)
110 nop->vbus = vbus;
115 nop->phy.last_event = status;
118 nop_set_vbus_draw(nop, 100);
120 atomic_notifier_call_chain(&nop->phy.notifier, status,
123 nop_set_vbus_draw(nop, 0);
127 nop->phy.last_event = status;
129 atomic_notifier_call_chain(&nop->phy.notifier, status,
137 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
140 if (!IS_ERR(nop->vcc)) {
141 if (regulator_enable(nop->vcc))
145 if (!IS_ERR(nop->clk)) {
146 ret = clk_prepare_enable(nop->clk);
151 nop_reset(nop);
159 struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
161 gpiod_set_value_cansleep(nop->gpiod_reset, 1);
163 if (!IS_ERR(nop->clk))
164 clk_disable_unprepare(nop->clk);
166 if (!IS_ERR(nop->vcc)) {
167 if (regulator_disable(nop->vcc))
206 int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop)
222 nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
224 err = PTR_ERR_OR_ZERO(nop->gpiod_reset);
226 nop->gpiod_vbus = devm_gpiod_get_optional(dev,
229 err = PTR_ERR_OR_ZERO(nop->gpiod_vbus);
235 if (nop->gpiod_reset)
236 gpiod_direction_output(nop->gpiod_reset, 1);
238 nop->phy.otg = devm_kzalloc(dev, sizeof(*nop->phy.otg),
240 if (!nop->phy.otg)
243 nop->clk = devm_clk_get(dev, "main_clk");
244 if (IS_ERR(nop->clk)) {
246 PTR_ERR(nop->clk));
248 return PTR_ERR(nop->clk);
251 if (!IS_ERR(nop->clk) && clk_rate) {
252 err = clk_set_rate(nop->clk, clk_rate);
259 nop->vcc = devm_regulator_get_optional(dev, "vcc");
260 if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV)
261 return dev_err_probe(dev, PTR_ERR(nop->vcc),
264 nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus");
265 if (PTR_ERR(nop->vbus_draw) == -ENODEV)
266 nop->vbus_draw = NULL;
267 if (IS_ERR(nop->vbus_draw))
268 return dev_err_probe(dev, PTR_ERR(nop->vbus_draw),
271 nop->dev = dev;
272 nop->phy.dev = nop->dev;
273 nop->phy.label = "nop-xceiv";
274 nop->phy.set_suspend = nop_set_suspend;
275 nop->phy.type = type;
277 nop->phy.otg->state = OTG_STATE_UNDEFINED;
278 nop->phy.otg->usb_phy = &nop->phy;
279 nop->phy.otg->set_host = nop_set_host;
280 nop->phy.otg->set_peripheral = nop_set_peripheral;
290 struct usb_phy_generic *nop;
293 nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL);
294 if (!nop)
297 err = usb_phy_gen_create_phy(dev, nop);
300 if (nop->gpiod_vbus) {
302 gpiod_to_irq(nop->gpiod_vbus),
305 nop);
308 gpiod_to_irq(nop->gpiod_vbus), err);
311 nop->phy.otg->state = gpiod_get_value(nop->gpiod_vbus) ?
315 nop->phy.init = usb_gen_phy_init;
316 nop->phy.shutdown = usb_gen_phy_shutdown;
318 err = usb_add_phy_dev(&nop->phy);
325 platform_set_drvdata(pdev, nop);
335 struct usb_phy_generic *nop = platform_get_drvdata(pdev);
337 usb_remove_phy(&nop->phy);
341 { .compatible = "usb-nop-xceiv" },