blob: 89ef2f82c8903610707ebc78138fc38ee9564360 [file] [log] [blame]
Wolfgang Denk0c32d962006-06-16 17:32:31 +02001/* By Thomas.Lange@Corelatus.com 001025 */
2/* Definitions for EEPROM/VOLT METER DS2438 */
3/* Copyright (C) 2000-2005 Corelatus AB */
4
5/* This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA
19 */
20
21#ifndef INCeedevh
22#define INCeedevh
23
Wolfgang Denkb87dfd22006-07-19 13:50:38 +020024#define E_DEBUG(fmt,args...) if( Debug ) printk(KERN_DEBUG"EE: " fmt, ##args)
Wolfgang Denk0c32d962006-06-16 17:32:31 +020025
26/* MIPS */
27#define WRITE_PORT(Value) write_gpio_data(Value)
28
29#define READ_PORT (gpio_read()&GPIO_EEDQ)
30
31/* 64 bytes chip */
32#define EE_CHIP_SIZE 64
33
34/* Board with new current resistor */
35#define EE_GTH_0304 1
36
37/* new dsp and 64 MB SDRAM */
38#define EE_DSP_64 0x10
39
40/* microsecs */
41/* Pull line down at least this long for reset pulse */
42#define RESET_LOW_TIME 490
43
44/* Read presence pulse after we release reset pulse */
45#define PRESENCE_TIMEOUT 100
46#define PRESENCE_LOW_TIME 200
47
48#define WRITE_0_LOW 60
49#define WRITE_1_LOW 1
50#define TOTAL_WRITE_LOW 60
51
52#define READ_LOW 1
53#define READ_TIMEOUT 10
54#define TOTAL_READ_LOW 70
55
56/* Rom function commands */
57#define READ_ROM 0x33
58#define MATCH_ROM 0x55
59#define SKIP_ROM 0xCC
60#define SEARCH_ROM 0xF0
61
62
63/* Memory_command_function */
64#define WRITE_SCRATCHPAD 0x4E
65#define READ_SCRATCHPAD 0xBE
66#define COPY_SCRATCHPAD 0x48
67#define RECALL_MEMORY 0xB8
68#define CONVERT_TEMP 0x44
69#define CONVERT_VOLTAGE 0xB4
70
71/* Chip is divided in 8 pages, 8 bytes each */
72
73#define EE_PAGE_SIZE 8
74
75/* All chip data we want are in page 0 */
76
77/* Bytes in page 0 */
78#define EE_P0_STATUS 0
79#define EE_P0_TEMP_LSB 1
80#define EE_P0_TEMP_MSB 2
81#define EE_P0_VOLT_LSB 3
82#define EE_P0_VOLT_MSB 4
83#define EE_P0_CURRENT_LSB 5
84#define EE_P0_CURRENT_MSB 6
85
86
87/* 40 byte user data is located at page 3-7 */
88#define EE_USER_PAGE_0 3
89#define USER_PAGES 5
90
91/* Layout of gth user pages usage */
92/* Bytes 0-16 ethernet addr in ascii ( len 17 ) */
93
94#define EE_ETHERNET_OFFSET 0
95
96#endif /* INCeedevh */