~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/cavium-octeon/executive/cvmx-helper-board.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/cavium-octeon/executive/cvmx-helper-board.c (Architecture m68k) and /arch/mips/cavium-octeon/executive/cvmx-helper-board.c (Architecture mips)


  1 /***********************license start*********      1 /***********************license start***************
  2  * Author: Cavium Networks                          2  * Author: Cavium Networks
  3  *                                                  3  *
  4  * Contact: support@caviumnetworks.com              4  * Contact: support@caviumnetworks.com
  5  * This file is part of the OCTEON SDK              5  * This file is part of the OCTEON SDK
  6  *                                                  6  *
  7  * Copyright (c) 2003-2008 Cavium Networks          7  * Copyright (c) 2003-2008 Cavium Networks
  8  *                                                  8  *
  9  * This file is free software; you can redistr      9  * This file is free software; you can redistribute it and/or modify
 10  * it under the terms of the GNU General Publi     10  * it under the terms of the GNU General Public License, Version 2, as
 11  * published by the Free Software Foundation.      11  * published by the Free Software Foundation.
 12  *                                                 12  *
 13  * This file is distributed in the hope that i     13  * This file is distributed in the hope that it will be useful, but
 14  * AS-IS and WITHOUT ANY WARRANTY; without eve     14  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
 15  * of MERCHANTABILITY or FITNESS FOR A PARTICU     15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
 16  * NONINFRINGEMENT.  See the GNU General Publi     16  * NONINFRINGEMENT.  See the GNU General Public License for more
 17  * details.                                        17  * details.
 18  *                                                 18  *
 19  * You should have received a copy of the GNU      19  * You should have received a copy of the GNU General Public License
 20  * along with this file; if not, write to the      20  * along with this file; if not, write to the Free Software
 21  * Foundation, Inc., 51 Franklin St, Fifth Flo     21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 22  * or visit http://www.gnu.org/licenses/.          22  * or visit http://www.gnu.org/licenses/.
 23  *                                                 23  *
 24  * This file may also be available under a dif     24  * This file may also be available under a different license from Cavium.
 25  * Contact Cavium Networks for more informatio     25  * Contact Cavium Networks for more information
 26  ***********************license end***********     26  ***********************license end**************************************/
 27                                                    27 
 28 /*                                                 28 /*
 29  *                                                 29  *
 30  * Helper functions to abstract board specific     30  * Helper functions to abstract board specific data about
 31  * network ports from the rest of the cvmx-hel     31  * network ports from the rest of the cvmx-helper files.
 32  */                                                32  */
 33                                                    33 
 34 #include <linux/bug.h>                             34 #include <linux/bug.h>
 35 #include <asm/octeon/octeon.h>                     35 #include <asm/octeon/octeon.h>
 36 #include <asm/octeon/cvmx-bootinfo.h>              36 #include <asm/octeon/cvmx-bootinfo.h>
 37                                                    37 
 38 #include <asm/octeon/cvmx-config.h>                38 #include <asm/octeon/cvmx-config.h>
 39                                                    39 
 40 #include <asm/octeon/cvmx-helper.h>                40 #include <asm/octeon/cvmx-helper.h>
 41 #include <asm/octeon/cvmx-helper-util.h>           41 #include <asm/octeon/cvmx-helper-util.h>
 42 #include <asm/octeon/cvmx-helper-board.h>          42 #include <asm/octeon/cvmx-helper-board.h>
 43                                                    43 
 44 #include <asm/octeon/cvmx-gmxx-defs.h>             44 #include <asm/octeon/cvmx-gmxx-defs.h>
 45 #include <asm/octeon/cvmx-asxx-defs.h>             45 #include <asm/octeon/cvmx-asxx-defs.h>
 46                                                    46 
 47 /*                                                 47 /*
 48  * Return the MII PHY address associated with      48  * Return the MII PHY address associated with the given IPD
 49  * port. A result of -1 means there isn't a MI     49  * port. A result of -1 means there isn't a MII capable PHY
 50  * connected to this port. On chips supporting     50  * connected to this port. On chips supporting multiple MII
 51  * busses the bus number is encoded in bits <1     51  * busses the bus number is encoded in bits <15:8>.
 52  *                                                 52  *
 53  * This function must be modified for every ne     53  * This function must be modified for every new Octeon board.
 54  * Internally it uses switch statements based      54  * Internally it uses switch statements based on the cvmx_sysinfo
 55  * data to determine board types and revisions     55  * data to determine board types and revisions. It replies on the
 56  * fact that every Octeon board receives a uni     56  * fact that every Octeon board receives a unique board type
 57  * enumeration from the bootloader.                57  * enumeration from the bootloader.
 58  *                                                 58  *
 59  * @ipd_port: Octeon IPD port to get the MII a     59  * @ipd_port: Octeon IPD port to get the MII address for.
 60  *                                                 60  *
 61  * Returns MII PHY address and bus number or -     61  * Returns MII PHY address and bus number or -1.
 62  */                                                62  */
 63 int cvmx_helper_board_get_mii_address(int ipd_     63 int cvmx_helper_board_get_mii_address(int ipd_port)
 64 {                                                  64 {
 65         switch (cvmx_sysinfo_get()->board_type     65         switch (cvmx_sysinfo_get()->board_type) {
 66         case CVMX_BOARD_TYPE_SIM:                  66         case CVMX_BOARD_TYPE_SIM:
 67                 /* Simulator doesn't have MII      67                 /* Simulator doesn't have MII */
 68                 return -1;                         68                 return -1;
 69         case CVMX_BOARD_TYPE_EBT3000:              69         case CVMX_BOARD_TYPE_EBT3000:
 70         case CVMX_BOARD_TYPE_EBT5800:              70         case CVMX_BOARD_TYPE_EBT5800:
 71         case CVMX_BOARD_TYPE_THUNDER:              71         case CVMX_BOARD_TYPE_THUNDER:
 72         case CVMX_BOARD_TYPE_NICPRO2:              72         case CVMX_BOARD_TYPE_NICPRO2:
 73                 /* Interface 0 is SPI4, interf     73                 /* Interface 0 is SPI4, interface 1 is RGMII */
 74                 if ((ipd_port >= 16) && (ipd_p     74                 if ((ipd_port >= 16) && (ipd_port < 20))
 75                         return ipd_port - 16;      75                         return ipd_port - 16;
 76                 else                               76                 else
 77                         return -1;                 77                         return -1;
 78         case CVMX_BOARD_TYPE_KODAMA:               78         case CVMX_BOARD_TYPE_KODAMA:
 79         case CVMX_BOARD_TYPE_EBH3100:              79         case CVMX_BOARD_TYPE_EBH3100:
 80         case CVMX_BOARD_TYPE_HIKARI:               80         case CVMX_BOARD_TYPE_HIKARI:
 81         case CVMX_BOARD_TYPE_CN3010_EVB_HS5:       81         case CVMX_BOARD_TYPE_CN3010_EVB_HS5:
 82         case CVMX_BOARD_TYPE_CN3005_EVB_HS5:       82         case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
 83         case CVMX_BOARD_TYPE_CN3020_EVB_HS5:       83         case CVMX_BOARD_TYPE_CN3020_EVB_HS5:
 84                 /*                                 84                 /*
 85                  * Port 0 is WAN connected to      85                  * Port 0 is WAN connected to a PHY, Port 1 is GMII
 86                  * connected to a switch           86                  * connected to a switch
 87                  */                                87                  */
 88                 if (ipd_port == 0)                 88                 if (ipd_port == 0)
 89                         return 4;                  89                         return 4;
 90                 else if (ipd_port == 1)            90                 else if (ipd_port == 1)
 91                         return 9;                  91                         return 9;
 92                 else                               92                 else
 93                         return -1;                 93                         return -1;
 94         case CVMX_BOARD_TYPE_NAC38:                94         case CVMX_BOARD_TYPE_NAC38:
 95                 /* Board has 8 RGMII ports PHY     95                 /* Board has 8 RGMII ports PHYs are 0-7 */
 96                 if ((ipd_port >= 0) && (ipd_po     96                 if ((ipd_port >= 0) && (ipd_port < 4))
 97                         return ipd_port;           97                         return ipd_port;
 98                 else if ((ipd_port >= 16) && (     98                 else if ((ipd_port >= 16) && (ipd_port < 20))
 99                         return ipd_port - 16 +     99                         return ipd_port - 16 + 4;
100                 else                              100                 else
101                         return -1;                101                         return -1;
102         case CVMX_BOARD_TYPE_EBH3000:             102         case CVMX_BOARD_TYPE_EBH3000:
103                 /* Board has dual SPI4 and no     103                 /* Board has dual SPI4 and no PHYs */
104                 return -1;                        104                 return -1;
105         case CVMX_BOARD_TYPE_EBH5200:             105         case CVMX_BOARD_TYPE_EBH5200:
106         case CVMX_BOARD_TYPE_EBH5201:             106         case CVMX_BOARD_TYPE_EBH5201:
107         case CVMX_BOARD_TYPE_EBT5200:             107         case CVMX_BOARD_TYPE_EBT5200:
108                 /* Board has 2 management port    108                 /* Board has 2 management ports */
109                 if ((ipd_port >= CVMX_HELPER_B    109                 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) &&
110                     (ipd_port < (CVMX_HELPER_B    110                     (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
111                         return ipd_port - CVMX    111                         return ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT;
112                 /*                                112                 /*
113                  * Board has 4 SGMII ports. Th    113                  * Board has 4 SGMII ports. The PHYs start right after the MII
114                  * ports MII0 = 0, MII1 = 1, S    114                  * ports MII0 = 0, MII1 = 1, SGMII = 2-5.
115                  */                               115                  */
116                 if ((ipd_port >= 0) && (ipd_po    116                 if ((ipd_port >= 0) && (ipd_port < 4))
117                         return ipd_port + 2;      117                         return ipd_port + 2;
118                 else                              118                 else
119                         return -1;                119                         return -1;
120         case CVMX_BOARD_TYPE_EBH5600:             120         case CVMX_BOARD_TYPE_EBH5600:
121         case CVMX_BOARD_TYPE_EBH5601:             121         case CVMX_BOARD_TYPE_EBH5601:
122         case CVMX_BOARD_TYPE_EBH5610:             122         case CVMX_BOARD_TYPE_EBH5610:
123                 /* Board has 1 management port    123                 /* Board has 1 management port */
124                 if (ipd_port == CVMX_HELPER_BO    124                 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
125                         return 0;                 125                         return 0;
126                 /*                                126                 /*
127                  * Board has 8 SGMII ports. 4     127                  * Board has 8 SGMII ports. 4 connect out, two connect
128                  * to a switch, and 2 loop to     128                  * to a switch, and 2 loop to each other
129                  */                               129                  */
130                 if ((ipd_port >= 0) && (ipd_po    130                 if ((ipd_port >= 0) && (ipd_port < 4))
131                         return ipd_port + 1;      131                         return ipd_port + 1;
132                 else                              132                 else
133                         return -1;                133                         return -1;
134         case CVMX_BOARD_TYPE_CUST_NB5:            134         case CVMX_BOARD_TYPE_CUST_NB5:
135                 if (ipd_port == 2)                135                 if (ipd_port == 2)
136                         return 4;                 136                         return 4;
137                 else                              137                 else
138                         return -1;                138                         return -1;
139         case CVMX_BOARD_TYPE_NIC_XLE_4G:          139         case CVMX_BOARD_TYPE_NIC_XLE_4G:
140                 /* Board has 4 SGMII ports. co    140                 /* Board has 4 SGMII ports. connected QLM3(interface 1) */
141                 if ((ipd_port >= 16) && (ipd_p    141                 if ((ipd_port >= 16) && (ipd_port < 20))
142                         return ipd_port - 16 +    142                         return ipd_port - 16 + 1;
143                 else                              143                 else
144                         return -1;                144                         return -1;
145         case CVMX_BOARD_TYPE_NIC_XLE_10G:         145         case CVMX_BOARD_TYPE_NIC_XLE_10G:
146         case CVMX_BOARD_TYPE_NIC10E:              146         case CVMX_BOARD_TYPE_NIC10E:
147                 return -1;                        147                 return -1;
148         case CVMX_BOARD_TYPE_NIC4E:               148         case CVMX_BOARD_TYPE_NIC4E:
149                 if (ipd_port >= 0 && ipd_port     149                 if (ipd_port >= 0 && ipd_port <= 3)
150                         return (ipd_port + 0x1    150                         return (ipd_port + 0x1f) & 0x1f;
151                 else                              151                 else
152                         return -1;                152                         return -1;
153         case CVMX_BOARD_TYPE_NIC2E:               153         case CVMX_BOARD_TYPE_NIC2E:
154                 if (ipd_port >= 0 && ipd_port     154                 if (ipd_port >= 0 && ipd_port <= 1)
155                         return ipd_port + 1;      155                         return ipd_port + 1;
156                 else                              156                 else
157                         return -1;                157                         return -1;
158         case CVMX_BOARD_TYPE_BBGW_REF:            158         case CVMX_BOARD_TYPE_BBGW_REF:
159                 /*                                159                 /*
160                  * No PHYs are connected to Oc    160                  * No PHYs are connected to Octeon, everything is
161                  * through switch.                161                  * through switch.
162                  */                               162                  */
163                 return -1;                        163                 return -1;
164                                                   164 
165         case CVMX_BOARD_TYPE_CUST_WSX16:          165         case CVMX_BOARD_TYPE_CUST_WSX16:
166                 if (ipd_port >= 0 && ipd_port     166                 if (ipd_port >= 0 && ipd_port <= 3)
167                         return ipd_port;          167                         return ipd_port;
168                 else if (ipd_port >= 16 && ipd    168                 else if (ipd_port >= 16 && ipd_port <= 19)
169                         return ipd_port - 16 +    169                         return ipd_port - 16 + 4;
170                 else                              170                 else
171                         return -1;                171                         return -1;
172         case CVMX_BOARD_TYPE_UBNT_E100:           172         case CVMX_BOARD_TYPE_UBNT_E100:
173                 if (ipd_port >= 0 && ipd_port     173                 if (ipd_port >= 0 && ipd_port <= 2)
174                         return 7 - ipd_port;      174                         return 7 - ipd_port;
175                 else                              175                 else
176                         return -1;                176                         return -1;
177         case CVMX_BOARD_TYPE_KONTRON_S1901:       177         case CVMX_BOARD_TYPE_KONTRON_S1901:
178                 if (ipd_port == CVMX_HELPER_BO    178                 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
179                         return 1;                 179                         return 1;
180                 else                              180                 else
181                         return -1;                181                         return -1;
182                                                   182 
183         }                                         183         }
184                                                   184 
185         /* Some unknown board. Somebody forgot    185         /* Some unknown board. Somebody forgot to update this function... */
186         cvmx_dprintf                              186         cvmx_dprintf
187             ("cvmx_helper_board_get_mii_addres    187             ("cvmx_helper_board_get_mii_address: Unknown board type %d\n",
188              cvmx_sysinfo_get()->board_type);     188              cvmx_sysinfo_get()->board_type);
189         return -1;                                189         return -1;
190 }                                                 190 }
191                                                   191 
192 /*                                                192 /*
193  * This function is the board specific method     193  * This function is the board specific method of determining an
194  * ethernet ports link speed. Most Octeon boar    194  * ethernet ports link speed. Most Octeon boards have Marvell PHYs
195  * and are handled by the fall through case. T    195  * and are handled by the fall through case. This function must be
196  * updated for boards that don't have the norm    196  * updated for boards that don't have the normal Marvell PHYs.
197  *                                                197  *
198  * This function must be modified for every ne    198  * This function must be modified for every new Octeon board.
199  * Internally it uses switch statements based     199  * Internally it uses switch statements based on the cvmx_sysinfo
200  * data to determine board types and revisions    200  * data to determine board types and revisions. It relies on the
201  * fact that every Octeon board receives a uni    201  * fact that every Octeon board receives a unique board type
202  * enumeration from the bootloader.               202  * enumeration from the bootloader.
203  *                                                203  *
204  * @ipd_port: IPD input port associated with t    204  * @ipd_port: IPD input port associated with the port we want to get link
205  *                 status for.                    205  *                 status for.
206  *                                                206  *
207  * Returns The ports link status. If the link     207  * Returns The ports link status. If the link isn't fully resolved, this must
208  *         return zero.                           208  *         return zero.
209  */                                               209  */
210 union cvmx_helper_link_info __cvmx_helper_boar    210 union cvmx_helper_link_info __cvmx_helper_board_link_get(int ipd_port)
211 {                                                 211 {
212         union cvmx_helper_link_info result;       212         union cvmx_helper_link_info result;
213                                                   213 
214         WARN_ONCE(!octeon_is_simulation(),        214         WARN_ONCE(!octeon_is_simulation(),
215              "Using deprecated link status - p    215              "Using deprecated link status - please update your DT");
216                                                   216 
217         /* Unless we fix it later, all links a    217         /* Unless we fix it later, all links are defaulted to down */
218         result.u64 = 0;                           218         result.u64 = 0;
219                                                   219 
220         if (octeon_is_simulation()) {             220         if (octeon_is_simulation()) {
221                 /* The simulator gives you a s    221                 /* The simulator gives you a simulated 1Gbps full duplex link */
222                 result.s.link_up = 1;             222                 result.s.link_up = 1;
223                 result.s.full_duplex = 1;         223                 result.s.full_duplex = 1;
224                 result.s.speed = 1000;            224                 result.s.speed = 1000;
225                 return result;                    225                 return result;
226         }                                         226         }
227                                                   227 
228         if (OCTEON_IS_MODEL(OCTEON_CN3XXX)        228         if (OCTEON_IS_MODEL(OCTEON_CN3XXX)
229                    || OCTEON_IS_MODEL(OCTEON_C    229                    || OCTEON_IS_MODEL(OCTEON_CN58XX)
230                    || OCTEON_IS_MODEL(OCTEON_C    230                    || OCTEON_IS_MODEL(OCTEON_CN50XX)) {
231                 /*                                231                 /*
232                  * We don't have a PHY address    232                  * We don't have a PHY address, so attempt to use
233                  * in-band status. It is reall    233                  * in-band status. It is really important that boards
234                  * not supporting in-band stat    234                  * not supporting in-band status never get
235                  * here. Reading broken in-ban    235                  * here. Reading broken in-band status tends to do bad
236                  * things                         236                  * things
237                  */                               237                  */
238                 union cvmx_gmxx_rxx_rx_inbnd i    238                 union cvmx_gmxx_rxx_rx_inbnd inband_status;
239                 int interface = cvmx_helper_ge    239                 int interface = cvmx_helper_get_interface_num(ipd_port);
240                 int index = cvmx_helper_get_in    240                 int index = cvmx_helper_get_interface_index_num(ipd_port);
241                 inband_status.u64 =               241                 inband_status.u64 =
242                     cvmx_read_csr(CVMX_GMXX_RX    242                     cvmx_read_csr(CVMX_GMXX_RXX_RX_INBND(index, interface));
243                                                   243 
244                 result.s.link_up = inband_stat    244                 result.s.link_up = inband_status.s.status;
245                 result.s.full_duplex = inband_    245                 result.s.full_duplex = inband_status.s.duplex;
246                 switch (inband_status.s.speed)    246                 switch (inband_status.s.speed) {
247                 case 0: /* 10 Mbps */             247                 case 0: /* 10 Mbps */
248                         result.s.speed = 10;      248                         result.s.speed = 10;
249                         break;                    249                         break;
250                 case 1: /* 100 Mbps */            250                 case 1: /* 100 Mbps */
251                         result.s.speed = 100;     251                         result.s.speed = 100;
252                         break;                    252                         break;
253                 case 2: /* 1 Gbps */              253                 case 2: /* 1 Gbps */
254                         result.s.speed = 1000;    254                         result.s.speed = 1000;
255                         break;                    255                         break;
256                 case 3: /* Illegal */             256                 case 3: /* Illegal */
257                         result.u64 = 0;           257                         result.u64 = 0;
258                         break;                    258                         break;
259                 }                                 259                 }
260         } else {                                  260         } else {
261                 /*                                261                 /*
262                  * We don't have a PHY address    262                  * We don't have a PHY address and we don't have
263                  * in-band status. There is no    263                  * in-band status. There is no way to determine the
264                  * link speed. Return down ass    264                  * link speed. Return down assuming this port isn't
265                  * wired                          265                  * wired
266                  */                               266                  */
267                 result.u64 = 0;                   267                 result.u64 = 0;
268         }                                         268         }
269                                                   269 
270         /* If link is down, return all fields     270         /* If link is down, return all fields as zero. */
271         if (!result.s.link_up)                    271         if (!result.s.link_up)
272                 result.u64 = 0;                   272                 result.u64 = 0;
273                                                   273 
274         return result;                            274         return result;
275 }                                                 275 }
276                                                   276 
277 /*                                                277 /*
278  * This function is called by cvmx_helper_inte    278  * This function is called by cvmx_helper_interface_probe() after it
279  * determines the number of ports Octeon can s    279  * determines the number of ports Octeon can support on a specific
280  * interface. This function is the per board l    280  * interface. This function is the per board location to override
281  * this value. It is called with the number of    281  * this value. It is called with the number of ports Octeon might
282  * support and should return the number of act    282  * support and should return the number of actual ports on the
283  * board.                                         283  * board.
284  *                                                284  *
285  * This function must be modified for every ne    285  * This function must be modified for every new Octeon board.
286  * Internally it uses switch statements based     286  * Internally it uses switch statements based on the cvmx_sysinfo
287  * data to determine board types and revisions    287  * data to determine board types and revisions. It relies on the
288  * fact that every Octeon board receives a uni    288  * fact that every Octeon board receives a unique board type
289  * enumeration from the bootloader.               289  * enumeration from the bootloader.
290  *                                                290  *
291  * @interface: Interface to probe                 291  * @interface: Interface to probe
292  * @supported_ports:                              292  * @supported_ports:
293  *                  Number of ports Octeon sup    293  *                  Number of ports Octeon supports.
294  *                                                294  *
295  * Returns Number of ports the actual board su    295  * Returns Number of ports the actual board supports. Many times this will
296  *         simple be "support_ports".             296  *         simple be "support_ports".
297  */                                               297  */
298 int __cvmx_helper_board_interface_probe(int in    298 int __cvmx_helper_board_interface_probe(int interface, int supported_ports)
299 {                                                 299 {
300         switch (cvmx_sysinfo_get()->board_type    300         switch (cvmx_sysinfo_get()->board_type) {
301         case CVMX_BOARD_TYPE_CN3005_EVB_HS5:      301         case CVMX_BOARD_TYPE_CN3005_EVB_HS5:
302                 if (interface == 0)               302                 if (interface == 0)
303                         return 2;                 303                         return 2;
304                 break;                            304                 break;
305         case CVMX_BOARD_TYPE_BBGW_REF:            305         case CVMX_BOARD_TYPE_BBGW_REF:
306                 if (interface == 0)               306                 if (interface == 0)
307                         return 2;                 307                         return 2;
308                 break;                            308                 break;
309         case CVMX_BOARD_TYPE_NIC_XLE_4G:          309         case CVMX_BOARD_TYPE_NIC_XLE_4G:
310                 if (interface == 0)               310                 if (interface == 0)
311                         return 0;                 311                         return 0;
312                 break;                            312                 break;
313                 /* The 2nd interface on the EB    313                 /* The 2nd interface on the EBH5600 is connected to the Marvel switch,
314                    which we don't support. Dis    314                    which we don't support. Disable ports connected to it */
315         case CVMX_BOARD_TYPE_EBH5600:             315         case CVMX_BOARD_TYPE_EBH5600:
316                 if (interface == 1)               316                 if (interface == 1)
317                         return 0;                 317                         return 0;
318                 break;                            318                 break;
319         }                                         319         }
320         return supported_ports;                   320         return supported_ports;
321 }                                                 321 }
322                                                   322 
323 /*                                                323 /*
324  * Get the clock type used for the USB block b    324  * Get the clock type used for the USB block based on board type.
325  * Used by the USB code for auto configuration    325  * Used by the USB code for auto configuration of clock type.
326  *                                                326  *
327  * Return USB clock type enumeration              327  * Return USB clock type enumeration
328  */                                               328  */
329 enum cvmx_helper_board_usb_clock_types __cvmx_    329 enum cvmx_helper_board_usb_clock_types __cvmx_helper_board_usb_get_clock_type(void)
330 {                                                 330 {
331         switch (cvmx_sysinfo_get()->board_type    331         switch (cvmx_sysinfo_get()->board_type) {
332         case CVMX_BOARD_TYPE_BBGW_REF:            332         case CVMX_BOARD_TYPE_BBGW_REF:
333         case CVMX_BOARD_TYPE_LANAI2_A:            333         case CVMX_BOARD_TYPE_LANAI2_A:
334         case CVMX_BOARD_TYPE_LANAI2_U:            334         case CVMX_BOARD_TYPE_LANAI2_U:
335         case CVMX_BOARD_TYPE_LANAI2_G:            335         case CVMX_BOARD_TYPE_LANAI2_G:
336         case CVMX_BOARD_TYPE_NIC10E_66:           336         case CVMX_BOARD_TYPE_NIC10E_66:
337         case CVMX_BOARD_TYPE_UBNT_E100:           337         case CVMX_BOARD_TYPE_UBNT_E100:
338                 return USB_CLOCK_TYPE_CRYSTAL_    338                 return USB_CLOCK_TYPE_CRYSTAL_12;
339         case CVMX_BOARD_TYPE_NIC10E:              339         case CVMX_BOARD_TYPE_NIC10E:
340                 return USB_CLOCK_TYPE_REF_12;     340                 return USB_CLOCK_TYPE_REF_12;
341         default:                                  341         default:
342                 break;                            342                 break;
343         }                                         343         }
344         /* Most boards except NIC10e use a 12M    344         /* Most boards except NIC10e use a 12MHz crystal */
345         if (OCTEON_IS_OCTEON2())                  345         if (OCTEON_IS_OCTEON2())
346                 return USB_CLOCK_TYPE_CRYSTAL_    346                 return USB_CLOCK_TYPE_CRYSTAL_12;
347         return USB_CLOCK_TYPE_REF_48;             347         return USB_CLOCK_TYPE_REF_48;
348 }                                                 348 }
349                                                   349 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php