summaryrefslogtreecommitdiff
path: root/board/toradex/colibri_t20
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-08-06 00:47:04 +0200
committerTom Warren <twarren@nvidia.com>2015-08-13 13:06:02 -0700
commit10ef82d398e2789af57e01a4f8e5eed74a876f32 (patch)
tree4c4e5e012458f9cde3345b3c98f94684d15202a1 /board/toradex/colibri_t20
parentc1faf0024c9c8b3b39fd41fd08308688e757cb85 (diff)
colibri_t20: disable PMIC sleep mode on low supply voltage
The Colibri T20's PMIC enters a sleep mode on low supply voltage < 3.0V ±2.5% (2.92...3.08V). Rising the main supply voltage again does not bring it back to regular operation. Not even a full reset does bring the module back. A full power cycle was required to reboot the system. A long positive pulse on the PMICs resume pin also reboots the system but this pin is only accessible as a test point on the module. This patch configures the PMIC through I2C to not enter this sleep mode plus force it to normal state upon sleep request exit should this ever happen. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'board/toradex/colibri_t20')
-rw-r--r--board/toradex/colibri_t20/colibri_t20.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index 81d344ca04..42b293d81e 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -13,9 +13,44 @@
#include <asm/arch-tegra/tegra.h>
#include <asm/gpio.h>
#include <asm/io.h>
+#include <i2c.h>
+
+#define PMU_I2C_ADDRESS 0x34
+#define MAX_I2C_RETRY 3
+#define PMU_SUPPLYENE 0x14
+#define PMU_SUPPLYENE_SYSINEN (1<<5)
+#define PMU_SUPPLYENE_EXITSLREQ (1<<1)
int arch_misc_init(void)
{
+ /* Disable PMIC sleep mode on low supply voltage */
+ struct udevice *dev;
+ u8 addr, data[1];
+ int err;
+
+ err = i2c_get_chip_for_busnum(0, PMU_I2C_ADDRESS, 1, &dev);
+ if (err) {
+ debug("%s: Cannot find PMIC I2C chip\n", __func__);
+ return err;
+ }
+
+ addr = PMU_SUPPLYENE;
+
+ err = dm_i2c_read(dev, addr, data, 1);
+ if (err) {
+ debug("failed to get PMU_SUPPLYENE\n");
+ return err;
+ }
+
+ data[0] &= ~PMU_SUPPLYENE_SYSINEN;
+ data[0] |= PMU_SUPPLYENE_EXITSLREQ;
+
+ err = dm_i2c_write(dev, addr, data, 1);
+ if (err) {
+ debug("failed to set PMU_SUPPLYENE\n");
+ return err;
+ }
+
if (readl(NV_PA_BASE_SRAM + NVBOOTINFOTABLE_BOOTTYPE) ==
NVBOOTTYPE_RECOVERY)
printf("USB recovery mode\n");