diff options
Diffstat (limited to 'drivers/usb/phy/phy-generic.c')
-rw-r--r-- | drivers/usb/phy/phy-generic.c | 65 |
1 files changed, 28 insertions, 37 deletions
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index bb394980532b..7594e5069ae5 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/platform_device.h> | 30 | #include <linux/platform_device.h> |
31 | #include <linux/dma-mapping.h> | 31 | #include <linux/dma-mapping.h> |
32 | #include <linux/usb/otg.h> | 32 | #include <linux/usb/otg.h> |
33 | #include <linux/usb/usb_phy_gen_xceiv.h> | 33 | #include <linux/usb/usb_phy_generic.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/clk.h> | 35 | #include <linux/clk.h> |
36 | #include <linux/regulator/consumer.h> | 36 | #include <linux/regulator/consumer.h> |
@@ -41,34 +41,25 @@ | |||
41 | 41 | ||
42 | #include "phy-generic.h" | 42 | #include "phy-generic.h" |
43 | 43 | ||
44 | static struct platform_device *pd; | 44 | struct platform_device *usb_phy_generic_register(void) |
45 | |||
46 | void usb_nop_xceiv_register(void) | ||
47 | { | 45 | { |
48 | if (pd) | 46 | return platform_device_register_simple("usb_phy_generic", |
49 | return; | 47 | PLATFORM_DEVID_AUTO, NULL, 0); |
50 | pd = platform_device_register_simple("usb_phy_gen_xceiv", -1, NULL, 0); | ||
51 | if (IS_ERR(pd)) { | ||
52 | pr_err("Unable to register generic usb transceiver\n"); | ||
53 | pd = NULL; | ||
54 | return; | ||
55 | } | ||
56 | } | 48 | } |
57 | EXPORT_SYMBOL(usb_nop_xceiv_register); | 49 | EXPORT_SYMBOL_GPL(usb_phy_generic_register); |
58 | 50 | ||
59 | void usb_nop_xceiv_unregister(void) | 51 | void usb_phy_generic_unregister(struct platform_device *pdev) |
60 | { | 52 | { |
61 | platform_device_unregister(pd); | 53 | platform_device_unregister(pdev); |
62 | pd = NULL; | ||
63 | } | 54 | } |
64 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); | 55 | EXPORT_SYMBOL_GPL(usb_phy_generic_unregister); |
65 | 56 | ||
66 | static int nop_set_suspend(struct usb_phy *x, int suspend) | 57 | static int nop_set_suspend(struct usb_phy *x, int suspend) |
67 | { | 58 | { |
68 | return 0; | 59 | return 0; |
69 | } | 60 | } |
70 | 61 | ||
71 | static void nop_reset_set(struct usb_phy_gen_xceiv *nop, int asserted) | 62 | static void nop_reset_set(struct usb_phy_generic *nop, int asserted) |
72 | { | 63 | { |
73 | int value; | 64 | int value; |
74 | 65 | ||
@@ -87,7 +78,7 @@ static void nop_reset_set(struct usb_phy_gen_xceiv *nop, int asserted) | |||
87 | 78 | ||
88 | int usb_gen_phy_init(struct usb_phy *phy) | 79 | int usb_gen_phy_init(struct usb_phy *phy) |
89 | { | 80 | { |
90 | struct usb_phy_gen_xceiv *nop = dev_get_drvdata(phy->dev); | 81 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); |
91 | 82 | ||
92 | if (!IS_ERR(nop->vcc)) { | 83 | if (!IS_ERR(nop->vcc)) { |
93 | if (regulator_enable(nop->vcc)) | 84 | if (regulator_enable(nop->vcc)) |
@@ -106,7 +97,7 @@ EXPORT_SYMBOL_GPL(usb_gen_phy_init); | |||
106 | 97 | ||
107 | void usb_gen_phy_shutdown(struct usb_phy *phy) | 98 | void usb_gen_phy_shutdown(struct usb_phy *phy) |
108 | { | 99 | { |
109 | struct usb_phy_gen_xceiv *nop = dev_get_drvdata(phy->dev); | 100 | struct usb_phy_generic *nop = dev_get_drvdata(phy->dev); |
110 | 101 | ||
111 | /* Assert RESET */ | 102 | /* Assert RESET */ |
112 | nop_reset_set(nop, 1); | 103 | nop_reset_set(nop, 1); |
@@ -150,8 +141,8 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
150 | return 0; | 141 | return 0; |
151 | } | 142 | } |
152 | 143 | ||
153 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, | 144 | int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, |
154 | struct usb_phy_gen_xceiv_platform_data *pdata) | 145 | struct usb_phy_generic_platform_data *pdata) |
155 | { | 146 | { |
156 | enum usb_phy_type type = USB_PHY_TYPE_USB2; | 147 | enum usb_phy_type type = USB_PHY_TYPE_USB2; |
157 | int err; | 148 | int err; |
@@ -245,10 +236,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, | |||
245 | } | 236 | } |
246 | EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy); | 237 | EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy); |
247 | 238 | ||
248 | static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) | 239 | static int usb_phy_generic_probe(struct platform_device *pdev) |
249 | { | 240 | { |
250 | struct device *dev = &pdev->dev; | 241 | struct device *dev = &pdev->dev; |
251 | struct usb_phy_gen_xceiv *nop; | 242 | struct usb_phy_generic *nop; |
252 | int err; | 243 | int err; |
253 | 244 | ||
254 | nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); | 245 | nop = devm_kzalloc(dev, sizeof(*nop), GFP_KERNEL); |
@@ -274,9 +265,9 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) | |||
274 | return 0; | 265 | return 0; |
275 | } | 266 | } |
276 | 267 | ||
277 | static int usb_phy_gen_xceiv_remove(struct platform_device *pdev) | 268 | static int usb_phy_generic_remove(struct platform_device *pdev) |
278 | { | 269 | { |
279 | struct usb_phy_gen_xceiv *nop = platform_get_drvdata(pdev); | 270 | struct usb_phy_generic *nop = platform_get_drvdata(pdev); |
280 | 271 | ||
281 | usb_remove_phy(&nop->phy); | 272 | usb_remove_phy(&nop->phy); |
282 | 273 | ||
@@ -290,29 +281,29 @@ static const struct of_device_id nop_xceiv_dt_ids[] = { | |||
290 | 281 | ||
291 | MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids); | 282 | MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids); |
292 | 283 | ||
293 | static struct platform_driver usb_phy_gen_xceiv_driver = { | 284 | static struct platform_driver usb_phy_generic_driver = { |
294 | .probe = usb_phy_gen_xceiv_probe, | 285 | .probe = usb_phy_generic_probe, |
295 | .remove = usb_phy_gen_xceiv_remove, | 286 | .remove = usb_phy_generic_remove, |
296 | .driver = { | 287 | .driver = { |
297 | .name = "usb_phy_gen_xceiv", | 288 | .name = "usb_phy_generic", |
298 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
299 | .of_match_table = nop_xceiv_dt_ids, | 290 | .of_match_table = nop_xceiv_dt_ids, |
300 | }, | 291 | }, |
301 | }; | 292 | }; |
302 | 293 | ||
303 | static int __init usb_phy_gen_xceiv_init(void) | 294 | static int __init usb_phy_generic_init(void) |
304 | { | 295 | { |
305 | return platform_driver_register(&usb_phy_gen_xceiv_driver); | 296 | return platform_driver_register(&usb_phy_generic_driver); |
306 | } | 297 | } |
307 | subsys_initcall(usb_phy_gen_xceiv_init); | 298 | subsys_initcall(usb_phy_generic_init); |
308 | 299 | ||
309 | static void __exit usb_phy_gen_xceiv_exit(void) | 300 | static void __exit usb_phy_generic_exit(void) |
310 | { | 301 | { |
311 | platform_driver_unregister(&usb_phy_gen_xceiv_driver); | 302 | platform_driver_unregister(&usb_phy_generic_driver); |
312 | } | 303 | } |
313 | module_exit(usb_phy_gen_xceiv_exit); | 304 | module_exit(usb_phy_generic_exit); |
314 | 305 | ||
315 | MODULE_ALIAS("platform:usb_phy_gen_xceiv"); | 306 | MODULE_ALIAS("platform:usb_phy_generic"); |
316 | MODULE_AUTHOR("Texas Instruments Inc"); | 307 | MODULE_AUTHOR("Texas Instruments Inc"); |
317 | MODULE_DESCRIPTION("NOP USB Transceiver driver"); | 308 | MODULE_DESCRIPTION("NOP USB Transceiver driver"); |
318 | MODULE_LICENSE("GPL"); | 309 | MODULE_LICENSE("GPL"); |