]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: rmobile: Implement PMIC reset on V2H Blanche
authorMarek Vasut <marek.vasut+renesas@gmail.com>
Sat, 21 Mar 2020 15:57:58 +0000 (16:57 +0100)
committermarex <marex@desktop.lan>
Mon, 30 Mar 2020 09:35:23 +0000 (11:35 +0200)
Add code to reset the board through PMIC, by writing the required
PMIC registers in the CPU reset handler.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
board/renesas/blanche/blanche.c

index 7232370d6f4f84179a08c9d8588435a935da1e7f..471d80fc72f5c44154fa84efa94efcaf854c031b 100644 (file)
@@ -20,6 +20,7 @@
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
 #include <env.h>
+#include <hang.h>
 #include <i2c.h>
 #include <linux/errno.h>
 #include <malloc.h>
@@ -355,4 +356,23 @@ int dram_init_banksize(void)
 
 void reset_cpu(ulong addr)
 {
+       struct udevice *dev;
+       const u8 pmic_bus = 6;
+       const u8 pmic_addr = 0x58;
+       u8 data;
+       int ret;
+
+       ret = i2c_get_chip_for_busnum(pmic_bus, pmic_addr, 1, &dev);
+       if (ret)
+               hang();
+
+       ret = dm_i2c_read(dev, 0x13, &data, 1);
+       if (ret)
+               hang();
+
+       data |= BIT(1);
+
+       ret = dm_i2c_write(dev, 0x13, &data, 1);
+       if (ret)
+               hang();
 }