]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/amcc/yucca/cmd_yucca.c
3 * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
5 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/byteorder.h>
16 extern void print_evb440spe_info(void);
17 static int setBootStrapClock(cmd_tbl_t
*cmdtp
, int incrflag
,
18 int flag
, int argc
, char * const argv
[]);
20 /* ------------------------------------------------------------------------- */
21 int do_evb440spe(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
23 return setBootStrapClock (cmdtp
, 1, flag
, argc
, argv
);
26 /* ------------------------------------------------------------------------- */
30 * evb440spe wrclk prom0,prom1
32 static int setBootStrapClock(cmd_tbl_t
*cmdtp
, int incrflag
, int flag
,
33 int argc
, char * const argv
[])
45 return cmd_usage(cmdtp
);
47 if (strcmp(argv
[2], "prom0") == 0)
48 chip
= IIC0_BOOTPROM_ADDR
;
50 chip
= IIC0_ALT_BOOTPROM_ADDR
;
53 printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
54 nbytes
= readline (" ? ");
56 if (strcmp(console_buffer
, "quit") == 0)
59 if ((strcmp(console_buffer
, "33") != 0) &
60 (strcmp(console_buffer
, "66") != 0))
63 strcpy(sysClock
, console_buffer
);
65 } while (nbytes
== 0);
68 if (strcmp(sysClock
, "66") == 0) {
69 printf("enter cpu clock frequency 400, 533 MHz or quit to abort\n");
72 printf("enter cpu clock frequency 400, 500, 533, 667 MHz or quit to abort\n");
74 printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
77 nbytes
= readline (" ? ");
79 if (strcmp(console_buffer
, "quit") == 0)
82 if (strcmp(sysClock
, "66") == 0) {
83 if ((strcmp(console_buffer
, "400") != 0) &
84 (strcmp(console_buffer
, "533") != 0)
86 & (strcmp(console_buffer
, "667") != 0)
92 if ((strcmp(console_buffer
, "400") != 0) &
93 (strcmp(console_buffer
, "500") != 0) &
94 (strcmp(console_buffer
, "533") != 0)
96 & (strcmp(console_buffer
, "667") != 0)
103 strcpy(cpuClock
, console_buffer
);
105 } while (nbytes
== 0);
107 if (strcmp(cpuClock
, "500") == 0){
108 strcpy(plbClock
, "166");
109 } else if (strcmp(cpuClock
, "533") == 0){
110 strcpy(plbClock
, "133");
113 if (strcmp(cpuClock
, "400") == 0)
114 printf("enter plb clock frequency 100, 133 MHz or quit to abort\n");
117 if (strcmp(cpuClock
, "667") == 0)
118 printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
121 nbytes
= readline (" ? ");
123 if (strcmp(console_buffer
, "quit") == 0)
126 if (strcmp(cpuClock
, "400") == 0) {
127 if ((strcmp(console_buffer
, "100") != 0) &
128 (strcmp(console_buffer
, "133") != 0))
132 if (strcmp(cpuClock
, "667") == 0) {
133 if ((strcmp(console_buffer
, "133") != 0) &
134 (strcmp(console_buffer
, "166") != 0))
138 strcpy(plbClock
, console_buffer
);
140 } while (nbytes
== 0);
144 printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
145 nbytes
= readline (" ? ");
147 if (strcmp(console_buffer
, "quit") == 0)
150 if ((strcmp(console_buffer
, "33") != 0) &
151 (strcmp(console_buffer
, "66") != 0) &
152 (strcmp(console_buffer
, "100") != 0) &
153 (strcmp(console_buffer
, "133") != 0)) {
156 strcpy(pcixClock
, console_buffer
);
158 } while (nbytes
== 0);
160 printf("\nsys clk = %s MHz\n", sysClock
);
161 printf("cpu clk = %s MHz\n", cpuClock
);
162 printf("plb clk = %s MHz\n", plbClock
);
163 printf("Pci-X clk = %s MHz\n", pcixClock
);
166 printf("\npress [y] to write I2C bootstrap \n");
167 printf("or [n] to abort. \n");
168 printf("Don't forget to set board switches \n");
169 printf("according to your choice before re-starting \n");
170 printf("(refer to 440spe_uboot_kit_um_1_01.pdf) \n");
172 nbytes
= readline (" ? ");
173 if (strcmp(console_buffer
, "n") == 0)
176 } while (nbytes
== 0);
178 if (strcmp(sysClock
, "33") == 0) {
179 if ((strcmp(cpuClock
, "400") == 0) &
180 (strcmp(plbClock
, "100") == 0))
183 if ((strcmp(cpuClock
, "400") == 0) &
184 (strcmp(plbClock
, "133") == 0))
187 if ((strcmp(cpuClock
, "500") == 0))
190 if ((strcmp(cpuClock
, "533") == 0))
194 if ((strcmp(cpuClock
, "667") == 0) &
195 (strcmp(plbClock
, "133") == 0))
198 if ((strcmp(cpuClock
, "667") == 0) &
199 (strcmp(plbClock
, "166") == 0))
204 if (strcmp(sysClock
, "66") == 0) {
205 if ((strcmp(cpuClock
, "400") == 0) &
206 (strcmp(plbClock
, "100") == 0))
209 if ((strcmp(cpuClock
, "400") == 0) &
210 (strcmp(plbClock
, "133") == 0))
213 if ((strcmp(cpuClock
, "533") == 0))
217 if ((strcmp(cpuClock
, "667") == 0) &
218 (strcmp(plbClock
, "133") == 0))
221 if ((strcmp(cpuClock
, "667") == 0) &
222 (strcmp(plbClock
, "166") == 0))
229 printf(" pin strap0 to write in i2c = %x\n", data
);
232 if (i2c_write(chip
, 0, 1, (uchar
*)&data
, 4) != 0)
233 printf("Error writing strap0 in %s\n", argv
[2]);
235 if (strcmp(pcixClock
, "33") == 0)
238 if (strcmp(pcixClock
, "66") == 0)
241 if (strcmp(pcixClock
, "100") == 0)
244 if (strcmp(pcixClock
, "133") == 0)
247 if (strcmp(plbClock
, "166") == 0)
248 data
= data
| 0x05950000;
250 data
= data
| 0x05A50000;
253 printf(" pin strap1 to write in i2c = %x\n", data
);
257 if (i2c_write(chip
, 4, 1, (uchar
*)&data
, 4) != 0)
258 printf("Error writing strap1 in %s\n", argv
[2]);
264 evb440spe
, 3, 1, do_evb440spe
,
265 "program the serial device strap",
266 "wrclk [prom0|prom1] - program the serial device strap"