3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 static u8 boot_267_nor[] = {
30 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x00,
31 0x14, 0xc0, 0x36, 0xcc, 0x00, 0x0c, 0x00, 0x00,
32 0x00, 0x00, 0x00, 0x00
35 static u8 boot_267_nand[] = {
36 0xd0, 0x38, 0xc3, 0x50, 0x13, 0x88, 0x8e, 0x00,
37 0x14, 0xc0, 0x36, 0xcc, 0x00, 0x0c, 0x00, 0x00,
38 0x00, 0x00, 0x00, 0x00
41 static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
48 printf("Usage:\n%s\n", cmdtp->usage);
52 cpu_freq = simple_strtol(argv[1], NULL, 10);
53 if (cpu_freq != 267) {
54 printf("Unsupported cpu-frequency - only 267 supported\n");
58 /* use 0x50 as I2C EEPROM address for now */
61 if ((strcmp(argv[2], "nor") != 0) &&
62 (strcmp(argv[2], "nand") != 0)) {
63 printf("Unsupported boot-device - only nor|nand support\n");
67 if (strcmp(argv[2], "nand") == 0) {
85 if (i2c_write(chip, 0, 1, buf, 16) != 0)
86 printf("Error writing to EEPROM at address 0x%x\n", chip);
87 udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
88 if (i2c_write(chip, 0x10, 1, buf+16, 4) != 0)
89 printf("Error2 writing to EEPROM at address 0x%x\n", chip);
92 printf("Please power-cycle the board for the changes to take effect\n");
98 bootstrap, 3, 0, do_bootstrap,
99 "bootstrap - program the I2C bootstrap EEPROM\n",
100 "<cpu-freq> <nor|nand> - program the I2C bootstrap EEPROM\n"