blob: 7096b107e540d7fb91bbb3b096713161b1c77b14 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Jon Loeligerd68e2ba2006-05-30 17:47:00 -05002/*
Timur Tabi7ba8b322010-03-31 17:44:13 -05003 * Copyright 2006,2010 Freescale Semiconductor
Jon Loeligerd68e2ba2006-05-30 17:47:00 -05004 * Jeff Brown
5 * Srikanth Srinivasan (srikanth.srinivasan@freescale.com)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -05006 */
7
8#include <common.h>
Jon Loeligerd68e2ba2006-05-30 17:47:00 -05009#include <command.h>
Andy Flemingdb2b5bd2008-08-31 16:33:30 -050010#include <asm/io.h>
Jon Loeliger4eab6232008-01-15 13:42:41 -060011
Timur Tabi7ba8b322010-03-31 17:44:13 -050012#define pixis_base (u8 *)PIXIS_BASE
Haiying Wang57b6e9c2007-01-22 12:37:30 -060013
14/*
15 * Simple board reset.
16 */
17void pixis_reset(void)
18{
Kumar Gala146c4b22009-07-22 10:12:39 -050019 out_8(pixis_base + PIXIS_RST, 0);
Haiying Wang57b6e9c2007-01-22 12:37:30 -060020
Timur Tabi7ba8b322010-03-31 17:44:13 -050021 while (1);
22}
Haiying Wang57b6e9c2007-01-22 12:37:30 -060023
Jon Loeligerd68e2ba2006-05-30 17:47:00 -050024/*
25 * Per table 27, page 58 of MPC8641HPCN spec.
26 */
Timur Tabi7ba8b322010-03-31 17:44:13 -050027static int set_px_sysclk(unsigned long sysclk)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -050028{
29 u8 sysclk_s, sysclk_r, sysclk_v, vclkh, vclkl, sysclk_aux;
30
31 switch (sysclk) {
32 case 33:
33 sysclk_s = 0x04;
34 sysclk_r = 0x04;
35 sysclk_v = 0x07;
36 sysclk_aux = 0x00;
37 break;
38 case 40:
39 sysclk_s = 0x01;
40 sysclk_r = 0x1F;
41 sysclk_v = 0x20;
42 sysclk_aux = 0x01;
43 break;
44 case 50:
45 sysclk_s = 0x01;
46 sysclk_r = 0x1F;
47 sysclk_v = 0x2A;
48 sysclk_aux = 0x02;
49 break;
50 case 66:
51 sysclk_s = 0x01;
52 sysclk_r = 0x04;
53 sysclk_v = 0x04;
54 sysclk_aux = 0x03;
55 break;
56 case 83:
57 sysclk_s = 0x01;
58 sysclk_r = 0x1F;
59 sysclk_v = 0x4B;
60 sysclk_aux = 0x04;
61 break;
62 case 100:
63 sysclk_s = 0x01;
64 sysclk_r = 0x1F;
65 sysclk_v = 0x5C;
66 sysclk_aux = 0x05;
67 break;
68 case 134:
69 sysclk_s = 0x06;
70 sysclk_r = 0x1F;
71 sysclk_v = 0x3B;
72 sysclk_aux = 0x06;
73 break;
74 case 166:
75 sysclk_s = 0x06;
76 sysclk_r = 0x1F;
77 sysclk_v = 0x4B;
78 sysclk_aux = 0x07;
79 break;
80 default:
81 printf("Unsupported SYSCLK frequency.\n");
82 return 0;
83 }
84
Jon Loeliger4fbb09c2006-08-22 12:25:27 -050085 vclkh = (sysclk_s << 5) | sysclk_r;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -050086 vclkl = sysclk_v;
87
Kumar Gala146c4b22009-07-22 10:12:39 -050088 out_8(pixis_base + PIXIS_VCLKH, vclkh);
89 out_8(pixis_base + PIXIS_VCLKL, vclkl);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -050090
Kumar Gala146c4b22009-07-22 10:12:39 -050091 out_8(pixis_base + PIXIS_AUX, sysclk_aux);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -050092
93 return 1;
94}
95
Timur Tabi7ba8b322010-03-31 17:44:13 -050096/* Set the CFG_SYSPLL bits
97 *
98 * This only has effect if PX_VCFGEN0[SYSPLL]=1, which is true if
99 * read_from_px_regs() is called.
100 */
101static int set_px_mpxpll(unsigned long mpxpll)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500102{
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500103 switch (mpxpll) {
104 case 2:
105 case 4:
106 case 6:
107 case 8:
108 case 10:
109 case 12:
110 case 14:
111 case 16:
Timur Tabi7ba8b322010-03-31 17:44:13 -0500112 clrsetbits_8(pixis_base + PIXIS_VSPEED1, 0x1F, mpxpll);
113 return 1;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500114 }
115
Timur Tabi7ba8b322010-03-31 17:44:13 -0500116 printf("Unsupported MPXPLL ratio.\n");
117 return 0;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500118}
119
Timur Tabi7ba8b322010-03-31 17:44:13 -0500120static int set_px_corepll(unsigned long corepll)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500121{
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500122 u8 val;
123
Timur Tabi7ba8b322010-03-31 17:44:13 -0500124 switch (corepll) {
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500125 case 20:
126 val = 0x08;
127 break;
128 case 25:
129 val = 0x0C;
130 break;
131 case 30:
132 val = 0x10;
133 break;
134 case 35:
135 val = 0x1C;
136 break;
137 case 40:
138 val = 0x14;
139 break;
140 case 45:
141 val = 0x0E;
142 break;
143 default:
144 printf("Unsupported COREPLL ratio.\n");
145 return 0;
146 }
147
Timur Tabi7ba8b322010-03-31 17:44:13 -0500148 clrsetbits_8(pixis_base + PIXIS_VSPEED0, 0x1F, val);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500149 return 1;
150}
151
Tom Rini364d0022023-01-10 11:19:45 -0500152#ifndef CFG_SYS_PIXIS_VCFGEN0_ENABLE
153#define CFG_SYS_PIXIS_VCFGEN0_ENABLE 0x1C
Timur Tabi7ba8b322010-03-31 17:44:13 -0500154#endif
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500155
Timur Tabi7ba8b322010-03-31 17:44:13 -0500156/* Tell the PIXIS where to find the COREPLL, MPXPLL, SYSCLK values
157 *
158 * The PIXIS can be programmed to look at either the on-board dip switches
159 * or various other PIXIS registers to determine the values for COREPLL,
160 * MPXPLL, and SYSCLK.
161 *
Tom Rini364d0022023-01-10 11:19:45 -0500162 * CFG_SYS_PIXIS_VCFGEN0_ENABLE is the value to write to the PIXIS_VCFGEN0
Timur Tabi7ba8b322010-03-31 17:44:13 -0500163 * register that tells the pixis to use the various PIXIS register.
164 */
165static void read_from_px_regs(int set)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500166{
Kumar Gala146c4b22009-07-22 10:12:39 -0500167 u8 tmp = in_8(pixis_base + PIXIS_VCFGEN0);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500168
169 if (set)
Tom Rini364d0022023-01-10 11:19:45 -0500170 tmp = tmp | CFG_SYS_PIXIS_VCFGEN0_ENABLE;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500171 else
Tom Rini364d0022023-01-10 11:19:45 -0500172 tmp = tmp & ~CFG_SYS_PIXIS_VCFGEN0_ENABLE;
Timur Tabi7ba8b322010-03-31 17:44:13 -0500173
Kumar Gala146c4b22009-07-22 10:12:39 -0500174 out_8(pixis_base + PIXIS_VCFGEN0, tmp);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500175}
176
Tom Rini364d0022023-01-10 11:19:45 -0500177/* CFG_SYS_PIXIS_VBOOT_ENABLE is the value to write to the PX_VCFGEN1
Timur Tabi7ba8b322010-03-31 17:44:13 -0500178 * register that tells the pixis to use the PX_VBOOT[LBMAP] register.
179 */
Tom Rini364d0022023-01-10 11:19:45 -0500180#ifndef CFG_SYS_PIXIS_VBOOT_ENABLE
181#define CFG_SYS_PIXIS_VBOOT_ENABLE 0x04
Timur Tabi7ba8b322010-03-31 17:44:13 -0500182#endif
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500183
Timur Tabi7ba8b322010-03-31 17:44:13 -0500184/* Configure the source of the boot location
185 *
186 * The PIXIS can be programmed to look at either the on-board dip switches
187 * or the PX_VBOOT[LBMAP] register to determine where we should boot.
188 *
189 * If we want to boot from the alternate boot bank, we need to tell the PIXIS
190 * to ignore the on-board dip switches and use the PX_VBOOT[LBMAP] instead.
191 */
192static void read_from_px_regs_altbank(int set)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500193{
Kumar Gala146c4b22009-07-22 10:12:39 -0500194 u8 tmp = in_8(pixis_base + PIXIS_VCFGEN1);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500195
196 if (set)
Tom Rini364d0022023-01-10 11:19:45 -0500197 tmp = tmp | CFG_SYS_PIXIS_VBOOT_ENABLE;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500198 else
Tom Rini364d0022023-01-10 11:19:45 -0500199 tmp = tmp & ~CFG_SYS_PIXIS_VBOOT_ENABLE;
Timur Tabi7ba8b322010-03-31 17:44:13 -0500200
Kumar Gala146c4b22009-07-22 10:12:39 -0500201 out_8(pixis_base + PIXIS_VCFGEN1, tmp);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500202}
203
Tom Rini364d0022023-01-10 11:19:45 -0500204/* CFG_SYS_PIXIS_VBOOT_MASK contains the bits to set in VBOOT register that
Timur Tabi7ba8b322010-03-31 17:44:13 -0500205 * tells the PIXIS what the alternate flash bank is.
206 *
207 * Note that it's not really a mask. It contains the actual LBMAP bits that
208 * must be set to select the alternate bank. This code assumes that the
209 * primary bank has these bits set to 0, and the alternate bank has these
210 * bits set to 1.
211 */
Tom Rini364d0022023-01-10 11:19:45 -0500212#ifndef CFG_SYS_PIXIS_VBOOT_MASK
213#define CFG_SYS_PIXIS_VBOOT_MASK (0x40)
Jason Jinf08899a2007-10-29 19:26:21 +0800214#endif
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500215
Timur Tabi7ba8b322010-03-31 17:44:13 -0500216/* Tell the PIXIS to boot from the default flash bank
217 *
218 * Program the default flash bank into the VBOOT register. This register is
219 * used only if PX_VCFGEN1[FLASH]=1.
220 */
221static void clear_altbank(void)
James Yang61f17812008-01-16 11:58:08 -0600222{
Tom Rini364d0022023-01-10 11:19:45 -0500223 clrbits_8(pixis_base + PIXIS_VBOOT, CFG_SYS_PIXIS_VBOOT_MASK);
James Yang61f17812008-01-16 11:58:08 -0600224}
225
Timur Tabi7ba8b322010-03-31 17:44:13 -0500226/* Tell the PIXIS to boot from the alternate flash bank
227 *
228 * Program the alternate flash bank into the VBOOT register. This register is
229 * used only if PX_VCFGEN1[FLASH]=1.
230 */
231static void set_altbank(void)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500232{
Tom Rini364d0022023-01-10 11:19:45 -0500233 setbits_8(pixis_base + PIXIS_VBOOT, CFG_SYS_PIXIS_VBOOT_MASK);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500234}
235
Timur Tabi7ba8b322010-03-31 17:44:13 -0500236/* Reset the board with watchdog disabled.
237 *
238 * This respects the altbank setting.
239 */
240static void set_px_go(void)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500241{
Timur Tabi7ba8b322010-03-31 17:44:13 -0500242 /* Disable the VELA sequencer and watchdog */
243 clrbits_8(pixis_base + PIXIS_VCTL, 9);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500244
Timur Tabi7ba8b322010-03-31 17:44:13 -0500245 /* Reboot by starting the VELA sequencer */
246 setbits_8(pixis_base + PIXIS_VCTL, 0x1);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500247
Timur Tabi7ba8b322010-03-31 17:44:13 -0500248 while (1);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500249}
250
Timur Tabi7ba8b322010-03-31 17:44:13 -0500251/* Reset the board with watchdog enabled.
252 *
253 * This respects the altbank setting.
254 */
255static void set_px_go_with_watchdog(void)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500256{
Timur Tabi7ba8b322010-03-31 17:44:13 -0500257 /* Disable the VELA sequencer */
258 clrbits_8(pixis_base + PIXIS_VCTL, 1);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500259
Timur Tabi7ba8b322010-03-31 17:44:13 -0500260 /* Enable the watchdog and reboot by starting the VELA sequencer */
261 setbits_8(pixis_base + PIXIS_VCTL, 0x9);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500262
Timur Tabi7ba8b322010-03-31 17:44:13 -0500263 while (1);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500264}
265
Timur Tabi7ba8b322010-03-31 17:44:13 -0500266/* Disable the watchdog
267 *
268 */
Simon Glassed38aef2020-05-10 11:40:03 -0600269static int pixis_disable_watchdog_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
270 char *const argv[])
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500271{
Timur Tabi7ba8b322010-03-31 17:44:13 -0500272 /* Disable the VELA sequencer and the watchdog */
273 clrbits_8(pixis_base + PIXIS_VCTL, 9);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500274
275 return 0;
276}
277
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500278U_BOOT_CMD(
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200279 diswd, 1, 0, pixis_disable_watchdog_cmd,
280 "Disable watchdog timer",
281 ""
282);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500283
284/*
285 * This function takes the non-integral cpu:mpx pll ratio
286 * and converts it to an integer that can be used to assign
287 * FPGA register values.
288 * input: strptr i.e. argv[2]
289 */
Timur Tabi7ba8b322010-03-31 17:44:13 -0500290static unsigned long strfractoint(char *strptr)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500291{
Timur Tabi7ba8b322010-03-31 17:44:13 -0500292 int i, j;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500293 int mulconst;
Kumar Gala85e44122011-11-09 10:02:11 -0600294 int no_dec = 0;
Timur Tabi7ba8b322010-03-31 17:44:13 -0500295 unsigned long intval = 0, decval = 0;
296 char intarr[3], decarr[3];
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500297
298 /* Assign the integer part to intarr[]
299 * If there is no decimal point i.e.
300 * if the ratio is an integral value
301 * simply create the intarr.
302 */
303 i = 0;
James Yang61f17812008-01-16 11:58:08 -0600304 while (strptr[i] != '.') {
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500305 if (strptr[i] == 0) {
306 no_dec = 1;
307 break;
308 }
309 intarr[i] = strptr[i];
310 i++;
311 }
312
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500313 intarr[i] = '\0';
314
315 if (no_dec) {
316 /* Currently needed only for single digit corepll ratios */
Jon Loeliger4fbb09c2006-08-22 12:25:27 -0500317 mulconst = 10;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500318 decval = 0;
319 } else {
320 j = 0;
Jon Loeliger4fbb09c2006-08-22 12:25:27 -0500321 i++; /* Skipping the decimal point */
James Yang61f17812008-01-16 11:58:08 -0600322 while ((strptr[i] >= '0') && (strptr[i] <= '9')) {
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500323 decarr[j] = strptr[i];
324 i++;
325 j++;
326 }
327
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500328 decarr[j] = '\0';
329
330 mulconst = 1;
Timur Tabi7ba8b322010-03-31 17:44:13 -0500331 for (i = 0; i < j; i++)
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500332 mulconst *= 10;
Simon Glassff9b9032021-07-24 09:03:30 -0600333 decval = dectoul(decarr, NULL);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500334 }
335
Simon Glassff9b9032021-07-24 09:03:30 -0600336 intval = dectoul(intarr, NULL);
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500337 intval = intval * mulconst;
338
Timur Tabi7ba8b322010-03-31 17:44:13 -0500339 return intval + decval;
Jon Loeligerd68e2ba2006-05-30 17:47:00 -0500340}
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600341
Simon Glassed38aef2020-05-10 11:40:03 -0600342static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
343 char *const argv[])
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600344{
James Yang61f17812008-01-16 11:58:08 -0600345 unsigned int i;
346 char *p_cf = NULL;
347 char *p_cf_sysclk = NULL;
348 char *p_cf_corepll = NULL;
349 char *p_cf_mpxpll = NULL;
350 char *p_altbank = NULL;
351 char *p_wd = NULL;
Timur Tabi7ba8b322010-03-31 17:44:13 -0500352 int unknown_param = 0;
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600353
354 /*
355 * No args is a simple reset request.
356 */
357 if (argc <= 1) {
358 pixis_reset();
359 /* not reached */
360 }
361
James Yang61f17812008-01-16 11:58:08 -0600362 for (i = 1; i < argc; i++) {
363 if (strcmp(argv[i], "cf") == 0) {
364 p_cf = argv[i];
365 if (i + 3 >= argc) {
366 break;
367 }
368 p_cf_sysclk = argv[i+1];
369 p_cf_corepll = argv[i+2];
370 p_cf_mpxpll = argv[i+3];
371 i += 3;
372 continue;
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600373 }
374
James Yang61f17812008-01-16 11:58:08 -0600375 if (strcmp(argv[i], "altbank") == 0) {
376 p_altbank = argv[i];
377 continue;
378 }
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600379
James Yang61f17812008-01-16 11:58:08 -0600380 if (strcmp(argv[i], "wd") == 0) {
381 p_wd = argv[i];
382 continue;
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600383 }
384
James Yang61f17812008-01-16 11:58:08 -0600385 unknown_param = 1;
386 }
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600387
James Yang61f17812008-01-16 11:58:08 -0600388 /*
389 * Check that cf has all required parms
390 */
391 if ((p_cf && !(p_cf_sysclk && p_cf_corepll && p_cf_mpxpll))
Wolfgang Denka1be4762008-05-20 16:00:29 +0200392 || unknown_param) {
Ed Swarthout06c70d62008-10-08 23:38:01 -0500393#ifdef CONFIG_SYS_LONGHELP
James Yang61f17812008-01-16 11:58:08 -0600394 puts(cmdtp->help);
York Sun13444b22013-05-31 08:48:04 -0700395 putc('\n');
Ed Swarthout06c70d62008-10-08 23:38:01 -0500396#endif
James Yang61f17812008-01-16 11:58:08 -0600397 return 1;
398 }
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600399
James Yang61f17812008-01-16 11:58:08 -0600400 /*
401 * PIXIS seems to be sensitive to the ordering of
402 * the registers that are touched.
403 */
404 read_from_px_regs(0);
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600405
Timur Tabi7ba8b322010-03-31 17:44:13 -0500406 if (p_altbank)
James Yang61f17812008-01-16 11:58:08 -0600407 read_from_px_regs_altbank(0);
Timur Tabi7ba8b322010-03-31 17:44:13 -0500408
James Yang61f17812008-01-16 11:58:08 -0600409 clear_altbank();
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600410
James Yang61f17812008-01-16 11:58:08 -0600411 /*
412 * Clock configuration specified.
413 */
414 if (p_cf) {
415 unsigned long sysclk;
416 unsigned long corepll;
417 unsigned long mpxpll;
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600418
Simon Glassff9b9032021-07-24 09:03:30 -0600419 sysclk = dectoul(p_cf_sysclk, NULL);
Timur Tabi7ba8b322010-03-31 17:44:13 -0500420 corepll = strfractoint(p_cf_corepll);
Simon Glassff9b9032021-07-24 09:03:30 -0600421 mpxpll = dectoul(p_cf_mpxpll, NULL);
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600422
James Yang61f17812008-01-16 11:58:08 -0600423 if (!(set_px_sysclk(sysclk)
424 && set_px_corepll(corepll)
425 && set_px_mpxpll(mpxpll))) {
Ed Swarthout06c70d62008-10-08 23:38:01 -0500426#ifdef CONFIG_SYS_LONGHELP
James Yang61f17812008-01-16 11:58:08 -0600427 puts(cmdtp->help);
York Sun13444b22013-05-31 08:48:04 -0700428 putc('\n');
Ed Swarthout06c70d62008-10-08 23:38:01 -0500429#endif
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600430 return 1;
431 }
James Yang61f17812008-01-16 11:58:08 -0600432 read_from_px_regs(1);
433 }
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600434
James Yang61f17812008-01-16 11:58:08 -0600435 /*
436 * Altbank specified
437 *
438 * NOTE CHANGE IN BEHAVIOR: previous code would default
439 * to enabling watchdog if altbank is specified.
440 * Now the watchdog must be enabled explicitly using 'wd'.
441 */
442 if (p_altbank) {
443 set_altbank();
444 read_from_px_regs_altbank(1);
445 }
446
447 /*
448 * Reset with watchdog specified.
449 */
Timur Tabi7ba8b322010-03-31 17:44:13 -0500450 if (p_wd)
James Yang61f17812008-01-16 11:58:08 -0600451 set_px_go_with_watchdog();
Timur Tabi7ba8b322010-03-31 17:44:13 -0500452 else
James Yang61f17812008-01-16 11:58:08 -0600453 set_px_go();
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600454
James Yang61f17812008-01-16 11:58:08 -0600455 /*
456 * Shouldn't be reached.
457 */
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600458 return 0;
459}
460
461
462U_BOOT_CMD(
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200463 pixis_reset, CONFIG_SYS_MAXARGS, 1, pixis_reset_cmd,
Peter Tyserdfb72b82009-01-27 18:03:12 -0600464 "Reset the board using the FPGA sequencer",
Haiying Wang57b6e9c2007-01-22 12:37:30 -0600465 " pixis_reset\n"
466 " pixis_reset [altbank]\n"
467 " pixis_reset altbank wd\n"
468 " pixis_reset altbank cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>\n"
Wolfgang Denkc54781c2009-05-24 17:06:54 +0200469 " pixis_reset cf <SYSCLK freq> <COREPLL ratio> <MPXPLL ratio>"
470);