123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- /*
- * (C) Copyright 2003
- * Josef Baumgartner <josef.baumgartner@telex.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
- #include <common.h>
- #include <watchdog.h>
- #include <command.h>
- #ifdef CONFIG_M5272
- #include <asm/immap_5272.h>
- #include <asm/m5272.h>
- #endif
- #ifdef CONFIG_M5282
- #endif
- #ifdef CONFIG_M5272
- int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
- volatile wdog_t * wdp = (wdog_t *)(CFG_MBAR + MCFSIM_WRRR);
- wdp->wdog_wrrr = 0;
- udelay (1000);
- /* enable watchdog, set timeout to 0 and wait */
- wdp->wdog_wrrr = 1;
- while (1);
- /* we don't return! */
- return 0;
- };
- int checkcpu(void) {
- ulong *dirp = (ulong *)(CFG_MBAR + MCFSIM_DIR);
- uchar msk;
- char *suf;
- puts ("CPU: ");
- msk = (*dirp > 28) & 0xf;
- switch (msk) {
- case 0x2: suf = "1K75N"; break;
- case 0x4: suf = "3K75N"; break;
- default:
- suf = NULL;
- printf ("MOTOROLA MCF5272 (Mask:%01x)\n", msk);
- break;
- }
- if (suf)
- printf ("MOTOROLA MCF5272 %s\n", suf);
- return 0;
- };
- #if defined(CONFIG_WATCHDOG)
- /* Called by macro WATCHDOG_RESET */
- void watchdog_reset (void)
- {
- volatile immap_t * regp = (volatile immap_t *)CFG_MBAR;
- regp->wdog_reg.wdog_wcr = 0;
- }
- int watchdog_disable (void)
- {
- volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
- regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
- regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
- regp->wdog_reg.wdog_wrrr = 0; /* disable watchdog timer */
- puts ("WATCHDOG:disabled\n");
- return (0);
- }
- int watchdog_init (void)
- {
- volatile immap_t *regp = (volatile immap_t *)CFG_MBAR;
- regp->wdog_reg.wdog_wirr = 0; /* disable watchdog interrupt */
- /* set timeout and enable watchdog */
- regp->wdog_reg.wdog_wrrr = ((CONFIG_WATCHDOG_TIMEOUT * CFG_HZ) / (32768 * 1000)) - 1;
- regp->wdog_reg.wdog_wcr = 0; /* reset watchdog counter */
- puts ("WATCHDOG:enabled\n");
- return (0);
- }
- #endif /* #ifdef CONFIG_WATCHDOG */
- #endif /* #ifdef CONFIG_M5272 */
- #ifdef CONFIG_M5282
- int checkcpu (void)
- {
- puts ("CPU: MOTOROLA Coldfire MCF5282\n");
- return 0;
- }
- int do_reset (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) {
- return 0;
- };
- #endif
|