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>
This commit is contained in:
parent
7fd097e727
commit
0c6ef985ce
@ -54,7 +54,6 @@ static struct usbhs_pkt_handle usbhsf_null_handler = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
||||||
struct usbhs_pkt_handle *handler,
|
|
||||||
void *buf, int len, int zero)
|
void *buf, int len, int zero)
|
||||||
{
|
{
|
||||||
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
|
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,
|
|||||||
/******************** spin lock ********************/
|
/******************** spin lock ********************/
|
||||||
usbhs_lock(priv, flags);
|
usbhs_lock(priv, flags);
|
||||||
|
|
||||||
if (!handler) {
|
if (!pipe->handler) {
|
||||||
dev_err(dev, "no handler function\n");
|
dev_err(dev, "no handler function\n");
|
||||||
handler = &usbhsf_null_handler;
|
pipe->handler = &usbhsf_null_handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_del_init(&pkt->node);
|
list_del_init(&pkt->node);
|
||||||
list_add_tail(&pkt->node, &pipe->list);
|
list_add_tail(&pkt->node, &pipe->list);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* each pkt must hold own handler.
|
||||||
|
* because handler might be changed by its situation.
|
||||||
|
* dma handler -> pio handler.
|
||||||
|
*/
|
||||||
pkt->pipe = pipe;
|
pkt->pipe = pipe;
|
||||||
pkt->buf = buf;
|
pkt->buf = buf;
|
||||||
pkt->handler = handler;
|
pkt->handler = pipe->handler;
|
||||||
pkt->length = len;
|
pkt->length = len;
|
||||||
pkt->zero = zero;
|
pkt->zero = zero;
|
||||||
pkt->actual = 0;
|
pkt->actual = 0;
|
||||||
|
@ -86,7 +86,6 @@ extern struct usbhs_pkt_handle usbhs_fifo_dma_pop_handler;
|
|||||||
|
|
||||||
void usbhs_pkt_init(struct usbhs_pkt *pkt);
|
void usbhs_pkt_init(struct usbhs_pkt *pkt);
|
||||||
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
void usbhs_pkt_push(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt,
|
||||||
struct usbhs_pkt_handle *handler,
|
|
||||||
void *buf, int len, int zero);
|
void *buf, int len, int zero);
|
||||||
struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt);
|
struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt);
|
||||||
void usbhs_pkt_start(struct usbhs_pipe *pipe);
|
void usbhs_pkt_start(struct usbhs_pipe *pipe);
|
||||||
|
@ -39,7 +39,6 @@ struct usbhsg_uep {
|
|||||||
char ep_name[EP_NAME_SIZE];
|
char ep_name[EP_NAME_SIZE];
|
||||||
|
|
||||||
struct usbhsg_gpriv *gpriv;
|
struct usbhsg_gpriv *gpriv;
|
||||||
struct usbhs_pkt_handle *handler;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct usbhsg_gpriv {
|
struct usbhsg_gpriv {
|
||||||
@ -139,8 +138,7 @@ static void usbhsg_queue_push(struct usbhsg_uep *uep,
|
|||||||
|
|
||||||
req->actual = 0;
|
req->actual = 0;
|
||||||
req->status = -EINPROGRESS;
|
req->status = -EINPROGRESS;
|
||||||
usbhs_pkt_push(pipe, pkt, uep->handler,
|
usbhs_pkt_push(pipe, pkt, req->buf, req->length, req->zero);
|
||||||
req->buf, req->length, req->zero);
|
|
||||||
|
|
||||||
dev_dbg(dev, "pipe %d : queue push (%d)\n",
|
dev_dbg(dev, "pipe %d : queue push (%d)\n",
|
||||||
usbhs_pipe_number(pipe),
|
usbhs_pipe_number(pipe),
|
||||||
@ -389,13 +387,13 @@ static int usbhsg_irq_ctrl_stage(struct usbhs_priv *priv,
|
|||||||
|
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case READ_DATA_STAGE:
|
case READ_DATA_STAGE:
|
||||||
dcp->handler = &usbhs_fifo_pio_push_handler;
|
pipe->handler = &usbhs_fifo_pio_push_handler;
|
||||||
break;
|
break;
|
||||||
case WRITE_DATA_STAGE:
|
case WRITE_DATA_STAGE:
|
||||||
dcp->handler = &usbhs_fifo_pio_pop_handler;
|
pipe->handler = &usbhs_fifo_pio_pop_handler;
|
||||||
break;
|
break;
|
||||||
case NODATA_STATUS_STAGE:
|
case NODATA_STATUS_STAGE:
|
||||||
dcp->handler = &usbhs_ctrl_stage_end_handler;
|
pipe->handler = &usbhs_ctrl_stage_end_handler;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return ret;
|
return ret;
|
||||||
@ -501,9 +499,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep,
|
|||||||
* It will use pio handler if impossible.
|
* It will use pio handler if impossible.
|
||||||
*/
|
*/
|
||||||
if (usb_endpoint_dir_in(desc))
|
if (usb_endpoint_dir_in(desc))
|
||||||
uep->handler = &usbhs_fifo_dma_push_handler;
|
pipe->handler = &usbhs_fifo_dma_push_handler;
|
||||||
else
|
else
|
||||||
uep->handler = &usbhs_fifo_dma_pop_handler;
|
pipe->handler = &usbhs_fifo_dma_pop_handler;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ struct usbhs_pipe {
|
|||||||
#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1)
|
#define USBHS_PIPE_FLAGS_IS_DIR_IN (1 << 1)
|
||||||
#define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2)
|
#define USBHS_PIPE_FLAGS_IS_DIR_HOST (1 << 2)
|
||||||
|
|
||||||
|
struct usbhs_pkt_handle *handler;
|
||||||
|
|
||||||
void *mod_private;
|
void *mod_private;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user