aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy/phy-tahvo.c
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-10-30 13:41:13 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:01:25 -0500
commite47d92545c2972bcf3711e7db80f481e402163c7 (patch)
treea84db324fbd565aaa371bc0ef5677456541877e3 /drivers/usb/phy/phy-tahvo.c
parenta2655e4a8edb66d21b0967940172e83a51d30ef3 (diff)
usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. [ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c, phy-isp1301-omap, and chipidea's debug.c ] Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy/phy-tahvo.c')
-rw-r--r--drivers/usb/phy/phy-tahvo.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index cc61ee44b911..04ece535c2f8 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -81,33 +81,33 @@ static void check_vbus_state(struct tahvo_usb *tu)
81 81
82 reg = retu_read(rdev, TAHVO_REG_IDSR); 82 reg = retu_read(rdev, TAHVO_REG_IDSR);
83 if (reg & TAHVO_STAT_VBUS) { 83 if (reg & TAHVO_STAT_VBUS) {
84 switch (tu->phy.state) { 84 switch (tu->phy.otg->state) {
85 case OTG_STATE_B_IDLE: 85 case OTG_STATE_B_IDLE:
86 /* Enable the gadget driver */ 86 /* Enable the gadget driver */
87 if (tu->phy.otg->gadget) 87 if (tu->phy.otg->gadget)
88 usb_gadget_vbus_connect(tu->phy.otg->gadget); 88 usb_gadget_vbus_connect(tu->phy.otg->gadget);
89 tu->phy.state = OTG_STATE_B_PERIPHERAL; 89 tu->phy.otg->state = OTG_STATE_B_PERIPHERAL;
90 break; 90 break;
91 case OTG_STATE_A_IDLE: 91 case OTG_STATE_A_IDLE:
92 /* 92 /*
93 * Session is now valid assuming the USB hub is driving 93 * Session is now valid assuming the USB hub is driving
94 * Vbus. 94 * Vbus.
95 */ 95 */
96 tu->phy.state = OTG_STATE_A_HOST; 96 tu->phy.otg->state = OTG_STATE_A_HOST;
97 break; 97 break;
98 default: 98 default:
99 break; 99 break;
100 } 100 }
101 dev_info(&tu->pt_dev->dev, "USB cable connected\n"); 101 dev_info(&tu->pt_dev->dev, "USB cable connected\n");
102 } else { 102 } else {
103 switch (tu->phy.state) { 103 switch (tu->phy.otg->state) {
104 case OTG_STATE_B_PERIPHERAL: 104 case OTG_STATE_B_PERIPHERAL:
105 if (tu->phy.otg->gadget) 105 if (tu->phy.otg->gadget)
106 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); 106 usb_gadget_vbus_disconnect(tu->phy.otg->gadget);
107 tu->phy.state = OTG_STATE_B_IDLE; 107 tu->phy.otg->state = OTG_STATE_B_IDLE;
108 break; 108 break;
109 case OTG_STATE_A_HOST: 109 case OTG_STATE_A_HOST:
110 tu->phy.state = OTG_STATE_A_IDLE; 110 tu->phy.otg->state = OTG_STATE_A_IDLE;
111 break; 111 break;
112 default: 112 default:
113 break; 113 break;
@@ -132,14 +132,14 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu)
132 /* Power up the transceiver in USB host mode */ 132 /* Power up the transceiver in USB host mode */
133 retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND | 133 retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
134 USBR_MASTER_SW2 | USBR_MASTER_SW1); 134 USBR_MASTER_SW2 | USBR_MASTER_SW1);
135 tu->phy.state = OTG_STATE_A_IDLE; 135 tu->phy.otg->state = OTG_STATE_A_IDLE;
136 136
137 check_vbus_state(tu); 137 check_vbus_state(tu);
138} 138}
139 139
140static void tahvo_usb_stop_host(struct tahvo_usb *tu) 140static void tahvo_usb_stop_host(struct tahvo_usb *tu)
141{ 141{
142 tu->phy.state = OTG_STATE_A_IDLE; 142 tu->phy.otg->state = OTG_STATE_A_IDLE;
143} 143}
144 144
145static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) 145static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
@@ -151,7 +151,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
151 /* Power up transceiver and set it in USB peripheral mode */ 151 /* Power up transceiver and set it in USB peripheral mode */
152 retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | 152 retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT |
153 USBR_NSUSPEND | USBR_SLAVE_SW); 153 USBR_NSUSPEND | USBR_SLAVE_SW);
154 tu->phy.state = OTG_STATE_B_IDLE; 154 tu->phy.otg->state = OTG_STATE_B_IDLE;
155 155
156 check_vbus_state(tu); 156 check_vbus_state(tu);
157} 157}
@@ -160,7 +160,7 @@ static void tahvo_usb_stop_peripheral(struct tahvo_usb *tu)
160{ 160{
161 if (tu->phy.otg->gadget) 161 if (tu->phy.otg->gadget)
162 usb_gadget_vbus_disconnect(tu->phy.otg->gadget); 162 usb_gadget_vbus_disconnect(tu->phy.otg->gadget);
163 tu->phy.state = OTG_STATE_B_IDLE; 163 tu->phy.otg->state = OTG_STATE_B_IDLE;
164} 164}
165 165
166static void tahvo_usb_power_off(struct tahvo_usb *tu) 166static void tahvo_usb_power_off(struct tahvo_usb *tu)
@@ -173,7 +173,7 @@ static void tahvo_usb_power_off(struct tahvo_usb *tu)
173 173
174 /* Power off transceiver */ 174 /* Power off transceiver */
175 retu_write(rdev, TAHVO_REG_USBR, 0); 175 retu_write(rdev, TAHVO_REG_USBR, 0);
176 tu->phy.state = OTG_STATE_UNDEFINED; 176 tu->phy.otg->state = OTG_STATE_UNDEFINED;
177} 177}
178 178
179static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend) 179static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend)
@@ -379,7 +379,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
379 /* Create OTG interface */ 379 /* Create OTG interface */
380 tahvo_usb_power_off(tu); 380 tahvo_usb_power_off(tu);
381 tu->phy.dev = &pdev->dev; 381 tu->phy.dev = &pdev->dev;
382 tu->phy.state = OTG_STATE_UNDEFINED; 382 tu->phy.otg->state = OTG_STATE_UNDEFINED;
383 tu->phy.label = DRIVER_NAME; 383 tu->phy.label = DRIVER_NAME;
384 tu->phy.set_suspend = tahvo_usb_set_suspend; 384 tu->phy.set_suspend = tahvo_usb_set_suspend;
385 385