diff options
author | Felipe Balbi <balbi@ti.com> | 2012-07-19 06:38:06 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2012-08-03 02:36:19 -0400 |
commit | c84d364f8178d2bc12827836bf58eb45598262a4 (patch) | |
tree | bc12127c693bc537ea280a9bb84c38b4a01b74c4 | |
parent | 78c289f8769aaefcc52d26ca53c8b2ee545fb332 (diff) |
usb: xceiv: nop: let it work as USB2 and USB3 phy
We add a platform_data to pass the desired mode
for the nop-xceiv so it can work on USB2 and USB3
modes.
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/otg/nop-usb-xceiv.c | 7 | ||||
-rw-r--r-- | include/linux/usb/nop-usb-xceiv.h | 6 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 3c3ad6bb307c..e52e35e7adaf 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -95,7 +95,9 @@ static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
95 | 95 | ||
96 | static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | 96 | static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) |
97 | { | 97 | { |
98 | struct nop_usb_xceiv_platform_data *pdata = pdev->dev.platform_data; | ||
98 | struct nop_usb_xceiv *nop; | 99 | struct nop_usb_xceiv *nop; |
100 | enum usb_phy_type type = USB_PHY_TYPE_USB2; | ||
99 | int err; | 101 | int err; |
100 | 102 | ||
101 | nop = kzalloc(sizeof *nop, GFP_KERNEL); | 103 | nop = kzalloc(sizeof *nop, GFP_KERNEL); |
@@ -108,6 +110,9 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
108 | return -ENOMEM; | 110 | return -ENOMEM; |
109 | } | 111 | } |
110 | 112 | ||
113 | if (pdata) | ||
114 | type = pdata->type; | ||
115 | |||
111 | nop->dev = &pdev->dev; | 116 | nop->dev = &pdev->dev; |
112 | nop->phy.dev = nop->dev; | 117 | nop->phy.dev = nop->dev; |
113 | nop->phy.label = "nop-xceiv"; | 118 | nop->phy.label = "nop-xceiv"; |
@@ -118,7 +123,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
118 | nop->phy.otg->set_host = nop_set_host; | 123 | nop->phy.otg->set_host = nop_set_host; |
119 | nop->phy.otg->set_peripheral = nop_set_peripheral; | 124 | nop->phy.otg->set_peripheral = nop_set_peripheral; |
120 | 125 | ||
121 | err = usb_add_phy(&nop->phy, USB_PHY_TYPE_USB2); | 126 | err = usb_add_phy(&nop->phy, type); |
122 | if (err) { | 127 | if (err) { |
123 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", | 128 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", |
124 | err); | 129 | err); |
diff --git a/include/linux/usb/nop-usb-xceiv.h b/include/linux/usb/nop-usb-xceiv.h index ecc7562a38cc..28884c717411 100644 --- a/include/linux/usb/nop-usb-xceiv.h +++ b/include/linux/usb/nop-usb-xceiv.h | |||
@@ -1,6 +1,12 @@ | |||
1 | #ifndef __LINUX_USB_NOP_XCEIV_H | 1 | #ifndef __LINUX_USB_NOP_XCEIV_H |
2 | #define __LINUX_USB_NOP_XCEIV_H | 2 | #define __LINUX_USB_NOP_XCEIV_H |
3 | 3 | ||
4 | #include <linux/usb/otg.h> | ||
5 | |||
6 | struct nop_usb_xceiv_platform_data { | ||
7 | enum usb_phy_type type; | ||
8 | }; | ||
9 | |||
4 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 10 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
5 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 11 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
6 | extern void usb_nop_xceiv_register(void); | 12 | extern void usb_nop_xceiv_register(void); |