1 // SPDX-License-Identifier: GPL-2.0+
4 * (C) Copyright 2000-2003
7 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
18 #include <asm/immap.h>
21 DECLARE_GLOBAL_DATA_PTR;
23 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
25 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
27 out_be16(&gptmr->pre, 10);
28 out_be16(&gptmr->cnt, 1);
30 /* enable watchdog, set timeout to 0 and wait */
31 out_8(&gptmr->mode, GPT_TMS_SGPIO);
32 out_8(&gptmr->ctrl, GPT_CTRL_WDEN | GPT_CTRL_CE);
34 /* we don't return! */
38 #if defined(CONFIG_DISPLAY_CPUINFO)
39 int print_cpuinfo(void)
41 siu_t *siu = (siu_t *) MMAP_SIU;
46 switch ((in_be32(&siu->jtagid) & 0x000FF000) >> 12) {
86 char buf1[32], buf2[32];
88 printf("Freescale MCF%d\n", id);
89 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
90 strmhz(buf1, gd->cpu_clk),
91 strmhz(buf2, gd->bus_clk));
96 #endif /* CONFIG_DISPLAY_CPUINFO */
98 #if defined(CONFIG_HW_WATCHDOG)
99 /* Called by macro WATCHDOG_RESET */
100 void hw_watchdog_reset(void)
102 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
104 out_8(&gptmr->ocpw, 0xa5);
107 int watchdog_disable(void)
109 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
111 /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
112 out_8(&gptmr->mode, 0);
113 out_8(&gptmr->ctrl, 0);
115 puts("WATCHDOG:disabled\n");
120 int watchdog_init(void)
122 gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
124 out_be16(&gptmr->pre, CONFIG_WATCHDOG_TIMEOUT);
125 out_be16(&gptmr->cnt, CONFIG_SYS_TIMER_PRESCALER * 1000);
127 out_8(&gptmr->mode, GPT_TMS_SGPIO);
128 out_8(&gptmr->ctrl, GPT_CTRL_CE | GPT_CTRL_WDEN);
129 puts("WATCHDOG:enabled\n");
133 #endif /* CONFIG_HW_WATCHDOG */
135 #if defined(CONFIG_FSLDMAFEC) || defined(CONFIG_MCFFEC)
136 /* Default initializations for MCFFEC controllers. To override,
137 * create a board-specific function called:
138 * int board_eth_init(bd_t *bis)
141 int cpu_eth_init(bd_t *bis)
143 #if defined(CONFIG_FSLDMAFEC)
144 mcdmafec_initialize(bis);
146 #if defined(CONFIG_MCFFEC)
147 mcffec_initialize(bis);