]> git.ipfire.org Git - people/ms/u-boot.git/commit
i2c: mvtwsi: Eliminate flags parameter
authormario.six@gdsys.cc <mario.six@gdsys.cc>
Thu, 21 Jul 2016 09:57:04 +0000 (11:57 +0200)
committerHeiko Schocher <hs@denx.de>
Tue, 26 Jul 2016 08:19:29 +0000 (10:19 +0200)
commit670514f52479cd1e0ae7952f45fef5779719aef2
treef96ba286d02ba9328094269455a0fca5586ae8b4
parent49c801bf352933b6285873d3d3ca6b315c60710f
i2c: mvtwsi: Eliminate flags parameter

Due to breaking boots from NOR flashes, commit d6b7757 ("i2c: mvtwsi:
Eliminate twsi_control_flags") removed the static global
twsi_control_flags variable, which kept a set of default flags that were
always or'd to the control register when writing. It was replaced with a
flags parameter, which was passed around between the functions that
needed it.

Since the twsi_control_flags variable was used just for the purposes of
a) setting the MVTWSI_CONTROL_TWSIEN on every control register write,
   and
b) setting the MVTWSI_CONTROL_ACK from twsi_i2c_read if needed,
anyway, the added overhead of another variable being passed around is no
longer justified, and we are better off implementing this flag setting
logic locally in the functions that actually write to the control
register.

Therefore, this patch sets MVTWSI_CONTROL_TWSIEN on every control
register write, replaces the twsi_i2c_read's flags parameter with a
ack_flag parameter, which tells the function whether to acknowledge the
read or not, and removes every other instance of the flags variable.
This has the added benefit that now every notion of "global default
flags" is gone, and it's much easier to see which control flags are
actually set at which point in time.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
Reviewed-by: Stefan Roese <sr@denx.de>
drivers/i2c/mvtwsi.c