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 02/19] ARM: OMAP4: PM: save/restore all CM1/2 settings in OFF mode
Date: Fri, 11 May 2012 17:30:04 +0300	[thread overview]
Message-ID: <1336746604.2149.301.camel@sokoban> (raw)
In-Reply-To: <87ehqtexzw.fsf@ti.com>

On Wed, 2012-05-09 at 16:27 -0700, Kevin Hilman wrote:
> Tero Kristo <t-kristo@ti.com> writes:
> 
> > From: Rajendra Nayak <rnayak@ti.com>
> >
> > Restore all CM1/2 module registers as they are lost in OFF mode.
> 
> Except they are still lost since nobody calls these new functions (in
> this patch.)  :)
> 
> For ease of review, it's preferred to add the *users* of new code in the
> same patch as the new code.

I'll fix this for the next version. I think this same comment applies to
patch #3 also.

> 
> > [nm at ti.com: minor clean ups]
> > Signed-off-by: Nishanth Menon <nm@ti.com>
> > Signed-off-by: Rajendra Nayak <rnayak@ti.com>
> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> > Signed-off-by: Axel Haslam <axelhaslam@gmail.com>
> > Signed-off-by: Tero Kristo <t-kristo@ti.com>
> > ---
> >  arch/arm/mach-omap2/cm44xx.c |  322 ++++++++++++++++++++++++++++++++++++++++++
> >  arch/arm/mach-omap2/cm44xx.h |    2 +
> >  2 files changed, 324 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/cm44xx.c b/arch/arm/mach-omap2/cm44xx.c
> > index 535d66e..fb5465b 100644
> > --- a/arch/arm/mach-omap2/cm44xx.c
> > +++ b/arch/arm/mach-omap2/cm44xx.c
> > @@ -21,8 +21,11 @@
> >  #include "iomap.h"
> >  #include "common.h"
> >  #include "cm.h"
> > +#include "cm44xx.h"
> >  #include "cm1_44xx.h"
> >  #include "cm2_44xx.h"
> > +#include "cminst44xx.h"
> > +#include "prcm44xx.h"
> >  #include "cm-regbits-44xx.h"
> >  
> >  /* CM1 hardware module low-level functions */
> > @@ -50,3 +53,322 @@ void omap4_cm2_write_inst_reg(u32 val, s16 inst, u16 reg)
> >  {
> >  	__raw_writel(val, OMAP44XX_CM2_REGADDR(inst, reg));
> >  }
> > +
> > +#define MAX_CM_REGISTERS 51
> > +
> > +struct omap4_cm_reg {
> > +	u16 offset;
> > +	u32 val;
> > +};
> > +
> > +struct omap4_cm_regs {
> > +	u32 mod_off;
> > +	u32 no_reg;
> 
> minor: do these need to be u32?

u16 should be good enough to save space I guess, I'll try changing this
and see what happens.

> 
> > +	struct omap4_cm_reg reg[MAX_CM_REGISTERS];
> > +};
> > +
> > +static struct omap4_cm_regs cm1_regs[] = {
> > +	/* OMAP4430_CM1_OCP_SOCKET_MOD */
> > +	{ .mod_off = OMAP4430_CM1_OCP_SOCKET_INST, .no_reg = 1,
> > +	{{.offset = OMAP4_CM_CM1_PROFILING_CLKCTRL_OFFSET} },
> 
> For readability sake, I'd prefer to see this line indented.  And why
> the extra space before the final '}'}

These tables are horrible, would be better to get rid of them completely
but I guess that is not possible... I'll look at the indentation.

> 
> > +	},
> 
> [...]
> 
> > +static void omap4_cm1_prepare_off(void)
> > +{
> > +	u32 i, j;
> > +	struct omap4_cm_regs *cm_reg = cm1_regs;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(cm1_regs); i++, cm_reg++) {
> > +		for (j = 0; j < cm_reg->no_reg; j++) {
> > +			cm_reg->reg[j].val =
> > +			    omap4_cminst_read_inst_reg(OMAP4430_CM1_PARTITION,
> > +						       cm_reg->mod_off,
> > +						       cm_reg->reg[j].offset);
> > +		}
> > +	}
> > +}
> > +
> > +static void omap4_cm2_prepare_off(void)
> > +{
> > +	u32 i, j;
> > +	struct omap4_cm_regs *cm_reg = cm2_regs;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(cm2_regs); i++, cm_reg++) {
> > +		for (j = 0; j < cm_reg->no_reg; j++) {
> > +			cm_reg->reg[j].val =
> > +			    omap4_cminst_read_inst_reg(OMAP4430_CM2_PARTITION,
> > +						       cm_reg->mod_off,
> > +						       cm_reg->reg[j].offset);
> > +		}
> > +	}
> > +}
> 
> > +static void omap4_cm1_resume_off(void)
> > +{
> > +	u32 i, j;
> > +	struct omap4_cm_regs *cm_reg = cm1_regs;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(cm1_regs); i++, cm_reg++) {
> > +		for (j = 0; j < cm_reg->no_reg; j++) {
> > +			omap4_cminst_write_inst_reg(cm_reg->reg[j].val,
> > +						    OMAP4430_CM1_PARTITION,
> > +						    cm_reg->mod_off,
> > +						    cm_reg->reg[j].offset);
> > +		}
> > +	}
> > +}
> > +
> > +static void omap4_cm2_resume_off(void)
> > +{
> > +	u32 i, j;
> > +	struct omap4_cm_regs *cm_reg = cm2_regs;
> > +
> > +	for (i = 0; i < ARRAY_SIZE(cm2_regs); i++, cm_reg++) {
> > +		for (j = 0; j < cm_reg->no_reg; j++) {
> > +			omap4_cminst_write_inst_reg(cm_reg->reg[j].val,
> > +						    OMAP4430_CM2_PARTITION,
> > +						    cm_reg->mod_off,
> > +						    cm_reg->reg[j].offset);
> > +		}
> > +	}
> > +}
> 
> Notice the two prpare functions (and resume functions) are basically
> identical, except for the partition.
> 
> How about adding a .partition field to the struct so there can be a
> single function}

Yea, should be possible. I'll fix this for next rev.

-Tero

  reply	other threads:[~2012-05-11 14:30 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 [this message]
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
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=1336746604.2149.301.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).