sw_an.h (4857B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 */ 8 9 #ifdef SW_AUTONEG_SUPPORT 10 11 #ifndef __BCM_SW_AN_H__ 12 #define __BCM_SW_AN_H__ 13 14 #include <phymod/phymod.h> 15 #include <bcm/types.h> 16 17 typedef enum bcm_port_sw_an_event_e { 18 BCM_PORT_SW_AN_EVENT_NONE = 0, 19 BCM_PORT_SW_AN_EVENT_AN_START, 20 BCM_PORT_SW_AN_EVENT_AN_IN_PROCESS, 21 BCM_PORT_SW_AN_EVENT_AN_RESTART, 22 BCM_PORT_SW_AN_EVENT_AN_DOWN, 23 BCM_PORT_SW_AN_EVENT_AN_STOP, 24 BCM_PORT_SW_AN_EVENT_AN_LINK_DOWN, 25 BCM_PORT_SW_AN_EVENT_AN_MAX 26 } bcm_port_sw_an_event_t; 27 28 typedef enum bcm_sw_an_fsm_event_e { 29 BCM_FSM_SW_AN_EVT_NONE = 0, 30 BCM_FSM_SW_AN_EVT_WAIT, /* wait for event */ 31 BCM_FSM_SW_AN_EVT_START, /* SW state to kick off the state machine */ 32 BCM_FSM_SW_AN_EVT_SEQ_START, /* HW event to restart AN from base page exchange */ 33 BCM_FSM_SW_AN_EVT_LD_PAGE, /* HW req to load the new page */ 34 BCM_FSM_SW_AN_EVT_LP_PAGE_RDY, /* HW event indicating LP page rcvd */ 35 BCM_FSM_SW_AN_EVT_PAGE_EX_COMPLETE, 36 BCM_FSM_SW_AN_EVT_SEND_ACK, 37 BCM_FSM_SW_AN_EVT_SEND_RESTART, /* Restart request from external events like link down */ 38 BCM_FSM_SW_AN_EVT_MAX 39 } bcm_sw_an_fsm_event_t; 40 41 #define SW_AN_MODE_CL73_MSA 0x3 42 #define SW_AN_MODE_MSA_ONLY 0x4 43 44 #define SW_AN_MSA_OUI_13to23 0x353 45 #define SW_AN_MSA_OUI_2to12 0x4DF 46 #define SW_AN_MSA_OUI_0to1 0x1 47 48 /* pause capability not related to PHY */ 49 #define SW_AN_BASE0_PAGE_CAP_MASK 0x3 50 #define SW_AN_BASE0_PAGE_CAP_OFFSET 0xA 51 52 /* Next Page bit postion */ 53 #define SW_AN_BASE0_PAGE_NP_MASK 0x1 54 #define SW_AN_BASE0_PAGE_NP_OFFSET 0xF 55 56 #define SW_AN_BASE_TECH_ABILITY_10GKR_MASK 0x1 57 #define SW_AN_BASE_TECH_ABILITY_10GKR_OFFSET 0x7 58 59 #define SW_AN_BASE_TECH_ABILITY_25GKRS_MASK 0x1 60 #define SW_AN_BASE_TECH_ABILITY_25GKRS_OFFSET 0xE 61 62 #define SW_AN_BASE_TECH_ABILITY_25GKR_MASK 0x1 63 #define SW_AN_BASE_TECH_ABILITY_25GKR_OFFSET 0xF 64 65 #define SW_AN_BASE_CL74_ABILITY_SUP_MASK 0x1 66 #define SW_AN_BASE_CL74_ABILITY_SUP_OFFSET 0xE 67 68 #define SW_AN_BASE_CL74_ABILITY_REQ_MASK 0x1 69 #define SW_AN_BASE_CL74_ABILITY_REQ_OFFSET 0xF 70 71 #define SW_AN_BASE_CL91_ABILITY_REQ_MASK 0x1 72 #define SW_AN_BASE_CL91_ABILITY_REQ_OFFSET 0xC 73 74 #define SW_AN_BASE_CL74_25GKRS_REQ_MASK 0x1 75 #define SW_AN_BASE_CL74_25GKRS_REQ_OFFSET 0xD 76 77 /* Message Page definitions */ 78 79 #define SW_AN_MSG_PAGE0_MSG_CODE_MASK 0x3FF 80 #define SW_AN_MSG_PAGE0_MSG_CODE_OFFSET 0x0 81 82 #define SW_AN_MSG_PAGE1_OUI_13to23_MASK 0x7FF 83 #define SW_AN_MSG_PAGE1_OUI_13to23_OFFSET 0x0 84 85 #define SW_AN_MSG_PAGE2_OUI_2to12_MASK 0x7FF 86 #define SW_AN_MSG_PAGE2_OUI_2to12_OFFSET 0x0 87 88 /* Unformatted Page for MSA */ 89 #define SW_AN_UF_PAGE0_OUI_MASK 0x3 90 #define SW_AN_UF_PAGE0_OUI_OFFSET 0x9 91 92 #define SW_AN_UF_PAGE1_25G_KR1_ABILITY_MASK 0x1 93 #define SW_AN_UF_PAGE1_25G_KR1_ABILITY_OFFSET 0x4 94 95 #define SW_AN_UF_PAGE1_25G_CR1_ABILITY_MASK 0x1 96 #define SW_AN_UF_PAGE1_25G_CR1_ABILITY_OFFSET 0x5 97 98 #define SW_AN_UF_PAGE1_50G_KR2_ABILITY_MASK 0x1 99 #define SW_AN_UF_PAGE1_50G_KR2_ABILITY_OFFSET 0x8 100 101 #define SW_AN_UF_PAGE1_50G_CR2_ABILITY_MASK 0x1 102 #define SW_AN_UF_PAGE1_50G_CR2_ABILITY_OFFSET 0x9 103 104 #define SW_AN_UF_PAGE2_CL91_SUPPORT_MASK 0x1 105 #define SW_AN_UF_PAGE2_CL91_SUPPORT_OFFSET 0x8 106 107 #define SW_AN_UF_PAGE2_CL74_SUPPORT_MASK 0x1 108 #define SW_AN_UF_PAGE2_CL74_SUPPORT_OFFSET 0x9 109 110 #define SW_AN_UF_PAGE2_CL91_REQ_MASK 0x1 111 #define SW_AN_UF_PAGE2_CL91_REQ_OFFSET 0xA 112 113 #define SW_AN_UF_PAGE2_CL74_REQ_MASK 0x1 114 #define SW_AN_UF_PAGE2_CL74_REQ_OFFSET 0xB 115 116 /* initialize the SW AN module */ 117 extern int bcm_sw_an_module_init(int unit); 118 119 /* deInit the SW AN module */ 120 extern int bcm_sw_an_module_deinit(int unit); 121 122 /* Start/Stop the SW AN thread for the unit */ 123 extern int bcm_sw_an_enable_set(int unit, int enable); 124 125 extern int bcm_sw_an_enable_get(int unit, int *enable); 126 127 /* add the port to SW AN */ 128 extern int bcm_sw_an_port_register(int unit, bcm_port_t port); 129 130 /* remove the port from SW AN */ 131 extern int bcm_sw_an_port_unregister(int unit, bcm_port_t port); 132 133 /* notify the SW AN thread of any AN event */ 134 extern int bcm_sw_an_post_event(int unit, bcm_port_t port, bcm_port_sw_an_event_t event); 135 136 /* sw an advert set */ 137 extern int bcm_sw_an_advert_set(int unit, bcm_port_t port, phymod_autoneg_ability_t *ability); 138 139 extern int bcm_sw_an_ability_advert_set(int unit, soc_port_t port, soc_port_ability_t *ability); 140 141 /* sw an advert/remote ability get */ 142 extern int bcm_sw_an_ability_remote_get(int unit, soc_port_t port, soc_port_ability_t *portAbility); 143 extern int bcm_sw_an_ability_advert_get(int unit, soc_port_t port, soc_port_ability_t *portAbility); 144 145 /* debug function to dump an context for the port */ 146 extern int bcm_sw_an_port_diag(int unit, int port); 147 148 149 #endif /* __BCM_SW_AN_H__ */ 150 #endif /* SW_AUTONEG_SUPPORT */ 151