summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddharth Vadapalli <s-vadapalli@ti.com>2024-09-30 15:04:07 +0530
committerTom Rini <trini@konsulko.com>2024-09-30 09:08:07 -0600
commit17da9795c115dcfac49338ea044fa9413f5d0763 (patch)
tree8fd7b5f193772f23971497e69f84cc74231ceb42
parent37c1cb8c88c38ba699d7cabf536bdd980c7f5475 (diff)
downloadu-boot-17da9795c115dcfac49338ea044fa9413f5d0763.tar.gz
u-boot-17da9795c115dcfac49338ea044fa9413f5d0763.tar.bz2
u-boot-17da9795c115dcfac49338ea044fa9413f5d0763.zip
usb: gadget: cdns3: Fix missing cache operations for non-zero Endpoints
Transfer initiation and completion for the non-zero Endpoints are handled by cdns3_ep_run_transfer() and cdns3_transfer_completed() respectively. Failing to flush the cache associated with the TRB Pool within cdns3_ep_run_transfer() results in the transfers never being initiated. Similarly, failing to invalidate the cache associated with the TRB pool within cdns3_transfer_completed() results in the transfers never being completed. Fix this. Fixes: 7e91f6ccdc84 ("usb: Add Cadence USB3 host and gadget driver") Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Marek Vasut <marex@denx.de>
-rw-r--r--drivers/usb/cdns3/gadget.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 32b2c41206..ac7e469469 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -965,6 +965,12 @@ int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
if (priv_dev->dev_ver <= DEV_VER_V2)
cdns3_wa1_tray_restore_cycle_bit(priv_dev, priv_ep);
+ /* Flush TRBs */
+ flush_dcache_range((unsigned long)priv_ep->trb_pool,
+ (unsigned long)priv_ep->trb_pool +
+ ROUND(sizeof(struct cdns3_trb) * priv_ep->num_trbs,
+ CONFIG_SYS_CACHELINE_SIZE));
+
trace_cdns3_prepare_trb(priv_ep, priv_req->trb);
/*
@@ -1153,6 +1159,13 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev,
priv_ep->endpoint.desc->bEndpointAddress);
#endif
+ /* Invalidate TRBs */
+ invalidate_dcache_range((unsigned long)priv_ep->trb_pool,
+ (unsigned long)priv_ep->trb_pool +
+ ROUND(sizeof(struct cdns3_trb) *
+ priv_ep->num_trbs,
+ CONFIG_SYS_CACHELINE_SIZE));
+
if (!cdns3_request_handled(priv_ep, priv_req))
goto prepare_next_td;