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-2008, 2012 Freescale Semiconductor, Inc.
8 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
18 #include <linux/delay.h>
20 #include <asm/immap.h>
23 DECLARE_GLOBAL_DATA_PTR;
25 int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
27 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
30 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
32 /* we don't return! */
36 #if defined(CONFIG_DISPLAY_CPUINFO)
37 int print_cpuinfo(void)
39 ccm_t *ccm = (ccm_t *) MMAP_CCM;
45 msk = (in_be16(&ccm->cir) >> 6);
46 ver = (in_be16(&ccm->cir) & 0x003f);
48 #ifdef CONFIG_MCF5301x
91 char buf1[32], buf2[32];
93 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
95 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
96 strmhz(buf1, gd->cpu_clk),
97 strmhz(buf2, gd->bus_clk));
102 #endif /* CONFIG_DISPLAY_CPUINFO */
104 #if defined(CONFIG_WATCHDOG)
105 /* Called by macro WATCHDOG_RESET */
106 void watchdog_reset(void)
108 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
111 out_be16(&wdp->sr, 0x5555);
112 out_be16(&wdp->sr, 0xaaaa);
115 int watchdog_disable(void)
117 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
119 /* UserManual, once the wdog is disabled, wdog cannot be re-enabled */
120 /* halted watchdog timer */
121 setbits_be16(&wdp->cr, WTM_WCR_HALTED);
123 puts("WATCHDOG:disabled\n");
127 int watchdog_init(void)
129 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
132 /* set timeout and enable watchdog */
133 wdog_module = ((CONFIG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT);
135 out_be16(&wdp->mr, wdog_module / 8192);
137 out_be16(&wdp->mr, wdog_module / 4096);
140 out_be16(&wdp->cr, WTM_WCR_EN);
141 puts("WATCHDOG:enabled\n");
145 #endif /* CONFIG_WATCHDOG */
147 #if defined(CONFIG_MCFFEC)
148 /* Default initializations for MCFFEC controllers. To override,
149 * create a board-specific function called:
150 * int board_eth_init(bd_t *bis)
152 int cpu_eth_init(bd_t *bis)
154 return mcffec_initialize(bis);