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_533_nor[] = {
30 0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xa0, 0x30,
31 0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
34 static u8 boot_533_nand[] = {
35 0x87, 0x78, 0x82, 0x52, 0x09, 0x57, 0xd0, 0x10,
36 0xa0, 0x68, 0x23, 0x58, 0x0d, 0x05, 0x00, 0x00
39 static u8 boot_667_nor[] = {
40 0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xa0, 0x30,
41 0x40, 0x08, 0x23, 0x50, 0x0d, 0x05, 0x00, 0x00
44 static u8 boot_667_nand[] = {
45 0x87, 0x78, 0xa2, 0x52, 0x09, 0xd7, 0xd0, 0x10,
46 0xa0, 0x68, 0x23, 0x58, 0x0d, 0x05, 0x00, 0x00
49 static int do_bootstrap(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
56 printf("Usage:\n%s\n", cmdtp->usage);
60 cpu_freq = simple_strtol(argv[1], NULL, 10);
61 if (!((cpu_freq == 533) || (cpu_freq == 667))) {
62 printf("Unsupported cpu-frequency - only 533 and 667 supported\n");
66 /* use 0x52 as I2C EEPROM address for now */
69 if ((strcmp(argv[2], "nor") != 0) &&
70 (strcmp(argv[2], "nand") != 0)) {
71 printf("Unsupported boot-device - only nor|nand support\n");
75 if (strcmp(argv[2], "nand") == 0) {
97 if (i2c_write(chip, 0, 1, buf, 16) != 0)
98 printf("Error writing to EEPROM at address 0x%x\n", chip);
99 udelay(CFG_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
102 printf("Please power-cycle the board for the changes to take effect\n");
108 bootstrap, 3, 0, do_bootstrap,
109 "bootstrap - program the I2C bootstrap EEPROM\n",
110 "<cpu-freq> <nor|nand> - program the I2C bootstrap EEPROM\n"