All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: mtu3: flush cache for next GPD
@ 2021-03-03  8:07 Chunfeng Yun
  2021-03-03 10:58 ` Marek Vasut
  0 siblings, 1 reply; 2+ messages in thread
From: Chunfeng Yun @ 2021-03-03  8:07 UTC (permalink / raw)
  To: u-boot

When flush cache of the current GPD and resume QMU, the controller
will try to access the next GPD after processing the current one,
if not flush the next GPD, the controller may get wrong GPD status.

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/mtu3/mtu3_qmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/mtu3/mtu3_qmu.c b/drivers/usb/mtu3/mtu3_qmu.c
index 801c2bc416..95eaf6d236 100644
--- a/drivers/usb/mtu3/mtu3_qmu.c
+++ b/drivers/usb/mtu3/mtu3_qmu.c
@@ -198,6 +198,7 @@ static int mtu3_prepare_tx_gpd(struct mtu3_ep *mep, struct mtu3_request *mreq)
 
 	enq->flag &= ~GPD_FLAGS_HWO;
 	gpd->next_gpd = cpu_to_le32((u32)gpd_virt_to_dma(ring, enq));
+	mtu3_flush_cache((uintptr_t)enq, sizeof(*gpd));
 
 	if (req->zero)
 		gpd->ext_flag |= GPD_EXT_FLAG_ZLP;
@@ -234,6 +235,8 @@ static int mtu3_prepare_rx_gpd(struct mtu3_ep *mep, struct mtu3_request *mreq)
 
 	enq->flag &= ~GPD_FLAGS_HWO;
 	gpd->next_gpd = cpu_to_le32((u32)gpd_virt_to_dma(ring, enq));
+	mtu3_flush_cache((uintptr_t)enq, sizeof(*gpd));
+
 	gpd->flag |= GPD_FLAGS_IOC | GPD_FLAGS_HWO;
 
 	mreq->gpd = gpd;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] usb: mtu3: flush cache for next GPD
  2021-03-03  8:07 [PATCH] usb: mtu3: flush cache for next GPD Chunfeng Yun
@ 2021-03-03 10:58 ` Marek Vasut
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut @ 2021-03-03 10:58 UTC (permalink / raw)
  To: u-boot

On 3/3/21 9:07 AM, Chunfeng Yun wrote:
> When flush cache of the current GPD and resume QMU, the controller
> will try to access the next GPD after processing the current one,
> if not flush the next GPD, the controller may get wrong GPD status.

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-03 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  8:07 [PATCH] usb: mtu3: flush cache for next GPD Chunfeng Yun
2021-03-03 10:58 ` Marek Vasut

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.