1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#define FIRST_DEVICE 0x00
26#define SECOND_DEVICE 0x04
27#define FIRST_BLOCK 0x00
28#define SECOND_BLOCK 0x02
29#define BLOCK_SIZE 0x100
30#define ERROR (-1)
31
32#define CLK2P0TO1_1MB_PB_0P5DH 0x79000100
33#define CLK2P5TO1_1MB_PB_0P5DH 0x7B000100
34
35#define CPU_TYPE_740 0x08
36#define CPU_TYPE_750 0x08
37#define CPU_TYPE ((get_pvr()>>16)&0xffff)
38
39#define ABS(x) ((x<0)?-x:x)
40#define SROM_SHORT(pX) (*(u8 *)(pX) | *((u8 *)(pX)+1) << 8)
41
42
43#define I2C_BUS_DAT (CONFIG_SYS_ISA_IO + 0x220)
44#define I2C_BUS_DIR (CONFIG_SYS_ISA_IO + 0x221)
45
46
47#define MPC107_I2CADDR (mpc107_eumb_addr + 0x3000)
48#define MPC107_I2CFDR (mpc107_eumb_addr + 0x3004)
49#define MPC107_I2CCR (mpc107_eumb_addr + 0x3008)
50#define MPC107_I2CSR (mpc107_eumb_addr + 0x300c)
51#define MPC107_I2CDR (mpc107_eumb_addr + 0x3010)
52#define MPC107_I2C_TIMEOUT 10000000
53
54
55#define EE_ADDR_BITS 6
56#define EE_SIZE 0x40
57#define EE_CHECKSUM 0xBABA
58
59
60#define DEC_SROM_SIZE 128
61
62
63
64
65
66typedef struct {
67 char magic[8];
68 char revrev[2];
69 unsigned short size;
70 unsigned long crc;
71 char board[16];
72 char option[4][16];
73 char serial[8];
74 char etheraddr[6];
75 char reserved[2];
76 char revision[7][2];
77 char category[2];
78 char text[64];
79 char res[64];
80} revinfo;
81
82unsigned long el_srom_checksum (unsigned char *ptr, unsigned long size);
83int el_srom_load (unsigned char addr, unsigned char *buf, int cnt,
84 unsigned char device, unsigned char block);
85int el_srom_store (unsigned char addr, unsigned char *buf, int cnt,
86 unsigned char device, unsigned char block);
87
88int mpc107_i2c_init (unsigned long eumb_addr, unsigned long divider);
89int mpc107_i2c_read_byte (unsigned char device, unsigned char block, unsigned char offset);
90int mpc107_i2c_write_byte (unsigned char device, unsigned char block,
91 unsigned char offset, unsigned char val);
92int mpc107_srom_load (unsigned char addr, unsigned char *pBuf, int cnt,
93 unsigned char device, unsigned char block);
94int mpc107_srom_store (unsigned char addr, unsigned char *pBuf, int cnt,
95 unsigned char device, unsigned char block);
96
97int dc_srom_load (unsigned short *dest);
98int dc_srom_store (unsigned short *src);
99
100unsigned short eepro100_srom_checksum (unsigned short *sromdata);
101void eepro100_srom_load (unsigned short *destination);
102int eepro100_srom_store (unsigned short *source);
103