From patchwork Tue Jan 28 11:10:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 240404 List-Id: U-Boot discussion From: rasmus.villemoes at prevas.dk (Rasmus Villemoes) Date: Tue, 28 Jan 2020 11:10:29 +0000 Subject: [PATCH 0/2] gpio: mpc8xxx: honour shadow register when writing gpdat Message-ID: <20200128111020.15136-1-rasmus.villemoes@prevas.dk> The driver correctly uses the shadow register when asked for the current value of an output gpio. Unfortunately, it does RMW on the gpdat register both when setting a gpio as input and output. These two patches fix that. Aside: Apparently, the mpc8309 also partially suffers from the errata preventing outputs from being read back - the bits corresponding to gpios 0-7 are always read as 0, while at least the value of gpio10 is correctly reflected when reading gpdat. Which is how I noticed these bugs - I couldn't understand why turning one LED on would turn off another. Rasmus Villemoes (2): gpio: mpc8xxx: don't modify gpdat when setting gpio as input gpio: mpc8xxx: don't do RMW on gpdat register when setting value drivers/gpio/mpc8xxx_gpio.c | 41 ++++++++++++++----------------------- 1 file changed, 15 insertions(+), 26 deletions(-)