summaryrefslogtreecommitdiff
path: root/board/toradex
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-10-05 15:27:11 -0700
committerStefano Babic <sbabic@denx.de>2016-10-07 12:26:15 +0200
commit02ad90eca5d156914ec7aeadf1bac6160dc05f41 (patch)
tree18bc9a31a39722400cd11dfc0081caffa75bd6c7 /board/toradex
parentcced7e5bb57311e894f06eb7c04ba62833e66939 (diff)
colibri_imx7: use Ricoh RN5T567 to reboot the board
Use the external PMIC Ricoh RN5T567 to reliably restart the system. Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Diffstat (limited to 'board/toradex')
-rw-r--r--board/toradex/colibri_imx7/colibri_imx7.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c
index bd7d5bc858..c64e31eaa4 100644
--- a/board/toradex/colibri_imx7/colibri_imx7.c
+++ b/board/toradex/colibri_imx7/colibri_imx7.c
@@ -21,6 +21,8 @@
#include <mmc.h>
#include <miiphy.h>
#include <netdev.h>
+#include <power/pmic.h>
+#include <power/rn5t567_pmic.h>
#include <usb/ehci-ci.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -337,6 +339,46 @@ int board_late_init(void)
return 0;
}
+#ifdef CONFIG_DM_PMIC
+int power_init_board(void)
+{
+ struct udevice *dev;
+ int reg, ver;
+ int ret;
+
+
+ ret = pmic_get("rn5t567", &dev);
+ if (ret)
+ return ret;
+ ver = pmic_reg_read(dev, RN5T567_LSIVER);
+ reg = pmic_reg_read(dev, RN5T567_OTPVER);
+
+ printf("PMIC: RN5T567 LSIVER=0x%02x OTPVER=0x%02x\n", ver, reg);
+
+ /* set judge and press timer of N_OE to minimal values */
+ pmic_clrsetbits(dev, RN5T567_NOETIMSETCNT, 0x7, 0);
+
+ return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+ struct udevice *dev;
+
+ pmic_get("rn5t567", &dev);
+
+ /* Use PMIC to reset, set REPWRTIM to 0 and REPWRON to 1 */
+ pmic_reg_write(dev, RN5T567_REPCNT, 0x1);
+ pmic_reg_write(dev, RN5T567_SLPCNT, 0x1);
+
+ /*
+ * Re-power factor detection on PMIC side is not instant. 1ms
+ * proved to be enough time until reset takes effect.
+ */
+ mdelay(1);
+}
+#endif
+
int checkboard(void)
{
printf("Model: Toradex Colibri iMX7%c\n",