1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#include <config.h>
25#include <common.h>
26#include <command.h>
27#include <asm/processor.h>
28#include <asm/io.h>
29#include <asm/gpio.h>
30#include <i2c.h>
31
32#if defined(CONFIG_ZEUS)
33
34u8 buf_zeus_ce[] = {
35
36 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39
40 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41
42 0x00, 0xc0, 0x50, 0x12, 0x72, 0x3e, 0x00, 0x00 };
43
44u8 buf_zeus_pe[] = {
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64
65 0x00, 0x60, 0x68, 0x2d, 0x42, 0xbe, 0x00, 0x00 };
66
67static int update_boot_eeprom(void)
68{
69 u32 len = 0x20;
70 u8 chip = CONFIG_SYS_I2C_EEPROM_ADDR;
71 u8 *pbuf;
72 u8 base;
73 int i;
74
75 if (in_be32((void *)GPIO0_IR) & GPIO_VAL(CONFIG_SYS_GPIO_ZEUS_PE)) {
76 pbuf = buf_zeus_pe;
77 base = 0x40;
78 } else {
79 pbuf = buf_zeus_ce;
80 base = 0x00;
81 }
82
83 for (i = 0; i < len; i++, base++) {
84 if (i2c_write(chip, base, 1, &pbuf[i], 1) != 0) {
85 printf("i2c_write fail\n");
86 return 1;
87 }
88 udelay(11000);
89 }
90
91 return 0;
92}
93
94int do_update_boot_eeprom(cmd_tbl_t* cmdtp, int flag, int argc, char* argv[])
95{
96 return update_boot_eeprom();
97}
98
99U_BOOT_CMD (
100 update_boot_eeprom, 1, 1, do_update_boot_eeprom,
101 "update boot eeprom content",
102 ""
103);
104
105#endif
106