From: Tom Rini Date: Tue, 31 Mar 2020 15:09:43 -0400 Subject: [PATCH resend 2/2] gpio: mpc8xxx: don't do RMW on gpdat register when setting value In-Reply-To: <20200128120423.16667-3-rasmus.villemoes@prevas.dk> References: <20200128120423.16667-1-rasmus.villemoes@prevas.dk> <20200128120423.16667-3-rasmus.villemoes@prevas.dk> Message-ID: <20200331190943.GC27133@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tue, Jan 28, 2020 at 12:04:34PM +0000, Rasmus Villemoes wrote: > The driver correctly handles reading back the value of an output gpio > by reading from the shadow register for output, and from gpdat for > inputs. > > Unfortunately, when setting the value of some gpio, we do a RMW cycle > on the gpdat register without taking the shadow register into account, > thus accidentally setting other output gpios (at least those whose > value cannot be read back) to 0 at the same time. > > When changing a gpio from input to output, we still need to make sure > it initially has the requested value. So, the procedure is > > - update the shadow register > - compute the new gpdir register > - write the bitwise and of the shadow and new gpdir register to gpdat > - write the new gpdir register > > Signed-off-by: Rasmus Villemoes Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: