From patchwork Sat Mar 21 16:10:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 244049 List-Id: U-Boot discussion From: marek.vasut at gmail.com (Marek Vasut) Date: Sat, 21 Mar 2020 17:10:49 +0100 Subject: [PATCH 3/3] ARM: rmobile: Implement PMIC reset on V2H Blanche In-Reply-To: <20200321161049.64558-1-marek.vasut+renesas@gmail.com> References: <20200321161049.64558-1-marek.vasut+renesas@gmail.com> Message-ID: <20200321161049.64558-3-marek.vasut+renesas@gmail.com> Add code to reset the board through PMIC, by writing the required PMIC registers in the CPU reset handler. Signed-off-by: Marek Vasut Cc: Nobuhiro Iwamatsu --- board/renesas/blanche/blanche.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c index 7232370d6f..0807967d6e 100644 --- a/board/renesas/blanche/blanche.c +++ b/board/renesas/blanche/blanche.c @@ -355,4 +355,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(); }