aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/mod_host.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-12-08 21:30:23 -0500
committerFelipe Balbi <balbi@ti.com>2011-12-13 06:06:28 -0500
commitb1930da08872f6e17b8cdca60ee9c7321a8b5b8c (patch)
tree895a62a92958dcfaae8ed51aec789559c890a334 /drivers/usb/renesas_usbhs/mod_host.c
parent31e00fd116cab296da2d12bc0b82a30a9fbdd681 (diff)
usb: renesas_usbhs: add usbhsh_is_running()
It is possible to judge whether renesas_usbhs driver is running, by checking attch irq mask. This patch adds usbhsh_is_running() to check it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs/mod_host.c')
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index c947d0aca9bf..28b2cb3a029a 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -191,6 +191,21 @@ static void usbhsh_ureq_free(struct usbhsh_hpriv *hpriv,
191} 191}
192 192
193/* 193/*
194 * status
195 */
196static int usbhsh_is_running(struct usbhsh_hpriv *hpriv)
197{
198 /*
199 * we can decide some device is attached or not
200 * by checking mod.irq_attch
201 * see
202 * usbhsh_irq_attch()
203 * usbhsh_irq_dtch()
204 */
205 return (hpriv->mod.irq_attch == NULL);
206}
207
208/*
194 * pipe control 209 * pipe control
195 */ 210 */
196static void usbhsh_endpoint_sequence_save(struct usbhsh_hpriv *hpriv, 211static void usbhsh_endpoint_sequence_save(struct usbhsh_hpriv *hpriv,
@@ -900,6 +915,11 @@ static int usbhsh_urb_enqueue(struct usb_hcd *hcd,
900 915
901 dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out"); 916 dev_dbg(dev, "%s (%s)\n", __func__, is_dir_in ? "in" : "out");
902 917
918 if (!usbhsh_is_running(hpriv)) {
919 ret = -EIO;
920 goto usbhsh_urb_enqueue_error_not_linked;
921 }
922
903 ret = usb_hcd_link_urb_to_ep(hcd, urb); 923 ret = usb_hcd_link_urb_to_ep(hcd, urb);
904 if (ret) 924 if (ret)
905 goto usbhsh_urb_enqueue_error_not_linked; 925 goto usbhsh_urb_enqueue_error_not_linked;
@@ -1249,6 +1269,12 @@ static int usbhsh_irq_attch(struct usbhs_priv *priv,
1249 * attch interrupt might happen infinitely on some device 1269 * attch interrupt might happen infinitely on some device
1250 * (on self power USB hub ?) 1270 * (on self power USB hub ?)
1251 * disable it here. 1271 * disable it here.
1272 *
1273 * usbhsh_is_running() becomes effective
1274 * according to this process.
1275 * see
1276 * usbhsh_is_running()
1277 * usbhsh_urb_enqueue()
1252 */ 1278 */
1253 hpriv->mod.irq_attch = NULL; 1279 hpriv->mod.irq_attch = NULL;
1254 usbhs_irq_callback_update(priv, &hpriv->mod); 1280 usbhs_irq_callback_update(priv, &hpriv->mod);
@@ -1269,6 +1295,12 @@ static int usbhsh_irq_dtch(struct usbhs_priv *priv,
1269 1295
1270 /* 1296 /*
1271 * enable attch interrupt again 1297 * enable attch interrupt again
1298 *
1299 * usbhsh_is_running() becomes invalid
1300 * according to this process.
1301 * see
1302 * usbhsh_is_running()
1303 * usbhsh_urb_enqueue()
1272 */ 1304 */
1273 hpriv->mod.irq_attch = usbhsh_irq_attch; 1305 hpriv->mod.irq_attch = usbhsh_irq_attch;
1274 usbhs_irq_callback_update(priv, &hpriv->mod); 1306 usbhs_irq_callback_update(priv, &hpriv->mod);