Lines Matching full:interface

49 /* Port count per interface */
53 * Return the number of interfaces the chip has. Each interface
56 * one interface.
80 * Return the number of ports on an interface. Depending on the
82 * specifies that the interface doesn't exist or isn't usable.
84 * @interface: Interface to get the port count for
86 * Returns Number of ports on interface. Can be Zero.
88 int cvmx_helper_ports_on_interface(int interface) in cvmx_helper_ports_on_interface() argument
90 return interface_port_count[interface]; in cvmx_helper_ports_on_interface()
96 * Return interface mode for CN68xx.
98 static cvmx_helper_interface_mode_t __cvmx_get_mode_cn68xx(int interface) in __cvmx_get_mode_cn68xx() argument
101 switch (interface) { in __cvmx_get_mode_cn68xx()
117 qlm_cfg.u64 = cvmx_read_csr(CVMX_MIO_QLMX_CFG(interface)); in __cvmx_get_mode_cn68xx()
148 * Return interface mode for an Octeon II
150 static cvmx_helper_interface_mode_t __cvmx_get_mode_octeon2(int interface) in __cvmx_get_mode_octeon2() argument
155 return __cvmx_get_mode_cn68xx(interface); in __cvmx_get_mode_octeon2()
157 if (interface == 2) in __cvmx_get_mode_octeon2()
160 if (interface == 3) in __cvmx_get_mode_octeon2()
165 (interface == 4 || interface == 5)) || in __cvmx_get_mode_octeon2()
167 interface >= 4 && interface <= 7)) { in __cvmx_get_mode_octeon2()
175 if (interface == 0) in __cvmx_get_mode_octeon2()
177 else if (interface == 1) in __cvmx_get_mode_octeon2()
194 if (interface == 0) { in __cvmx_get_mode_octeon2()
202 } else if (interface == 1) { in __cvmx_get_mode_octeon2()
212 if (interface == 0) { in __cvmx_get_mode_octeon2()
221 if (interface == 1 && OCTEON_IS_MODEL(OCTEON_CN63XX)) in __cvmx_get_mode_octeon2()
224 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface)); in __cvmx_get_mode_octeon2()
248 * Return interface mode for CN7XXX.
250 static cvmx_helper_interface_mode_t __cvmx_get_mode_cn7xxx(int interface) in __cvmx_get_mode_cn7xxx() argument
254 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface)); in __cvmx_get_mode_cn7xxx()
256 switch (interface) { in __cvmx_get_mode_cn7xxx()
283 * Get the operating mode of an interface. Depending on the Octeon
285 * of the type of packet I/O supported by an interface.
287 * @interface: Interface to probe
289 * Returns Mode of the interface. Unknown or unsupported interfaces return
292 cvmx_helper_interface_mode_t cvmx_helper_interface_get_mode(int interface) in cvmx_helper_interface_get_mode() argument
296 if (interface < 0 || in cvmx_helper_interface_get_mode()
297 interface >= cvmx_helper_get_number_of_interfaces()) in cvmx_helper_interface_get_mode()
304 return __cvmx_get_mode_cn7xxx(interface); in cvmx_helper_interface_get_mode()
310 return __cvmx_get_mode_octeon2(interface); in cvmx_helper_interface_get_mode()
315 if (interface == 2) in cvmx_helper_interface_get_mode()
318 if (interface == 3) { in cvmx_helper_interface_get_mode()
326 /* Interface 1 is always disabled on CN31XX and CN30XX */ in cvmx_helper_interface_get_mode()
327 if ((interface == 1) in cvmx_helper_interface_get_mode()
333 mode.u64 = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface)); in cvmx_helper_interface_get_mode()
371 * per interface numbering
414 * This function sets the interface_port_count[interface] correctly,
418 * @interface: Interface to probe
422 int cvmx_helper_interface_enumerate(int interface) in cvmx_helper_interface_enumerate() argument
424 switch (cvmx_helper_interface_get_mode(interface)) { in cvmx_helper_interface_enumerate()
428 interface_port_count[interface] = 0; in cvmx_helper_interface_enumerate()
432 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
433 __cvmx_helper_xaui_enumerate(interface); in cvmx_helper_interface_enumerate()
441 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
442 __cvmx_helper_rgmii_enumerate(interface); in cvmx_helper_interface_enumerate()
449 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
450 __cvmx_helper_spi_enumerate(interface); in cvmx_helper_interface_enumerate()
458 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
459 __cvmx_helper_sgmii_enumerate(interface); in cvmx_helper_interface_enumerate()
461 /* PCI target Network Packet Interface */ in cvmx_helper_interface_enumerate()
463 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
464 __cvmx_helper_npi_enumerate(interface); in cvmx_helper_interface_enumerate()
471 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
472 __cvmx_helper_loop_enumerate(interface); in cvmx_helper_interface_enumerate()
476 interface_port_count[interface] = in cvmx_helper_interface_enumerate()
477 __cvmx_helper_board_interface_probe(interface, in cvmx_helper_interface_enumerate()
479 [interface]); in cvmx_helper_interface_enumerate()
488 * This function probes an interface to determine the actual
491 * interface_port_count[interface] correctly. Hardware setup of the
494 * @interface: Interface to probe
498 int cvmx_helper_interface_probe(int interface) in cvmx_helper_interface_probe() argument
500 cvmx_helper_interface_enumerate(interface); in cvmx_helper_interface_probe()
504 switch (cvmx_helper_interface_get_mode(interface)) { in cvmx_helper_interface_probe()
511 __cvmx_helper_xaui_probe(interface); in cvmx_helper_interface_probe()
519 __cvmx_helper_rgmii_probe(interface); in cvmx_helper_interface_probe()
526 __cvmx_helper_spi_probe(interface); in cvmx_helper_interface_probe()
534 __cvmx_helper_sgmii_probe(interface); in cvmx_helper_interface_probe()
536 /* PCI target Network Packet Interface */ in cvmx_helper_interface_probe()
538 __cvmx_helper_npi_probe(interface); in cvmx_helper_interface_probe()
545 __cvmx_helper_loop_probe(interface); in cvmx_helper_interface_probe()
556 * Setup the IPD/PIP for the ports on an interface. Packet
558 * interface. The number of ports on the interface must already
561 * @interface: Interface to setup IPD/PIP for
565 static int __cvmx_helper_interface_setup_ipd(int interface) in __cvmx_helper_interface_setup_ipd() argument
567 int ipd_port = cvmx_helper_get_ipd_port(interface, 0); in __cvmx_helper_interface_setup_ipd()
568 int num_ports = interface_port_count[interface]; in __cvmx_helper_interface_setup_ipd()
579 * interface or port. This must be called before IPD is enabled.
600 * Setup the PKO for the ports on an interface. The number of
604 * @interface: Interface to setup PKO for
608 static int __cvmx_helper_interface_setup_pko(int interface) in __cvmx_helper_interface_setup_pko() argument
630 int ipd_port = cvmx_helper_get_ipd_port(interface, 0); in __cvmx_helper_interface_setup_pko()
631 int num_ports = interface_port_count[interface]; in __cvmx_helper_interface_setup_pko()
645 * interface or port. This must be called before PKO is enabled.
689 int interface; in __cvmx_helper_global_setup_backpressure() local
690 for (interface = 0; interface < num_interfaces; interface++) { in __cvmx_helper_global_setup_backpressure()
691 switch (cvmx_helper_interface_get_mode(interface)) { in __cvmx_helper_global_setup_backpressure()
703 cvmx_gmx_set_backpressure_override(interface, 0xf); in __cvmx_helper_global_setup_backpressure()
719 * @interface: Interface to enable
723 static int __cvmx_helper_packet_hardware_enable(int interface) in __cvmx_helper_packet_hardware_enable() argument
726 switch (cvmx_helper_interface_get_mode(interface)) { in __cvmx_helper_packet_hardware_enable()
734 result = __cvmx_helper_xaui_enable(interface); in __cvmx_helper_packet_hardware_enable()
742 result = __cvmx_helper_rgmii_enable(interface); in __cvmx_helper_packet_hardware_enable()
749 result = __cvmx_helper_spi_enable(interface); in __cvmx_helper_packet_hardware_enable()
757 result = __cvmx_helper_sgmii_enable(interface); in __cvmx_helper_packet_hardware_enable()
759 /* PCI target Network Packet Interface */ in __cvmx_helper_packet_hardware_enable()
761 result = __cvmx_helper_npi_enable(interface); in __cvmx_helper_packet_hardware_enable()
768 result = __cvmx_helper_loop_enable(interface); in __cvmx_helper_packet_hardware_enable()
787 /* Ports 0-15 are interface 0, 16-31 are interface 1 */ in __cvmx_helper_errata_fix_ipd_ptr_alignment()
788 #define INTERFACE(port) (port >> 4) in __cvmx_helper_errata_fix_ipd_ptr_alignment() macro
803 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
805 cvmx_read_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
807 cvmx_read_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
810 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
813 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
822 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT)), 0); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
844 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
900 INTERFACE(FIX_IPD_OUTPORT))); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
904 INTERFACE(FIX_IPD_OUTPORT)), gmx_cfg.u64); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
905 cvmx_write_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
907 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
912 INTERFACE(FIX_IPD_OUTPORT)), 65392 - 14 - 4); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
915 INTERFACE(FIX_IPD_OUTPORT)), 65392 - 14 - 4); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
946 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
948 cvmx_write_csr(CVMX_ASXX_TX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
950 cvmx_write_csr(CVMX_ASXX_RX_PRT_EN(INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
953 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
956 (INDEX(FIX_IPD_OUTPORT), INTERFACE(FIX_IPD_OUTPORT)), in __cvmx_helper_errata_fix_ipd_ptr_alignment()
958 cvmx_write_csr(CVMX_ASXX_PRT_LOOP(INTERFACE(FIX_IPD_OUTPORT)), 0); in __cvmx_helper_errata_fix_ipd_ptr_alignment()
977 int interface; in cvmx_helper_ipd_and_packet_input_enable() local
988 for (interface = 0; interface < num_interfaces; interface++) { in cvmx_helper_ipd_and_packet_input_enable()
989 if (cvmx_helper_ports_on_interface(interface) > 0) in cvmx_helper_ipd_and_packet_input_enable()
990 __cvmx_helper_packet_hardware_enable(interface); in cvmx_helper_ipd_and_packet_input_enable()
1016 int interface; in cvmx_helper_initialize_packet_io_global() local
1038 for (interface = 0; interface < num_interfaces; interface++) { in cvmx_helper_initialize_packet_io_global()
1039 result |= cvmx_helper_interface_probe(interface); in cvmx_helper_initialize_packet_io_global()
1040 if (cvmx_helper_ports_on_interface(interface) > 0) in cvmx_helper_initialize_packet_io_global()
1041 cvmx_dprintf("Interface %d has %d ports (%s)\n", in cvmx_helper_initialize_packet_io_global()
1042 interface, in cvmx_helper_initialize_packet_io_global()
1043 cvmx_helper_ports_on_interface(interface), in cvmx_helper_initialize_packet_io_global()
1046 (interface))); in cvmx_helper_initialize_packet_io_global()
1047 result |= __cvmx_helper_interface_setup_ipd(interface); in cvmx_helper_initialize_packet_io_global()
1048 result |= __cvmx_helper_interface_setup_pko(interface); in cvmx_helper_initialize_packet_io_global()
1077 int interface = cvmx_helper_get_interface_num(ipd_port); in cvmx_helper_link_get() local
1084 if (index >= cvmx_helper_ports_on_interface(interface)) in cvmx_helper_link_get()
1087 switch (cvmx_helper_interface_get_mode(interface)) { in cvmx_helper_link_get()
1138 int interface = cvmx_helper_get_interface_num(ipd_port); in cvmx_helper_link_set() local
1141 if (index >= cvmx_helper_ports_on_interface(interface)) in cvmx_helper_link_set()
1144 switch (cvmx_helper_interface_get_mode(interface)) { in cvmx_helper_link_set()