~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/board/amcc/taishan/update.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * (C) Copyright 2007
 
3
 * Stefan Roese, DENX Software Engineering, sr@denx.de.
 
4
 *
 
5
 * SPDX-License-Identifier:     GPL-2.0+
 
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;
 
38
        uchar chip = CONFIG_SYS_BOOTSTRAP_IIC_ADDR;
 
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
 
 
55
int do_update_boot_eeprom(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
56
{
 
57
        return update_boot_eeprom();
 
58
}
 
59
 
 
60
U_BOOT_CMD(update_boot_eeprom, 1, 1, do_update_boot_eeprom,
 
61
           "update bootstrap eeprom content", "");
 
62
#endif