aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/phy/phy-generic.c')
-rw-r--r--drivers/usb/phy/phy-generic.c65
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
44static struct platform_device *pd; 44struct platform_device *usb_phy_generic_register(void)
45
46void 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}
57EXPORT_SYMBOL(usb_nop_xceiv_register); 49EXPORT_SYMBOL_GPL(usb_phy_generic_register);
58 50
59void usb_nop_xceiv_unregister(void) 51void 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}
64EXPORT_SYMBOL(usb_nop_xceiv_unregister); 55EXPORT_SYMBOL_GPL(usb_phy_generic_unregister);
65 56
66static int nop_set_suspend(struct usb_phy *x, int suspend) 57static int nop_set_suspend(struct usb_phy *x, int suspend)
67{ 58{
68 return 0; 59 return 0;
69} 60}
70 61
71static void nop_reset_set(struct usb_phy_gen_xceiv *nop, int asserted) 62static 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
88int usb_gen_phy_init(struct usb_phy *phy) 79int 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
107void usb_gen_phy_shutdown(struct usb_phy *phy) 98void 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
153int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_gen_xceiv *nop, 144int 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}
246EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy); 237EXPORT_SYMBOL_GPL(usb_phy_gen_create_phy);
247 238
248static int usb_phy_gen_xceiv_probe(struct platform_device *pdev) 239static 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
277static int usb_phy_gen_xceiv_remove(struct platform_device *pdev) 268static 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
291MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids); 282MODULE_DEVICE_TABLE(of, nop_xceiv_dt_ids);
292 283
293static struct platform_driver usb_phy_gen_xceiv_driver = { 284static 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
303static int __init usb_phy_gen_xceiv_init(void) 294static 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}
307subsys_initcall(usb_phy_gen_xceiv_init); 298subsys_initcall(usb_phy_generic_init);
308 299
309static void __exit usb_phy_gen_xceiv_exit(void) 300static 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}
313module_exit(usb_phy_gen_xceiv_exit); 304module_exit(usb_phy_generic_exit);
314 305
315MODULE_ALIAS("platform:usb_phy_gen_xceiv"); 306MODULE_ALIAS("platform:usb_phy_generic");
316MODULE_AUTHOR("Texas Instruments Inc"); 307MODULE_AUTHOR("Texas Instruments Inc");
317MODULE_DESCRIPTION("NOP USB Transceiver driver"); 308MODULE_DESCRIPTION("NOP USB Transceiver driver");
318MODULE_LICENSE("GPL"); 309MODULE_LICENSE("GPL");