blob: 917e9fbe7fa590e967904e5482f8e6a8e7e9b64c [file] [log] [blame]
From ae709040337cd251060e70b73f2c7e97ab0c77d1 Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: Wed, 6 Dec 2017 17:18:32 +0900
Subject: [PATCH 0508/1795] usb: renesas_usbhs: add
usbhs_pipe_clear_without_sequence() function
This patch adds usbhs_pipe_clear_without_sequence() function.
The controller has the pipe buffer and the PIPEnCTR.ACLRM can clear
it completely. But, it's also clear the data sequence. So, the driver
needs to get the sequence before.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
(cherry picked from commit 8d8a0435d10225499ddc8ad36446773ddecaf484)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/usb/renesas_usbhs/pipe.c | 19 ++++++++++++++-----
drivers/usb/renesas_usbhs/pipe.h | 2 ++
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/renesas_usbhs/pipe.c b/drivers/usb/renesas_usbhs/pipe.c
index 093cd8e87335..9677e0e31475 100644
--- a/drivers/usb/renesas_usbhs/pipe.c
+++ b/drivers/usb/renesas_usbhs/pipe.c
@@ -590,10 +590,22 @@ void usbhs_pipe_clear(struct usbhs_pipe *pipe)
}
}
-void usbhs_pipe_config_change_bfre(struct usbhs_pipe *pipe, int enable)
+/* Should call usbhsp_pipe_select() before */
+void usbhs_pipe_clear_without_sequence(struct usbhs_pipe *pipe,
+ int needs_bfre, int bfre_enable)
{
int sequence;
+ usbhsp_pipe_select(pipe);
+ sequence = usbhs_pipe_get_data_sequence(pipe);
+ if (needs_bfre)
+ usbhsp_pipe_cfg_set(pipe, BFRE, bfre_enable ? BFRE : 0);
+ usbhs_pipe_clear(pipe);
+ usbhs_pipe_data_sequence(pipe, sequence);
+}
+
+void usbhs_pipe_config_change_bfre(struct usbhs_pipe *pipe, int enable)
+{
if (usbhs_pipe_is_dcp(pipe))
return;
@@ -602,10 +614,7 @@ void usbhs_pipe_config_change_bfre(struct usbhs_pipe *pipe, int enable)
if (!(enable ^ !!(usbhsp_pipe_cfg_get(pipe) & BFRE)))
return;
- sequence = usbhs_pipe_get_data_sequence(pipe);
- usbhsp_pipe_cfg_set(pipe, BFRE, enable ? BFRE : 0);
- usbhs_pipe_clear(pipe);
- usbhs_pipe_data_sequence(pipe, sequence);
+ usbhs_pipe_clear_without_sequence(pipe, 1, enable);
}
static struct usbhs_pipe *usbhsp_get_pipe(struct usbhs_priv *priv, u32 type)
diff --git a/drivers/usb/renesas_usbhs/pipe.h b/drivers/usb/renesas_usbhs/pipe.h
index d3d002244891..3080423e600c 100644
--- a/drivers/usb/renesas_usbhs/pipe.h
+++ b/drivers/usb/renesas_usbhs/pipe.h
@@ -80,6 +80,8 @@ void usbhs_pipe_init(struct usbhs_priv *priv,
struct usbhs_pkt *pkt, int map));
int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe);
void usbhs_pipe_clear(struct usbhs_pipe *pipe);
+void usbhs_pipe_clear_without_sequence(struct usbhs_pipe *pipe,
+ int needs_bfre, int bfre_enable);
int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe);
void usbhs_pipe_enable(struct usbhs_pipe *pipe);
void usbhs_pipe_disable(struct usbhs_pipe *pipe);
--
2.19.0