From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sun, 27 Apr 2014 21:14:13 +0200 Subject: [U-Boot] [linux-sunxi] Uboot error: address not aligned in v7_dcache_inval_range In-Reply-To: <1398624050.19277.135.camel@hastur.hellion.org.uk> References: <201404262027.00954.marex@denx.de> <1398624050.19277.135.camel@hastur.hellion.org.uk> Message-ID: <201404272114.13166.marex@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 Sunday, April 27, 2014 at 08:40:50 PM, Ian Campbell wrote: > On Sat, 2014-04-26 at 20:27 +0200, Marek Vasut wrote: > > This was a sheer luck this ever worked. Looking at the entire driver, to > > fix all your issues with DMA and caches, it would be sufficient to > > re-align "struct dw_eth_dev" properly. > > > > See drivers/net/designware.h: > > 1) struct dmamacdescr {} is already __aligned(ARCH_DMA_MINALIGN) > > > > => This structure, if aligned in memory to proper boundary, can be > > flushed/ > > > > invalidated without problems. > > > > 2) struct dw_eth_dev {} can be aligned to ANY 4-byte boundary > > > > But this structure contains two arrays of struct dmamacdescr {} , > > which each have their elements' lenght aligned to ARCH_DMA_MINALIGN > > > > Solution: > > > > Your patch [1/3] and reorder the structure in designware.h so that the > > struct dmamacdescr tx_mac_descrtable[] > > struct dmamacdescr rx_mac_descrtable[] > > are first and anything that does not need to be aligned follows. This > > way, the DMA descriptors will always be aligned and you need not worry > > about the flushes. You don't even need to ROUNDUP their length, since > > they are already fine. > > That sounds like a good plan. I'll take a look. > > > When reordering the struct dw_eth_dev {}, make sure to add a comment > > about the alignment. > > Of course. Thanks Best regards, Marek Vasut