Skip to content
Commit dd4cf53f authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Tom Rini
Browse files

gpio: mpc8xxx: don't do RMW on gpdat register when setting value



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: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
parent 1d7ad9fa
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment