Re: Question about e300 core decrementer interrupt

2009-09-10 Thread Scott Wood

Li Tao wrote:

Hi Scott Wood,
Thanks for your response

在 2009-09-09三的 13:43 -0500,Scott Wood写道:

The decrementer stops ticking when the core goes to sleep.  However, if a
decrementer was already pending (but masked with MSR[EE]) before you
enter sleep mode, it will cause a wakeup.

To avoid this, the decrementer is set to a very large value prior to and
after disabling interrupts.  See generic_suspend_disable_irqs() in
arch/powerpc/kernel/time.c.  Is this not happening for you?  Which kernel
version are you using, and what mechanism are you using to go to sleep?

I use 2.6.24 kernel. The PM driver code have set decrementer to
0x7fff before go to sleep mode.


It looks like 2.6.24 doesn't have commit 
7ac5dde99eb9fefdb526973c600075b7c5703a86 (Implement arch disable/enable 
irq hooks) -- are you disabling the decrementer in a similar manner, or 
is it possible that the decrementer has already fired by the time you 
set it to 0x7fff?  Could you read the value just prior to entering 
sleep?


Why use such an old kernel, BTW?


The driver set HID0[10]=1, then set MSR POW bit. PMCCR = 00111.


I was more interested in whether you were using the suspend_ops (maybe 
pm_ops back then?) infrastructure (which would invoke the irq hooks) or 
something custom.


-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about e300 core decrementer interrupt

2009-09-10 Thread Li Tao
Hi Scott Wood,
Thanks for your response

在 2009-09-09三的 13:43 -0500,Scott Wood写道:
> On Wed, Sep 09, 2009 at 01:16:07PM +0200, Kenneth Johansson wrote:
> > On Tue, 2009-09-08 at 13:48 +0800, Li Tao-B22598 wrote:
> > > Dear all,
> > > 
> > > I have a problem in MPC5121 sleep mode. As you know MPC5121 use e300c4
> > > core. When I make the e300c4 core into sleep mode, it will return to
> > > full power mode when the“decrementer interrupt” occurred.
> > > 
> > > But in the e300 core reference manual said that the “decrementer
> > > interrupt”have no effect when e300 core in sleep mode, because the
> > > time
> > > base and decrementer are disabled while the core is in sleep mode.
> > > Can anybody explain about this procedure ?
> 
> I'm not specifically familiar with MPC5121, but I'll answer from the
> perspective of MPC83xx which has a similar core:
> 
> The decrementer stops ticking when the core goes to sleep.  However, if a
> decrementer was already pending (but masked with MSR[EE]) before you
> enter sleep mode, it will cause a wakeup.
> 
> To avoid this, the decrementer is set to a very large value prior to and
> after disabling interrupts.  See generic_suspend_disable_irqs() in
> arch/powerpc/kernel/time.c.  Is this not happening for you?  Which kernel
> version are you using, and what mechanism are you using to go to sleep?
I use 2.6.24 kernel. The PM driver code have set decrementer to
0x7fff before go to sleep mode.
The driver set HID0[10]=1, then set MSR POW bit. PMCCR = 00111.
>  
> 
> > I'm a bit irritated that it's not as the "solution" can mean hardware
> > changes an thus it's potentially expensive.
> 
> What sort of hardware changes?
> 
> -Scott

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about e300 core decrementer interrupt

2009-09-10 Thread Li Tao
Hi Johansson,

Thanks for your response

在 2009-09-10四的 11:09 +0200,Kenneth Johansson写道:
> On Wed, 2009-09-09 at 13:43 -0500, Scott Wood wrote:
> > On Wed, Sep 09, 2009 at 01:16:07PM +0200, Kenneth Johansson wrote:
> > > On Tue, 2009-09-08 at 13:48 +0800, Li Tao-B22598 wrote:
> > > > Dear all,
> > > > 
> > > > I have a problem in MPC5121 sleep mode. As you know MPC5121 use e300c4
> > > > core. When I make the e300c4 core into sleep mode, it will return to
> > > > full power mode when the“decrementer interrupt” occurred.
> > > > 
> > > > But in the e300 core reference manual said that the “decrementer
> > > > interrupt”have no effect when e300 core in sleep mode, because the
> > > > time
> > > > base and decrementer are disabled while the core is in sleep mode.
> > > > Can anybody explain about this procedure ?
> > 
> > I'm not specifically familiar with MPC5121, but I'll answer from the
> > perspective of MPC83xx which has a similar core:
> > 
> > The decrementer stops ticking when the core goes to sleep.  However, if a
> > decrementer was already pending (but masked with MSR[EE]) before you
> > enter sleep mode, it will cause a wakeup.
> > 
> > To avoid this, the decrementer is set to a very large value prior to and
> > after disabling interrupts.  See generic_suspend_disable_irqs() in
> > arch/powerpc/kernel/time.c.  Is this not happening for you?  Which kernel
> > version are you using, and what mechanism are you using to go to sleep? 
> > 
> > > I'm a bit irritated that it's not as the "solution" can mean hardware
> > > changes an thus it's potentially expensive.
> > 
> > What sort of hardware changes?
> 
>  I don't want to spread missinformation but this procedure has helped on
> the ads5121 rev3 and two custom boards. 
> 
> the gpio 28,29,30 needs to be low and gpio31 needs to be hi. regardless
> of what is used as wakeup source when the device enters deep sleep
> otherwise you end up in some sort of meta state where you might not wake
> up on anything and you have this 42 second auto wakeup from the
> decrementer. 
I use ads5121 rev4.1 board, the gpio 28,29,30 is low and gpio31 is high.
I find that the RTC is fail too, when I use hwclock -f /dev/rtc0 cmd, it
was always "Wed Dec 31 23:59:59 1969  0.00 seconds". I measured the
the RTC oscillator is 32.768 kHz, and the VBAT_RTC is 4.2v. I have no
idea about why RTC is fail. 
> 
> Other weired states has also been observed. the PMC module is a bit
> tempremental in this chip.
> 
> 
> 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about e300 core decrementer interrupt

2009-09-10 Thread Kenneth Johansson
On Wed, 2009-09-09 at 13:43 -0500, Scott Wood wrote:
> On Wed, Sep 09, 2009 at 01:16:07PM +0200, Kenneth Johansson wrote:
> > On Tue, 2009-09-08 at 13:48 +0800, Li Tao-B22598 wrote:
> > > Dear all,
> > > 
> > > I have a problem in MPC5121 sleep mode. As you know MPC5121 use e300c4
> > > core. When I make the e300c4 core into sleep mode, it will return to
> > > full power mode when the“decrementer interrupt” occurred.
> > > 
> > > But in the e300 core reference manual said that the “decrementer
> > > interrupt”have no effect when e300 core in sleep mode, because the
> > > time
> > > base and decrementer are disabled while the core is in sleep mode.
> > > Can anybody explain about this procedure ?
> 
> I'm not specifically familiar with MPC5121, but I'll answer from the
> perspective of MPC83xx which has a similar core:
> 
> The decrementer stops ticking when the core goes to sleep.  However, if a
> decrementer was already pending (but masked with MSR[EE]) before you
> enter sleep mode, it will cause a wakeup.
> 
> To avoid this, the decrementer is set to a very large value prior to and
> after disabling interrupts.  See generic_suspend_disable_irqs() in
> arch/powerpc/kernel/time.c.  Is this not happening for you?  Which kernel
> version are you using, and what mechanism are you using to go to sleep? 
> 
> > I'm a bit irritated that it's not as the "solution" can mean hardware
> > changes an thus it's potentially expensive.
> 
> What sort of hardware changes?

 I don't want to spread missinformation but this procedure has helped on
the ads5121 rev3 and two custom boards. 

the gpio 28,29,30 needs to be low and gpio31 needs to be hi. regardless
of what is used as wakeup source when the device enters deep sleep
otherwise you end up in some sort of meta state where you might not wake
up on anything and you have this 42 second auto wakeup from the
decrementer. 

Other weired states has also been observed. the PMC module is a bit
tempremental in this chip.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about e300 core decrementer interrupt

2009-09-09 Thread Scott Wood
On Wed, Sep 09, 2009 at 01:16:07PM +0200, Kenneth Johansson wrote:
> On Tue, 2009-09-08 at 13:48 +0800, Li Tao-B22598 wrote:
> > Dear all,
> > 
> > I have a problem in MPC5121 sleep mode. As you know MPC5121 use e300c4
> > core. When I make the e300c4 core into sleep mode, it will return to
> > full power mode when the“decrementer interrupt” occurred.
> > 
> > But in the e300 core reference manual said that the “decrementer
> > interrupt”have no effect when e300 core in sleep mode, because the
> > time
> > base and decrementer are disabled while the core is in sleep mode.
> > Can anybody explain about this procedure ?

I'm not specifically familiar with MPC5121, but I'll answer from the
perspective of MPC83xx which has a similar core:

The decrementer stops ticking when the core goes to sleep.  However, if a
decrementer was already pending (but masked with MSR[EE]) before you
enter sleep mode, it will cause a wakeup.

To avoid this, the decrementer is set to a very large value prior to and
after disabling interrupts.  See generic_suspend_disable_irqs() in
arch/powerpc/kernel/time.c.  Is this not happening for you?  Which kernel
version are you using, and what mechanism are you using to go to sleep? 

> I'm a bit irritated that it's not as the "solution" can mean hardware
> changes an thus it's potentially expensive.

What sort of hardware changes?

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: Question about e300 core decrementer interrupt

2009-09-09 Thread Kenneth Johansson
On Tue, 2009-09-08 at 13:48 +0800, Li Tao-B22598 wrote:
> Dear all,
> 
> I have a problem in MPC5121 sleep mode. As you know MPC5121 use e300c4
> core. When I make the e300c4 core into sleep mode, it will return to
> full power mode when the“decrementer interrupt” occurred.
> 
> But in the e300 core reference manual said that the “decrementer
> interrupt”have no effect when e300 core in sleep mode, because the
> time
> base and decrementer are disabled while the core is in sleep mode.
> Can anybody explain about this procedure ?


Please talk to people internal to freescale. There is errata on this
that is known for a long time(more than a year now) that for some reason
is never entered into the errata document. 

I'm a bit irritated that it's not as the "solution" can mean hardware
changes an thus it's potentially expensive.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev