1 /***********************license start***************
2 * Author: Cavium Networks
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
7 * Copyright (c) 2003-2008 Cavium Networks
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
30 * Helper functions for common, but complicated tasks.
33 #include <asm/octeon/octeon.h>
35 #include <asm/octeon/cvmx-config.h>
37 #include <asm/octeon/cvmx-fpa.h>
38 #include <asm/octeon/cvmx-pip.h>
39 #include <asm/octeon/cvmx-pko.h>
40 #include <asm/octeon/cvmx-ipd.h>
41 #include <asm/octeon/cvmx-spi.h>
42 #include <asm/octeon/cvmx-helper.h>
43 #include <asm/octeon/cvmx-helper-board.h>
45 #include <asm/octeon/cvmx-pip-defs.h>
46 #include <asm/octeon/cvmx-smix-defs.h>
47 #include <asm/octeon/cvmx-asxx-defs.h>
50 * cvmx_override_pko_queue_priority(int ipd_port, uint64_t
51 * priorities[16]) is a function pointer. It is meant to allow
52 * customization of the PKO queue priorities based on the port
53 * number. Users should set this pointer to a function before
54 * calling any cvmx-helper operations.
56 void (*cvmx_override_pko_queue_priority
) (int pko_port
,
57 uint64_t priorities
[16]);
60 * cvmx_override_ipd_port_setup(int ipd_port) is a function
61 * pointer. It is meant to allow customization of the IPD port
62 * setup before packet input/output comes online. It is called
63 * after cvmx-helper does the default IPD configuration, but
64 * before IPD is enabled. Users should set this pointer to a
65 * function before calling any cvmx-helper operations.
67 void (*cvmx_override_ipd_port_setup
) (int ipd_port
);
69 /* Port count per interface */
70 static int interface_port_count
[5];
72 /* Port last configured link info index by IPD/PKO port */
73 static cvmx_helper_link_info_t
74 port_link_info
[CVMX_PIP_NUM_INPUT_PORTS
];
77 * Return the number of interfaces the chip has. Each interface
78 * may have multiple ports. Most chips support two interfaces,
79 * but the CNX0XX and CNX1XX are exceptions. These only support
82 * Returns Number of interfaces on chip
84 int cvmx_helper_get_number_of_interfaces(void)
86 if (OCTEON_IS_MODEL(OCTEON_CN56XX
) || OCTEON_IS_MODEL(OCTEON_CN52XX
))
91 EXPORT_SYMBOL_GPL(cvmx_helper_get_number_of_interfaces
);
94 * Return the number of ports on an interface. Depending on the
95 * chip and configuration, this can be 1-16. A value of 0
96 * specifies that the interface doesn't exist or isn't usable.
98 * @interface: Interface to get the port count for
100 * Returns Number of ports on interface. Can be Zero.
102 int cvmx_helper_ports_on_interface(int interface
)
104 return interface_port_count
[interface
];
106 EXPORT_SYMBOL_GPL(cvmx_helper_ports_on_interface
);
110 * Return interface mode for CN68xx.
112 static cvmx_helper_interface_mode_t
__cvmx_get_mode_cn68xx(int interface
)
114 union cvmx_mio_qlmx_cfg qlm_cfg
;
117 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
118 /* QLM is disabled when QLM SPD is 15. */
119 if (qlm_cfg
.s
.qlm_spd
== 15)
120 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
122 if (qlm_cfg
.s
.qlm_cfg
== 2)
123 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
124 else if (qlm_cfg
.s
.qlm_cfg
== 3)
125 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
127 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
131 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(interface
));
132 /* QLM is disabled when QLM SPD is 15. */
133 if (qlm_cfg
.s
.qlm_spd
== 15)
134 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
136 if (qlm_cfg
.s
.qlm_cfg
== 2)
137 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
138 else if (qlm_cfg
.s
.qlm_cfg
== 3)
139 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
141 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
143 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(3));
144 /* QLM is disabled when QLM SPD is 15. */
145 if (qlm_cfg
.s
.qlm_spd
== 15) {
146 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
147 } else if (qlm_cfg
.s
.qlm_cfg
!= 0) {
148 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(1));
149 if (qlm_cfg
.s
.qlm_cfg
!= 0)
150 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
152 return CVMX_HELPER_INTERFACE_MODE_NPI
;
154 return CVMX_HELPER_INTERFACE_MODE_LOOP
;
156 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
162 * Return interface mode for an Octeon II
164 static cvmx_helper_interface_mode_t
__cvmx_get_mode_octeon2(int interface
)
166 union cvmx_gmxx_inf_mode mode
;
168 if (OCTEON_IS_MODEL(OCTEON_CN68XX
))
169 return __cvmx_get_mode_cn68xx(interface
);
172 return CVMX_HELPER_INTERFACE_MODE_NPI
;
175 return CVMX_HELPER_INTERFACE_MODE_LOOP
;
177 /* Only present in CN63XX & CN66XX Octeon model */
178 if ((OCTEON_IS_MODEL(OCTEON_CN63XX
) &&
179 (interface
== 4 || interface
== 5)) ||
180 (OCTEON_IS_MODEL(OCTEON_CN66XX
) &&
181 interface
>= 4 && interface
<= 7)) {
182 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
185 if (OCTEON_IS_MODEL(OCTEON_CN66XX
)) {
186 union cvmx_mio_qlmx_cfg mio_qlm_cfg
;
188 /* QLM2 is SGMII0 and QLM1 is SGMII1 */
190 mio_qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(2));
191 else if (interface
== 1)
192 mio_qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(1));
194 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
196 if (mio_qlm_cfg
.s
.qlm_spd
== 15)
197 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
199 if (mio_qlm_cfg
.s
.qlm_cfg
== 9)
200 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
201 else if (mio_qlm_cfg
.s
.qlm_cfg
== 11)
202 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
204 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
205 } else if (OCTEON_IS_MODEL(OCTEON_CN61XX
)) {
206 union cvmx_mio_qlmx_cfg qlm_cfg
;
208 if (interface
== 0) {
209 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(2));
210 if (qlm_cfg
.s
.qlm_cfg
== 2)
211 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
212 else if (qlm_cfg
.s
.qlm_cfg
== 3)
213 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
215 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
216 } else if (interface
== 1) {
217 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
218 if (qlm_cfg
.s
.qlm_cfg
== 2)
219 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
220 else if (qlm_cfg
.s
.qlm_cfg
== 3)
221 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
223 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
225 } else if (OCTEON_IS_MODEL(OCTEON_CNF71XX
)) {
226 if (interface
== 0) {
227 union cvmx_mio_qlmx_cfg qlm_cfg
;
228 qlm_cfg
.u64
= cvmx_read_csr(CVMX_MIO_QLMX_CFG(0));
229 if (qlm_cfg
.s
.qlm_cfg
== 2)
230 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
232 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
235 if (interface
== 1 && OCTEON_IS_MODEL(OCTEON_CN63XX
))
236 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
238 mode
.u64
= cvmx_read_csr(CVMX_GMXX_INF_MODE(interface
));
240 if (OCTEON_IS_MODEL(OCTEON_CN63XX
)) {
241 switch (mode
.cn63xx
.mode
) {
243 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
245 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
247 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
251 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
254 return CVMX_HELPER_INTERFACE_MODE_GMII
;
256 return CVMX_HELPER_INTERFACE_MODE_RGMII
;
261 * Get the operating mode of an interface. Depending on the Octeon
262 * chip and configuration, this function returns an enumeration
263 * of the type of packet I/O supported by an interface.
265 * @interface: Interface to probe
267 * Returns Mode of the interface. Unknown or unsupported interfaces return
270 cvmx_helper_interface_mode_t
cvmx_helper_interface_get_mode(int interface
)
272 union cvmx_gmxx_inf_mode mode
;
275 interface
>= cvmx_helper_get_number_of_interfaces())
276 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
281 if (OCTEON_IS_MODEL(OCTEON_CN6XXX
) || OCTEON_IS_MODEL(OCTEON_CNF71XX
))
282 return __cvmx_get_mode_octeon2(interface
);
285 * Octeon and Octeon Plus models
288 return CVMX_HELPER_INTERFACE_MODE_NPI
;
290 if (interface
== 3) {
291 if (OCTEON_IS_MODEL(OCTEON_CN56XX
)
292 || OCTEON_IS_MODEL(OCTEON_CN52XX
))
293 return CVMX_HELPER_INTERFACE_MODE_LOOP
;
295 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
299 && cvmx_sysinfo_get()->board_type
== CVMX_BOARD_TYPE_CN3005_EVB_HS5
300 && cvmx_sysinfo_get()->board_rev_major
== 1) {
302 * Lie about interface type of CN3005 board. This
303 * board has a switch on port 1 like the other
304 * evaluation boards, but it is connected over RGMII
305 * instead of GMII. Report GMII mode so that the
306 * speed is forced to 1 Gbit full duplex. Other than
307 * some initial configuration (which does not use the
308 * output of this function) there is no difference in
309 * setup between GMII and RGMII modes.
311 return CVMX_HELPER_INTERFACE_MODE_GMII
;
314 /* Interface 1 is always disabled on CN31XX and CN30XX */
316 && (OCTEON_IS_MODEL(OCTEON_CN31XX
) || OCTEON_IS_MODEL(OCTEON_CN30XX
)
317 || OCTEON_IS_MODEL(OCTEON_CN50XX
)
318 || OCTEON_IS_MODEL(OCTEON_CN52XX
)))
319 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
321 mode
.u64
= cvmx_read_csr(CVMX_GMXX_INF_MODE(interface
));
323 if (OCTEON_IS_MODEL(OCTEON_CN56XX
) || OCTEON_IS_MODEL(OCTEON_CN52XX
)) {
324 switch (mode
.cn56xx
.mode
) {
326 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
328 return CVMX_HELPER_INTERFACE_MODE_XAUI
;
330 return CVMX_HELPER_INTERFACE_MODE_SGMII
;
332 return CVMX_HELPER_INTERFACE_MODE_PICMG
;
334 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
338 return CVMX_HELPER_INTERFACE_MODE_DISABLED
;
341 if (OCTEON_IS_MODEL(OCTEON_CN38XX
)
342 || OCTEON_IS_MODEL(OCTEON_CN58XX
))
343 return CVMX_HELPER_INTERFACE_MODE_SPI
;
345 return CVMX_HELPER_INTERFACE_MODE_GMII
;
347 return CVMX_HELPER_INTERFACE_MODE_RGMII
;
350 EXPORT_SYMBOL_GPL(cvmx_helper_interface_get_mode
);
353 * Configure the IPD/PIP tagging and QoS options for a specific
354 * port. This function determines the POW work queue entry
355 * contents for a port. The setup performed here is controlled by
356 * the defines in executive-config.h.
358 * @ipd_port: Port to configure. This follows the IPD numbering, not the
359 * per interface numbering
361 * Returns Zero on success, negative on failure
363 static int __cvmx_helper_port_setup_ipd(int ipd_port
)
365 union cvmx_pip_prt_cfgx port_config
;
366 union cvmx_pip_prt_tagx tag_config
;
368 port_config
.u64
= cvmx_read_csr(CVMX_PIP_PRT_CFGX(ipd_port
));
369 tag_config
.u64
= cvmx_read_csr(CVMX_PIP_PRT_TAGX(ipd_port
));
371 /* Have each port go to a different POW queue */
372 port_config
.s
.qos
= ipd_port
& 0x7;
374 /* Process the headers and place the IP header in the work queue */
375 port_config
.s
.mode
= CVMX_HELPER_INPUT_PORT_SKIP_MODE
;
377 tag_config
.s
.ip6_src_flag
= CVMX_HELPER_INPUT_TAG_IPV6_SRC_IP
;
378 tag_config
.s
.ip6_dst_flag
= CVMX_HELPER_INPUT_TAG_IPV6_DST_IP
;
379 tag_config
.s
.ip6_sprt_flag
= CVMX_HELPER_INPUT_TAG_IPV6_SRC_PORT
;
380 tag_config
.s
.ip6_dprt_flag
= CVMX_HELPER_INPUT_TAG_IPV6_DST_PORT
;
381 tag_config
.s
.ip6_nxth_flag
= CVMX_HELPER_INPUT_TAG_IPV6_NEXT_HEADER
;
382 tag_config
.s
.ip4_src_flag
= CVMX_HELPER_INPUT_TAG_IPV4_SRC_IP
;
383 tag_config
.s
.ip4_dst_flag
= CVMX_HELPER_INPUT_TAG_IPV4_DST_IP
;
384 tag_config
.s
.ip4_sprt_flag
= CVMX_HELPER_INPUT_TAG_IPV4_SRC_PORT
;
385 tag_config
.s
.ip4_dprt_flag
= CVMX_HELPER_INPUT_TAG_IPV4_DST_PORT
;
386 tag_config
.s
.ip4_pctl_flag
= CVMX_HELPER_INPUT_TAG_IPV4_PROTOCOL
;
387 tag_config
.s
.inc_prt_flag
= CVMX_HELPER_INPUT_TAG_INPUT_PORT
;
388 tag_config
.s
.tcp6_tag_type
= CVMX_HELPER_INPUT_TAG_TYPE
;
389 tag_config
.s
.tcp4_tag_type
= CVMX_HELPER_INPUT_TAG_TYPE
;
390 tag_config
.s
.ip6_tag_type
= CVMX_HELPER_INPUT_TAG_TYPE
;
391 tag_config
.s
.ip4_tag_type
= CVMX_HELPER_INPUT_TAG_TYPE
;
392 tag_config
.s
.non_tag_type
= CVMX_HELPER_INPUT_TAG_TYPE
;
393 /* Put all packets in group 0. Other groups can be used by the app */
394 tag_config
.s
.grp
= 0;
396 cvmx_pip_config_port(ipd_port
, port_config
, tag_config
);
398 /* Give the user a chance to override our setting for each port */
399 if (cvmx_override_ipd_port_setup
)
400 cvmx_override_ipd_port_setup(ipd_port
);
406 * This function sets the interface_port_count[interface] correctly,
407 * without modifying any hardware configuration. Hardware setup of
408 * the ports will be performed later.
410 * @interface: Interface to probe
412 * Returns Zero on success, negative on failure
414 int cvmx_helper_interface_enumerate(int interface
)
416 switch (cvmx_helper_interface_get_mode(interface
)) {
417 /* These types don't support ports to IPD/PKO */
418 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
419 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
420 interface_port_count
[interface
] = 0;
422 /* XAUI is a single high speed port */
423 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
424 interface_port_count
[interface
] =
425 __cvmx_helper_xaui_enumerate(interface
);
428 * RGMII/GMII/MII are all treated about the same. Most
429 * functions refer to these ports as RGMII.
431 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
432 case CVMX_HELPER_INTERFACE_MODE_GMII
:
433 interface_port_count
[interface
] =
434 __cvmx_helper_rgmii_enumerate(interface
);
437 * SPI4 can have 1-16 ports depending on the device at
440 case CVMX_HELPER_INTERFACE_MODE_SPI
:
441 interface_port_count
[interface
] =
442 __cvmx_helper_spi_enumerate(interface
);
445 * SGMII can have 1-4 ports depending on how many are
448 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
449 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
450 interface_port_count
[interface
] =
451 __cvmx_helper_sgmii_enumerate(interface
);
453 /* PCI target Network Packet Interface */
454 case CVMX_HELPER_INTERFACE_MODE_NPI
:
455 interface_port_count
[interface
] =
456 __cvmx_helper_npi_enumerate(interface
);
459 * Special loopback only ports. These are not the same
460 * as other ports in loopback mode.
462 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
463 interface_port_count
[interface
] =
464 __cvmx_helper_loop_enumerate(interface
);
468 interface_port_count
[interface
] =
469 __cvmx_helper_board_interface_probe(interface
,
473 /* Make sure all global variables propagate to other cores */
480 * This function probes an interface to determine the actual
481 * number of hardware ports connected to it. It doesn't setup the
482 * ports or enable them. The main goal here is to set the global
483 * interface_port_count[interface] correctly. Hardware setup of the
484 * ports will be performed later.
486 * @interface: Interface to probe
488 * Returns Zero on success, negative on failure
490 int cvmx_helper_interface_probe(int interface
)
492 cvmx_helper_interface_enumerate(interface
);
493 /* At this stage in the game we don't want packets to be moving yet.
494 The following probe calls should perform hardware setup
495 needed to determine port counts. Receive must still be disabled */
496 switch (cvmx_helper_interface_get_mode(interface
)) {
497 /* These types don't support ports to IPD/PKO */
498 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
499 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
501 /* XAUI is a single high speed port */
502 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
503 __cvmx_helper_xaui_probe(interface
);
506 * RGMII/GMII/MII are all treated about the same. Most
507 * functions refer to these ports as RGMII.
509 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
510 case CVMX_HELPER_INTERFACE_MODE_GMII
:
511 __cvmx_helper_rgmii_probe(interface
);
514 * SPI4 can have 1-16 ports depending on the device at
517 case CVMX_HELPER_INTERFACE_MODE_SPI
:
518 __cvmx_helper_spi_probe(interface
);
521 * SGMII can have 1-4 ports depending on how many are
524 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
525 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
526 __cvmx_helper_sgmii_probe(interface
);
528 /* PCI target Network Packet Interface */
529 case CVMX_HELPER_INTERFACE_MODE_NPI
:
530 __cvmx_helper_npi_probe(interface
);
533 * Special loopback only ports. These are not the same
534 * as other ports in loopback mode.
536 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
537 __cvmx_helper_loop_probe(interface
);
541 /* Make sure all global variables propagate to other cores */
548 * Setup the IPD/PIP for the ports on an interface. Packet
549 * classification and tagging are set for every port on the
550 * interface. The number of ports on the interface must already
553 * @interface: Interface to setup IPD/PIP for
555 * Returns Zero on success, negative on failure
557 static int __cvmx_helper_interface_setup_ipd(int interface
)
559 int ipd_port
= cvmx_helper_get_ipd_port(interface
, 0);
560 int num_ports
= interface_port_count
[interface
];
562 while (num_ports
--) {
563 __cvmx_helper_port_setup_ipd(ipd_port
);
570 * Setup global setting for IPD/PIP not related to a specific
571 * interface or port. This must be called before IPD is enabled.
573 * Returns Zero on success, negative on failure.
575 static int __cvmx_helper_global_setup_ipd(void)
577 /* Setup the global packet input options */
578 cvmx_ipd_config(CVMX_FPA_PACKET_POOL_SIZE
/ 8,
579 CVMX_HELPER_FIRST_MBUFF_SKIP
/ 8,
580 CVMX_HELPER_NOT_FIRST_MBUFF_SKIP
/ 8,
581 /* The +8 is to account for the next ptr */
582 (CVMX_HELPER_FIRST_MBUFF_SKIP
+ 8) / 128,
583 /* The +8 is to account for the next ptr */
584 (CVMX_HELPER_NOT_FIRST_MBUFF_SKIP
+ 8) / 128,
586 CVMX_IPD_OPC_MODE_STT
,
587 CVMX_HELPER_ENABLE_BACK_PRESSURE
);
592 * Setup the PKO for the ports on an interface. The number of
593 * queues per port and the priority of each PKO output queue
594 * is set here. PKO must be disabled when this function is called.
596 * @interface: Interface to setup PKO for
598 * Returns Zero on success, negative on failure
600 static int __cvmx_helper_interface_setup_pko(int interface
)
603 * Each packet output queue has an associated priority. The
604 * higher the priority, the more often it can send a packet. A
605 * priority of 8 means it can send in all 8 rounds of
606 * contention. We're going to make each queue one less than
607 * the last. The vector of priorities has been extended to
608 * support CN5xxx CPUs, where up to 16 queues can be
609 * associated to a port. To keep backward compatibility we
610 * don't change the initial 8 priorities and replicate them in
611 * the second half. With per-core PKO queues (PKO lockless
612 * operation) all queues have the same priority.
614 uint64_t priorities
[16] =
615 { 8, 7, 6, 5, 4, 3, 2, 1, 8, 7, 6, 5, 4, 3, 2, 1 };
618 * Setup the IPD/PIP and PKO for the ports discovered
619 * above. Here packet classification, tagging and output
620 * priorities are set.
622 int ipd_port
= cvmx_helper_get_ipd_port(interface
, 0);
623 int num_ports
= interface_port_count
[interface
];
624 while (num_ports
--) {
626 * Give the user a chance to override the per queue
629 if (cvmx_override_pko_queue_priority
)
630 cvmx_override_pko_queue_priority(ipd_port
, priorities
);
632 cvmx_pko_config_port(ipd_port
,
633 cvmx_pko_get_base_queue_per_core(ipd_port
,
635 cvmx_pko_get_num_queues(ipd_port
),
643 * Setup global setting for PKO not related to a specific
644 * interface or port. This must be called before PKO is enabled.
646 * Returns Zero on success, negative on failure.
648 static int __cvmx_helper_global_setup_pko(void)
651 * Disable tagwait FAU timeout. This needs to be done before
652 * anyone might start packet output using tags.
654 union cvmx_iob_fau_timeout fau_to
;
656 fau_to
.s
.tout_val
= 0xfff;
657 fau_to
.s
.tout_enb
= 0;
658 cvmx_write_csr(CVMX_IOB_FAU_TIMEOUT
, fau_to
.u64
);
663 * Setup global backpressure setting.
665 * Returns Zero on success, negative on failure
667 static int __cvmx_helper_global_setup_backpressure(void)
669 #if CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE
670 /* Disable backpressure if configured to do so */
671 /* Disable backpressure (pause frame) generation */
672 int num_interfaces
= cvmx_helper_get_number_of_interfaces();
674 for (interface
= 0; interface
< num_interfaces
; interface
++) {
675 switch (cvmx_helper_interface_get_mode(interface
)) {
676 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
677 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
678 case CVMX_HELPER_INTERFACE_MODE_NPI
:
679 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
680 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
682 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
683 case CVMX_HELPER_INTERFACE_MODE_GMII
:
684 case CVMX_HELPER_INTERFACE_MODE_SPI
:
685 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
686 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
687 cvmx_gmx_set_backpressure_override(interface
, 0xf);
697 * Enable packet input/output from the hardware. This function is
698 * called after all internal setup is complete and IPD is enabled.
699 * After this function completes, packets will be accepted from the
700 * hardware ports. PKO should still be disabled to make sure packets
701 * aren't sent out partially setup hardware.
703 * @interface: Interface to enable
705 * Returns Zero on success, negative on failure
707 static int __cvmx_helper_packet_hardware_enable(int interface
)
710 switch (cvmx_helper_interface_get_mode(interface
)) {
711 /* These types don't support ports to IPD/PKO */
712 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
713 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
716 /* XAUI is a single high speed port */
717 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
718 result
= __cvmx_helper_xaui_enable(interface
);
721 * RGMII/GMII/MII are all treated about the same. Most
722 * functions refer to these ports as RGMII
724 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
725 case CVMX_HELPER_INTERFACE_MODE_GMII
:
726 result
= __cvmx_helper_rgmii_enable(interface
);
729 * SPI4 can have 1-16 ports depending on the device at
732 case CVMX_HELPER_INTERFACE_MODE_SPI
:
733 result
= __cvmx_helper_spi_enable(interface
);
736 * SGMII can have 1-4 ports depending on how many are
739 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
740 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
741 result
= __cvmx_helper_sgmii_enable(interface
);
743 /* PCI target Network Packet Interface */
744 case CVMX_HELPER_INTERFACE_MODE_NPI
:
745 result
= __cvmx_helper_npi_enable(interface
);
748 * Special loopback only ports. These are not the same
749 * as other ports in loopback mode
751 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
752 result
= __cvmx_helper_loop_enable(interface
);
755 result
|= __cvmx_helper_board_hardware_enable(interface
);
760 * Function to adjust internal IPD pointer alignments
762 * Returns 0 on success
765 int __cvmx_helper_errata_fix_ipd_ptr_alignment(void)
767 #define FIX_IPD_FIRST_BUFF_PAYLOAD_BYTES \
768 (CVMX_FPA_PACKET_POOL_SIZE-8-CVMX_HELPER_FIRST_MBUFF_SKIP)
769 #define FIX_IPD_NON_FIRST_BUFF_PAYLOAD_BYTES \
770 (CVMX_FPA_PACKET_POOL_SIZE-8-CVMX_HELPER_NOT_FIRST_MBUFF_SKIP)
771 #define FIX_IPD_OUTPORT 0
772 /* Ports 0-15 are interface 0, 16-31 are interface 1 */
773 #define INTERFACE(port) (port >> 4)
774 #define INDEX(port) (port & 0xf)
776 cvmx_pko_command_word0_t pko_command
;
777 union cvmx_buf_ptr g_buffer
, pkt_buffer
;
779 int size
, num_segs
= 0, wqe_pcnt
, pkt_pcnt
;
780 union cvmx_gmxx_prtx_cfg gmx_cfg
;
784 cvmx_helper_link_info_t link_info
;
786 /* Save values for restore at end */
788 cvmx_read_csr(CVMX_GMXX_PRTX_CFG
789 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)));
791 cvmx_read_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)));
793 cvmx_read_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)));
794 uint64_t rxx_jabber
=
795 cvmx_read_csr(CVMX_GMXX_RXX_JABBER
796 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)));
798 cvmx_read_csr(CVMX_GMXX_RXX_FRM_MAX
799 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)));
801 /* Configure port to gig FDX as required for loopback mode */
802 cvmx_helper_rgmii_internal_loopback(FIX_IPD_OUTPORT
);
805 * Disable reception on all ports so if traffic is present it
806 * will not interfere.
808 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)), 0);
810 cvmx_wait(100000000ull);
812 for (retry_loop_cnt
= 0; retry_loop_cnt
< 10; retry_loop_cnt
++) {
814 wqe_pcnt
= cvmx_read_csr(CVMX_IPD_PTR_COUNT
);
815 pkt_pcnt
= (wqe_pcnt
>> 7) & 0x7f;
818 num_segs
= (2 + pkt_pcnt
- wqe_pcnt
) & 3;
826 FIX_IPD_FIRST_BUFF_PAYLOAD_BYTES
+
827 ((num_segs
- 1) * FIX_IPD_NON_FIRST_BUFF_PAYLOAD_BYTES
) -
828 (FIX_IPD_NON_FIRST_BUFF_PAYLOAD_BYTES
/ 2);
830 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT
)),
831 1 << INDEX(FIX_IPD_OUTPORT
));
836 cvmx_ptr_to_phys(cvmx_fpa_alloc(CVMX_FPA_WQE_POOL
));
837 if (g_buffer
.s
.addr
== 0) {
838 cvmx_dprintf("WARNING: FIX_IPD_PTR_ALIGNMENT "
839 "buffer allocation failure.\n");
843 g_buffer
.s
.pool
= CVMX_FPA_WQE_POOL
;
844 g_buffer
.s
.size
= num_segs
;
848 cvmx_ptr_to_phys(cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL
));
849 if (pkt_buffer
.s
.addr
== 0) {
850 cvmx_dprintf("WARNING: FIX_IPD_PTR_ALIGNMENT "
851 "buffer allocation failure.\n");
855 pkt_buffer
.s
.pool
= CVMX_FPA_PACKET_POOL
;
856 pkt_buffer
.s
.size
= FIX_IPD_FIRST_BUFF_PAYLOAD_BYTES
;
858 p64
= (uint64_t *) cvmx_phys_to_ptr(pkt_buffer
.s
.addr
);
859 p64
[0] = 0xffffffffffff0000ull
;
860 p64
[1] = 0x08004510ull
;
861 p64
[2] = ((uint64_t) (size
- 14) << 48) | 0x5ae740004000ull
;
862 p64
[3] = 0x3a5fc0a81073c0a8ull
;
864 for (i
= 0; i
< num_segs
; i
++) {
867 FIX_IPD_NON_FIRST_BUFF_PAYLOAD_BYTES
;
869 if (i
== (num_segs
- 1))
872 *(uint64_t *) cvmx_phys_to_ptr(g_buffer
.s
.addr
+
873 8 * i
) = pkt_buffer
.u64
;
876 /* Build the PKO command */
878 pko_command
.s
.segs
= num_segs
;
879 pko_command
.s
.total_bytes
= size
;
880 pko_command
.s
.dontfree
= 0;
881 pko_command
.s
.gather
= 1;
884 cvmx_read_csr(CVMX_GMXX_PRTX_CFG
885 (INDEX(FIX_IPD_OUTPORT
),
886 INTERFACE(FIX_IPD_OUTPORT
)));
888 cvmx_write_csr(CVMX_GMXX_PRTX_CFG
889 (INDEX(FIX_IPD_OUTPORT
),
890 INTERFACE(FIX_IPD_OUTPORT
)), gmx_cfg
.u64
);
891 cvmx_write_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)),
892 1 << INDEX(FIX_IPD_OUTPORT
));
893 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)),
894 1 << INDEX(FIX_IPD_OUTPORT
));
896 cvmx_write_csr(CVMX_GMXX_RXX_JABBER
897 (INDEX(FIX_IPD_OUTPORT
),
898 INTERFACE(FIX_IPD_OUTPORT
)), 65392 - 14 - 4);
899 cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX
900 (INDEX(FIX_IPD_OUTPORT
),
901 INTERFACE(FIX_IPD_OUTPORT
)), 65392 - 14 - 4);
903 cvmx_pko_send_packet_prepare(FIX_IPD_OUTPORT
,
904 cvmx_pko_get_base_queue
906 CVMX_PKO_LOCK_CMD_QUEUE
);
907 cvmx_pko_send_packet_finish(FIX_IPD_OUTPORT
,
908 cvmx_pko_get_base_queue
909 (FIX_IPD_OUTPORT
), pko_command
,
910 g_buffer
, CVMX_PKO_LOCK_CMD_QUEUE
);
915 work
= cvmx_pow_work_request_sync(CVMX_POW_WAIT
);
917 } while ((work
== NULL
) && (retry_cnt
> 0));
920 cvmx_dprintf("WARNING: FIX_IPD_PTR_ALIGNMENT "
921 "get_work() timeout occurred.\n");
925 cvmx_helper_free_packet_data(work
);
930 /* Return CSR configs to saved values */
931 cvmx_write_csr(CVMX_GMXX_PRTX_CFG
932 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)),
934 cvmx_write_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)),
936 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT
)),
938 cvmx_write_csr(CVMX_GMXX_RXX_JABBER
939 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)),
941 cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX
942 (INDEX(FIX_IPD_OUTPORT
), INTERFACE(FIX_IPD_OUTPORT
)),
944 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT
)), 0);
945 /* Set link to down so autonegotiation will set it up again */
947 cvmx_helper_link_set(FIX_IPD_OUTPORT
, link_info
);
950 * Bring the link back up as autonegotiation is not done in
953 cvmx_helper_link_autoconf(FIX_IPD_OUTPORT
);
957 cvmx_dprintf("WARNING: FIX_IPD_PTR_ALIGNMENT failed.\n");
964 * Called after all internal packet IO paths are setup. This
965 * function enables IPD/PIP and begins packet input and output.
967 * Returns Zero on success, negative on failure
969 int cvmx_helper_ipd_and_packet_input_enable(void)
978 * Time to enable hardware ports packet input and output. Note
979 * that at this point IPD/PIP must be fully functional and PKO
982 num_interfaces
= cvmx_helper_get_number_of_interfaces();
983 for (interface
= 0; interface
< num_interfaces
; interface
++) {
984 if (cvmx_helper_ports_on_interface(interface
) > 0)
985 __cvmx_helper_packet_hardware_enable(interface
);
988 /* Finally enable PKO now that the entire path is up and running */
991 if ((OCTEON_IS_MODEL(OCTEON_CN31XX_PASS1
)
992 || OCTEON_IS_MODEL(OCTEON_CN30XX_PASS1
))
993 && (cvmx_sysinfo_get()->board_type
!= CVMX_BOARD_TYPE_SIM
))
994 __cvmx_helper_errata_fix_ipd_ptr_alignment();
997 EXPORT_SYMBOL_GPL(cvmx_helper_ipd_and_packet_input_enable
);
1000 * Initialize the PIP, IPD, and PKO hardware to support
1001 * simple priority based queues for the ethernet ports. Each
1002 * port is configured with a number of priority queues based
1003 * on CVMX_PKO_QUEUES_PER_PORT_* where each queue is lower
1004 * priority than the previous.
1006 * Returns Zero on success, non-zero on failure
1008 int cvmx_helper_initialize_packet_io_global(void)
1012 union cvmx_l2c_cfg l2c_cfg
;
1013 union cvmx_smix_en smix_en
;
1014 const int num_interfaces
= cvmx_helper_get_number_of_interfaces();
1017 * CN52XX pass 1: Due to a bug in 2nd order CDR, it needs to
1020 if (OCTEON_IS_MODEL(OCTEON_CN52XX_PASS1_0
))
1021 __cvmx_helper_errata_qlm_disable_2nd_order_cdr(1);
1024 * Tell L2 to give the IOB statically higher priority compared
1025 * to the cores. This avoids conditions where IO blocks might
1026 * be starved under very high L2 loads.
1028 l2c_cfg
.u64
= cvmx_read_csr(CVMX_L2C_CFG
);
1029 l2c_cfg
.s
.lrf_arb_mode
= 0;
1030 l2c_cfg
.s
.rfb_arb_mode
= 0;
1031 cvmx_write_csr(CVMX_L2C_CFG
, l2c_cfg
.u64
);
1033 /* Make sure SMI/MDIO is enabled so we can query PHYs */
1034 smix_en
.u64
= cvmx_read_csr(CVMX_SMIX_EN(0));
1035 if (!smix_en
.s
.en
) {
1037 cvmx_write_csr(CVMX_SMIX_EN(0), smix_en
.u64
);
1040 /* Newer chips actually have two SMI/MDIO interfaces */
1041 if (!OCTEON_IS_MODEL(OCTEON_CN3XXX
) &&
1042 !OCTEON_IS_MODEL(OCTEON_CN58XX
) &&
1043 !OCTEON_IS_MODEL(OCTEON_CN50XX
)) {
1044 smix_en
.u64
= cvmx_read_csr(CVMX_SMIX_EN(1));
1045 if (!smix_en
.s
.en
) {
1047 cvmx_write_csr(CVMX_SMIX_EN(1), smix_en
.u64
);
1051 cvmx_pko_initialize_global();
1052 for (interface
= 0; interface
< num_interfaces
; interface
++) {
1053 result
|= cvmx_helper_interface_probe(interface
);
1054 if (cvmx_helper_ports_on_interface(interface
) > 0)
1055 cvmx_dprintf("Interface %d has %d ports (%s)\n",
1057 cvmx_helper_ports_on_interface(interface
),
1058 cvmx_helper_interface_mode_to_string
1059 (cvmx_helper_interface_get_mode
1061 result
|= __cvmx_helper_interface_setup_ipd(interface
);
1062 result
|= __cvmx_helper_interface_setup_pko(interface
);
1065 result
|= __cvmx_helper_global_setup_ipd();
1066 result
|= __cvmx_helper_global_setup_pko();
1068 /* Enable any flow control and backpressure */
1069 result
|= __cvmx_helper_global_setup_backpressure();
1071 #if CVMX_HELPER_ENABLE_IPD
1072 result
|= cvmx_helper_ipd_and_packet_input_enable();
1076 EXPORT_SYMBOL_GPL(cvmx_helper_initialize_packet_io_global
);
1079 * Does core local initialization for packet io
1081 * Returns Zero on success, non-zero on failure
1083 int cvmx_helper_initialize_packet_io_local(void)
1085 return cvmx_pko_initialize_local();
1089 * Auto configure an IPD/PKO port link state and speed. This
1090 * function basically does the equivalent of:
1091 * cvmx_helper_link_set(ipd_port, cvmx_helper_link_get(ipd_port));
1093 * @ipd_port: IPD/PKO port to auto configure
1095 * Returns Link state after configure
1097 cvmx_helper_link_info_t
cvmx_helper_link_autoconf(int ipd_port
)
1099 cvmx_helper_link_info_t link_info
;
1100 int interface
= cvmx_helper_get_interface_num(ipd_port
);
1101 int index
= cvmx_helper_get_interface_index_num(ipd_port
);
1103 if (index
>= cvmx_helper_ports_on_interface(interface
)) {
1108 link_info
= cvmx_helper_link_get(ipd_port
);
1109 if (link_info
.u64
== port_link_info
[ipd_port
].u64
)
1112 /* If we fail to set the link speed, port_link_info will not change */
1113 cvmx_helper_link_set(ipd_port
, link_info
);
1116 * port_link_info should be the current value, which will be
1117 * different than expect if cvmx_helper_link_set() failed.
1119 return port_link_info
[ipd_port
];
1121 EXPORT_SYMBOL_GPL(cvmx_helper_link_autoconf
);
1124 * Return the link state of an IPD/PKO port as returned by
1125 * auto negotiation. The result of this function may not match
1126 * Octeon's link config if auto negotiation has changed since
1127 * the last call to cvmx_helper_link_set().
1129 * @ipd_port: IPD/PKO port to query
1131 * Returns Link state
1133 cvmx_helper_link_info_t
cvmx_helper_link_get(int ipd_port
)
1135 cvmx_helper_link_info_t result
;
1136 int interface
= cvmx_helper_get_interface_num(ipd_port
);
1137 int index
= cvmx_helper_get_interface_index_num(ipd_port
);
1139 /* The default result will be a down link unless the code below
1143 if (index
>= cvmx_helper_ports_on_interface(interface
))
1146 switch (cvmx_helper_interface_get_mode(interface
)) {
1147 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
1148 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
1149 /* Network links are not supported */
1151 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
1152 result
= __cvmx_helper_xaui_link_get(ipd_port
);
1154 case CVMX_HELPER_INTERFACE_MODE_GMII
:
1156 result
= __cvmx_helper_rgmii_link_get(ipd_port
);
1158 result
.s
.full_duplex
= 1;
1159 result
.s
.link_up
= 1;
1160 result
.s
.speed
= 1000;
1163 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
1164 result
= __cvmx_helper_rgmii_link_get(ipd_port
);
1166 case CVMX_HELPER_INTERFACE_MODE_SPI
:
1167 result
= __cvmx_helper_spi_link_get(ipd_port
);
1169 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
1170 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
1171 result
= __cvmx_helper_sgmii_link_get(ipd_port
);
1173 case CVMX_HELPER_INTERFACE_MODE_NPI
:
1174 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
1175 /* Network links are not supported */
1180 EXPORT_SYMBOL_GPL(cvmx_helper_link_get
);
1183 * Configure an IPD/PKO port for the specified link state. This
1184 * function does not influence auto negotiation at the PHY level.
1185 * The passed link state must always match the link state returned
1186 * by cvmx_helper_link_get(). It is normally best to use
1187 * cvmx_helper_link_autoconf() instead.
1189 * @ipd_port: IPD/PKO port to configure
1190 * @link_info: The new link state
1192 * Returns Zero on success, negative on failure
1194 int cvmx_helper_link_set(int ipd_port
, cvmx_helper_link_info_t link_info
)
1197 int interface
= cvmx_helper_get_interface_num(ipd_port
);
1198 int index
= cvmx_helper_get_interface_index_num(ipd_port
);
1200 if (index
>= cvmx_helper_ports_on_interface(interface
))
1203 switch (cvmx_helper_interface_get_mode(interface
)) {
1204 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
1205 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
1207 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
1208 result
= __cvmx_helper_xaui_link_set(ipd_port
, link_info
);
1211 * RGMII/GMII/MII are all treated about the same. Most
1212 * functions refer to these ports as RGMII.
1214 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
1215 case CVMX_HELPER_INTERFACE_MODE_GMII
:
1216 result
= __cvmx_helper_rgmii_link_set(ipd_port
, link_info
);
1218 case CVMX_HELPER_INTERFACE_MODE_SPI
:
1219 result
= __cvmx_helper_spi_link_set(ipd_port
, link_info
);
1221 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
1222 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
1223 result
= __cvmx_helper_sgmii_link_set(ipd_port
, link_info
);
1225 case CVMX_HELPER_INTERFACE_MODE_NPI
:
1226 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
1229 /* Set the port_link_info here so that the link status is updated
1230 no matter how cvmx_helper_link_set is called. We don't change
1231 the value if link_set failed */
1233 port_link_info
[ipd_port
].u64
= link_info
.u64
;
1236 EXPORT_SYMBOL_GPL(cvmx_helper_link_set
);
1239 * Configure a port for internal and/or external loopback. Internal loopback
1240 * causes packets sent by the port to be received by Octeon. External loopback
1241 * causes packets received from the wire to sent out again.
1243 * @ipd_port: IPD/PKO port to loopback.
1245 * Non zero if you want internal loopback
1247 * Non zero if you want external loopback
1249 * Returns Zero on success, negative on failure.
1251 int cvmx_helper_configure_loopback(int ipd_port
, int enable_internal
,
1252 int enable_external
)
1255 int interface
= cvmx_helper_get_interface_num(ipd_port
);
1256 int index
= cvmx_helper_get_interface_index_num(ipd_port
);
1258 if (index
>= cvmx_helper_ports_on_interface(interface
))
1261 switch (cvmx_helper_interface_get_mode(interface
)) {
1262 case CVMX_HELPER_INTERFACE_MODE_DISABLED
:
1263 case CVMX_HELPER_INTERFACE_MODE_PCIE
:
1264 case CVMX_HELPER_INTERFACE_MODE_SPI
:
1265 case CVMX_HELPER_INTERFACE_MODE_NPI
:
1266 case CVMX_HELPER_INTERFACE_MODE_LOOP
:
1268 case CVMX_HELPER_INTERFACE_MODE_XAUI
:
1270 __cvmx_helper_xaui_configure_loopback(ipd_port
,
1274 case CVMX_HELPER_INTERFACE_MODE_RGMII
:
1275 case CVMX_HELPER_INTERFACE_MODE_GMII
:
1277 __cvmx_helper_rgmii_configure_loopback(ipd_port
,
1281 case CVMX_HELPER_INTERFACE_MODE_SGMII
:
1282 case CVMX_HELPER_INTERFACE_MODE_PICMG
:
1284 __cvmx_helper_sgmii_configure_loopback(ipd_port
,