From: Ian Campbell Date: Wed, 26 Mar 2014 08:30:38 +0000 Subject: [U-Boot] [PATCH v2 2/9] sunxi: initial sun7i pinmux and gpio support In-Reply-To: <201403242154.12633.marex@denx.de> References: <1395438845.2234.95.camel@hastur.hellion.org.uk> <1395438866-1193-2-git-send-email-ijc@hellion.org.uk> <201403242154.12633.marex@denx.de> Message-ID: <1395822638.29683.9.camel@dagon.hellion.org.uk> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, 2014-03-24 at 21:54 +0100, Marek Vasut wrote: > > + cfg = readl(&pio->cfg[0] + index); > > + cfg &= ~(0xf << offset); > > + cfg |= val << offset; > > + > > + writel(cfg, &pio->cfg[0] + index); > > clrsetbits_le32() here. I looked at this transform in a few different contexts and one concern I had was that readl and writel have barriers in them (after the read and before the write respectively) while clrsetbits and friends do not. I don't think this will matter for the read/modify/write bit twiddling itself (since there are register dependencies) but I was slightly concerned that the barriers were hiding the lack of explicit barriers which would be required between the various reads/writes. But I think I am probably being overly cautious here and the obvious transformation can be made. Anyone got any thoughts? Ian.