summaryrefslogtreecommitdiff
path: root/plat/allwinner
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2018-09-09 00:38:58 +0100
committerAndre Przywara <andre.przywara@arm.com>2018-09-17 09:51:22 +0100
commit159c52491af33ff8014ee2fa708804bb75540419 (patch)
tree27d1e2c745a0e7ae93f3868eff7089f42e2435f4 /plat/allwinner
parent1a910bcee2444842de58a3b748a942fe0f183d67 (diff)
allwinner: sun50i_h6: initialise I2C just before powering down
Even though we initialise the platform part and the I2C controller itself at boot time, we actually only access the bus on power down. Meanwhile a rich OS might have configured the I2C pins differently or even disabled the controller. So repeat the platform setup and controller initialisation just before we actually access the bus to power off the system. This is safe, because at this point the rich OS should no longer be running. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'plat/allwinner')
-rw-r--r--plat/allwinner/sun50i_h6/sunxi_power.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/plat/allwinner/sun50i_h6/sunxi_power.c b/plat/allwinner/sun50i_h6/sunxi_power.c
index b6e07a24..12438b33 100644
--- a/plat/allwinner/sun50i_h6/sunxi_power.c
+++ b/plat/allwinner/sun50i_h6/sunxi_power.c
@@ -120,10 +120,9 @@ void __dead2 sunxi_power_down(void)
switch (pmic) {
case AXP805:
- val = 0x26; /* Default value for REG 32H */
+ sunxi_init_r_i2c();
axp_i2c_read(AXP805_ADDR, 0x32, &val);
- val |= 0x80;
- axp_i2c_write(AXP805_ADDR, 0x32, val);
+ axp_i2c_write(AXP805_ADDR, 0x32, val | 0x80);
break;
default:
break;