| .. | .. | 
|---|
| 21 | 21 | #include <linux/clk.h> | 
|---|
| 22 | 22 | #include <linux/regulator/consumer.h> | 
|---|
| 23 | 23 | #include <linux/of.h> | 
|---|
| 24 |  | -#include <linux/of_gpio.h> | 
|---|
| 25 |  | -#include <linux/gpio.h> | 
|---|
|  | 24 | +#include <linux/gpio/consumer.h> | 
|---|
| 26 | 25 | #include <linux/delay.h> | 
|---|
| 27 | 26 |  | 
|---|
| 28 | 27 | #include "phy-generic.h" | 
|---|
| .. | .. | 
|---|
| 204 | 203 | return 0; | 
|---|
| 205 | 204 | } | 
|---|
| 206 | 205 |  | 
|---|
| 207 |  | -int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, | 
|---|
| 208 |  | -		struct usb_phy_generic_platform_data *pdata) | 
|---|
|  | 206 | +int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) | 
|---|
| 209 | 207 | { | 
|---|
| 210 | 208 | enum usb_phy_type type = USB_PHY_TYPE_USB2; | 
|---|
| 211 | 209 | int err = 0; | 
|---|
| .. | .. | 
|---|
| 221 | 219 |  | 
|---|
| 222 | 220 | needs_vcc = of_property_read_bool(node, "vcc-supply"); | 
|---|
| 223 | 221 | needs_clk = of_property_read_bool(node, "clocks"); | 
|---|
| 224 |  | -		nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", | 
|---|
| 225 |  | -							   GPIOD_ASIS); | 
|---|
| 226 |  | -		err = PTR_ERR_OR_ZERO(nop->gpiod_reset); | 
|---|
| 227 |  | -		if (!err) { | 
|---|
| 228 |  | -			nop->gpiod_vbus = devm_gpiod_get_optional(dev, | 
|---|
| 229 |  | -							 "vbus-detect", | 
|---|
| 230 |  | -							 GPIOD_ASIS); | 
|---|
| 231 |  | -			err = PTR_ERR_OR_ZERO(nop->gpiod_vbus); | 
|---|
| 232 |  | -		} | 
|---|
| 233 |  | -	} else if (pdata) { | 
|---|
| 234 |  | -		type = pdata->type; | 
|---|
| 235 |  | -		clk_rate = pdata->clk_rate; | 
|---|
| 236 |  | -		needs_vcc = pdata->needs_vcc; | 
|---|
| 237 |  | -		if (gpio_is_valid(pdata->gpio_reset)) { | 
|---|
| 238 |  | -			err = devm_gpio_request_one(dev, pdata->gpio_reset, | 
|---|
| 239 |  | -						    GPIOF_ACTIVE_LOW, | 
|---|
| 240 |  | -						    dev_name(dev)); | 
|---|
| 241 |  | -			if (!err) | 
|---|
| 242 |  | -				nop->gpiod_reset = | 
|---|
| 243 |  | -					gpio_to_desc(pdata->gpio_reset); | 
|---|
| 244 |  | -		} | 
|---|
| 245 |  | -		nop->gpiod_vbus = pdata->gpiod_vbus; | 
|---|
|  | 222 | +	} | 
|---|
|  | 223 | +	nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", | 
|---|
|  | 224 | +						   GPIOD_ASIS); | 
|---|
|  | 225 | +	err = PTR_ERR_OR_ZERO(nop->gpiod_reset); | 
|---|
|  | 226 | +	if (!err) { | 
|---|
|  | 227 | +		nop->gpiod_vbus = devm_gpiod_get_optional(dev, | 
|---|
|  | 228 | +						 "vbus-detect", | 
|---|
|  | 229 | +						 GPIOD_ASIS); | 
|---|
|  | 230 | +		err = PTR_ERR_OR_ZERO(nop->gpiod_vbus); | 
|---|
| 246 | 231 | } | 
|---|
| 247 | 232 |  | 
|---|
| 248 | 233 | if (err == -EPROBE_DEFER) | 
|---|
| .. | .. | 
|---|
| 283 | 268 | return -EPROBE_DEFER; | 
|---|
| 284 | 269 | } | 
|---|
| 285 | 270 |  | 
|---|
|  | 271 | +	nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); | 
|---|
|  | 272 | +	if (PTR_ERR(nop->vbus_draw) == -ENODEV) | 
|---|
|  | 273 | +		nop->vbus_draw = NULL; | 
|---|
|  | 274 | +	if (IS_ERR(nop->vbus_draw)) | 
|---|
|  | 275 | +		return dev_err_probe(dev, PTR_ERR(nop->vbus_draw), | 
|---|
|  | 276 | +				     "could not get vbus regulator\n"); | 
|---|
|  | 277 | + | 
|---|
| 286 | 278 | nop->dev		= dev; | 
|---|
| 287 | 279 | nop->phy.dev		= nop->dev; | 
|---|
| 288 | 280 | nop->phy.label		= "nop-xceiv"; | 
|---|
| .. | .. | 
|---|
| 308 | 300 | if (!nop) | 
|---|
| 309 | 301 | return -ENOMEM; | 
|---|
| 310 | 302 |  | 
|---|
| 311 |  | -	err = usb_phy_gen_create_phy(dev, nop, dev_get_platdata(&pdev->dev)); | 
|---|
|  | 303 | +	err = usb_phy_gen_create_phy(dev, nop); | 
|---|
| 312 | 304 | if (err) | 
|---|
| 313 | 305 | return err; | 
|---|
| 314 | 306 | if (nop->gpiod_vbus) { | 
|---|