From ccd521c4681a5850bbec1feec140eeaec33936b0 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Mar 2014 12:48:09 +0100 Subject: colibri_t20: disable PMIC sleep mode on low supply voltage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- arch/arm/include/asm/arch-tegra2/pmu.h | 4 ++++ board/toradex/common/board.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-tegra2/pmu.h b/arch/arm/include/asm/arch-tegra2/pmu.h index 0faf07c3db..6cf363df7d 100644 --- a/arch/arm/include/asm/arch-tegra2/pmu.h +++ b/arch/arm/include/asm/arch-tegra2/pmu.h @@ -27,6 +27,10 @@ #define DVC_I2C_BUS_NUMBER 0 #define PMU_I2C_ADDRESS 0x34 +#define PMU_SUPPLYENE 0x14 +#define PMU_SUPPLYENE_SYSINEN (1<<5) +#define PMU_SUPPLYENE_EXITSLREQ (1<<1) + #define PMU_CORE_VOLTAGE_REG 0x26 #define PMU_CPU_VOLTAGE_REG 0x23 #define PMU_SUPPLY_CONTROL_REG1 0x20 diff --git a/board/toradex/common/board.c b/board/toradex/common/board.c index ea70dbdc11..a48c0efb7e 100644 --- a/board/toradex/common/board.c +++ b/board/toradex/common/board.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2012 + * (C) Copyright 2012-2014 * Toradex, Inc. * * See file CREDITS for list of people who contributed to this @@ -341,6 +341,30 @@ static TrdxBootDevice board_get_current_bootdev(void) return boot_device; } +/* Disable PMIC sleep mode on low supply voltage for Colibri T20 */ +static void board_disable_pmic_sleep(void) { +#ifdef CONFIG_TEGRA2 + uchar reg, data_buffer[1]; + int i; + + i2c_set_bus_num(DVC_I2C_BUS_NUMBER); /* PMU is on bus 0 */ + + reg = PMU_SUPPLYENE; + for (i = 0; i < MAX_I2C_RETRY; ++i) { + if (!i2c_read(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) + break; + udelay(100); + } + data_buffer[0] &= ~PMU_SUPPLYENE_SYSINEN; + data_buffer[0] |= PMU_SUPPLYENE_EXITSLREQ; + for (i = 0; i < MAX_I2C_RETRY; ++i) { + if (!i2c_write(PMU_I2C_ADDRESS, reg, 1, data_buffer, 1)) + break; + udelay(100); + } +#endif +} + /* * Routine: board_init * Description: Early hardware init. @@ -373,6 +397,9 @@ int board_init(void) i2c_init_board(); #endif + /* Disable PMIC sleep mode on low supply voltage */ + board_disable_pmic_sleep(); + #ifdef CONFIG_TEGRA_CLOCK_SCALING pmu_set_nominal(); arch_full_speed(); -- cgit v1.2.3