2 * (C) Copyright 2002 ELTEC Elektronik AG
3 * Frank Gottschling <fgottschling@eltec.de>
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
24 /* common srom defs */
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
32 #define CLK2P0TO1_1MB_PB_0P5DH 0x79000100
33 #define CLK2P5TO1_1MB_PB_0P5DH 0x7B000100
35 #define CPU_TYPE_740 0x08
36 #define CPU_TYPE_750 0x08
37 #define CPU_TYPE ((get_pvr()>>16)&0xffff)
39 #define ABS(x) ((x<0)?-x:x)
40 #define SROM_SHORT(pX) (*(u8 *)(pX) | *((u8 *)(pX)+1) << 8)
42 /* bab7xx ELTEC srom */
43 #define I2C_BUS_DAT (CFG_ISA_IO + 0x220)
44 #define I2C_BUS_DIR (CFG_ISA_IO + 0x221)
47 #define MPC107_I2CADDR (mpc107_eumb_addr + 0x3000) /* address */
48 #define MPC107_I2CFDR (mpc107_eumb_addr + 0x3004) /* freq divider */
49 #define MPC107_I2CCR (mpc107_eumb_addr + 0x3008) /* control */
50 #define MPC107_I2CSR (mpc107_eumb_addr + 0x300c) /* status */
51 #define MPC107_I2CDR (mpc107_eumb_addr + 0x3010) /* data */
52 #define MPC107_I2C_TIMEOUT 10000000
55 #define EE_ADDR_BITS 6
56 #define EE_SIZE 0x40 /* 0x40 words */
57 #define EE_CHECKSUM 0xBABA
60 #define DEC_SROM_SIZE 128
64 * structure of revision srom
67 char magic[8]; /* 000 - Magic number */
68 char revrev[2]; /* 008 - Revision of structure */
69 unsigned short size; /* 00A - Size of CRC area */
70 unsigned long crc; /* 00C - CRC */
71 char board[16]; /* 010 - Board Revision information */
72 char option[4][16]; /* 020 - Option Revision information */
73 char serial[8]; /* 060 - Board serial number */
74 char etheraddr[6]; /* 068 - Ethernet node addresse */
75 char reserved[2]; /* 06E - Reserved */
76 char revision[7][2]; /* 070 - Revision codes */
77 char category[2]; /* 07E - Category codes */
78 char text[64]; /* 080 - Text field */
79 char res[64]; /* 0C0 - Reserved */
82 unsigned long el_srom_checksum (unsigned char *ptr, unsigned long size);
83 int el_srom_load (unsigned char addr, unsigned char *buf, int cnt,
84 unsigned char device, unsigned char block);
85 int el_srom_store (unsigned char addr, unsigned char *buf, int cnt,
86 unsigned char device, unsigned char block);
88 int mpc107_i2c_init (unsigned long eumb_addr, unsigned long divider);
89 int mpc107_i2c_read_byte (unsigned char device, unsigned char block, unsigned char offset);
90 int mpc107_i2c_write_byte (unsigned char device, unsigned char block,
91 unsigned char offset, unsigned char val);
92 int mpc107_srom_load (unsigned char addr, unsigned char *pBuf, int cnt,
93 unsigned char device, unsigned char block);
94 int mpc107_srom_store (unsigned char addr, unsigned char *pBuf, int cnt,
95 unsigned char device, unsigned char block);
97 int dc_srom_load (unsigned short *dest);
98 int dc_srom_store (unsigned short *src);
100 unsigned short eepro100_srom_checksum (unsigned short *sromdata);
101 void eepro100_srom_load (unsigned short *destination);
102 int eepro100_srom_store (unsigned short *source);