From ceefcb9507814653072130989d29c1abb5f6bb32 Mon Sep 17 00:00:00 2001 From: Wayne Chang Date: Tue, 19 Sep 2023 16:51:22 +0800 Subject: [PATCH] NVIDIA: SAUCE: usb: gadget: xudc: ACK ST_RC after clearing CTRL_RUN We found a bug where the ST_RC bit in the status register was not being acknowledged after clearing the CTRL_RUN bit in the control register. This could lead to unexpected behavior in the USB gadget driver. This patch fix the issue by add the code to ACK ST_RC after clearing CTRL_RUN. http://nvbugs/4295138 http://nvbugs/4163106 Signed-off-by: Wayne Chang Signed-off-by: Laxman Dewangan Acked-by: Noah Wager Acked-by: Jacob Martin Signed-off-by: Noah Wager --- drivers/usb/gadget/udc/tegra-xudc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c index 570de6fb98d8..8a994e920fae 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -1755,6 +1755,10 @@ static int __tegra_xudc_ep_disable(struct tegra_xudc_ep *ep) val = xudc_readl(xudc, CTRL); val &= ~CTRL_RUN; xudc_writel(xudc, val, CTRL); + + val = xudc_readl(xudc, ST); + if (val & ST_RC) + xudc_writel(xudc, ST_RC, ST); } dev_info(xudc->dev, "ep %u disabled\n", ep->index);