Lines Matching refs:ipd_port

87  * cvmx_override_board_link_get(int ipd_port) is a function
94 CVMX_SHARED cvmx_helper_link_info_t (*cvmx_override_board_link_get)(int ipd_port) = NULL;
107 static int __pip_eth_node(const void *fdt_addr, int aliases, int ipd_port)
112 int interface_num = cvmx_helper_get_interface_num(ipd_port);
113 int interface_index = cvmx_helper_get_interface_index_num(ipd_port);
198 * @param ipd_port Octeon IPD port to get the MII address for.
203 static cvmx_phy_info_t __get_phy_info_from_dt(int ipd_port)
227 if (ipd_port < 0)
229 int interface_index = ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT;
234 eth = __pip_eth_node(fdt_addr, aliases, ipd_port);
238 cvmx_dprintf("ERROR : cannot find interface for ipd_port=%d\n", ipd_port);
245 cvmx_dprintf("ERROR : phy handle not found in device tree ipd_port=%d"
246 "\n", ipd_port);
253 cvmx_dprintf("ERROR : cannot find phy for ipd_port=%d ret=%d\n",
254 ipd_port, phy);
282 cvmx_dprintf("ERROR : cannot find phy parent for ipd_port=%d ret=%d\n",
283 ipd_port, phy_parent);
323 * @param ipd_port Octeon IPD port to get the MII address for.
328 int cvmx_helper_board_get_mii_address_from_dt(int ipd_port)
330 cvmx_phy_info_t phy_info = __get_phy_info_from_dt(ipd_port);
347 * @param ipd_port Octeon IPD port to get the MII address for.
351 int cvmx_helper_board_get_mii_address(int ipd_port)
357 switch (ipd_port) {
378 cvmx_phy_info_t phy_info = __get_phy_info_from_dt(ipd_port);
379 //cvmx_dprintf("ipd_port=%d phy_addr=%d\n", ipd_port, phy_info.phy_addr);
395 if ((ipd_port >= 16) && (ipd_port < 20))
396 return ipd_port - 16;
400 if (ipd_port == 0)
406 if (ipd_port == 0)
420 if (ipd_port == 0)
422 else if (ipd_port == 1)
438 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) && (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
439 return ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT;
442 if ((ipd_port >= 0) && (ipd_port < 4))
443 return ipd_port+2;
450 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
454 if ((ipd_port >= 0) && (ipd_port < 4))
455 return ipd_port+1;
460 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
469 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
473 if ((ipd_port >= 0) && (ipd_port < 4))
481 return ipd_port+1 + (1<<8);
483 else if ((ipd_port >= 16) && (ipd_port < 20))
491 return ipd_port-16+1 + (1<<8);
498 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) && (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
499 return ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT + 4;
500 if ((ipd_port >= 0) && (ipd_port < 4))
501 return ipd_port + 1 + (1<<8);
506 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
508 if (ipd_port >= 0x800 && ipd_port < 0x900) /* QLM 0*/
509 return 0x101 + ((ipd_port >> 4) & 3); /* SMI 1*/
510 if (ipd_port >= 0xa00 && ipd_port < 0xb00) /* QLM 2*/
511 return 0x201 + ((ipd_port >> 4) & 3); /* SMI 2*/
512 if (ipd_port >= 0xb00 && ipd_port < 0xc00) /* QLM 3*/
513 return 0x301 + ((ipd_port >> 4) & 3); /* SMI 3*/
514 if (ipd_port >= 0xc00 && ipd_port < 0xd00) /* QLM 4*/
515 return 0x001 + ((ipd_port >> 4) & 3); /* SMI 0*/
518 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
520 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT+1)
524 int interface = cvmx_helper_get_interface_num(ipd_port);
527 return ipd_port;
528 else if ((ipd_port >= 0) && (ipd_port < 4))
529 return ipd_port + 3;
536 if (ipd_port == 2)
542 if ((ipd_port >= 16) && (ipd_port < 20))
543 return ipd_port - 16 + 1;
550 if (ipd_port >= 0 && ipd_port <= 3)
551 return (ipd_port + 0x1f) & 0x1f;
555 if (ipd_port >= 0 && ipd_port <= 1)
556 return (ipd_port + 1);
564 if (ipd_port >= 0 && ipd_port <= 3)
565 return ipd_port;
566 else if (ipd_port >= 16 && ipd_port <= 19)
567 return ipd_port - 16 + 4;
575 if ((ipd_port >= 16) && (ipd_port < 28))
576 return ipd_port - 16;
579 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) && (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
580 return (ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT) + 0x81;
581 if ((ipd_port >= 0) && (ipd_port < 4))
582 return ipd_port;
588 switch (ipd_port) {
601 if (ipd_port > 2)
603 return (7 - ipd_port);
629 if ((ipd_port >= 16) && (ipd_port < 20))
630 return ipd_port - 16 + 0x40;
755 static cvmx_helper_link_info_t __get_inband_link_state(int ipd_port)
759 int interface = cvmx_helper_get_interface_num(ipd_port);
760 int index = cvmx_helper_get_interface_index_num(ipd_port);
789 static int __switch_mdio_mux(int ipd_port)
799 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
802 if ((ipd_port >= 0) && (ipd_port < 4))
810 return ipd_port+1 + (1<<8);
812 else if ((ipd_port >= 16) && (ipd_port < 20))
820 return ipd_port-16+1 + (1<<8);
830 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) &&
831 (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
832 return ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT + 4;
833 if ((ipd_port >= 0) && (ipd_port < 4)) /* QLM 2 */
850 return 0x101 + ipd_port;
852 else if ((ipd_port >= 16) && (ipd_port < 20)) /* QLM 1 */
869 return 0x101 + (ipd_port - 16);
883 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) &&
884 (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
885 return ipd_port - CVMX_HELPER_BOARD_MGMT_IPD_PORT + 4;
886 if ((ipd_port >= 0) && (ipd_port < 4)) /* QLM 2 */
889 return 0x101 + ipd_port;
891 else if ((ipd_port >= 16) && (ipd_port < 20)) /* QLM 0 */
894 return 0x101 + (ipd_port - 16);
898 printf("%s: Unknown ipd port 0x%x\n", __func__, ipd_port);
919 * @param ipd_port IPD input port associated with the port we want to get link
926 cvmx_helper_link_info_t __cvmx_helper_board_link_get_from_dt(int ipd_port)
940 phy_info = __get_phy_info_from_dt(ipd_port);
941 //cvmx_dprintf("ipd_port=%d phy_addr=%d dc=%d type=%d \n", ipd_port,
946 __switch_mdio_mux(ipd_port);
956 result = __get_inband_link_state(ipd_port);
978 * @param ipd_port IPD input port associated with the port we want to get link
984 cvmx_helper_link_info_t __cvmx_helper_board_link_get(int ipd_port)
993 return __cvmx_helper_board_link_get_from_dt(ipd_port);
999 return cvmx_override_board_link_get(ipd_port);
1026 if (ipd_port == 1)
1040 if (ipd_port == CVMX_HELPER_BOARD_MGMT_IPD_PORT)
1047 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) && (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2)))
1053 if ((ipd_port >= CVMX_HELPER_BOARD_MGMT_IPD_PORT) && (ipd_port < (CVMX_HELPER_BOARD_MGMT_IPD_PORT + 2))
1054 && cvmx_helper_board_get_mii_address(ipd_port) >= 0 && cvmx_helper_board_get_mii_address(ipd_port) <= 1)
1062 if (ipd_port == 1)
1074 if (ipd_port == 2)
1101 if (ipd_port == 0)
1122 phy_addr = cvmx_helper_board_get_mii_address(ipd_port);
1123 //cvmx_dprintf("ipd_port=%d phy_addr=%d broadcom=%d\n",
1124 // ipd_port, phy_addr, is_broadcom_phy);
1143 result = __get_inband_link_state(ipd_port);
1148 int interface = cvmx_helper_get_interface_num(ipd_port);
1149 int index = cvmx_helper_get_interface_index_num(ipd_port);