linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: t-kristo@ti.com (Tero Kristo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 10/19] ARM: OMAP4: PM: Work-around for ROM code BUG of IVAHD/TESLA
Date: Wed, 25 Apr 2012 10:31:13 +0300	[thread overview]
Message-ID: <1335339073.2149.107.camel@sokoban> (raw)
In-Reply-To: <4F96E7E7.9050005@ti.com>

On Tue, 2012-04-24 at 12:50 -0500, Jon Hunter wrote:
> Hi Tero,
> 
> On 04/20/2012 04:33 AM, Tero Kristo wrote:
> > From: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > 
> > The ROM BUG is when MPU Domain OFF wake up sequence that can compromise
> > IVA and Tesla execution.
> > 
> > At wakeup from MPU OFF on HS device only (not GP device), when
> > restoring the Secure RAM, the ROM Code reconfigures the clocks the
> > same way it is done at Cold Reset.
> > The IVAHD Clocks and Power Domain settings are:
> > 	IVAHD_CM2 IVAHD_CLKCTRL_MODULE_MODE = DISABLE
> > 	IVAHD_CM2 SL2_CLKCTRL_MODULE_MODE = DISABLE
> > 	IVAHD_CM2 SL2_CLKSTCTRL_CLKTRCTRL = HW_AUTO
> > 	IVAHD_PRM IVAHD_PWRSTCTRL_POWERSTATE = OFF
> > The TESLA Clocks and Power Domain settings are:
> > 	TESLA_CM1 TESLA_CLKCTRL_MODULE_MODE = DISABLE
> > 	TESLA_CM1 TESLA_CLKSTCTRL_CLKTRCTRL = HW_AUTO
> > 	TESLA_PRM TESLA_PWRSTCTRL_POWERSTATE = OFF
> > 
> > This patch fixes the low power OFF mode code so that the these
> > registers are saved and restore across MPU OFF state.
> > 
> > Also because of this limitation, MPU OFF alone is not targeted without
> > device OFF to avoid IVAHD and TESLA execution impact
> 
> You may wish to state which devices is impacted by this in the changelog.

Okay.

> 
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > [t-kristo at ti.com: added omap4 pm errata support]
> > Signed-off-by: Tero Kristo <t-kristo@ti.com>
> > ---
> >  arch/arm/mach-omap2/omap-mpuss-lowpower.c |   53 +++++++++++++++++++++++++++++
> >  arch/arm/mach-omap2/pm.h                  |    2 +
> >  arch/arm/mach-omap2/pm44xx.c              |    9 +++++
> >  3 files changed, 64 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> > index b9a2cc7..208d4a4 100644
> > --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> > +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
> > @@ -52,6 +52,7 @@
> >  
> >  #include <plat/omap44xx.h>
> >  
> > +#include "iomap.h"
> >  #include "common.h"
> >  #include "omap4-sar-layout.h"
> >  #include "pm.h"
> > @@ -76,6 +77,24 @@ static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
> >  static struct powerdomain *mpuss_pd;
> >  static void __iomem *sar_base;
> >  
> > +struct reg_tuple {
> > +	void __iomem *addr;
> > +	u32 val;
> > +};
> > +
> > +static struct reg_tuple tesla_reg[] = {
> > +	{.addr = OMAP4430_CM_TESLA_CLKSTCTRL},
> > +	{.addr = OMAP4430_CM_TESLA_TESLA_CLKCTRL},
> > +	{.addr = OMAP4430_PM_TESLA_PWRSTCTRL},
> > +};
> > +
> > +static struct reg_tuple ivahd_reg[] = {
> > +	{.addr = OMAP4430_CM_IVAHD_CLKSTCTRL},
> > +	{.addr = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL},
> > +	{.addr = OMAP4430_CM_IVAHD_SL2_CLKCTRL},
> > +	{.addr = OMAP4430_PM_IVAHD_PWRSTCTRL}
> > +};
> > +
> >  /*
> >   * Program the wakeup routine address for the CPU0 and CPU1
> >   * used for OFF or DORMANT wakeup.
> > @@ -215,6 +234,34 @@ static void save_l2x0_context(void)
> >  {}
> >  #endif
> >  
> > +static inline void save_ivahd_tesla_regs(void)
> > +{
> > +	int i;
> > +
> > +	if (!IS_PM44XX_ERRATUM(PM_OMAP4_ROM_IVAHD_TESLA_ERRATUM))
> > +		return;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(tesla_reg); i++)
> > +		tesla_reg[i].val = __raw_readl(tesla_reg[i].addr);
> > +
> > +	for (i = 0; i < ARRAY_SIZE(ivahd_reg); i++)
> > +		ivahd_reg[i].val = __raw_readl(ivahd_reg[i].addr);
> > +}
> > +
> > +static inline void restore_ivahd_tesla_regs(void)
> > +{
> > +	int i;
> > +
> > +	if (!IS_PM44XX_ERRATUM(PM_OMAP4_ROM_IVAHD_TESLA_ERRATUM))
> > +		return;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(tesla_reg); i++)
> > +		__raw_writel(tesla_reg[i].val, tesla_reg[i].addr);
> > +
> > +	for (i = 0; i < ARRAY_SIZE(ivahd_reg); i++)
> > +		__raw_writel(ivahd_reg[i].val, ivahd_reg[i].addr);
> > +}
> > +
> >  /**
> >   * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function
> >   * The purpose of this function is to manage low power programming
> > @@ -273,11 +320,14 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
> >  		omap_sar_overwrite();
> >  		omap4_cm_prepare_off();
> >  		omap4_dpll_prepare_off();
> > +		save_ivahd_tesla_regs();
> >  		save_state = 3;
> >  	} else if ((pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_RET) &&
> >  		(pwrdm_read_logic_retst(mpuss_pd) == PWRDM_POWER_OFF)) {
> > +		save_ivahd_tesla_regs();
> >  		save_state = 2;
> >  	} else if (pwrdm_read_next_pwrst(mpuss_pd) == PWRDM_POWER_OFF) {
> > +		save_ivahd_tesla_regs();
> >  		save_state = 3;
> >  	}
> >  
> > @@ -302,6 +352,9 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state)
> >  	wakeup_cpu = smp_processor_id();
> >  	set_cpu_next_pwrst(wakeup_cpu, PWRDM_POWER_ON);
> >  
> > +	if (omap4_mpuss_read_prev_context_state())
> > +		restore_ivahd_tesla_regs();
> > +
> >  	if (omap4_device_prev_state_off()) {
> >  		omap4_dpll_resume_off();
> >  		omap4_cm_resume_off();
> > diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
> > index e78ec63..051aeb9 100644
> > --- a/arch/arm/mach-omap2/pm.h
> > +++ b/arch/arm/mach-omap2/pm.h
> > @@ -131,6 +131,8 @@ extern void enable_omap3630_toggle_l2_on_restore(void);
> >  static inline void enable_omap3630_toggle_l2_on_restore(void) { }
> >  #endif		/* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */
> >  
> > +#define PM_OMAP4_ROM_IVAHD_TESLA_ERRATUM	(1 << 0)
> > +
> >  #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
> >  extern u16 pm44xx_errata;
> >  #define IS_PM44XX_ERRATUM(id)		(pm44xx_errata & (id))
> > diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> > index 8238097..67cb799 100644
> > --- a/arch/arm/mach-omap2/pm44xx.c
> > +++ b/arch/arm/mach-omap2/pm44xx.c
> > @@ -263,6 +263,15 @@ static int __init omap4_pm_init(void)
> >  
> >  	(void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
> >  
> > +	/*
> > +	 * ROM code initializes IVAHD and TESLA clock registers during
> > +	 * secure RAM restore phase on omap4430 EMU/HS devices, thus
> > +	 * IVAHD / TESLA clock registers must be saved / restored
> > +	 * during MPU OSWR / device off.
> > +	 */
> > +	if (cpu_is_omap443x() && omap_type() != OMAP2_DEVICE_TYPE_GP)
> > +		pm44xx_errata |= PM_OMAP4_ROM_IVAHD_TESLA_ERRATUM;
> 
> This erratum does not impact omap4430 es2.3 so the above should account
> for that.

Okay, will change that.

-Tero

  reply	other threads:[~2012-04-25  7:31 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20  9:33 [PATCH 00/19] ARM: OMAP4 device off support Tero Kristo
2012-04-20  9:33 ` [PATCH 01/19] ARM: OMAP4: PM: save/restore all DPLL settings in OFF mode Tero Kristo
2012-04-23 16:09   ` Jon Hunter
2012-04-25  7:33     ` Tero Kristo
2012-04-25 15:12       ` Jon Hunter
2012-05-04 19:22         ` Tony Lindgren
2012-05-02 10:10   ` Bedia, Vaibhav
2012-05-02 10:18     ` Shilimkar, Santosh
2012-05-02 10:55       ` Bedia, Vaibhav
2012-05-02 11:00         ` Shilimkar, Santosh
2012-05-02 11:40           ` Bedia, Vaibhav
2012-05-02 11:46             ` Shilimkar, Santosh
2012-05-02 11:55               ` Bedia, Vaibhav
2012-05-02 11:47             ` Menon, Nishanth
2012-05-02 11:55               ` Bedia, Vaibhav
2012-05-02 11:58                 ` Shilimkar, Santosh
2012-05-02 12:10                   ` Bedia, Vaibhav
2012-04-20  9:33 ` [PATCH 02/19] ARM: OMAP4: PM: save/restore all CM1/2 " Tero Kristo
2012-05-09 23:27   ` Kevin Hilman
2012-05-11 14:30     ` Tero Kristo
2012-04-20  9:33 ` [PATCH 03/19] ARM: OMAP4: PM: powerdomain: Add HWSAR flag to L3INIT Tero Kristo
2012-04-20  9:33 ` [PATCH 04/19] ARM: OMAP4: Add SAR ROM base address Tero Kristo
2012-04-20  9:33 ` [PATCH 05/19] ARM: OMAP4: PM: Add SAR backup support towards device OFF Tero Kristo
2012-04-24 16:35   ` Tony Lindgren
2012-04-25  7:18     ` Tero Kristo
2012-04-20  9:33 ` [PATCH 06/19] ARM: OMAP4: Auto generate SAR layout contents Tero Kristo
2012-04-24 16:37   ` Tony Lindgren
2012-04-20  9:33 ` [PATCH 07/19] ARM: OMAP4: SAR: generate overwrite data based on SAR ROM contents Tero Kristo
2012-04-20  9:33 ` [PATCH 08/19] ARM: OMAP4: PM: Add device-off support Tero Kristo
2012-04-24 17:46   ` Jon Hunter
2012-04-25  7:30     ` Tero Kristo
2012-04-20  9:33 ` [PATCH 09/19] ARM: OMAP4: PM: add errata support Tero Kristo
2012-04-20  9:33 ` [PATCH 10/19] ARM: OMAP4: PM: Work-around for ROM code BUG of IVAHD/TESLA Tero Kristo
2012-04-24 17:50   ` Jon Hunter
2012-04-25  7:31     ` Tero Kristo [this message]
2012-04-20  9:33 ` [PATCH 11/19] ARM: OMAP4: PM: save/restore CM L3INSTR registers when MPU hits OSWR/OFF mode Tero Kristo
2012-04-24 17:57   ` Jon Hunter
2012-04-25  7:31     ` Tero Kristo
2012-04-20  9:33 ` [PATCH 12/19] ARM: OMAP4: PM: update ROM return address for OSWR and OFF Tero Kristo
2012-04-24 16:39   ` Tony Lindgren
2012-04-25  7:24     ` Tero Kristo
2012-04-20  9:33 ` [PATCH 13/19] ARM: OMAP4: PM: Mark the PPI and SPI interrupts as non-secure for GP Tero Kristo
2012-04-20  9:33 ` [PATCH 14/19] ARM: OMAP4: wakeupgen: enable clocks for save_secure_all Tero Kristo
2012-04-20  9:33 ` [PATCH 15/19] ARM: OMAP4430: PM: workaround for DDR corruption on second CS Tero Kristo
2012-04-24 18:22   ` Jon Hunter
2012-04-25  7:26     ` Tero Kristo
2012-04-25  7:59       ` Shilimkar, Santosh
2012-04-25 15:16       ` Jon Hunter
2012-04-26  6:19         ` Shilimkar, Santosh
2012-04-20  9:33 ` [PATCH 16/19] TEMP: ARM: OMAP4: prevent voltage transitions Tero Kristo
2012-04-20  9:33 ` [PATCH 17/19] ARM: OMAP4: put cpu1 back to sleep if no wake request Tero Kristo
2012-04-20  9:33 ` [PATCH 18/19] ARM: OMAP4460: wakeupgen: set GIC_CPU0 backup status flag always Tero Kristo
2012-04-20  9:33 ` [PATCH 19/19] ARM: OMAP4: powerdomain: update mpu / core off counters during device off Tero Kristo
2012-04-20 12:20 ` [PATCH 00/19] ARM: OMAP4 device off support T Krishnamoorthy, Balaji
2012-04-20 12:58   ` Tero Kristo
2012-04-20 13:55     ` Kevin Hilman
2012-04-20 14:43       ` Tero Kristo
2012-04-20 14:51         ` Datta, Shubhrajyoti
2012-04-20 15:07           ` Tero Kristo
2012-04-23  6:28             ` Shubhrajyoti Datta
2012-05-09 22:46 ` Kevin Hilman
2012-05-09 23:14   ` Russell King - ARM Linux
2012-05-10  9:47     ` Tero Kristo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1335339073.2149.107.camel@sokoban \
    --to=t-kristo@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).