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 | * |
Wolfgang Denk | bd8ec7e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <config.h> |
| 9 | #include <common.h> |
| 10 | #include <command.h> |
| 11 | #include <asm/processor.h> |
| 12 | #include <i2c.h> |
| 13 | |
| 14 | #if defined(CONFIG_TAISHAN) |
| 15 | |
| 16 | const uchar bootstrap_buf[16] = { |
| 17 | 0x86, |
| 18 | 0x78, |
| 19 | 0xc1, |
| 20 | 0xa6, |
| 21 | 0x09, |
| 22 | 0x67, |
| 23 | 0x04, |
| 24 | 0x63, |
| 25 | 0x00, |
| 26 | 0x00, |
| 27 | 0x00, |
| 28 | 0x00, |
| 29 | 0x00, |
| 30 | 0x00, |
| 31 | 0x00, |
| 32 | 0x00 |
| 33 | }; |
| 34 | |
| 35 | static int update_boot_eeprom(void) |
| 36 | { |
| 37 | ulong len = 0x10; |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 38 | uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR; |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 39 | uchar *pbuf = (uchar *)bootstrap_buf; |
| 40 | int ii, jj; |
| 41 | |
| 42 | for (ii = 0; ii < len; ii++) { |
| 43 | if (i2c_write(chip, ii, 1, &pbuf[ii], 1) != 0) { |
| 44 | printf("i2c_write failed\n"); |
| 45 | return -1; |
| 46 | } |
| 47 | |
| 48 | /* wait 10ms */ |
| 49 | for (jj = 0; jj < 10; jj++) |
| 50 | udelay(1000); |
| 51 | } |
| 52 | return 0; |
| 53 | } |
| 54 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 55 | int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 56 | { |
| 57 | return update_boot_eeprom(); |
| 58 | } |
| 59 | |
| 60 | U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom, |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 61 | "update bootstrap eeprom content", ""); |
Stefan Roese | 8d98230 | 2007-01-18 10:25:34 +0100 | [diff] [blame] | 62 | #endif |