Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sbeid.c
Go to the documentation of this file.
1 /* Copyright (C) 2005 SBE, Inc.
2  *
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.
7  *
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.
12  */
13 
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"
21 
22 #ifdef SBE_INCLUDE_SYMBOLS
23 #define STATIC
24 #else
25 #define STATIC static
26 #endif
27 
28 
29 char *
31 {
32  char *np = 0;
33 
34  switch (ci->brd_id)
35  {
37  np = "wanPTMC-256T3 <E1>";
38  break;
40  np = "wanPTMC-256T3 <T1>";
41  break;
44  np = "wanPMC-C4T1E1";
45  break;
48  np = "wanPMC-C2T1E1";
49  break;
52  np = "wanPMC-C1T1E1";
53  break;
55  np = "wanPCI-C4T1E1";
56  break;
58  np = "wanPCI-C2T1E1";
59  break;
61  np = "wanPCI-C1T1E1";
62  break;
63  default:
64  /*** np = "<unknown>"; ***/
65  np = "wanPCI-CxT1E1";
66  break;
67  }
68 
69  return np;
70 }
71 
72 
73 /* given the presetting of brd_id, set the corresponding hdw_id */
74 
75 void
77 {
78  /*
79  * set SBE's unique hardware identification (for legacy boards might not
80  * have this register implemented)
81  */
82 
83  switch (ci->brd_id)
84  {
86  ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1
87  * Version) */
88  break;
90  ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1
91  * Version) */
92  break;
95  /*
96  * This Board ID is a generic identification. Use the found number
97  * of ports to further define this hardware.
98  */
99  switch (ci->max_port)
100  {
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 */
109  break;
110  case 1:
111  ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
113  break;
114  }
115  break;
118  ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */
119  break;
122  ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */
123  break;
124 #ifdef SBE_PMCC4_ENABLE
125  /*
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.
129  */
130  case 0:
131  /* start by assuming 4-port for ZERO casing */
133  /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */
134 #endif
136  /*
137  * This Board ID is a generic identification. Use the number of
138  * found ports to further define this hardware.
139  */
140  switch (ci->max_port)
141  {
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 */
150  break;
151  case 1:
152  ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */
154  break;
155  }
156  break;
158  ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */
159  break;
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;
167  }
168 }
169 
170 /* given the presetting of hdw_bid, set the corresponding brd_id */
171 
172 void
174 {
175  /* set SBE's unique PCI VENDOR/DEVID */
176  switch (ci->hdw_bid)
177  {
178  case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */
180  break;
181  case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */
183  break;
184  case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */
186  break;
187  case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */
189  break;
190  case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */
192  break;
193  case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */
195  break;
196  case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */
198  break;
199  case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */
201  break;
202  case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */
204  break;
205  case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */
207  break;
208 
209  default:
210  /*** hdw_bid = "<unknown>"; ***/
212  break;
213  }
214 }
215 
216 
217 /*** End-of-File ***/