MFD: TWL4030: changes for TRITON Errata 27 workaround
PATCH v3 1/1 MFD: TWL4030: changes for TRITON Errata 27 workaround
Fix for TWL5030 Silicon Errata 27 & 28:
27 - VDD1, VDD2, may have glitches when their output value is updated. 28 - VDD1 and / or VDD2 DCDC clock may stop working when internal clock
is switched from internal to external.
Workaround requires the TWL DCDCs to use HFCLKIN instead of internal oscillator.
There is a chance for VDD1/VDD2 to collapse to 0 Volt,
if we switch the TWL DCDCs to internal oscillator form HFCLKIN while VDD1/VDD2 is active. So during first time when we switch TWLDCDC to HFCLKIN, TWL watchdog timer is used to recover if the VDD1/VDD2 stop working.
Using HFCLKIN for TWL DCDCs uncovers another issue when going in and out of OFF mode, if HFCLK is disabled in OFFMODE. So the sleep/wakeup sequence and setuptimes are modified to make sure the switching will happen only when HFCLKIN is stable.
This fix is required for TWL5030 Silicon version less than or equal to ES1.1 Since the IDCODE register on TWL5030 Si is not updated correctly, version check may not be correct. So the workaround is enabled based on the flag TWL5030_ERRATA_27 & TRITON Si version.
The workaround changes are called from twl4030_power_init(), since we have to make some i2c_read calls to check the TRITON version & the i2c will not be initialized in the early stage.
Changes taken from Nishanth Menons TRITON Errata27 workaround patch.
---
This patch series is based off Kevin's tree origin/pm-wip-sr branch.
This patch has dependency on:
Updated TRITON power scripts from Lesly.
Changes to fix Kevins comments:
Removing menuconfig option and using optional flag from board file to enable the workaround.
This changes are tested on OMAP3430 SDP board with:
enable_off_mode
voltage_off_while_idle
sleep_while_idle (VDD1/VDD2 voltage scaling to 0v) enabled in cpuidle and suspned path.
Also tested for reboot and dvfs.
arch/arm/mach-omap2/board-3430sdp.c | 43 +++++++++ arch/arm/mach-omap2/board-zoom-peripherals.c | 43 +++++++++ arch/arm/mach-omap2/twl4030.c | 76 ++++++++++++++++ arch/arm/mach-omap2/voltage.c | 8 ++ arch/arm/mach-omap2/voltage.h | 9 ++ drivers/mfd/twl4030-power.c | 121 ++++++++++++++++++++++++- include/linux/i2c/twl.h | 6 ++ 7 files changed, 301 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +43 -0
@@ -51,6 +51,9 @@#include "omap3-opp.h" #include "smartreflex-class3.h" +/* Enable TWL5030 Errata 27 workaround */ +#define TWL5030_ERRATA_27 1 +#define SDP3430_TS_GPIO_IRQ_SDPV1 3#define SDP3430_TS_GPIO_IRQ_SDPV2 2
@@ -452,8 +455,48 @@ static struct twl4030_resconfig twl4030_rconfig[] = { { 0, 0}, }; +/* VDD1/VDD2/VPLL are assigned to P1 and P3, to have better control +* during OFFMODE. HFCLKOUT is assigned to P1 and P3 (*p2) to trun off +* only during OFFMODE. +* (*P2 is included if the platform uses it for modem/some other processor) +*/ +static struct twl4030_resconfig twl4030_rconfig_errata27[] = { + { .resource =RES_VPLL1 , .devgroup =DEV_GRP_P1 |DEV_GRP_P3 , + .type =3 , .type2 =1 , .remap_sleep =RES_STATE_OFF }, + { .resource =RES_VINTANA1 , .devgroup =DEV_GRP_ALL , .type =1 , + .type2 =2 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_VINTANA2 , .devgroup =DEV_GRP_ALL , .type =0 , + .type2 =2 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_VINTDIG , .devgroup =DEV_GRP_ALL , .type =1 , + .type2 =2 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_VIO , .devgroup =DEV_GRP_ALL , .type =2 , + .type2 =2 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_VDD1 , .devgroup =DEV_GRP_P1 |DEV_GRP_P3 , + .type =4 , .type2 =1 , .remap_sleep =RES_STATE_OFF }, + { .resource =RES_VDD2 , .devgroup =DEV_GRP_P1 |DEV_GRP_P3 , + .type =3 , .type2 =1 , .remap_sleep =RES_STATE_OFF }, + { .resource =RES_REGEN , .devgroup =DEV_GRP_ALL , .type =2 , + .type2 =1 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_NRES_PWRON , .devgroup =DEV_GRP_ALL , .type =0 , + .type2 =1 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_CLKEN , .devgroup =DEV_GRP_ALL , .type =3 , + .type2 =2 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_SYSEN , .devgroup =DEV_GRP_ALL , .type =6 , + .type2 =1 , .remap_sleep =RES_STATE_SLEEP }, + { .resource =RES_HFCLKOUT , .devgroup =DEV_GRP_P1 |DEV_GRP_P3 , + .type =0 , .type2 =1 , .remap_sleep =RES_STATE_SLEEP }, + {0 ,0 }, +}; +static struct twl4030_power_data sdp3430_t2scripts_data__initdata = { .resource_config = twl4030_rconfig, + .resource_config_errata27 = twl4030_rconfig_errata27, + .twl5030_errata27wa_vcsetup = omap_vcsetup_twl5030_errata27, +#ifdef TWL5030_ERRATA_27 + .enable_errata27_wa =TWL5030_SI_ERRATA27 , +#else + .enable_errata27_wa =0 , +#endif };/*
arch/arm/mach-omap2/board-zoom-peripherals.c +43 -0
57 lines not on this page · raw message
arch/arm/mach-omap2/twl4030.c +76 -0
92 lines not on this page · raw message
arch/arm/mach-omap2/voltage.c +8 -0
@@ -949,6 +949,14 @@ void __init omap_voltage_init_vc(struct prm_setup_vc *setup_vc)memcpy (&vc_config, setup_vc,2 *sizeof (struct setuptime_vc )); } +void omap_vcsetup_twl5030_errata27 (void ) +{ + vc_config.off.clksetup =CLKSETUP_TWL5030_ERRATA27 ; + + vc_config.off.voltoffset =VOLTOFFSET_TWL5030_ERRATA27 ; + vc_config.off.voltsetup2 =VOLTSETUP2_TWL5030_ERRATA27 ; +} +void omap_voltage_vc_update (int core_next_state) {u32 voltctrl =0 ;
arch/arm/mach-omap2/voltage.h +9 -0
@@ -132,6 +132,15 @@ void omap_voltageprocessor_disable(int vp_id);void omap_voltage_init_vc (struct prm_setup_vc *setup_vc);void omap_voltage_vc_update (int core_next_state);void omap_voltage_init (void ); + +/* The clk/volt setuptime is adjusted to do the VDD1/VDD2 voltage rampup +* only after HFCLKIN is stabilized and the HFCLKOUT is enabled +*/ +#define CLKSETUP_TWL5030_ERRATA27 0x17B +#define VOLTOFFSET_TWL5030_ERRATA27 0x10 +#define VOLTSETUP2_TWL5030_ERRATA27 0x16B +void omap_vcsetup_twl5030_errata27 (void ); +int omap_voltage_scale (int vdd,unsigned long target_volt,unsigned long current_volt);void omap_reset_voltage (int vdd);
drivers/mfd/twl4030-power.c +116 -5
154 lines not on this page · raw message
include/linux/i2c/twl.h +6 -0
@@ -550,6 +550,12 @@ struct twl4030_power_data {struct twl4030_script **scripts;unsigned num;struct twl4030_resconfig *resource_config; +struct twl4030_script **scripts_errata27; +unsigned num_errata27; +struct twl4030_resconfig *resource_config_errata27; +void (*twl5030_errata27wa_vcsetup)(void ); +u8 enable_errata27_wa; +#define TWL5030_SI_ERRATA27 (1<<0)#define TWL4030_RESCONFIG_UNDEF ((u8)-1) };
Signature · 1 line
1.6.0.4