linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Execute Reset via CheckStop approach
@ 2002-07-23 13:45 Steven Vacca
  2002-07-23 13:54 ` Wolfgang Denk
  2002-07-24  5:19 ` Govindan
  0 siblings, 2 replies; 7+ messages in thread
From: Steven Vacca @ 2002-07-23 13:45 UTC (permalink / raw)
  To: LinuxEmbeddedMailList (E-mail)


I would like to execute an Internal Hard Reset on an MPC860T
bd. using the Checkstop Reset approach.

Does anyone have some code that I could utilize to implement
this?

Thanks,

ShutEye Thinkin
Valcom, Inc.

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

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

* Re: Execute Reset via CheckStop approach
  2002-07-23 13:45 Execute Reset via CheckStop approach Steven Vacca
@ 2002-07-23 13:54 ` Wolfgang Denk
  2002-07-24  5:19 ` Govindan
  1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2002-07-23 13:54 UTC (permalink / raw)
  To: svacca@valcom.com; +Cc: LinuxEmbeddedMailList (E-mail)


In message <01C2322D.B3A24AF0.svacca@valcom.com> you wrote:
>
> I would like to execute an Internal Hard Reset on an MPC860T
> bd. using the Checkstop Reset approach.

THis is what we do on all 8xx and 8260 systems.

> Does anyone have some code that I could utilize to implement
> this?

Sure. Check out our 2.4.4 kernel tree; see
http://www.denx.de/solutions-en.html#CVS-Linux

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Nothing ever becomes real till it is experienced -- even a proverb is
no proverb to you till your life has illustrated it.     - John Keats

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

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

* RE: Execute Reset via CheckStop approach
  2002-07-23 13:45 Execute Reset via CheckStop approach Steven Vacca
  2002-07-23 13:54 ` Wolfgang Denk
@ 2002-07-24  5:19 ` Govindan
  2002-07-24 15:46   ` Wolfgang Denk
  1 sibling, 1 reply; 7+ messages in thread
From: Govindan @ 2002-07-24  5:19 UTC (permalink / raw)
  To: svacca, LinuxEmbeddedMailList (E-mail), govindan


Here is something we found working:
-Govindan

#include <asm/8xx_immap.h>
#include <asm/mpc8xx.h>

#define IMAP_ADDR         ((uint)0xff000000)        /* Internal memory map
address for our board. */
#define PLPRCR_CSR      0x00000080      /* CheskStop Reset value */
int csreset (void)
{
      unsigned int msr,addr;

      ((volatile immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= PLPRCR_CSR;
      /* Interrupts and MMU off */
      asm("mtspr 81,0");
      asm("mfmsr %0": "=r"(msr));
      msr &= ~0x1030;
      asm ("mtmsr %0" : /* no output */ : "r" (msr));

      addr = 0x10000000;  // This should be a non-accessible memory
location.
      ((void (*)(void ))addr)();
        return 0;
}

-----Original Message-----
From: owner-linuxppc-embedded@lists.linuxppc.org
[mailto:owner-linuxppc-embedded@lists.linuxppc.org]On Behalf Of Steven
Vacca
Sent: Tuesday, July 23, 2002 7:16 PM
To: LinuxEmbeddedMailList (E-mail); govindan@tejasnetworks.com
Subject: Execute Reset via CheckStop approach



I would like to execute an Internal Hard Reset on an MPC860T
bd. using the Checkstop Reset approach.

Does anyone have some code that I could utilize to implement
this?

Thanks,

ShutEye Thinkin
Valcom, Inc.


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

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

* Re: Execute Reset via CheckStop approach
  2002-07-24  5:19 ` Govindan
@ 2002-07-24 15:46   ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2002-07-24 15:46 UTC (permalink / raw)
  To: govindan; +Cc: svacca, LinuxEmbeddedMailList (E-mail), govindan


In message <NEBBINFJMPEFJBMDGBGMAEOGFAAA.govindan@india.tejasnetworks.com> you wrote:
>
> Here is something we found working:
...
>       addr = 0x10000000;  // This should be a non-accessible memory
> location.

The big disadvantage of this approach is that it works on one  board,
and fails on another - or even on the same board after you added some
more RAM, etc.

We solved this problem in our version (see the  CVS)  by  explicitely
invalidating the mapping in the memory controller:

        /* Get base address mapped by BR0/OR0
         */
        bad_addr = ((immap_t *)IMAP_ADDR)->im_memctl.memc_br0 & 0xFFFF8000;
        cli();

        /* Enable CheckStop Reset
         */
        ((immap_t *)IMAP_ADDR)->im_clkrst.car_rmr |= 0x00000001;

        /* Invalidate BR0 mapping
         */
        ((immap_t *)IMAP_ADDR)->im_memctl.memc_br0 = 0;

        /* Set MSR and cause reset
         */
        __asm__("mfmsr %0" : "=r" (msr) );
        msr &= ~0x1000;
        __asm__("mtmsr %0" : "=r" (msr) );
        dummy = * (unsigned char *) bad_addr;
        printk("Restart failed\n");
        while(1);


Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Microsoft Compatibility:
     your old Windows 3.11 application crash exactly as the new ones.

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

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

* Re: Execute Reset via CheckStop approach
       [not found] <3D6612BA.730D7A25@ardistech.com>
@ 2002-08-23 11:33 ` Wolfgang Denk
  2002-08-23 13:23   ` bart
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2002-08-23 11:33 UTC (permalink / raw)
  To: bart; +Cc: govindan, svacca, LinuxEmbeddedMailList (E-mail), govindan


In message <3D6612BA.730D7A25@ardistech.com> you wrote:
>
> But this is not enough. It looks like the CHSTP bit in the DER (Debug Enable
> Regsiter) is set preventing the HRESET_N sequence from the CPU. This DER is
> not a normal special register. Do you have an example how I can clear it?

The DER should be set by your formware. Fix this!

And the DER _is_ a normal special register (# 149).


Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
...when fits of creativity run strong, more than  one  programmer  or
writer  has  been  known to abandon the desktop for the more spacious
floor.                                             - Fred Brooks, Jr.

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

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

* Re: Execute Reset via CheckStop approach
  2002-08-23 11:33 ` Wolfgang Denk
@ 2002-08-23 13:23   ` bart
  2002-08-23 13:36     ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: bart @ 2002-08-23 13:23 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: govindan, svacca, LinuxEmbeddedMailList (E-mail), govindan


Hi Wolfgang,

> The DER should be set by your formware. Fix this!
>
I cleared CFG_DER in ppcboot to clear the CHSTP bit. After that I needed to
map in the br0 range and to make the asm's volatile and set the input/output
parameters of the asm to get the HRESET_N pulse. So this is the version
which works (on a MPC823e) in the context of the Linux kernel:

        /* Get base address mapped by BR0/OR0 and map it in */
        val = ((immap_t *)IMAP_ADDR)->im_memctl.memc_br0 & 0xFFFF8000;
	val = (int) ioremap( retval, 0x4000 );
        cli();

        /* Enable CheckStop Reset */
        ((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= 0x00000080;

        /* Invalidate BR0 mapping */
        ((immap_t *)IMAP_ADDR)->im_memctl.memc_br0 &= ~0x1;

        /* Clear ME in MSR and cause CheckStop */
        __asm__ volatile("mfmsr %0" : "=r" (msr) );
        msr &= ~0x1000;
        __asm__ volatile("mtmsr %0": : "r" (msr) );
        val = * (unsigned char *) val;
        printk("Restart failed\n");
        while(1)
	   ;

Cheers,
	Bart

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

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

* Re: Execute Reset via CheckStop approach
  2002-08-23 13:23   ` bart
@ 2002-08-23 13:36     ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2002-08-23 13:36 UTC (permalink / raw)
  To: bart; +Cc: govindan, svacca, LinuxEmbeddedMailList (E-mail), govindan


Hi,

in message <3D66375C.2046CFA9@ardistech.com> you wrote:
>
> I cleared CFG_DER in ppcboot to clear the CHSTP bit. After that I needed to
> map in the br0 range and to make the asm's volatile and set the input/output

Why do you think you have to do this? This is _NOT_ necessary.

> parameters of the asm to get the HRESET_N pulse. So this is the version
> which works (on a MPC823e) in the context of the Linux kernel:
>
>         /* Get base address mapped by BR0/OR0 and map it in */
>         val = ((immap_t *)IMAP_ADDR)->im_memctl.memc_br0 & 0xFFFF8000;
> 	val = (int) ioremap( retval, 0x4000 );

This code is wrong. You clobber the value of "val" here.


Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Defaults are wonderful, just like fire.
                  - Larry Wall in <1996Mar6.004121.27890@netlabs.com>

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

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

end of thread, other threads:[~2002-08-23 13:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-23 13:45 Execute Reset via CheckStop approach Steven Vacca
2002-07-23 13:54 ` Wolfgang Denk
2002-07-24  5:19 ` Govindan
2002-07-24 15:46   ` Wolfgang Denk
     [not found] <3D6612BA.730D7A25@ardistech.com>
2002-08-23 11:33 ` Wolfgang Denk
2002-08-23 13:23   ` bart
2002-08-23 13:36     ` Wolfgang Denk

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