Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 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 | |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 22 | char * |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 23 | sbeid_get_bdname (ci_t *ci) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 24 | { |
| 25 | char *np = 0; |
| 26 | |
| 27 | switch (ci->brd_id) |
| 28 | { |
| 29 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): |
| 30 | np = "wanPTMC-256T3 <E1>"; |
| 31 | break; |
| 32 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): |
| 33 | np = "wanPTMC-256T3 <T1>"; |
| 34 | break; |
| 35 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): |
| 36 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): |
| 37 | np = "wanPMC-C4T1E1"; |
| 38 | break; |
| 39 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): |
| 40 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): |
| 41 | np = "wanPMC-C2T1E1"; |
| 42 | break; |
| 43 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): |
| 44 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): |
| 45 | np = "wanPMC-C1T1E1"; |
| 46 | break; |
| 47 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): |
| 48 | np = "wanPCI-C4T1E1"; |
| 49 | break; |
| 50 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): |
| 51 | np = "wanPCI-C2T1E1"; |
| 52 | break; |
| 53 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): |
| 54 | np = "wanPCI-C1T1E1"; |
| 55 | break; |
| 56 | default: |
| 57 | /*** np = "<unknown>"; ***/ |
| 58 | np = "wanPCI-CxT1E1"; |
| 59 | break; |
| 60 | } |
| 61 | |
| 62 | return np; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | /* given the presetting of brd_id, set the corresponding hdw_id */ |
| 67 | |
| 68 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 69 | sbeid_set_hdwbid (ci_t *ci) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 70 | { |
| 71 | /* |
| 72 | * set SBE's unique hardware identification (for legacy boards might not |
| 73 | * have this register implemented) |
| 74 | */ |
| 75 | |
| 76 | switch (ci->brd_id) |
| 77 | { |
| 78 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1): |
| 79 | ci->hdw_bid = SBE_BID_256T3_E1; /* 0x46 - SBE wanPTMC-256T3 (E1 |
| 80 | * Version) */ |
| 81 | break; |
| 82 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1): |
| 83 | ci->hdw_bid = SBE_BID_256T3_T1; /* 0x42 - SBE wanPTMC-256T3 (T1 |
| 84 | * Version) */ |
| 85 | break; |
| 86 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1): |
| 87 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1_L): |
| 88 | /* |
| 89 | * This Board ID is a generic identification. Use the found number |
| 90 | * of ports to further define this hardware. |
| 91 | */ |
| 92 | switch (ci->max_port) |
| 93 | { |
| 94 | default: /* shouldn't need a default, but have one |
| 95 | * anyway */ |
| 96 | case 4: |
| 97 | ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0xC4 - SBE wanPMC-C4T1E1 */ |
| 98 | break; |
| 99 | case 2: |
| 100 | ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ |
| 101 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); |
| 102 | break; |
| 103 | case 1: |
| 104 | ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ |
| 105 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); |
| 106 | break; |
| 107 | } |
| 108 | break; |
| 109 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1): |
| 110 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1_L): |
| 111 | ci->hdw_bid = SBE_BID_PMC_C2T1E1; /* 0xC2 - SBE wanPMC-C2T1E1 */ |
| 112 | break; |
| 113 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1): |
| 114 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1_L): |
| 115 | ci->hdw_bid = SBE_BID_PMC_C1T1E1; /* 0xC1 - SBE wanPMC-C1T1E1 */ |
| 116 | break; |
| 117 | #ifdef SBE_PMCC4_ENABLE |
| 118 | /* |
| 119 | * This case is entered as a result of the inability to obtain the |
| 120 | * <bid> from the board's EEPROM. Assume a PCI board and set |
| 121 | * <hdsbid> according to the number ofr found ports. |
| 122 | */ |
| 123 | case 0: |
| 124 | /* start by assuming 4-port for ZERO casing */ |
| 125 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); |
| 126 | /* drop thru to set hdw_bid and alternate PCI CxT1E1 settings */ |
| 127 | #endif |
| 128 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1): |
| 129 | /* |
| 130 | * This Board ID is a generic identification. Use the number of |
| 131 | * found ports to further define this hardware. |
| 132 | */ |
| 133 | switch (ci->max_port) |
| 134 | { |
| 135 | default: /* shouldn't need a default, but have one |
| 136 | * anyway */ |
| 137 | case 4: |
| 138 | ci->hdw_bid = SBE_BID_PCI_C4T1E1; /* 0x04 - SBE wanPCI-C4T1E1 */ |
| 139 | break; |
| 140 | case 2: |
| 141 | ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ |
| 142 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); |
| 143 | break; |
| 144 | case 1: |
| 145 | ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ |
| 146 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); |
| 147 | break; |
| 148 | } |
| 149 | break; |
| 150 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1): |
| 151 | ci->hdw_bid = SBE_BID_PCI_C2T1E1; /* 0x02 - SBE wanPCI-C2T1E1 */ |
| 152 | break; |
| 153 | case SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1): |
| 154 | ci->hdw_bid = SBE_BID_PCI_C1T1E1; /* 0x01 - SBE wanPCI-C1T1E1 */ |
| 155 | break; |
| 156 | default: |
| 157 | /*** bid = "<unknown>"; ***/ |
| 158 | ci->hdw_bid = SBE_BID_PMC_C4T1E1; /* 0x41 - SBE wanPTMC-C4T1E1 */ |
| 159 | break; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /* given the presetting of hdw_bid, set the corresponding brd_id */ |
| 164 | |
| 165 | void |
Dulshani Gunawardhana | ee1803c | 2013-05-22 23:29:26 +0530 | [diff] [blame] | 166 | sbeid_set_bdtype (ci_t *ci) |
Bob Beers | 50ee11f | 2010-03-04 08:40:46 -0500 | [diff] [blame] | 167 | { |
| 168 | /* set SBE's unique PCI VENDOR/DEVID */ |
| 169 | switch (ci->hdw_bid) |
| 170 | { |
| 171 | case SBE_BID_C1T3: /* SBE wanPMC-C1T3 */ |
| 172 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T3); |
| 173 | break; |
| 174 | case SBE_BID_C24TE1: /* SBE wanPTMC-C24TE1 */ |
| 175 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_C24TE1); |
| 176 | break; |
| 177 | case SBE_BID_256T3_E1: /* SBE wanPTMC-256T3 E1 Version */ |
| 178 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_E1); |
| 179 | break; |
| 180 | case SBE_BID_256T3_T1: /* SBE wanPTMC-256T3 T1 Version */ |
| 181 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPTMC_256T3_T1); |
| 182 | break; |
| 183 | case SBE_BID_PMC_C4T1E1: /* 0xC4 - SBE wanPMC-C4T1E1 */ |
| 184 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C4T1E1); |
| 185 | break; |
| 186 | case SBE_BID_PMC_C2T1E1: /* 0xC2 - SBE wanPMC-C2T1E1 */ |
| 187 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C2T1E1); |
| 188 | break; |
| 189 | case SBE_BID_PMC_C1T1E1: /* 0xC1 - SBE wanPMC-C1T1E1 */ |
| 190 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPMC_C1T1E1); |
| 191 | break; |
| 192 | case SBE_BID_PCI_C4T1E1: /* 0x04 - SBE wanPCI-C4T1E1 */ |
| 193 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); |
| 194 | break; |
| 195 | case SBE_BID_PCI_C2T1E1: /* 0x02 - SBE wanPCI-C2T1E1 */ |
| 196 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C2T1E1); |
| 197 | break; |
| 198 | case SBE_BID_PCI_C1T1E1: /* 0x01 - SBE wanPCI-C1T1E1 */ |
| 199 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C1T1E1); |
| 200 | break; |
| 201 | |
| 202 | default: |
| 203 | /*** hdw_bid = "<unknown>"; ***/ |
| 204 | ci->brd_id = SBE_BOARD_ID (PCI_VENDOR_ID_SBE, PCI_DEVICE_ID_WANPCI_C4T1E1); |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | |
| 210 | /*** End-of-File ***/ |