1 // SPDX-License-Identifier: GPL-2.0+
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
8 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
19 #include <asm/immap.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
26 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
28 out_be16(&gptmr->pre, 10);
29 out_be16(&gptmr->cnt, 1);
31 /* enable watchdog, set timeout to 0 and wait */
32 out_8(&gptmr->mode, GPT_TMS_SGPIO);
33 out_8(&gptmr->ctrl, GPT_CTRL_WDEN | GPT_CTRL_CE);
35 /* we don't return! */
39 #if defined(CONFIG_DISPLAY_CPUINFO)
40 int print_cpuinfo(void)
42 siu_t *siu = (siu_t *) MMAP_SIU;
47 switch ((in_be32(&siu->jtagid) & 0x000FF000) >> 12) {
87 char buf1[32], buf2[32];
89 printf("Freescale MCF%d\n", id);
90 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
91 strmhz(buf1, gd->cpu_clk),
92 strmhz(buf2, gd->bus_clk));
97 #endif /* CONFIG_DISPLAY_CPUINFO */
99 #if defined(CONFIG_HW_WATCHDOG)
100 /* Called by macro WATCHDOG_RESET */
101 void hw_watchdog_reset(void)
103 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
105 out_8(&gptmr->ocpw, 0xa5);
108 int watchdog_disable(void)
110 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
112 /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
113 out_8(&gptmr->mode, 0);
114 out_8(&gptmr->ctrl, 0);
116 puts("WATCHDOG:disabled\n");
121 int watchdog_init(void)
123 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
125 out_be16(&gptmr->pre, CONFIG_WATCHDOG_TIMEOUT);
126 out_be16(&gptmr->cnt, CONFIG_SYS_TIMER_PRESCALER * 1000);
128 out_8(&gptmr->mode, GPT_TMS_SGPIO);
129 out_8(&gptmr->ctrl, GPT_CTRL_CE | GPT_CTRL_WDEN);
130 puts("WATCHDOG:enabled\n");
134 #endif /* CONFIG_HW_WATCHDOG */
136 #if defined(CONFIG_FSLDMAFEC) || defined(CONFIG_MCFFEC)
137 /* Default initializations for MCFFEC controllers. To override,
138 * create a board-specific function called:
139 * int board_eth_init(bd_t *bis)
142 int cpu_eth_init(bd_t *bis)
144 #if defined(CONFIG_FSLDMAFEC)
145 mcdmafec_initialize(bis);
147 #if defined(CONFIG_MCFFEC)
148 mcffec_initialize(bis);