linkctrl.h (3263B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: linkctrl.h 8 * Purpose: Hardware Linkscan Control module 9 */ 10 11 #ifndef _SOC_LINKCTRL_H_ 12 #define _SOC_LINKCTRL_H_ 13 14 #include <soc/types.h> 15 16 17 /* 18 * Provides port number defined in PC MIIM registers for 19 * write/read of a port PHY link status. 20 * Port values in MIIM are fixed based on the port physical 21 * block type/instance/index. 22 */ 23 typedef struct soc_linkctrl_port_info_s { 24 int block_type; 25 int block_number; 26 int block_index; 27 int port; 28 } soc_linkctrl_port_info_t; 29 30 31 /* 32 * Driver specific routines 33 * 34 * (See description for routines below) 35 */ 36 typedef struct soc_linkctrl_driver_s { 37 soc_linkctrl_port_info_t *port_info; /* null indicates no mapping */ 38 int (*ld_linkscan_hw_init)(int); 39 int (*ld_linkscan_config)(int, pbmp_t, pbmp_t); 40 int (*ld_linkscan_pause)(int); 41 int (*ld_linkscan_continue)(int); 42 int (*ld_update)(int); 43 int (*ld_hw_link_get)(int, pbmp_t *); 44 } soc_linkctrl_driver_t; 45 46 /* 47 * Driver specific routines description 48 * 49 * Function: 50 * ld_linkscan_hw_init 51 * Purpose: 52 * Initialize device specific HW linkscan. 53 * Parameters: 54 * unit - Device unit number 55 * 56 * 57 * Function: 58 * ld_linkscan_config 59 * Purpose: 60 * Set ports to hardware linkscan. 61 * Parameters: 62 * unit - Device unit number 63 * mii_pbm - Port bitmap of ports to scan with MIIM registers 64 * direct_pbm - Port bitmap of ports to scan using NON MII 65 * 66 * 67 * Function: 68 * ld_linkscan_pause 69 * Purpose: 70 * Pause hardware link scanning, without disabling it. 71 * This call is used to pause scanning temporarily. 72 * Parameters: 73 * unit - Device unit number 74 * 75 * 76 * Function: 77 * ld_linkscan_continue 78 * Purpose: 79 * Continue hardware link scanning after it has been paused. 80 * Parameters: 81 * unit - Device unit number 82 * 83 * 84 * Function: 85 * ld_update 86 * Purpose: 87 * Update the forwarding state in device. 88 * Parameters: 89 * unit - Device unit number 90 */ 91 92 93 extern int soc_linkctrl_init(int unit, CONST soc_linkctrl_driver_t *driver); 94 extern int soc_linkctrl_deinit(int unit); 95 96 /* These are called within src/bcm/ source files */ 97 extern int soc_linkctrl_link_fwd_set(int unit, pbmp_t fwd); 98 extern int soc_linkctrl_link_fwd_get(int unit, pbmp_t *fwd); 99 extern int soc_linkctrl_link_mask_set(int unit, pbmp_t mask); 100 extern int soc_linkctrl_link_mask_get(int unit, pbmp_t *mask); 101 102 /* These are called within src/soc/ and src/bcm/ source files */ 103 extern int soc_linkctrl_linkscan_register(int unit, void (*f)(int)); 104 extern int soc_linkctrl_linkscan_hw_init(int unit); 105 extern int soc_linkctrl_linkscan_config(int unit, pbmp_t hw_mii_pbm, 106 pbmp_t hw_direct_pbm); 107 extern int soc_linkctrl_linkscan_pause(int unit); 108 extern int soc_linkctrl_linkscan_continue(int unit); 109 110 extern int soc_linkctrl_miim_port_get(int unit, soc_port_t port, 111 int *miim_port); 112 extern int soc_linkctrl_hw_link_get(int unit, soc_pbmp_t *hw_link); 113 #endif /* _SOC_LINKCTRL_H_ */