blob: 3f063a05f065933f2dc36499969a80acfe68fde3 [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 *
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
32const 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
51static int update_boot_eeprom(void)
52{
53 ulong len = 0x10;
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020054 uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR;
Stefan Roese5fb692c2007-01-18 10:25:34 +010055 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
Wolfgang Denk54841ab2010-06-28 22:00:46 +020071int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
Stefan Roese5fb692c2007-01-18 10:25:34 +010072{
73 return update_boot_eeprom();
74}
75
76U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom,
Wolfgang Denka89c33d2009-05-24 17:06:54 +020077 "update bootstrap eeprom content", "");
Stefan Roese5fb692c2007-01-18 10:25:34 +010078#endif