aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:00:59 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:36 -0400
commit0c6ef985ced753b60ecdc091fa49c3f5fa4a4f79 (patch)
treedac1c56511cb1e9455eec22320114d69d8df3c33 /drivers/usb
parent7fd097e727466cda1b22beca6cb11096b8be88d2 (diff)
usb: gadget: renesas_usbhs: struct usbhs_pipe hold handler
packet handler had moved to struct usbhs_pipe from struct usbhsg_uep. it is preparation of mod_host support Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c12
-rw-r--r--drivers/usb/renesas_usbhs/fifo.h1
-rw-r--r--drivers/usb/renesas_usbhs/mod_gadget.c14
-rw-r--r--drivers/usb/renesas_usbhs/pipe.h2
4 files changed, 16 insertions, 13 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 7eacacda8589..328238c373f6 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -54,7 +54,6 @@ static struct usbhs_pkt_handle usbhsf_null_handler = {
54}; 54};
55 55
56void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt, 56void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
57 struct usbhs_pkt_handle *handler,
58 void *buf, int len, int zero) 57 void *buf, int len, int zero)
59{ 58{
60 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); 59 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
@@ -64,17 +63,22 @@ void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
64 /******************** spin lock ********************/ 63 /******************** spin lock ********************/
65 usbhs_lock(priv, flags); 64 usbhs_lock(priv, flags);
66 65
67 if (!handler) { 66 if (!pipe->handler) {
68 dev_err(dev, "no handler function\n"); 67 dev_err(dev, "no handler function\n");
69 handler = &usbhsf_null_handler; 68 pipe->handler = &usbhsf_null_handler;
70 } 69 }
71 70
72 list_del_init(&pkt->node); 71 list_del_init(&pkt->node);
73 list_add_tail(&pkt->node, &pipe->list); 72 list_add_tail(&pkt->node, &pipe->list);
74 73
74 /*
75 * each pkt must hold own handler.
76 * because handler might be changed by its situation.
77 * dma handler -> pio handler.
78 */
75 pkt->pipe = pipe; 79 pkt->pipe = pipe;
76 pkt->buf = buf; 80 pkt->buf = buf;
77 pkt->handler = handler; 81 pkt->handler = pipe->handler;
78 pkt->length = len; 82 pkt->length = len;
79 pkt->zero = zero; 83 pkt->zero = zero;
80 pkt->actual = 0; 84 pkt->actual = 0;
diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h
index 7a78440e7647..60aa20fd303e 100644
--- a/drivers/usb/renesas_usbhs/fifo.h
+++ b/drivers/usb/renesas_usbhs/fifo.h
@@ -86,7 +86,6 @@ extern struct usbhs_pkt_handle usbhs_fifo_dma_pop_handler;
86 86
87void usbhs_pkt_init(struct usbhs_pkt *pkt); 87void usbhs_pkt_init(struct usbhs_pkt *pkt);
88void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt, 88void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
89 struct usbhs_pkt_handle *handler,
90 void *buf, int len, int zero); 89 void *buf, int len, int zero);
91struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt); 90struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt);
92void usbhs_pkt_start(struct usbhs_pipe *pipe); 91void usbhs_pkt_start(struct usbhs_pipe *pipe);
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 5a697b76ff12..babd90c979c1 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -39,7 +39,6 @@ struct usbhsg_uep {
39 char ep_name[EP_NAME_SIZE]; 39 char ep_name[EP_NAME_SIZE];
40 40
41 struct usbhsg_gpriv *gpriv; 41 struct usbhsg_gpriv *gpriv;
42 struct usbhs_pkt_handle *handler;
43}; 42};
44 43
45struct usbhsg_gpriv { 44struct usbhsg_gpriv {
@@ -139,8 +138,7 @@ static void usbhsg_queue_push(struct usbhsg_uep *uep,
139 138
140 req->actual = 0; 139 req->actual = 0;
141 req->status = -EINPROGRESS; 140 req->status = -EINPROGRESS;
142 usbhs_pkt_push(pipe, pkt, uep->handler, 141 usbhs_pkt_push(pipe, pkt, req->buf, req->length, req->zero);
143 req->buf, req->length, req->zero);
144 142
145 dev_dbg(dev, "pipe %d : queue push (%d)\n", 143 dev_dbg(dev, "pipe %d : queue push (%d)\n",
146 usbhs_pipe_number(pipe), 144 usbhs_pipe_number(pipe),
@@ -389,13 +387,13 @@ static int usbhsg_irq_ctrl_stage(struct usbhs_priv *priv,
389 387
390 switch (stage) { 388 switch (stage) {
391 case READ_DATA_STAGE: 389 case READ_DATA_STAGE:
392 dcp->handler = &usbhs_fifo_pio_push_handler; 390 pipe->handler = &usbhs_fifo_pio_push_handler;
393 break; 391 break;
394 case WRITE_DATA_STAGE: 392 case WRITE_DATA_STAGE:
395 dcp->handler = &usbhs_fifo_pio_pop_handler; 393 pipe->handler = &usbhs_fifo_pio_pop_handler;
396 break; 394 break;
397 case NODATA_STATUS_STAGE: 395 case NODATA_STATUS_STAGE:
398 dcp->handler = &usbhs_ctrl_stage_end_handler; 396 pipe->handler = &usbhs_ctrl_stage_end_handler;
399 break; 397 break;
400 default: 398 default:
401 return ret; 399 return ret;
@@ -501,9 +499,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
501 * It will use pio handler if impossible. 499 * It will use pio handler if impossible.
502 */ 500 */
503 if (usb_endpoint_dir_in(desc)) 501 if (usb_endpoint_dir_in(desc))
504 uep->handler = &usbhs_fifo_dma_push_handler; 502 pipe->handler = &usbhs_fifo_dma_push_handler;
505 else 503 else
506 uep->handler = &usbhs_fifo_dma_pop_handler; 504 pipe->handler = &usbhs_fifo_dma_pop_handler;
507 505
508 ret = 0; 506 ret = 0;
509 } 507 }
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index 1baa1998c9a5..6760dff0b037 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -37,6 +37,8 @@ struct usbhs_pipe {
37#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1) 37#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1)
38#define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2) 38#define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2)
39 39
40 struct usbhs_pkt_handle *handler;
41
40 void *mod_private; 42 void *mod_private;
41}; 43};
42 44