3 * (C) Copyright 2000-2003
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Copyright (C) 2004-2007, 2012 Freescale Semiconductor, Inc.
7 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
9 * SPDX-License-Identifier: GPL-2.0+
17 #include <asm/immap.h>
20 DECLARE_GLOBAL_DATA_PTR
;
22 int do_reset(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
24 gptmr_t
*gptmr
= (gptmr_t
*) (MMAP_GPTMR
);
26 out_be16(&gptmr
->pre
, 10);
27 out_be16(&gptmr
->cnt
, 1);
29 /* enable watchdog, set timeout to 0 and wait */
30 out_8(&gptmr
->mode
, GPT_TMS_SGPIO
);
31 out_8(&gptmr
->ctrl
, GPT_CTRL_WDEN
| GPT_CTRL_CE
);
33 /* we don't return! */
39 siu_t
*siu
= (siu_t
*) MMAP_SIU
;
44 switch ((in_be32(&siu
->jtagid
) & 0x000FF000) >> 12) {
84 char buf1
[32], buf2
[32];
86 printf("Freescale MCF%d\n", id
);
87 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
88 strmhz(buf1
, gd
->cpu_clk
),
89 strmhz(buf2
, gd
->bus_clk
));
95 #if defined(CONFIG_HW_WATCHDOG)
96 /* Called by macro WATCHDOG_RESET */
97 void hw_watchdog_reset(void)
99 gptmr_t
*gptmr
= (gptmr_t
*) (MMAP_GPTMR
);
101 out_8(&gptmr
->ocpw
, 0xa5);
104 int watchdog_disable(void)
106 gptmr_t
*gptmr
= (gptmr_t
*) (MMAP_GPTMR
);
108 /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
109 out_8(&gptmr
->mode
, 0);
110 out_8(&gptmr
->ctrl
, 0);
112 puts("WATCHDOG:disabled\n");
117 int watchdog_init(void)
119 gptmr_t
*gptmr
= (gptmr_t
*) (MMAP_GPTMR
);
121 out_be16(&gptmr
->pre
, CONFIG_WATCHDOG_TIMEOUT
);
122 out_be16(&gptmr
->cnt
, CONFIG_SYS_TIMER_PRESCALER
* 1000);
124 out_8(&gptmr
->mode
, GPT_TMS_SGPIO
);
125 out_8(&gptmr
->ctrl
, GPT_CTRL_CE
| GPT_CTRL_WDEN
);
126 puts("WATCHDOG:enabled\n");
130 #endif /* CONFIG_HW_WATCHDOG */
132 #if defined(CONFIG_FSLDMAFEC) || defined(CONFIG_MCFFEC)
133 /* Default initializations for MCFFEC controllers. To override,
134 * create a board-specific function called:
135 * int board_eth_init(bd_t *bis)
138 int cpu_eth_init(bd_t
*bis
)
140 #if defined(CONFIG_FSLDMAFEC)
141 mcdmafec_initialize(bis
);
143 #if defined(CONFIG_MCFFEC)
144 mcffec_initialize(bis
);