Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465077 > unrolled thread

[PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2016-08-18 12:10 +0200
Last post2016-08-18 15:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-08-18 12:10 +0200
    Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command  immediately Ingo Molnar <mingo@kernel.org> - 2016-08-18 13:00 +0200
      Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command  immediately Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-08-18 13:20 +0200
        Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command  immediately Ingo Molnar <mingo@kernel.org> - 2016-08-18 15:40 +0200

#1465077 — [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-08-18 12:10 +0200
Subject[PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately
Message-ID<s7sqS-6Jo-43@gated-at.bofh.it>
On some firmwares we have to tell how exactly we want the command to be run.
The default case for now is to run it immediately.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/platform/intel-mid/pwr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c
index c901a34..0548741 100644
--- a/arch/x86/platform/intel-mid/pwr.c
+++ b/arch/x86/platform/intel-mid/pwr.c
@@ -44,6 +44,10 @@
 /* Bits in PM_CMD */
 #define PM_CMD_CMD(x)		((x) << 0)
 #define PM_CMD_IOC		(1 << 8)
+#define PM_CMD_CM_NOP		(0 << 9)
+#define PM_CMD_CM_IMMEDIATE	(1 << 9)
+#define PM_CMD_CM_DELAY		(2 << 9)
+#define PM_CMD_CM_TRIGGER	(3 << 9)
 #define PM_CMD_D3cold		(1 << 21)
 
 /* List of commands */
@@ -137,7 +141,7 @@ static int mid_pwr_wait(struct mid_pwr *pwr)
 
 static int mid_pwr_wait_for_cmd(struct mid_pwr *pwr, u8 cmd)
 {
-	writel(PM_CMD_CMD(cmd), pwr->regs + PM_CMD);
+	writel(PM_CMD_CMD(cmd) | PM_CMD_CM_IMMEDIATE, pwr->regs + PM_CMD);
 	return mid_pwr_wait(pwr);
 }
 
-- 
2.8.1

[toc] | [next] | [standalone]


#1465126 — Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately

FromIngo Molnar <mingo@kernel.org>
Date2016-08-18 13:00 +0200
SubjectRe: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately
Message-ID<s7tdf-75c-5@gated-at.bofh.it>
In reply to#1465077
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On some firmwares we have to tell how exactly we want the command to be run.
> The default case for now is to run it immediately.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/platform/intel-mid/pwr.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c
> index c901a34..0548741 100644
> --- a/arch/x86/platform/intel-mid/pwr.c
> +++ b/arch/x86/platform/intel-mid/pwr.c
> @@ -44,6 +44,10 @@
>  /* Bits in PM_CMD */
>  #define PM_CMD_CMD(x)		((x) << 0)
>  #define PM_CMD_IOC		(1 << 8)
> +#define PM_CMD_CM_NOP		(0 << 9)
> +#define PM_CMD_CM_IMMEDIATE	(1 << 9)
> +#define PM_CMD_CM_DELAY		(2 << 9)
> +#define PM_CMD_CM_TRIGGER	(3 << 9)
>  #define PM_CMD_D3cold		(1 << 21)
>  
>  /* List of commands */
> @@ -137,7 +141,7 @@ static int mid_pwr_wait(struct mid_pwr *pwr)
>  
>  static int mid_pwr_wait_for_cmd(struct mid_pwr *pwr, u8 cmd)
>  {
> -	writel(PM_CMD_CMD(cmd), pwr->regs + PM_CMD);
> +	writel(PM_CMD_CMD(cmd) | PM_CMD_CM_IMMEDIATE, pwr->regs + PM_CMD);
>  	return mid_pwr_wait(pwr);
>  }

Does this fix a bug? If yes then please also add that to the changelog: what are 
the symptoms of the bug - how does a user notice, etc.

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1465181 — Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-08-18 13:20 +0200
SubjectRe: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately
Message-ID<s7twB-7tk-15@gated-at.bofh.it>
In reply to#1465126
On Thu, 2016-08-18 at 12:52 +0200, Ingo Molnar wrote:
> * Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> > 
> > On some firmwares we have to tell how exactly we want the command to
> > be run.
> > The default case for now is to run it immediately.
> > 
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  arch/x86/platform/intel-mid/pwr.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/platform/intel-mid/pwr.c
> > b/arch/x86/platform/intel-mid/pwr.c
> > index c901a34..0548741 100644
> > --- a/arch/x86/platform/intel-mid/pwr.c
> > +++ b/arch/x86/platform/intel-mid/pwr.c
> > @@ -44,6 +44,10 @@
> >  /* Bits in PM_CMD */
> >  #define PM_CMD_CMD(x)		((x) << 0)
> >  #define PM_CMD_IOC		(1 << 8)
> > +#define PM_CMD_CM_NOP		(0 << 9)
> > +#define PM_CMD_CM_IMMEDIATE	(1 << 9)
> > +#define PM_CMD_CM_DELAY		(2 << 9)
> > +#define PM_CMD_CM_TRIGGER	(3 << 9)
> >  #define PM_CMD_D3cold		(1 << 21)
> >  
> >  /* List of commands */
> > @@ -137,7 +141,7 @@ static int mid_pwr_wait(struct mid_pwr *pwr)
> >  
> >  static int mid_pwr_wait_for_cmd(struct mid_pwr *pwr, u8 cmd)
> >  {
> > -	writel(PM_CMD_CMD(cmd), pwr->regs + PM_CMD);
> > +	writel(PM_CMD_CMD(cmd) | PM_CMD_CM_IMMEDIATE, pwr->regs +
> > PM_CMD);
> >  	return mid_pwr_wait(pwr);
> >  }
> 
> Does this fix a bug? If yes then please also add that to the
> changelog: what are 
> the symptoms of the bug - how does a user notice, etc.

Unfortunately I have no firmware (I have knowledge of) to test this. On
the board I have, i.e. Intel Edison, everything works either way. On the
other hand the official BSP code has magic number 0x2201 to set, where
bits [15:13] indeed has no meaning to firmware, but the rest is
meaningful. So, I could conclude it *might* fix a bug.

[15:13] MODE_ID
Numeric ID associated with the given mode from an OSPM perspective.
Value not interpreted by firmware. Upon successful completion of this
command, this value should be reflected in the PM_STS.MODE_ID field

Taking above to the consideration what would you advise me?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [prev] | [next] | [standalone]


#1465354 — Re: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately

FromIngo Molnar <mingo@kernel.org>
Date2016-08-18 15:40 +0200
SubjectRe: [PATCH v1 1/1] x86/platform/intel-mid: Run PWRMU command immediately
Message-ID<s7vI5-oA-13@gated-at.bofh.it>
In reply to#1465181
* Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> On Thu, 2016-08-18 at 12:52 +0200, Ingo Molnar wrote:
> > * Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > 
> > > 
> > > On some firmwares we have to tell how exactly we want the command to
> > > be run.
> > > The default case for now is to run it immediately.
> > > 
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  arch/x86/platform/intel-mid/pwr.c | 6 +++++-
> > >  1 file changed, 5 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/x86/platform/intel-mid/pwr.c
> > > b/arch/x86/platform/intel-mid/pwr.c
> > > index c901a34..0548741 100644
> > > --- a/arch/x86/platform/intel-mid/pwr.c
> > > +++ b/arch/x86/platform/intel-mid/pwr.c
> > > @@ -44,6 +44,10 @@
> > >  /* Bits in PM_CMD */
> > >  #define PM_CMD_CMD(x)		((x) << 0)
> > >  #define PM_CMD_IOC		(1 << 8)
> > > +#define PM_CMD_CM_NOP		(0 << 9)
> > > +#define PM_CMD_CM_IMMEDIATE	(1 << 9)
> > > +#define PM_CMD_CM_DELAY		(2 << 9)
> > > +#define PM_CMD_CM_TRIGGER	(3 << 9)
> > >  #define PM_CMD_D3cold		(1 << 21)
> > >  
> > >  /* List of commands */
> > > @@ -137,7 +141,7 @@ static int mid_pwr_wait(struct mid_pwr *pwr)
> > >  
> > >  static int mid_pwr_wait_for_cmd(struct mid_pwr *pwr, u8 cmd)
> > >  {
> > > -	writel(PM_CMD_CMD(cmd), pwr->regs + PM_CMD);
> > > +	writel(PM_CMD_CMD(cmd) | PM_CMD_CM_IMMEDIATE, pwr->regs +
> > > PM_CMD);
> > >  	return mid_pwr_wait(pwr);
> > >  }
> > 
> > Does this fix a bug? If yes then please also add that to the
> > changelog: what are 
> > the symptoms of the bug - how does a user notice, etc.
> 
> Unfortunately I have no firmware (I have knowledge of) to test this. On
> the board I have, i.e. Intel Edison, everything works either way. On the
> other hand the official BSP code has magic number 0x2201 to set, where
> bits [15:13] indeed has no meaning to firmware, but the rest is
> meaningful. So, I could conclude it *might* fix a bug.
> 
> [15:13] MODE_ID
> Numeric ID associated with the given mode from an OSPM perspective.
> Value not interpreted by firmware. Upon successful completion of this
> command, this value should be reflected in the PM_STS.MODE_ID field
> 
> Taking above to the consideration what would you advise me?

"This appears to be a safer approach based on the documentation." is good enough 
justification, IMHO. So if you update the changelog with this information it's 
fine to me!

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web