From: Wolfgang Denk <wd@denx.de>
To: zjzhou@newrocktech.com
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: reboot by software
Date: Tue, 16 Dec 2003 11:24:51 +0100 [thread overview]
Message-ID: <20031216102456.E79DEC5F5F@atlas.denx.de> (raw)
In-Reply-To: Your message of "Tue, 16 Dec 2003 17:38:46 +0800." <000101c3c3b8$68333110$b702a8c0@newrock2>
Dear John,
in message <000101c3c3b8$68333110$b702a8c0@newrock2> you wrote:
>
> I have a linux running on my mpc8260 board( power on reset at
> 0xfff00100, I use 32 bit flash, and directly maping 0xF0000000 ~
> 0xFFFFFFF in kernel).
>
> Now, I want to reboot system by software. But, when I jump to
> 0xfff00100 in kernel mode, it's going dead. Can anybody help me?
Jumping to some address does not cause a reboot of the system. After
a reset, the CPU state (especially the state of the memory
controller) is somewhat special. The safest way to cause a clean
reboot of the whole system is to actually go through a reset.
Try something like this:
void
m8260_restart(char *cmd)
{
__volatile__ unsigned char dummy;
__volatile__ unsigned int msr;
uint bad_addr;
/* 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);
}
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd@denx.de
Bankers do it with interest (penalty for early withdrawal).
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next prev parent reply other threads:[~2003-12-16 10:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-16 8:38 ELDK and suse 9.0 Kate Alhola
2003-12-16 8:50 ` Steven Scholz
2003-12-16 9:38 ` reboot by software John Zhou
2003-12-16 10:24 ` Wolfgang Denk [this message]
2003-12-16 13:10 ` Gary Thomas
2003-12-16 10:12 ` ELDK and suse 9.0 Wolfgang Denk
-- strict thread matches above, loose matches on Subject: below --
2003-12-16 13:16 reboot by software VanBaren, Gerald (AGRE)
2003-12-16 14:40 Wells, Charles
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=20031216102456.E79DEC5F5F@atlas.denx.de \
--to=wd@denx.de \
--cc=linuxppc-embedded@lists.linuxppc.org \
--cc=zjzhou@newrocktech.com \
/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).