1
2
3
4
5
6
7
8
9
10
11#include <common.h>
12#include <init.h>
13#include <net.h>
14#include <vsprintf.h>
15#include <watchdog.h>
16#include <command.h>
17#include <netdev.h>
18#include <linux/delay.h>
19
20#include <asm/immap.h>
21#include <asm/io.h>
22
23DECLARE_GLOBAL_DATA_PTR;
24
25int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
26{
27 rcm_t *rcm = (rcm_t *) (MMAP_RCM);
28
29 udelay(1000);
30 setbits_8(&rcm->rcr, RCM_RCR_SOFTRST);
31
32
33 return 0;
34};
35
36#if defined(CONFIG_DISPLAY_CPUINFO)
37int print_cpuinfo(void)
38{
39 ccm_t *ccm = (ccm_t *) MMAP_CCM;
40 u16 msk;
41 u16 id = 0;
42 u8 ver;
43
44 puts("CPU: ");
45 msk = (in_be16(&ccm->cir) >> 6);
46 ver = (in_be16(&ccm->cir) & 0x003f);
47 switch (msk) {
48#ifdef CONFIG_MCF5301x
49 case 0x78:
50 id = 53010;
51 break;
52 case 0x77:
53 id = 53012;
54 break;
55 case 0x76:
56 id = 53015;
57 break;
58 case 0x74:
59 id = 53011;
60 break;
61 case 0x73:
62 id = 53013;
63 break;
64#endif
65#ifdef CONFIG_MCF532x
66 case 0x54:
67 id = 5329;
68 break;
69 case 0x59:
70 id = 5328;
71 break;
72 case 0x61:
73 id = 5327;
74 break;
75 case 0x65:
76 id = 5373;
77 break;
78 case 0x68:
79 id = 53721;
80 break;
81 case 0x69:
82 id = 5372;
83 break;
84 case 0x6B:
85 id = 5372;
86 break;
87#endif
88 }
89
90 if (id) {
91 char buf1[32], buf2[32];
92
93 printf("Freescale MCF%d (Mask:%01x Version:%x)\n", id, msk,
94 ver);
95 printf(" CPU CLK %s MHz BUS CLK %s MHz\n",
96 strmhz(buf1, gd->cpu_clk),
97 strmhz(buf2, gd->bus_clk));
98 }
99
100 return 0;
101};
102#endif
103
104#if defined(CONFIG_WATCHDOG)
105
106void watchdog_reset(void)
107{
108 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
109
110
111 out_be16(&wdp->sr, 0x5555);
112 out_be16(&wdp->sr, 0xaaaa);
113}
114
115int watchdog_disable(void)
116{
117 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
118
119
120
121 setbits_be16(&wdp->cr, WTM_WCR_HALTED);
122
123 puts("WATCHDOG:disabled\n");
124 return (0);
125}
126
127int watchdog_init(void)
128{
129 wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
130 u32 wdog_module = 0;
131
132
133 wdog_module = ((CONFIG_SYS_CLK / 1000) * CONFIG_WATCHDOG_TIMEOUT);
134#ifdef CONFIG_M5329
135 out_be16(&wdp->mr, wdog_module / 8192);
136#else
137 out_be16(&wdp->mr, wdog_module / 4096);
138#endif
139
140 out_be16(&wdp->cr, WTM_WCR_EN);
141 puts("WATCHDOG:enabled\n");
142
143 return (0);
144}
145#endif
146
147#if defined(CONFIG_MCFFEC)
148
149
150
151
152int cpu_eth_init(struct bd_info *bis)
153{
154 return mcffec_initialize(bis);
155}
156#endif
157