Merge branch 'tpmdd-next-v3.6' of git://github.com/shpedoikal/linux into for-linus
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / cxt1e1 / sbe_promformat.h
CommitLineData
50ee11fe
BB
1#ifndef _INC_SBE_PROMFORMAT_H_
2#define _INC_SBE_PROMFORMAT_H_
3
4/*-----------------------------------------------------------------------------
5 * sbe_promformat.h - Contents of seeprom used by dvt and manufacturing tests
6 *
7 * Copyright (C) 2002-2005 SBE, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * For further information, contact via email: support@sbei.com
20 * SBE, Inc. San Ramon, California U.S.A.
21 *
22 *-----------------------------------------------------------------------------
50ee11fe
BB
23 */
24
25
26/***
27 * PMCC4 SAMPLE EEPROM IMAGE
28 *
29 * eeprom[00]: 01 11 76 07 01 00 a0 d6
30 * eeprom[08]: 22 34 56 3e 5b c1 1c 3e
31 * eeprom[16]: 5b e1 b6 00 00 00 01 00
32 * eeprom[24]: 00 08 46 d3 7b 5e a8 fb
33 * eeprom[32]: f7 ef df bf 7f 55 00 01
34 * eeprom[40]: 02 04 08 10 20 40 80 ff
35 * eeprom[48]: fe fd fb f7 ef df bf 7f
36 *
37 ***/
38
39
40/*------------------------------------------------------------------------
41 * Type 1 Format
42 * byte:
43 * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
44 * -------------------------------------------------------------------------
45 * 01 11 76 SS SS 00 0A D6 <SERIAL NUM> <Create TIME> <Heatrun TIME>
46 * SBE SUB SERIAL # (BCD) (time_t) (time_t)
47 * ID VENDOR (format) (format)
48 *
49 * 19 20 21 22 23 24 25 26
50 * Heat Run Heat Run
51 * Iterations Errors
52 *------------------------------------------------------------------------
53 *
54 *
55 *
56 * Type 2 Format - Added length, CRC in fixed position
57 * byte:
58 * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
59 * -------------------------------------------------------------------------
60 * 02 00 1A CC CC CC CC 11 76 07 03 00 0A D6 <SERIAL NUM>
61 * Payload SBE Crc32 SUB System System SERIAL/MAC
62 * Length VENDOR ID ID
63 *
64 * 17 18 19 20 21 22 23 24 25 26 27 28 29 39 31 32
65 * --------------------------------------------------------------------------
66 * <Create TIME> <Heatrun TIME> Heat Run Heat Run
67 * (time_t) (time_t) Iterations Errors
68 *
69 */
70
50ee11fe
BB
71#define STRUCT_OFFSET(type, symbol) ((long)&(((type *)0)->symbol))
72
73/*------------------------------------------------------------------------
74 * Historically different Prom format types.
75 *
76 * For diagnostic and failure purposes, do not create a type 0x00 or a
77 * type 0xff
78 *------------------------------------------------------------------------
79 */
80#define PROM_FORMAT_Unk (-1)
81#define PROM_FORMAT_TYPE1 1
82#define PROM_FORMAT_TYPE2 2
83
84
85/****** bit fields for a type 1 formatted seeprom **************************/
86 typedef struct
87 {
88 char type; /* 0x00 */
89 char Id[2]; /* 0x01-0x02 */
90 char SubId[2]; /* 0x03-0x04 */
91 char Serial[6]; /* 0x05-0x0a */
92 char CreateTime[4]; /* 0x0b-0x0e */
93 char HeatRunTime[4]; /* 0x0f-0x12 */
94 char HeatRunIterations[4]; /* 0x13-0x16 */
95 char HeatRunErrors[4]; /* 0x17-0x1a */
96 char Crc32[4]; /* 0x1b-0x1e */
97 } FLD_TYPE1;
98
99
100/****** bit fields for a type 2 formatted seeprom **************************/
101 typedef struct
102 {
103 char type; /* 0x00 */
104 char length[2]; /* 0x01-0x02 */
105 char Crc32[4]; /* 0x03-0x06 */
106 char Id[2]; /* 0x07-0x08 */
107 char SubId[2]; /* 0x09-0x0a */
108 char Serial[6]; /* 0x0b-0x10 */
109 char CreateTime[4]; /* 0x11-0x14 */
110 char HeatRunTime[4]; /* 0x15-0x18 */
111 char HeatRunIterations[4]; /* 0x19-0x1c */
112 char HeatRunErrors[4]; /* 0x1d-0x20 */
113 } FLD_TYPE2;
114
115
116
117/***** this union allows us to access the seeprom as an array of bytes ***/
118/***** or as individual fields ***/
119
120#define SBE_EEPROM_SIZE 128
121#define SBE_MFG_INFO_SIZE sizeof(FLD_TYPE2)
122
123 typedef union
124 {
125 char bytes[128];
126 FLD_TYPE1 fldType1;
127 FLD_TYPE2 fldType2;
128 } PROMFORMAT;
129
50ee11fe 130#endif /*** _INC_SBE_PROMFORMAT_H_ ***/