3 * Josef Baumgartner <josef.baumgartner@telex.de>
7 * BuS Elektronik GmbH & Co. KG <esw@bus-elektronik.de>
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #include <asm/immap_5272.h>
34 #include <asm/m5272.h>
38 #include <asm/m5282.h>
39 #include <asm/immap_5282.h>
43 #include <asm/m5249.h>
48 int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
49 volatile wdog_t * wdp = (wdog_t *)(CFG_MBAR + MCFSIM_WRRR);
54 /* enable watchdog, set timeout to 0 and wait */
58 /* we don't return! */
63 ulong *dirp = (ulong *)(CFG_MBAR + MCFSIM_DIR);
68 msk = (*dirp > 28) & 0xf;
70 case 0x2: suf = "1K75N"; break;
71 case 0x4: suf = "3K75N"; break;
74 printf ("MOTOROLA MCF5272 (Mask:%01x)\n", msk);
79 printf ("MOTOROLA MCF5272 %s\n", suf);
83 #if defined(CONFIG_WATCHDOG)
84 /* Called by macro WATCHDOG_RESET */
85 void watchdog_reset (void)
87 volatile immap_t * regp = (volatile immap_t *)CFG_MBAR;
88 regp->wdog_reg.wdog_wcr = 0;
91 int watchdog_disable (void)
93 volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
95 regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
96 regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
97 regp->wdog_reg.wdog_wrrr = 0; /* disable watchdog timer */
99 puts ("WATCHDOG:disabled\n");
103 int watchdog_init (void)
105 volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
107 regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
109 /* set timeout and enable watchdog */
110 regp->wdog_reg.wdog_wrrr = ((CONFIG_WATCHDOG_TIMEOUT * CFG_HZ) / (32768 * 1000)) - 1;
111 regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
113 puts ("WATCHDOG:enabled\n");
116 #endif /* #ifdef CONFIG_WATCHDOG */
118 #endif /* #ifdef CONFIG_M5272 */
124 unsigned char resetsource;
126 printf ("CPU: MOTOROLA Coldfire MCF5282 (PIN: %2.2x REV: %2.2x)\n",
127 MCFCCM_CIR>>8,MCFCCM_CIR & MCFCCM_CIR_PRN_MASK);
129 resetsource = MCFRESET_RSR;
130 if (resetsource & MCFRESET_RSR_LOL) puts("Lose-of-lock ");
131 if (resetsource & MCFRESET_RSR_LOC) puts("Lose-of-clock ");
132 if (resetsource & MCFRESET_RSR_EXT) puts("external ");
133 if (resetsource & MCFRESET_RSR_POR) puts("Power-on ");
134 if (resetsource & MCFRESET_RSR_WDR) puts("Watchdog ");
135 if (resetsource & MCFRESET_RSR_SOFT) puts("Software ");
136 if (resetsource & MCFRESET_RSR_LVD) puts("Low-voltage ");
141 int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
143 MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
148 #ifdef CONFIG_M5249 /* test-only: todo... */
153 printf ("CPU: MOTOROLA Coldfire MCF5249 at %s MHz\n", strmhz(buf, CFG_CLK));
157 int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
158 /* enable watchdog, set timeout to 0 and wait */
159 mbar_writeByte(MCFSIM_SYPCR, 0xc0);
162 /* we don't return! */