]>
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+
16 #include <asm/byteorder.h>
18 extern void print_evb440spe_info(void);
19 static int setBootStrapClock(cmd_tbl_t
*cmdtp
, int incrflag
,
20 int flag
, int argc
, char * const argv
[]);
22 /* ------------------------------------------------------------------------- */
23 int do_evb440spe(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char * const argv
[])
25 return setBootStrapClock (cmdtp
, 1, flag
, argc
, argv
);
28 /* ------------------------------------------------------------------------- */
32 * evb440spe wrclk prom0,prom1
34 static int setBootStrapClock(cmd_tbl_t
*cmdtp
, int incrflag
, int flag
,
35 int argc
, char * const argv
[])
47 return cmd_usage(cmdtp
);
49 if (strcmp(argv
[2], "prom0") == 0)
50 chip
= IIC0_BOOTPROM_ADDR
;
52 chip
= IIC0_ALT_BOOTPROM_ADDR
;
55 printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
56 nbytes
= cli_readline(" ? ");
58 if (strcmp(console_buffer
, "quit") == 0)
61 if ((strcmp(console_buffer
, "33") != 0) &
62 (strcmp(console_buffer
, "66") != 0))
65 strcpy(sysClock
, console_buffer
);
67 } while (nbytes
== 0);
70 if (strcmp(sysClock
, "66") == 0) {
71 printf("enter cpu clock frequency 400, 533 MHz or quit to abort\n");
74 printf("enter cpu clock frequency 400, 500, 533, 667 MHz or quit to abort\n");
76 printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
79 nbytes
= cli_readline(" ? ");
81 if (strcmp(console_buffer
, "quit") == 0)
84 if (strcmp(sysClock
, "66") == 0) {
85 if ((strcmp(console_buffer
, "400") != 0) &
86 (strcmp(console_buffer
, "533") != 0)
88 & (strcmp(console_buffer
, "667") != 0)
94 if ((strcmp(console_buffer
, "400") != 0) &
95 (strcmp(console_buffer
, "500") != 0) &
96 (strcmp(console_buffer
, "533") != 0)
98 & (strcmp(console_buffer
, "667") != 0)
105 strcpy(cpuClock
, console_buffer
);
107 } while (nbytes
== 0);
109 if (strcmp(cpuClock
, "500") == 0){
110 strcpy(plbClock
, "166");
111 } else if (strcmp(cpuClock
, "533") == 0){
112 strcpy(plbClock
, "133");
115 if (strcmp(cpuClock
, "400") == 0)
116 printf("enter plb clock frequency 100, 133 MHz or quit to abort\n");
119 if (strcmp(cpuClock
, "667") == 0)
120 printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
123 nbytes
= cli_readline(" ? ");
125 if (strcmp(console_buffer
, "quit") == 0)
128 if (strcmp(cpuClock
, "400") == 0) {
129 if ((strcmp(console_buffer
, "100") != 0) &
130 (strcmp(console_buffer
, "133") != 0))
134 if (strcmp(cpuClock
, "667") == 0) {
135 if ((strcmp(console_buffer
, "133") != 0) &
136 (strcmp(console_buffer
, "166") != 0))
140 strcpy(plbClock
, console_buffer
);
142 } while (nbytes
== 0);
146 printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
147 nbytes
= cli_readline(" ? ");
149 if (strcmp(console_buffer
, "quit") == 0)
152 if ((strcmp(console_buffer
, "33") != 0) &
153 (strcmp(console_buffer
, "66") != 0) &
154 (strcmp(console_buffer
, "100") != 0) &
155 (strcmp(console_buffer
, "133") != 0)) {
158 strcpy(pcixClock
, console_buffer
);
160 } while (nbytes
== 0);
162 printf("\nsys clk = %s MHz\n", sysClock
);
163 printf("cpu clk = %s MHz\n", cpuClock
);
164 printf("plb clk = %s MHz\n", plbClock
);
165 printf("Pci-X clk = %s MHz\n", pcixClock
);
168 printf("\npress [y] to write I2C bootstrap\n");
169 printf("or [n] to abort.\n");
170 printf("Don't forget to set board switches\n");
171 printf("according to your choice before re-starting\n");
172 printf("(refer to 440spe_uboot_kit_um_1_01.pdf)\n");
174 nbytes
= cli_readline(" ? ");
175 if (strcmp(console_buffer
, "n") == 0)
178 } while (nbytes
== 0);
180 if (strcmp(sysClock
, "33") == 0) {
181 if ((strcmp(cpuClock
, "400") == 0) &
182 (strcmp(plbClock
, "100") == 0))
185 if ((strcmp(cpuClock
, "400") == 0) &
186 (strcmp(plbClock
, "133") == 0))
189 if ((strcmp(cpuClock
, "500") == 0))
192 if ((strcmp(cpuClock
, "533") == 0))
196 if ((strcmp(cpuClock
, "667") == 0) &
197 (strcmp(plbClock
, "133") == 0))
200 if ((strcmp(cpuClock
, "667") == 0) &
201 (strcmp(plbClock
, "166") == 0))
206 if (strcmp(sysClock
, "66") == 0) {
207 if ((strcmp(cpuClock
, "400") == 0) &
208 (strcmp(plbClock
, "100") == 0))
211 if ((strcmp(cpuClock
, "400") == 0) &
212 (strcmp(plbClock
, "133") == 0))
215 if ((strcmp(cpuClock
, "533") == 0))
219 if ((strcmp(cpuClock
, "667") == 0) &
220 (strcmp(plbClock
, "133") == 0))
223 if ((strcmp(cpuClock
, "667") == 0) &
224 (strcmp(plbClock
, "166") == 0))
231 printf(" pin strap0 to write in i2c = %x\n", data
);
234 if (i2c_write(chip
, 0, 1, (uchar
*)&data
, 4) != 0)
235 printf("Error writing strap0 in %s\n", argv
[2]);
237 if (strcmp(pcixClock
, "33") == 0)
240 if (strcmp(pcixClock
, "66") == 0)
243 if (strcmp(pcixClock
, "100") == 0)
246 if (strcmp(pcixClock
, "133") == 0)
249 if (strcmp(plbClock
, "166") == 0)
250 data
= data
| 0x05950000;
252 data
= data
| 0x05A50000;
255 printf(" pin strap1 to write in i2c = %x\n", data
);
259 if (i2c_write(chip
, 4, 1, (uchar
*)&data
, 4) != 0)
260 printf("Error writing strap1 in %s\n", argv
[2]);
266 evb440spe
, 3, 1, do_evb440spe
,
267 "program the serial device strap",
268 "wrclk [prom0|prom1] - program the serial device strap"