Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Stefan Roese, DENX Software Engineering, sr@denx.de. |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 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. |
| 12 | * |
| 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. |
| 17 | * |
| 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, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <config.h> |
| 25 | #include <common.h> |
| 26 | #include <command.h> |
| 27 | #include <asm/processor.h> |
| 28 | #include <i2c.h> |
| 29 | |
| 30 | #if defined(CONFIG_TAISHAN) |
| 31 | |
| 32 | const uchar bootstrap_buf[16] = { |
| 33 | 0x86, |
| 34 | 0x78, |
| 35 | 0xc1, |
| 36 | 0xa6, |
| 37 | 0x09, |
| 38 | 0x67, |
| 39 | 0x04, |
| 40 | 0x63, |
| 41 | 0x00, |
| 42 | 0x00, |
| 43 | 0x00, |
| 44 | 0x00, |
| 45 | 0x00, |
| 46 | 0x00, |
| 47 | 0x00, |
| 48 | 0x00 |
| 49 | }; |
| 50 | |
| 51 | static int update_boot_eeprom(void) |
| 52 | { |
| 53 | ulong len = 0x10; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 54 | uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR; |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 55 | uchar *pbuf = (uchar *)bootstrap_buf; |
| 56 | int ii, jj; |
| 57 | |
| 58 | for (ii = 0; ii < len; ii++) { |
| 59 | if (i2c_write(chip, ii, 1, &pbuf[ii], 1) != 0) { |
| 60 | printf("i2c_write failed\n"); |
| 61 | return -1; |
| 62 | } |
| 63 | |
| 64 | /* wait 10ms */ |
| 65 | for (jj = 0; jj < 10; jj++) |
| 66 | udelay(1000); |
| 67 | } |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) |
| 72 | { |
| 73 | return update_boot_eeprom(); |
| 74 | } |
| 75 | |
| 76 | U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom, |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 77 | "update bootstrap eeprom content", ""); |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 78 | #endif |