usb: cdns3: ep0: Invalidate cache before reading Setup Packet
authorVignesh Raghavendra <vigneshr@ti.com>
Mon, 27 Jan 2020 12:25:54 +0000 (17:55 +0530)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Sun, 2 Feb 2020 17:19:52 +0000 (18:19 +0100)
Invalidate dcache line before accessing Setup Packet contents. Otherwise
driver will see stale content on non coherent architecture.

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
drivers/usb/cdns3/ep0.c

index 0b6d9cf7274e01e61f7689081b4d9ef4224a684e..f35a92483948a0038aa88a520c488dc29f7f1d69 100644 (file)
@@ -562,6 +562,10 @@ static void cdns3_ep0_setup_phase(struct cdns3_device *priv_dev)
        struct cdns3_endpoint *priv_ep = priv_dev->eps[0];
        int result;
 
+       /* Invalidate Setup Packet received */
+       invalidate_dcache_range(priv_dev->setup_dma,
+                               priv_dev->setup_dma + ARCH_DMA_MINALIGN);
+
        priv_dev->ep0_data_dir = ctrl->bRequestType & USB_DIR_IN;
 
        trace_cdns3_ctrl_req(ctrl);