i2c-eg20t: change timeout value 50msec to 1000msec
[zen-stable.git] / drivers / staging / cxt1e1 / sbeid.c
bloba2243b10ef0589fb38e8eec48692c71842c7a187
1 /* Copyright (C) 2005 SBE, Inc.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/types.h>
15 #include "pmcc4_sysdep.h"
16 #include "sbecom_inline_linux.h"
17 #include "libsbew.h"
18 #include "pmcc4_private.h"
19 #include "pmcc4.h"
20 #include "sbe_bid.h"
22 #ifdef SBE_INCLUDE_SYMBOLS
23 #define STATIC
24 #else
25 #define STATIC static
26 #endif
29 char *
30 sbeid_get_bdname (ci_t * ci)
32 char *np = 0;
34 switch (ci->brd_id)
36 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
37 np = "wanPTMC-256T3 <E1>";
38 break;
39 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
40 np = "wanPTMC-256T3 <T1>";
41 break;
42 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
43 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
44 np = "wanPMC-C4T1E1";
45 break;
46 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
47 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
48 np = "wanPMC-C2T1E1";
49 break;
50 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
51 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
52 np = "wanPMC-C1T1E1";
53 break;
54 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
55 np = "wanPCI-C4T1E1";
56 break;
57 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
58 np = "wanPCI-C2T1E1";
59 break;
60 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
61 np = "wanPCI-C1T1E1";
62 break;
63 default:
64 /*** np = "<unknown>"; ***/
65 np = "wanPCI-CxT1E1";
66 break;
69 return np;
73 /* given the presetting of brd_id, set the corresponding hdw_id */
75 void
76 sbeid_set_hdwbid (ci_t * ci)
79 * set SBE's unique hardware identification (for legacy boards might not
80 * have this register implemented)
83 switch (ci->brd_id)
85 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1):
86 ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1
87 * Version) */
88 break;
89 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1):
90 ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1
91 * Version) */
92 break;
93 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1):
94 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L):
96 * This Board ID is a generic identification. Use the found number
97 * of ports to further define this hardware.
99 switch (ci->max_port)
101 default: /* shouldn't need a default, but have one
102 * anyway */
103 case 4:
104 ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */
105 break;
106 case 2:
107 ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
108 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
109 break;
110 case 1:
111 ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
112 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
113 break;
115 break;
116 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1):
117 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L):
118 ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
119 break;
120 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1):
121 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L):
122 ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
123 break;
124 #ifdef SBE_PMCC4_ENABLE
126 * This case is entered as a result of the inability to obtain the
127 * <bid> from the board's EEPROM. Assume a PCI board and set
128 * <hdsbid> according to the number ofr found ports.
130 case 0:
131 /* start by assuming 4-port for ZERO casing */
132 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
133 /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
134 #endif
135 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1):
137 * This Board ID is a generic identification. Use the number of
138 * found ports to further define this hardware.
140 switch (ci->max_port)
142 default: /* shouldn't need a default, but have one
143 * anyway */
144 case 4:
145 ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */
146 break;
147 case 2:
148 ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
149 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
150 break;
151 case 1:
152 ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
153 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
154 break;
156 break;
157 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1):
158 ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
159 break;
160 case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1):
161 ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
162 break;
163 default:
164 /*** bid = "<unknown>"; ***/
165 ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */
166 break;
170 /* given the presetting of hdw_bid, set the corresponding brd_id */
172 void
173 sbeid_set_bdtype (ci_t * ci)
175 /* set SBE's unique PCI VENDOR/DEVID */
176 switch (ci->hdw_bid)
178 case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */
179 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3);
180 break;
181 case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */
182 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1);
183 break;
184 case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */
185 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1);
186 break;
187 case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */
188 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1);
189 break;
190 case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */
191 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1);
192 break;
193 case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */
194 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1);
195 break;
196 case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */
197 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1);
198 break;
199 case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */
200 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
201 break;
202 case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */
203 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1);
204 break;
205 case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */
206 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1);
207 break;
209 default:
210 /*** hdw_bid = "<unknown>"; ***/
211 ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1);
212 break;
217 /*** End-of-File ***/