linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* mpc8xx - power save modes - PIT
@ 2002-10-10 18:35 Patrick Mahoney
  2002-10-10 21:49 ` Conn Clark
  0 siblings, 1 reply; 19+ messages in thread
From: Patrick Mahoney @ 2002-10-10 18:35 UTC (permalink / raw)
  To: linuxppc-embedded


Hello pple,

My setup: MPC850 on a RPXlite_dw board.

My problem:

I am trying toggle between power saving modes and evaluate the current
drops with an ampermeter.

I succeeded in switching to several power modes, but each time i
switch, my serial connection dies, even if i switch to the  'normal
low mode', which is supposed to keep all functionnalities  present.

I am looking to use the PIT to automatically bring back the chip to
normal full power mode.

I tried the following:

      init_timer(&timer);
      timer.expires=1000;
      timer.function=timer_handler;
      add_timer(&timer);

without success. The kernel oops'es everytime. Ive been browsing the
kernel sources, but have yet to see where the PIT was
initialized/used.

Would anyone have successfully used the several power modes of the
mpc850 (or equivalent) through linux 2.4? If so, is there any code
snippet available?

Also, do you have any idea as to why the serial connection dies? Is it
a uart syncing -type problem?

Best regards,


Pat Mahoney

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: mpc8xx - power save modes - PIT
@ 2002-10-11 13:15 Steven Blakeslee
  2002-10-11 16:08 ` Patrick Mahoney
  0 siblings, 1 reply; 19+ messages in thread
From: Steven Blakeslee @ 2002-10-11 13:15 UTC (permalink / raw)
  To: 'Patrick Mahoney'; +Cc: 'linuxppc-embedded@lists.linuxppc.org'


In the 850 user manual I found the following to describe the SCCR[DNFH].
"Division factor high frequency. Sets the VCOOUT frequency division factor
for general system
clocks to be used in normal mode. In normal mode, the MPC850 automatically
switches to the
DFNH frequency. To select the DFNH frequency, load this Þeld with the divide
value and clear
CSRC. A loss-of-lock condition does not occur when this Þeld is changed.
This Þeld is cleared by a power-on or hard reset."

You have the following code.
imp->im_clkrst.car_plprcr |= 1<<21;		// plprcr[csrc]=1

It seems like it should be cleared, not set.




-----Original Message-----
From: Patrick Mahoney [mailto:pmahoney@8d.com]
Sent: Thursday, October 10, 2002 4:47 PM
To: Steven Blakeslee
Subject: Re: mpc8xx - power save modes - PIT


I therefore conclude that the register MSB is in the variable
LBS. Thats always goot to know! :) Thanks for the tip...

... but i still lose my console when i switch eith power mode or clock
divider. Ex:

    /* Normal high mode
     * clock divider set to 2
     * (sccr[dfnh]=110)
     */
    imp = (immap_t *)IMAP_ADDR;
    imp->im_clkrst.car_sccr &= ~(0x7<<5);
    imp->im_clkrst.car_sccr |= 0x1<<5;

Would you happen to know why?
Thanks again,


Pat Mahoney



On Thu, Oct 10, 2002 at 04:20:34PM -0400, Steven Blakeslee wrote:
> The line
> imp->im_clkrst.car_plprcr |= 1<<21;
> seems to be incorrect.  This line sets bit 10.  If you are setting
> plprcr[csrc] you would do the following
> imp->im_clkrst.car_plprcr |= 0x80;
>
> The line
> imp->im_clkrst.car_plprcr &= ~(0x3<<22);
> seems to be incorrect.  This line clears 9 and 8.  If you want to clear
> PLPRCR[LPM] you would do the following
> imp->im_clkrst.car_plprcr &= ~(0x100 | 0x200);
>
>
>
> -----Original Message-----
> From: Patrick Mahoney [mailto:pmahoney@8d.com]
> Sent: Thursday, October 10, 2002 3:40 PM
> To: Steven Blakeslee
> Subject: Re: mpc8xx - power save modes - PIT
>
>
> That was supposed to be:
>
>     /* Normal low mode
>      */
>     imp = (immap_t *)IMAP_ADDR;
>     imp->im_clkrstk.cark_plprcrk = ~KAPWR_KEY;
>     imp->im_clkrstk.cark_plprcrk = KAPWR_KEY;
>     imp->im_clkrst.car_plprcr |= 1<<21;
>     imp->im_clkrst.car_plprcr &= ~(0x3<<22);
>
> Sorry bout that.
> Thanks again,
>
>
> Pat Mahoney
>
>
> On Thu, Oct 10, 2002 at 03:33:19PM -0400, Patrick Mahoney wrote:
> > Hi Steven,
> >
> > In my module's init_module function, i do:
> >
> >     /* Normal low mode
> >      * ref: p. 14-21 of mpc850 ref book.
> >      */
> >     imp = (immap_t *)IMAP_ADDR;
> >     imp->im_clkrstk.cark_sccrk = ~KAPWR_KEY;	// unlock the
> >     imp->im_clkrstk.cark_sccrk = KAPWR_KEY;	// 	register key
> >     imp->im_clkrst.car_plprcr |= 1<<21;		// plprcr[csrc]=1
> >     imp->im_clkrst.car_plprcr &= ~(0x3<<22);	// PLPRCR[LPM]=00
> >
> > Did you succeed in toggling between power modes?
> >
> > Thanks for your support.
> > Best regards,
> >
> >
> > Pat Mahoney
> >
> > On Thu, Oct 10, 2002 at 03:19:58PM -0400, Steven Blakeslee wrote:
> > > What are you doing to put the processor into low power mode?  What
> registers
> > > are you changing?
> > >
> > >
> > > -----Original Message-----
> > > From: Patrick Mahoney [mailto:pmahoney@8d.com]
> > > Sent: Thursday, October 10, 2002 2:35 PM
> > > To: linuxppc-embedded@lists.linuxppc.org
> > > Subject: mpc8xx - power save modes - PIT
> > >
> > >
> > >
> > > Hello pple,
> > >
> > > My setup: MPC850 on a RPXlite_dw board.
> > >
> > > My problem:
> > >
> > > I am trying toggle between power saving modes and evaluate the current
> > > drops with an ampermeter.
> > >
> > > I succeeded in switching to several power modes, but each time i
> > > switch, my serial connection dies, even if i switch to the  'normal
> > > low mode', which is supposed to keep all functionnalities  present.
> > >
> > > I am looking to use the PIT to automatically bring back the chip to
> > > normal full power mode.
> > >
> > > I tried the following:
> > >
> > >       init_timer(&timer);
> > >       timer.expires=1000;
> > >       timer.function=timer_handler;
> > >       add_timer(&timer);
> > >
> > > without success. The kernel oops'es everytime. Ive been browsing the
> > > kernel sources, but have yet to see where the PIT was
> > > initialized/used.
> > >
> > > Would anyone have successfully used the several power modes of the
> > > mpc850 (or equivalent) through linux 2.4? If so, is there any code
> > > snippet available?
> > >
> > > Also, do you have any idea as to why the serial connection dies? Is it
> > > a uart syncing -type problem?
> > >
> > > Best regards,
> > >
> > >
> > > Pat Mahoney
> > >

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: mpc8xx - power save modes - PIT
@ 2002-10-16  6:00 Cameron Rich
  2002-10-16 13:22 ` Patrick Mahoney
  2002-10-16 17:29 ` Conn Clark
  0 siblings, 2 replies; 19+ messages in thread
From: Cameron Rich @ 2002-10-16  6:00 UTC (permalink / raw)
  To: 'Conn Clark', Patrick Mahoney; +Cc: May Ling List


Hi,

I've been following this series of emails closely as we are interested in
low power mode also.

I've tried Conn's code, but I'm experiencing problems with PLPRCR[CSCR] as
being 1 all the time after a rfi. I am also occasionally seeing MSR_POW set
to 1 after the rfi return.

I can work around this problem by setting PLPRCR[CSCR] = 0 and MSR_POW = 0
after the rfi and this eventually works. But is this the solution? I'm also
noticing no great decrease in power consumption even though I've only got a
couple of (sleeping) processes. And it seems that there is (mostly) no time
between entering Doze Low mode and the rfi which confirms the unsatisfactory
power consumption figures.

I have SCCR[CPQEN] (and SCCR[PRQEN]) set to 1.

I'm using a PPC850 processor with Doze Low mode set. DFNL=DFNH=0 and I'm
running 2.4.17 (with a RTAI patch).

Cheers,

Cameron


-----Original Message-----
From: Conn Clark [mailto:clark@esteem.com]
Sent: Wednesday, 16 October 2002 11:09 AM
To: Patrick Mahoney
Cc: May Ling List
Subject: Re: mpc8xx - power save modes - PIT



Patrick Mahoney wrote:
>
> Hello Conn,
>
> Progress has been made... I can succesfully raise the clock rate
> divider up to a factor of 8 before the kernel starts. This makes the
> current consumption drop from 0.41A to 0.32A...

Where are you doing this?
Is the divide by 8 in the SCCR[DFNH] or SCCR[DFNL]?
If you are going to have a SCCR[DFNL] divider that drops your clock
speed below 24MHz you need to set the SCCR[CRQEN] bit to keep ethernet
working. (assuming your DFNH keeps it above 24MHz)

>
> Also, the timer thing, that was a rookie mistake... The timer variable
> was declared on init_module stack, which disappeared before the timer
> interrupt. (Thanks to Hollis for that one).
>
> One more thing. I thought I had SCCR[PRQEN] set, but I did not. Thats
> why your idle.c hack caused a hang before the shell came up. I now
> set SCCR[PRQEN] from the planetcore bootloader and can reach the
> shell.
>
> phew!
>
> All right... Now I know 'idled' gets called... The thing is... Power
> consumption stays the same! :(

Power consumption will stay the same as long as you aren't taxing the
CPU with some task. When you have task running that that needs scheduling
it prevents the idle loop from running the power saving code. When the
CPU is kept busy chewing on this task power consumption should rise back
to about what it was before.

>  The only modification i brought is
> going into doze high instead of doze low... Going to doze low changes
> the clock rate and hangs my kernel...


Could you check and see what you have the SCCR[CRQEN] set to?
I belive if your SCCR[DFNL] is set to a divide ratio that is to high
it could keep the CPM from functioning correctly if the SCCR[CRQEN]
bit is not set. If this bit is set your processor should pop back
into normal high mode for any CPM activity.

I recommend that you set the SCCR[DFNH] to divide by 1 (000 binary)
and SCCR[DFNL] to divide by 8 (010 binary) since your board seems to
function that slowly. Also make sure that the SCCR[CRQEN] bit is set.

IF this works we might beable to try a higher division factor in your
SCCR[DFNL] to save more power.

> Here is my comment-stripped
> loop:
>
>                 while(!current->need_resched) {
>                         _nmask_and_or_msr( ( MSR_POW | MSR_EE ), 0);
>                         ((immap_t *)IMAP_ADDR)->im_clkrstk.cark_plprcrk =
KAPWR_KEY;
>                         reg = ((immap_t
*)IMAP_ADDR)->im_clkrst.car_plprcr;
>                         ((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr = reg
;
>                         reg &= 0xFFFFF8FF;
>                         ((immap_t *)IMAP_ADDR)->im_clkrstk.cark_plprcrk =
KAPWR_KEY;
>                         reg |= 0x00000100;
>                         ((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr =
reg;
>                         _nmask_and_or_msr(0, MSR_POW | MSR_EE);
>                 }
>                 schedule();
>                 check_pgt_cache();
>
> Waddaya think?
> Thanks for you help,
>
> Pat Mahoney
>
> On Thu, Oct 10, 2002 at 02:49:32PM -0700, Conn Clark wrote:
> > Patrick Mahoney wrote:
> > >
> > > Hello pple,

<snip>

> > }
> > #endif

	Your idle loop should work fine. I still don't see why Doze Low mode
hangs your kernel. If you have the SCCR[CRQEN] bit set the only time the CPU
should be in Doze Low mode is when its in the idle loop and no CPM activity
is present. If there is CPM activity it should transparently pop into Doze
High mode then back after the CPM activity has finished. Any interupt should
snap it out of either Doze mode and into Normal High mode until the idle
loop
power saving code gets executed again. If the SCCR[CRQEN] bit is set then
Doze High and Doze Low modes in the idle loop should be indistingushable
from
one another.

There has to be something fishy about a setting for this not to work.

Please keep me advised.

	Conn
--

*****************************************************************
  If you live at home long enough, your parents will move out.
 (Warning they may try to sell their house out from under you.)
*****************************************************************

Conn Clark
Engineering Stooge				clark@esteem.com
Electronic Systems Technology Inc.		www.esteem.com


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2002-10-21 15:52 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-10 18:35 mpc8xx - power save modes - PIT Patrick Mahoney
2002-10-10 21:49 ` Conn Clark
2002-10-10 23:00   ` Patrick Mahoney
2002-10-11  1:42     ` Conn Clark
2002-10-11 15:59       ` Patrick Mahoney
2002-10-11 17:05         ` Conn Clark
2002-10-11 17:17           ` Patrick Mahoney
     [not found]       ` <20021021133451.GA16540@segfault.usine.8d.com>
2002-10-21 15:52         ` Conn Clark
     [not found]   ` <20021015225625.GA8153@segfault.usine.8d.com>
2002-10-16  1:08     ` Conn Clark
2002-10-16 15:42       ` Patrick Mahoney
     [not found]       ` <20021016130153.GA16430@segfault.usine.8d.com>
2002-10-16 18:14         ` Conn Clark
  -- strict thread matches above, loose matches on Subject: below --
2002-10-11 13:15 Steven Blakeslee
2002-10-11 16:08 ` Patrick Mahoney
2002-10-16  6:00 Cameron Rich
2002-10-16 13:22 ` Patrick Mahoney
2002-10-16 20:00   ` Conn Clark
2002-10-17 19:58     ` Patrick Mahoney
2002-10-17 21:50       ` Conn Clark
2002-10-16 17:29 ` Conn Clark

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).