blob: 273898929a5cc63f220cab540840c84c174dab2c [file] [log] [blame]
Stefan Roese5fb692c2007-01-18 10:25:34 +01001/*
2 * (C) Copyright 2007
3 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
Wolfgang Denk3765b3e2013-10-07 13:07:26 +02005 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese5fb692c2007-01-18 10:25:34 +01006 */
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
16const 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
35static int update_boot_eeprom(void)
36{
37 ulong len = 0x10;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020038 uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR;
Stefan Roese5fb692c2007-01-18 10:25:34 +010039 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 Denk54841ab2010-06-28 22:00:46 +020055int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Stefan Roese5fb692c2007-01-18 10:25:34 +010056{
57 return update_boot_eeprom();
58}
59
60U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom,
Wolfgang Denka89c33d2009-05-24 17:06:54 +020061 "update bootstrap eeprom content", "");
Stefan Roese5fb692c2007-01-18 10:25:34 +010062#endif