diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-06-06 01:18:54 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-07 12:10:10 -0400 |
commit | 0432eed008024e0e90f16207ab406ac6ec877cac (patch) | |
tree | 0bcd9d1f7177b428c1d422d98335ac7e099d5edb | |
parent | d77e3f4e1743834c7b4acb54004ffd7f57c82582 (diff) |
usb: renesas_usbhs: tifyup packet start timing
packet transfer timing are controlled in mod_gadget on current renesas_usbhs,
and this style will be imitated on mod_host.
But it need not be managed with host/gadget if it is general transfer.
By this patch, the packet transfer timing is managed in fifo.c
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 6 | ||||
-rw-r--r-- | drivers/usb/renesas_usbhs/mod_gadget.c | 22 |
2 files changed, 11 insertions, 17 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 8852423313a3..0efee5fc034b 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c | |||
@@ -74,6 +74,8 @@ void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt, | |||
74 | 74 | ||
75 | usbhs_unlock(priv, flags); | 75 | usbhs_unlock(priv, flags); |
76 | /******************** spin unlock ******************/ | 76 | /******************** spin unlock ******************/ |
77 | |||
78 | usbhs_pkt_start(pipe); | ||
77 | } | 79 | } |
78 | 80 | ||
79 | static void __usbhsf_pkt_del(struct usbhs_pkt *pkt) | 81 | static void __usbhsf_pkt_del(struct usbhs_pkt *pkt) |
@@ -148,8 +150,10 @@ __usbhs_pkt_handler_end: | |||
148 | usbhs_unlock(priv, flags); | 150 | usbhs_unlock(priv, flags); |
149 | /******************** spin unlock ******************/ | 151 | /******************** spin unlock ******************/ |
150 | 152 | ||
151 | if (is_done) | 153 | if (is_done) { |
152 | info->done(pkt); | 154 | info->done(pkt); |
155 | usbhs_pkt_start(pipe); | ||
156 | } | ||
153 | 157 | ||
154 | return ret; | 158 | return ret; |
155 | } | 159 | } |
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c index b5a5ba7efb5e..3c582482ec44 100644 --- a/drivers/usb/renesas_usbhs/mod_gadget.c +++ b/drivers/usb/renesas_usbhs/mod_gadget.c | |||
@@ -125,23 +125,16 @@ static void usbhsg_queue_push(struct usbhsg_uep *uep, | |||
125 | struct usbhs_pkt *pkt = usbhsg_ureq_to_pkt(ureq); | 125 | struct usbhs_pkt *pkt = usbhsg_ureq_to_pkt(ureq); |
126 | struct usb_request *req = &ureq->req; | 126 | struct usb_request *req = &ureq->req; |
127 | 127 | ||
128 | usbhs_pkt_push(pipe, pkt, uep->handler, | ||
129 | req->buf, req->length, req->zero); | ||
130 | req->actual = 0; | 128 | req->actual = 0; |
131 | req->status = -EINPROGRESS; | 129 | req->status = -EINPROGRESS; |
130 | usbhs_pkt_push(pipe, pkt, uep->handler, | ||
131 | req->buf, req->length, req->zero); | ||
132 | 132 | ||
133 | dev_dbg(dev, "pipe %d : queue push (%d)\n", | 133 | dev_dbg(dev, "pipe %d : queue push (%d)\n", |
134 | usbhs_pipe_number(pipe), | 134 | usbhs_pipe_number(pipe), |
135 | req->length); | 135 | req->length); |
136 | } | 136 | } |
137 | 137 | ||
138 | static void usbhsg_queue_start(struct usbhsg_uep *uep) | ||
139 | { | ||
140 | struct usbhs_pipe *pipe = usbhsg_uep_to_pipe(uep); | ||
141 | |||
142 | usbhs_pkt_start(pipe); | ||
143 | } | ||
144 | |||
145 | static void usbhsg_queue_pop(struct usbhsg_uep *uep, | 138 | static void usbhsg_queue_pop(struct usbhsg_uep *uep, |
146 | struct usbhsg_request *ureq, | 139 | struct usbhsg_request *ureq, |
147 | int status) | 140 | int status) |
@@ -154,10 +147,6 @@ static void usbhsg_queue_pop(struct usbhsg_uep *uep, | |||
154 | 147 | ||
155 | ureq->req.status = status; | 148 | ureq->req.status = status; |
156 | ureq->req.complete(&uep->ep, &ureq->req); | 149 | ureq->req.complete(&uep->ep, &ureq->req); |
157 | |||
158 | /* more request ? */ | ||
159 | if (0 == status) | ||
160 | usbhsg_queue_start(uep); | ||
161 | } | 150 | } |
162 | 151 | ||
163 | static void usbhsg_queue_done(struct usbhs_pkt *pkt) | 152 | static void usbhsg_queue_done(struct usbhs_pkt *pkt) |
@@ -222,6 +211,7 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv, | |||
222 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); | 211 | struct usbhsg_gpriv *gpriv = usbhsg_priv_to_gpriv(priv); |
223 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); | 212 | struct device *dev = usbhsg_gpriv_to_dev(gpriv); |
224 | struct usbhsg_uep *uep; | 213 | struct usbhsg_uep *uep; |
214 | struct usbhs_pipe *pipe; | ||
225 | int recip = ctrl->bRequestType & USB_RECIP_MASK; | 215 | int recip = ctrl->bRequestType & USB_RECIP_MASK; |
226 | int nth = le16_to_cpu(ctrl->wIndex) & USB_ENDPOINT_NUMBER_MASK; | 216 | int nth = le16_to_cpu(ctrl->wIndex) & USB_ENDPOINT_NUMBER_MASK; |
227 | int ret; | 217 | int ret; |
@@ -230,7 +220,8 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv, | |||
230 | char *msg; | 220 | char *msg; |
231 | 221 | ||
232 | uep = usbhsg_gpriv_to_nth_uep(gpriv, nth); | 222 | uep = usbhsg_gpriv_to_nth_uep(gpriv, nth); |
233 | if (!usbhsg_uep_to_pipe(uep)) { | 223 | pipe = usbhsg_uep_to_pipe(uep); |
224 | if (!pipe) { | ||
234 | dev_err(dev, "wrong recip request\n"); | 225 | dev_err(dev, "wrong recip request\n"); |
235 | ret = -EINVAL; | 226 | ret = -EINVAL; |
236 | goto usbhsg_recip_run_handle_end; | 227 | goto usbhsg_recip_run_handle_end; |
@@ -268,7 +259,7 @@ static int usbhsg_recip_run_handle(struct usbhs_priv *priv, | |||
268 | } | 259 | } |
269 | 260 | ||
270 | usbhsg_recip_run_handle_end: | 261 | usbhsg_recip_run_handle_end: |
271 | usbhsg_queue_start(uep); | 262 | usbhs_pkt_start(pipe); |
272 | 263 | ||
273 | return ret; | 264 | return ret; |
274 | } | 265 | } |
@@ -470,7 +461,6 @@ static int usbhsg_ep_queue(struct usb_ep *ep, struct usb_request *req, | |||
470 | return -ESHUTDOWN; | 461 | return -ESHUTDOWN; |
471 | 462 | ||
472 | usbhsg_queue_push(uep, ureq); | 463 | usbhsg_queue_push(uep, ureq); |
473 | usbhsg_queue_start(uep); | ||
474 | 464 | ||
475 | return 0; | 465 | return 0; |
476 | } | 466 | } |