Commit cdeb7943 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Felipe Balbi

usb: renesas_usbhs: fix usbhs_pipe_clear() for DCP PIPE

Since the DCPCTR doesn't have the ACLRM bit, the usbus_pipe_clear()
should not call the usbhsp_pipectrl_set() with ACLRM.
So, this patch fixes this issue to add the usbhs_fifo_clear_dcp()
in fifo.c because the controller needs the CFIFO to clear the
the DCP PIPE.
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 4ef35b10
...@@ -1160,6 +1160,24 @@ static void usbhsf_dma_complete(void *arg) ...@@ -1160,6 +1160,24 @@ static void usbhsf_dma_complete(void *arg)
usbhs_pipe_number(pipe), ret); usbhs_pipe_number(pipe), ret);
} }
void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe)
{
struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv); /* CFIFO */
/* clear DCP FIFO of transmission */
if (usbhsf_fifo_select(pipe, fifo, 1) < 0)
return;
usbhsf_fifo_clear(pipe, fifo);
usbhsf_fifo_unselect(pipe, fifo);
/* clear DCP FIFO of reception */
if (usbhsf_fifo_select(pipe, fifo, 0) < 0)
return;
usbhsf_fifo_clear(pipe, fifo);
usbhsf_fifo_unselect(pipe, fifo);
}
/* /*
* fifo init * fifo init
*/ */
......
...@@ -74,6 +74,7 @@ int usbhs_fifo_probe(struct usbhs_priv *priv); ...@@ -74,6 +74,7 @@ int usbhs_fifo_probe(struct usbhs_priv *priv);
void usbhs_fifo_remove(struct usbhs_priv *priv); void usbhs_fifo_remove(struct usbhs_priv *priv);
void usbhs_fifo_init(struct usbhs_priv *priv); void usbhs_fifo_init(struct usbhs_priv *priv);
void usbhs_fifo_quit(struct usbhs_priv *priv); void usbhs_fifo_quit(struct usbhs_priv *priv);
void usbhs_fifo_clear_dcp(struct usbhs_pipe *pipe);
/* /*
* packet info * packet info
......
...@@ -782,9 +782,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status) ...@@ -782,9 +782,9 @@ static int usbhsg_try_start(struct usbhs_priv *priv, u32 status)
/* /*
* pipe initialize and enable DCP * pipe initialize and enable DCP
*/ */
usbhs_fifo_init(priv);
usbhs_pipe_init(priv, usbhs_pipe_init(priv,
usbhsg_dma_map_ctrl); usbhsg_dma_map_ctrl);
usbhs_fifo_init(priv);
/* dcp init instead of usbhsg_ep_enable() */ /* dcp init instead of usbhsg_ep_enable() */
dcp->pipe = usbhs_dcp_malloc(priv); dcp->pipe = usbhs_dcp_malloc(priv);
......
...@@ -1474,9 +1474,9 @@ static int usbhsh_start(struct usbhs_priv *priv) ...@@ -1474,9 +1474,9 @@ static int usbhsh_start(struct usbhs_priv *priv)
/* /*
* pipe initialize and enable DCP * pipe initialize and enable DCP
*/ */
usbhs_fifo_init(priv);
usbhs_pipe_init(priv, usbhs_pipe_init(priv,
usbhsh_dma_map_ctrl); usbhsh_dma_map_ctrl);
usbhs_fifo_init(priv);
usbhsh_pipe_init_for_host(priv); usbhsh_pipe_init_for_host(priv);
/* /*
......
...@@ -618,8 +618,12 @@ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) ...@@ -618,8 +618,12 @@ void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence)
void usbhs_pipe_clear(struct usbhs_pipe *pipe) void usbhs_pipe_clear(struct usbhs_pipe *pipe)
{ {
usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); if (usbhs_pipe_is_dcp(pipe)) {
usbhsp_pipectrl_set(pipe, ACLRM, 0); usbhs_fifo_clear_dcp(pipe);
} else {
usbhsp_pipectrl_set(pipe, ACLRM, ACLRM);
usbhsp_pipectrl_set(pipe, ACLRM, 0);
}
} }
static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type) static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment