From: Marek Vasut Date: Tue, 3 Oct 2017 15:18:23 +0200 Subject: [U-Boot] [PATCH] dwc: ep0: Allocate and flush dwc->ep0_trb in a cache aligned manner In-Reply-To: <78dff6f0-6381-3aba-4b7d-f8146404a9f8@ti.com> References: <1505819741-29843-1-git-send-email-faiz_abbas@ti.com> <78dff6f0-6381-3aba-4b7d-f8146404a9f8@ti.com> Message-ID: <807dfdf2-d002-e202-7e4b-054479b95ef1@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/03/2017 03:17 PM, Faiz Abbas wrote: > Hi, > > On Tuesday 03 October 2017 05:34 PM, Marek Vasut wrote: >> On 09/19/2017 01:15 PM, Faiz Abbas wrote: >>> A flush of the cache is required before any DMA access can take place. >> >> You mean invalidation for inbound DMA, flush for outbound DMA, right ? > > yes thats what i meant. > > >>> >>> - dwc3_flush_cache((uintptr_t)trb, sizeof(*trb)); >>> + dwc3_flush_cache((uintptr_t)dwc->ep0_trb_addr, sizeof(*trb) * 2); >> >> Why *2 ? > > Because its allocated as sizeof(*dwc->ep0_trb) * 2 below. This is not > strictly required as dwc3_flush_cache() rounds up the size to > CACHELINE_SIZE but from a caller POV, flush everything we allocated. Can the other TRB be in use ? Maybe aligning the TRBs to cacheline size would be better ? -- Best regards, Marek Vasut