aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/usb/omap-usb.txt4
-rw-r--r--Documentation/devicetree/bindings/usb/usb-phy.txt7
-rw-r--r--drivers/usb/musb/Kconfig1
-rw-r--r--drivers/usb/musb/omap2430.c68
-rw-r--r--drivers/usb/musb/omap2430.h9
-rw-r--r--drivers/usb/phy/Kconfig1
-rw-r--r--drivers/usb/phy/omap-usb2.c41
-rw-r--r--include/linux/usb/omap_usb.h4
8 files changed, 40 insertions, 95 deletions
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 3d78cc2b486e..1ef0ce71f8fa 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -3,6 +3,9 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
3OMAP MUSB GLUE 3OMAP MUSB GLUE
4 - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb" 4 - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
5 - ti,hwmods : must be "usb_otg_hs" 5 - ti,hwmods : must be "usb_otg_hs"
6 - ti,has-mailbox : to specify that omap uses an external mailbox
7 (in control module) to communicate with the musb core during device connect
8 and disconnect.
6 - multipoint : Should be "1" indicating the musb controller supports 9 - multipoint : Should be "1" indicating the musb controller supports
7 multipoint. This is a MUSB configuration-specific setting. 10 multipoint. This is a MUSB configuration-specific setting.
8 - num_eps : Specifies the number of endpoints. This is also a 11 - num_eps : Specifies the number of endpoints. This is also a
@@ -24,6 +27,7 @@ SOC specific device node entry
24usb_otg_hs: usb_otg_hs@4a0ab000 { 27usb_otg_hs: usb_otg_hs@4a0ab000 {
25 compatible = "ti,omap4-musb"; 28 compatible = "ti,omap4-musb";
26 ti,hwmods = "usb_otg_hs"; 29 ti,hwmods = "usb_otg_hs";
30 ti,has-mailbox;
27 multipoint = <1>; 31 multipoint = <1>;
28 num_eps = <16>; 32 num_eps = <16>;
29 ram_bits = <12>; 33 ram_bits = <12>;
diff --git a/Documentation/devicetree/bindings/usb/usb-phy.txt b/Documentation/devicetree/bindings/usb/usb-phy.txt
index 4234105302db..b4b86bb831b2 100644
--- a/Documentation/devicetree/bindings/usb/usb-phy.txt
+++ b/Documentation/devicetree/bindings/usb/usb-phy.txt
@@ -4,9 +4,7 @@ OMAP USB2 PHY
4 4
5Required properties: 5Required properties:
6 - compatible: Should be "ti,omap-usb2" 6 - compatible: Should be "ti,omap-usb2"
7 - reg : Address and length of the register set for the device. Also 7 - reg : Address and length of the register set for the device.
8add the address of control module dev conf register until a driver for
9control module is added
10 8
11Optional properties: 9Optional properties:
12 - ctrl-module : phandle of the control module used by PHY driver to power on 10 - ctrl-module : phandle of the control module used by PHY driver to power on
@@ -16,7 +14,6 @@ This is usually a subnode of ocp2scp to which it is connected.
16 14
17usb2phy@4a0ad080 { 15usb2phy@4a0ad080 {
18 compatible = "ti,omap-usb2"; 16 compatible = "ti,omap-usb2";
19 reg = <0x4a0ad080 0x58>, 17 reg = <0x4a0ad080 0x58>;
20 <0x4a002300 0x4>;
21 ctrl-module = <&omap_control_usb>; 18 ctrl-module = <&omap_control_usb>;
22}; 19};
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 23a0b7f0892d..de6e5ce26316 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -11,6 +11,7 @@ config USB_MUSB_HDRC
11 select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX) 11 select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
12 select TWL4030_USB if MACH_OMAP_3430SDP 12 select TWL4030_USB if MACH_OMAP_3430SDP
13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
14 select OMAP_CONTROL_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
14 select USB_OTG_UTILS 15 select USB_OTG_UTILS
15 help 16 help
16 Say Y here if your system has a dual role high speed USB 17 Say Y here if your system has a dual role high speed USB
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index da00af460794..779862d24590 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -37,6 +37,7 @@
37#include <linux/err.h> 37#include <linux/err.h>
38#include <linux/delay.h> 38#include <linux/delay.h>
39#include <linux/usb/musb-omap.h> 39#include <linux/usb/musb-omap.h>
40#include <linux/usb/omap_control_usb.h>
40 41
41#include "musb_core.h" 42#include "musb_core.h"
42#include "omap2430.h" 43#include "omap2430.h"
@@ -46,7 +47,7 @@ struct omap2430_glue {
46 struct platform_device *musb; 47 struct platform_device *musb;
47 enum omap_musb_vbus_id_status status; 48 enum omap_musb_vbus_id_status status;
48 struct work_struct omap_musb_mailbox_work; 49 struct work_struct omap_musb_mailbox_work;
49 u32 __iomem *control_otghs; 50 struct device *control_otghs;
50}; 51};
51#define glue_to_musb(g) platform_get_drvdata(g->musb) 52#define glue_to_musb(g) platform_get_drvdata(g->musb)
52 53
@@ -54,26 +55,6 @@ struct omap2430_glue *_glue;
54 55
55static struct timer_list musb_idle_timer; 56static struct timer_list musb_idle_timer;
56 57
57/**
58 * omap4_usb_phy_mailbox - write to usb otg mailbox
59 * @glue: struct omap2430_glue *
60 * @val: the value to be written to the mailbox
61 *
62 * On detection of a device (ID pin is grounded), this API should be called
63 * to set AVALID, VBUSVALID and ID pin is grounded.
64 *
65 * When OMAP is connected to a host (OMAP in device mode), this API
66 * is called to set AVALID, VBUSVALID and ID pin in high impedance.
67 *
68 * XXX: This function will be removed once we have a seperate driver for
69 * control module
70 */
71static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
72{
73 if (glue->control_otghs)
74 writel(val, glue->control_otghs);
75}
76
77static void musb_do_idle(unsigned long _musb) 58static void musb_do_idle(unsigned long _musb)
78{ 59{
79 struct musb *musb = (void *)_musb; 60 struct musb *musb = (void *)_musb;
@@ -269,7 +250,6 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
269 250
270static void omap_musb_set_mailbox(struct omap2430_glue *glue) 251static void omap_musb_set_mailbox(struct omap2430_glue *glue)
271{ 252{
272 u32 val;
273 struct musb *musb = glue_to_musb(glue); 253 struct musb *musb = glue_to_musb(glue);
274 struct device *dev = musb->controller; 254 struct device *dev = musb->controller;
275 struct musb_hdrc_platform_data *pdata = dev->platform_data; 255 struct musb_hdrc_platform_data *pdata = dev->platform_data;
@@ -285,8 +265,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
285 musb->xceiv->last_event = USB_EVENT_ID; 265 musb->xceiv->last_event = USB_EVENT_ID;
286 if (musb->gadget_driver) { 266 if (musb->gadget_driver) {
287 pm_runtime_get_sync(dev); 267 pm_runtime_get_sync(dev);
288 val = AVALID | VBUSVALID; 268 omap_control_usb_set_mode(glue->control_otghs,
289 omap4_usb_phy_mailbox(glue, val); 269 USB_MODE_HOST);
290 omap2430_musb_set_vbus(musb, 1); 270 omap2430_musb_set_vbus(musb, 1);
291 } 271 }
292 break; 272 break;
@@ -299,8 +279,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
299 musb->xceiv->last_event = USB_EVENT_VBUS; 279 musb->xceiv->last_event = USB_EVENT_VBUS;
300 if (musb->gadget_driver) 280 if (musb->gadget_driver)
301 pm_runtime_get_sync(dev); 281 pm_runtime_get_sync(dev);
302 val = IDDIG | AVALID | VBUSVALID; 282 omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
303 omap4_usb_phy_mailbox(glue, val);
304 break; 283 break;
305 284
306 case OMAP_MUSB_ID_FLOAT: 285 case OMAP_MUSB_ID_FLOAT:
@@ -317,8 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
317 if (musb->xceiv->otg->set_vbus) 296 if (musb->xceiv->otg->set_vbus)
318 otg_set_vbus(musb->xceiv->otg, 0); 297 otg_set_vbus(musb->xceiv->otg, 0);
319 } 298 }
320 val = SESSEND | IDDIG; 299 omap_control_usb_set_mode(glue->control_otghs,
321 omap4_usb_phy_mailbox(glue, val); 300 USB_MODE_DISCONNECT);
322 break; 301 break;
323 default: 302 default:
324 dev_dbg(dev, "ID float\n"); 303 dev_dbg(dev, "ID float\n");
@@ -415,7 +394,6 @@ err1:
415static void omap2430_musb_enable(struct musb *musb) 394static void omap2430_musb_enable(struct musb *musb)
416{ 395{
417 u8 devctl; 396 u8 devctl;
418 u32 val;
419 unsigned long timeout = jiffies + msecs_to_jiffies(1000); 397 unsigned long timeout = jiffies + msecs_to_jiffies(1000);
420 struct device *dev = musb->controller; 398 struct device *dev = musb->controller;
421 struct omap2430_glue *glue = dev_get_drvdata(dev->parent); 399 struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
@@ -425,8 +403,7 @@ static void omap2430_musb_enable(struct musb *musb)
425 switch (glue->status) { 403 switch (glue->status) {
426 404
427 case OMAP_MUSB_ID_GROUND: 405 case OMAP_MUSB_ID_GROUND:
428 val = AVALID | VBUSVALID; 406 omap_control_usb_set_mode(glue->control_otghs, USB_MODE_HOST);
429 omap4_usb_phy_mailbox(glue, val);
430 if (data->interface_type != MUSB_INTERFACE_UTMI) 407 if (data->interface_type != MUSB_INTERFACE_UTMI)
431 break; 408 break;
432 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 409 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -445,8 +422,7 @@ static void omap2430_musb_enable(struct musb *musb)
445 break; 422 break;
446 423
447 case OMAP_MUSB_VBUS_VALID: 424 case OMAP_MUSB_VBUS_VALID:
448 val = IDDIG | AVALID | VBUSVALID; 425 omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE);
449 omap4_usb_phy_mailbox(glue, val);
450 break; 426 break;
451 427
452 default: 428 default:
@@ -456,14 +432,12 @@ static void omap2430_musb_enable(struct musb *musb)
456 432
457static void omap2430_musb_disable(struct musb *musb) 433static void omap2430_musb_disable(struct musb *musb)
458{ 434{
459 u32 val;
460 struct device *dev = musb->controller; 435 struct device *dev = musb->controller;
461 struct omap2430_glue *glue = dev_get_drvdata(dev->parent); 436 struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
462 437
463 if (glue->status != OMAP_MUSB_UNKNOWN) { 438 if (glue->status != OMAP_MUSB_UNKNOWN)
464 val = SESSEND | IDDIG; 439 omap_control_usb_set_mode(glue->control_otghs,
465 omap4_usb_phy_mailbox(glue, val); 440 USB_MODE_DISCONNECT);
466 }
467} 441}
468 442
469static int omap2430_musb_exit(struct musb *musb) 443static int omap2430_musb_exit(struct musb *musb)
@@ -498,7 +472,6 @@ static int omap2430_probe(struct platform_device *pdev)
498 struct omap2430_glue *glue; 472 struct omap2430_glue *glue;
499 struct device_node *np = pdev->dev.of_node; 473 struct device_node *np = pdev->dev.of_node;
500 struct musb_hdrc_config *config; 474 struct musb_hdrc_config *config;
501 struct resource *res;
502 int ret = -ENOMEM; 475 int ret = -ENOMEM;
503 476
504 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); 477 glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
@@ -521,12 +494,6 @@ static int omap2430_probe(struct platform_device *pdev)
521 glue->musb = musb; 494 glue->musb = musb;
522 glue->status = OMAP_MUSB_UNKNOWN; 495 glue->status = OMAP_MUSB_UNKNOWN;
523 496
524 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
525
526 glue->control_otghs = devm_request_and_ioremap(&pdev->dev, res);
527 if (glue->control_otghs == NULL)
528 dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
529
530 if (np) { 497 if (np) {
531 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 498 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
532 if (!pdata) { 499 if (!pdata) {
@@ -558,11 +525,22 @@ static int omap2430_probe(struct platform_device *pdev)
558 of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits); 525 of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
559 of_property_read_u32(np, "power", (u32 *)&pdata->power); 526 of_property_read_u32(np, "power", (u32 *)&pdata->power);
560 config->multipoint = of_property_read_bool(np, "multipoint"); 527 config->multipoint = of_property_read_bool(np, "multipoint");
528 pdata->has_mailbox = of_property_read_bool(np,
529 "ti,has-mailbox");
561 530
562 pdata->board_data = data; 531 pdata->board_data = data;
563 pdata->config = config; 532 pdata->config = config;
564 } 533 }
565 534
535 if (pdata->has_mailbox) {
536 glue->control_otghs = omap_get_control_dev();
537 if (IS_ERR(glue->control_otghs)) {
538 dev_vdbg(&pdev->dev, "Failed to get control device\n");
539 return -ENODEV;
540 }
541 } else {
542 glue->control_otghs = ERR_PTR(-ENODEV);
543 }
566 pdata->platform_ops = &omap2430_ops; 544 pdata->platform_ops = &omap2430_ops;
567 545
568 platform_set_drvdata(pdev, glue); 546 platform_set_drvdata(pdev, glue);
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index 8ef656659fcb..1b5e83a9840e 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -49,13 +49,4 @@
49#define OTG_FORCESTDBY 0x414 49#define OTG_FORCESTDBY 0x414
50# define ENABLEFORCE (1 << 0) 50# define ENABLEFORCE (1 << 0)
51 51
52/*
53 * Control Module bit definitions
54 * XXX: Will be removed once we have a driver for control module.
55 */
56#define AVALID BIT(0)
57#define BVALID BIT(1)
58#define VBUSVALID BIT(2)
59#define SESSEND BIT(3)
60#define IDDIG BIT(4)
61#endif /* __MUSB_OMAP243X_H__ */ 52#endif /* __MUSB_OMAP243X_H__ */
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 053696a2b6ef..f989511f13da 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -8,6 +8,7 @@ config OMAP_USB2
8 tristate "OMAP USB2 PHY Driver" 8 tristate "OMAP USB2 PHY Driver"
9 depends on ARCH_OMAP2PLUS 9 depends on ARCH_OMAP2PLUS
10 select USB_OTG_UTILS 10 select USB_OTG_UTILS
11 select OMAP_CONTROL_USB
11 help 12 help
12 Enable this to support the transceiver that is part of SOC. This 13 Enable this to support the transceiver that is part of SOC. This
13 driver takes care of all the PHY functionality apart from comparator. 14 driver takes care of all the PHY functionality apart from comparator.
diff --git a/drivers/usb/phy/omap-usb2.c b/drivers/usb/phy/omap-usb2.c
index 26ae8f49225c..c2b4c8e6f3c6 100644
--- a/drivers/usb/phy/omap-usb2.c
+++ b/drivers/usb/phy/omap-usb2.c
@@ -27,6 +27,7 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/usb/omap_control_usb.h>
30 31
31/** 32/**
32 * omap_usb2_set_comparator - links the comparator present in the sytem with 33 * omap_usb2_set_comparator - links the comparator present in the sytem with
@@ -52,29 +53,6 @@ int omap_usb2_set_comparator(struct phy_companion *comparator)
52} 53}
53EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); 54EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
54 55
55/**
56 * omap_usb_phy_power - power on/off the phy using control module reg
57 * @phy: struct omap_usb *
58 * @on: 0 or 1, based on powering on or off the PHY
59 *
60 * XXX: Remove this function once control module driver gets merged
61 */
62static void omap_usb_phy_power(struct omap_usb *phy, int on)
63{
64 u32 val;
65
66 if (on) {
67 val = readl(phy->control_dev);
68 if (val & PHY_PD) {
69 writel(~PHY_PD, phy->control_dev);
70 /* XXX: add proper documentation for this delay */
71 mdelay(200);
72 }
73 } else {
74 writel(PHY_PD, phy->control_dev);
75 }
76}
77
78static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) 56static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
79{ 57{
80 struct omap_usb *phy = phy_to_omapusb(otg->phy); 58 struct omap_usb *phy = phy_to_omapusb(otg->phy);
@@ -124,7 +102,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
124 struct omap_usb *phy = phy_to_omapusb(x); 102 struct omap_usb *phy = phy_to_omapusb(x);
125 103
126 if (suspend && !phy->is_suspended) { 104 if (suspend && !phy->is_suspended) {
127 omap_usb_phy_power(phy, 0); 105 omap_control_usb_phy_power(phy->control_dev, 0);
128 pm_runtime_put_sync(phy->dev); 106 pm_runtime_put_sync(phy->dev);
129 phy->is_suspended = 1; 107 phy->is_suspended = 1;
130 } else if (!suspend && phy->is_suspended) { 108 } else if (!suspend && phy->is_suspended) {
@@ -134,7 +112,7 @@ static int omap_usb2_suspend(struct usb_phy *x, int suspend)
134 ret); 112 ret);
135 return ret; 113 return ret;
136 } 114 }
137 omap_usb_phy_power(phy, 1); 115 omap_control_usb_phy_power(phy->control_dev, 1);
138 phy->is_suspended = 0; 116 phy->is_suspended = 0;
139 } 117 }
140 118
@@ -145,7 +123,6 @@ static int omap_usb2_probe(struct platform_device *pdev)
145{ 123{
146 struct omap_usb *phy; 124 struct omap_usb *phy;
147 struct usb_otg *otg; 125 struct usb_otg *otg;
148 struct resource *res;
149 126
150 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); 127 phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
151 if (!phy) { 128 if (!phy) {
@@ -166,16 +143,14 @@ static int omap_usb2_probe(struct platform_device *pdev)
166 phy->phy.set_suspend = omap_usb2_suspend; 143 phy->phy.set_suspend = omap_usb2_suspend;
167 phy->phy.otg = otg; 144 phy->phy.otg = otg;
168 145
169 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 146 phy->control_dev = omap_get_control_dev();
170 147 if (IS_ERR(phy->control_dev)) {
171 phy->control_dev = devm_request_and_ioremap(&pdev->dev, res); 148 dev_dbg(&pdev->dev, "Failed to get control device\n");
172 if (phy->control_dev == NULL) { 149 return -ENODEV;
173 dev_err(&pdev->dev, "Failed to obtain io memory\n");
174 return -ENXIO;
175 } 150 }
176 151
177 phy->is_suspended = 1; 152 phy->is_suspended = 1;
178 omap_usb_phy_power(phy, 0); 153 omap_control_usb_phy_power(phy->control_dev, 0);
179 154
180 otg->set_host = omap_usb_set_host; 155 otg->set_host = omap_usb_set_host;
181 otg->set_peripheral = omap_usb_set_peripheral; 156 otg->set_peripheral = omap_usb_set_peripheral;
diff --git a/include/linux/usb/omap_usb.h b/include/linux/usb/omap_usb.h
index 0ea17f8ae820..3db9b5316b10 100644
--- a/include/linux/usb/omap_usb.h
+++ b/include/linux/usb/omap_usb.h
@@ -25,13 +25,11 @@ struct omap_usb {
25 struct usb_phy phy; 25 struct usb_phy phy;
26 struct phy_companion *comparator; 26 struct phy_companion *comparator;
27 struct device *dev; 27 struct device *dev;
28 u32 __iomem *control_dev; 28 struct device *control_dev;
29 struct clk *wkupclk; 29 struct clk *wkupclk;
30 u8 is_suspended:1; 30 u8 is_suspended:1;
31}; 31};
32 32
33#define PHY_PD 0x1
34
35#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy) 33#define phy_to_omapusb(x) container_of((x), struct omap_usb, phy)
36 34
37#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE) 35#if defined(CONFIG_OMAP_USB2) || defined(CONFIG_OMAP_USB2_MODULE)