ptp.h (131844B)
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 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_PTP_H__ 14 #define __BCM_PTP_H__ 15 16 #if defined(INCLUDE_PTP) 17 18 #include <bcm/types.h> 19 20 /* Miscellaneous PTP defines */ 21 #define BCM_PTP_CLOCK_EUID_IEEE1588_SIZE 8 /* Clock EUID size per 22 IEEE 1588 standard. */ 23 #define BCM_PTP_MAX_L2_HEADER_LENGTH 64 /* Maximum L2 Header 24 length. */ 25 #define BCM_PTP_MAX_NETW_ADDR_SIZE 16 /* Maximum Network 26 Address Size. */ 27 #define BCM_PTP_MAX_TOD_FORMAT_STRING 128 /* Maximum Network 28 Address Size. */ 29 #define BCM_PTP_EXT_STACK_FAULT_INFO_DEFAULT_MAX_SIZE 1024 /* Recommended maximum 30 buffer size for fault 31 info. */ 32 #define BCM_PTP_TRACEABILITY_NO_OVERRIDE 0xFF /* Flag used to clear the 33 traceability override 34 configuration. */ 35 #define BCM_PTP_IEEE1588_ALL_PORTS 0xFFFF /* All ports identifier 36 (as defined in IEEE 37 1588-2008 std, 38 sections 7.5.2.3, 39 13.12.1 and 15.3.1). */ 40 41 /* PTP Stack info flags */ 42 #define BCM_PTP_STACK_WITH_ID 0x0001 /* Use the specified PTP 43 Stack ID */ 44 #define BCM_PTP_STACK_EXTERNAL_TOP 0x0002 /* Specifies PTP stack 45 instance runs on 46 external processor */ 47 #define BCM_PTP_STACK_TIMESTAMPER_COMBINED_MODE 0x0004 /* Flag to enable TS0 and 48 TS1 timestamper in 49 combined mode */ 50 51 /* PTP Clock info flags */ 52 #define BCM_PTP_CLOCK_WITH_ID 0x0001 /* Use the specified PTP Clock ID */ 53 54 /* Maximum Number of Unicast Masters */ 55 #define BCM_PTP_MAX_UNICAST_MASTER_TABLE_ENTRIES 10 56 57 /* Number of Telecom G8265 Profile Packet Masters */ 58 #define BCM_PTP_TELECOM_MAX_NUMBER_PKTMASTERS BCM_PTP_MAX_UNICAST_MASTER_TABLE_ENTRIES 59 60 /* 61 * Specifies PTP PHY clock synchronization is performed on a modular 62 * system 63 */ 64 #define BCM_PTP_SYNC_PHY_MODULAR 0x0001 65 66 /* Bits in servo configuration flags. */ 67 #define BCM_PTP_SERVO_PHASE_ONLY (0x01) /* Phase-only bit. */ 68 #define BCM_PTP_SERVO_LOCK_SWITCH_FREQ (0x02) /* Switch-frequency lock bit. */ 69 #define BCM_PTP_SERVO_IGNORE_FREQ (0x04) /* Ignore-frequency bit. */ 70 #define BCM_PTP_SERVO_PHASE_HOLDOVER (0x08) /* Servo phase holdover bit. */ 71 72 /* Maximum number of C-TDEV timescales. */ 73 #define BCM_PTP_CTDEV_NUM_TIMESCALES_MAX (12) 74 75 /* PTP message flag fields bit postition */ 76 #define BCM_PTP_PKT_FLAG_LI_61 0 77 #define BCM_PTP_PKT_FLAG_59 1 78 #define BCM_PTP_PKT_FLAG_CUR_UTCOFFS_VAL 2 79 #define BCM_PTP_PKT_FLAG_TIMESCALE 3 80 #define BCM_PTP_PKT_FLAG_TIME_TRACEABLE 4 81 #define BCM_PTP_PKT_FLAG_FREQ_TRACEABLE 5 82 #define BCM_PTP_PKT_FLAG_SYNC_UNCERTAIN 6 83 #define BCM_PTP_PKT_FLAG_ALT_MASTER 8 84 #define BCM_PTP_PKT_FLAG_TWO_STEP 9 85 #define BCM_PTP_PKT_FLAG_UNICAST 10 86 #define BCM_PTP_PKT_FLAG_PROF_SPEC1 13 87 #define BCM_PTP_PKT_FLAG_PROF_SPEC2 14 88 #define BCM_PTP_PKT_FLAG_SECURITY 15 89 90 /* PTP Stack ID type */ 91 typedef int bcm_ptp_stack_id_t; 92 93 /* PTP Clock Identity type */ 94 typedef uint8 bcm_ptp_clock_identity_t[8]; 95 96 /* PTP Time of Day Format Types */ 97 typedef enum bcm_ptp_time_type_e { 98 bcmPTPTimeDefault /* Default */ 99 } bcm_ptp_time_type_t; 100 101 /* PTP Timesource Types */ 102 typedef enum bcm_ptp_time_source_e { 103 bcmPTPTimeSourceAtomicClock = 0x10, /* Atomic Clock */ 104 bcmPTPTimeSourceGPS = 0x20, /* Global Positioning System */ 105 bcmPTPTimeSourceTerRadio = 0x30, /* Terrestrial Radio */ 106 bcmPTPTimeSourcePtp = 0x40, /* PTP-based source */ 107 bcmPTPTimeSourceNTP = 0x50, /* Network Time Protocol source */ 108 bcmPTPTimeSourceHandSet = 0x60, /* Handset */ 109 bcmPTPTimeSourceOther = 0x90, /* Other timesource */ 110 bcmPTPTimeSourceInternalOsc = 0xA0 /* Internal Oscillator */ 111 } bcm_ptp_time_source_t; 112 113 /* PTP Clock Accuracy */ 114 typedef enum bcm_ptp_clock_accuracy_e { 115 bcmPTPClockAccuracy25ns = 0x0020, /* Time is accurate to with 25 ns */ 116 bcmPTPClockAccuracy100ns = 0x0021, /* Time is accurate to with 100 ns */ 117 bcmPTPClockAccuracy250ns = 0x0022, /* Time is accurate to with 250 ns */ 118 bcmPTPClockAccuracy1us = 0x0023, /* Time is accurate to with 1 us */ 119 bcmPTPClockAccuracy2500ns = 0x0024, /* Time is accurate to with 2500 ns */ 120 bcmPTPClockAccuracy10us = 0x0025, /* Time is accurate to with 10 us */ 121 bcmPTPClockAccuracy25us = 0x0026, /* Time is accurate to with 25 us */ 122 bcmPTPClockAccuracy100us = 0x0027, /* Time is accurate to with 100 us */ 123 bcmPTPClockAccuracy250us = 0x0028, /* Time is accurate to with 250 us */ 124 bcmPTPClockAccuracy1ms = 0x0029, /* Time is accurate to with 1 ms */ 125 bcmPTPClockAccuracy2500us = 0x002a, /* Time is accurate to with 2500 us */ 126 bcmPTPClockAccuracy10ms = 0x002b, /* Time is accurate to with 10 ms */ 127 bcmPTPClockAccuracy25ms = 0x002c, /* Time is accurate to with 25 ms */ 128 bcmPTPClockAccuracy100ms = 0x002d, /* Time is accurate to with 100 ms */ 129 bcmPTPClockAccuracy250ms = 0x002e, /* Time is accurate to with 250 ms */ 130 bcmPTPClockAccuracy1s = 0x002f, /* Time is accurate to with 1 s */ 131 bcmPTPClockAccuracy10s = 0x0030, /* Time is accurate to with 10 s */ 132 bcmPTPClockAccuracyL10s = 0x0031, /* Time is accurate to > 10 s */ 133 bcmPTPClockAccuracyUnknown = 0x00FE, /* Time accuracy is unknown */ 134 bcmPTPClockAccuracyReserved = 0x00FF /* Reserved */ 135 } bcm_ptp_clock_accuracy_t; 136 137 /* 138 * Flags to indicate the fields of bcm_ptp_clock_quality_t in 139 * bcm_ptp_clock_quality_set/get 140 */ 141 #define BCM_PTP_CLOCK_QUALITY_CLASS (0x1) 142 #define BCM_PTP_CLOCK_QUALITY_ACCURACY (0x2) 143 #define BCM_PTP_CLOCK_QUALITY_OFFSET_SCALED_LOG_VARIANCE (0x4) 144 145 /* PTP callback types */ 146 typedef enum bcm_ptp_cb_type_e { 147 bcmPTPCallbackTypeManagement, 148 bcmPTPCallbackTypeEvent, 149 bcmPTPCallbackTypeSignal, 150 bcmPTPCallbackTypeFault, 151 bcmPTPCallbackTypeCheckPeers, 152 bcmPTPCallbackCount 153 } bcm_ptp_cb_type_t; 154 155 /* PTP Clock types */ 156 typedef enum bcm_ptp_clock_type_e { 157 bcmPTPClockTypeOrdinary = 1, 158 bcmPTPClockTypeBoundary = 2, 159 bcmPTPClockTypeTransparent = 3 160 } bcm_ptp_clock_type_t; 161 162 /* PTP TOD Source */ 163 typedef enum bcm_ptp_tod_source_e { 164 bcmPTPTODSourceNone, 165 bcmPTPTODSourceSerial, 166 bcmPTPTODSourceEthernet, 167 bcmPTPTODSourceSerial1, 168 bcmPTPTODSourceSerial2, 169 bcmPTPTODSourceSerial3, 170 bcmPTPTODSourceMaster 171 } bcm_ptp_tod_source_t; 172 173 /* PTP TOD Formats */ 174 typedef enum bcm_ptp_tod_format_e { 175 bcmPTPTODFormatString, 176 bcmPTPTODFormatUBlox, 177 bcmPTPTODFormatChinaTcom, 178 bcmPTPTODFormatBCM, 179 bcmPTPTODFormatBCMTS, 180 bcmPTPTODFormatG8271 181 } bcm_ptp_tod_format_t; 182 183 /* PTP Source Types */ 184 typedef enum bcm_ptp_source_type_e { 185 bcmPTPSourceTypePTP, 186 bcmPTPSourceTypeGpsTimestamp, 187 bcmPTPSourceTypeSyncETimestamp, 188 bcmPTPSourceTypeE1Timestamp, 189 bcmPTPSourceTypeT1Timestamp, 190 bcmPTPSourceTypeRedundancy, 191 bcmPTPSourceTypeFrequencyOnly, 192 bcmPTPSourceTypeModular = 133 193 } bcm_ptp_source_type_t; 194 195 /* PTP Timestamp Source */ 196 typedef int bcm_ptp_timestamp_source_t; 197 198 /* PTP SyncE port */ 199 typedef int bcm_ptp_synce_port_t; 200 201 /* PTP Delay Mechanism types */ 202 typedef enum bcm_ptp_delay_mechanism_e { 203 bcmPTPDelayMechanismEnd2End = 1, 204 bcmPTPDelayMechanismPeer2Peer = 2, 205 bcmPTPDelayMechansimDisabled = 0xFE 206 } bcm_ptp_delay_mechanism_t; 207 208 /* PTP messageType IEEE Std. 1588-2008 */ 209 typedef enum bcm_ptp_message_type_e { 210 bcmPTP_MESSAGE_TYPE_SYNC = 0x0, /* Sync Message */ 211 bcmPTP_MESSAGE_TYPE_DELAY_REQ = 0x1, /* Delay Request Message */ 212 bcmPTP_MESSAGE_TYPE_PDELAY_REQ = 0x2, /* Peer Delay Request Message */ 213 bcmPTP_MESSAGE_TYPE_PDELAY_RESP = 0x3, /* Peer Delay Response Message */ 214 bcmPTP_MESSAGE_TYPE_FOLLOW_UP = 0x8, /* Follow Up Message */ 215 bcmPTP_MESSAGE_TYPE_DELAY_RESP = 0x9, /* Delay Response Message */ 216 bcmPTP_MESSAGE_TYPE_PDELAY_RESP_FOLLOW_UP = 0xA, /* Peer Delay Response Follow Up Message */ 217 bcmPTP_MESSAGE_TYPE_ANNOUNCE = 0xB, /* Announce Message */ 218 bcmPTP_MESSAGE_TYPE_SIGNALING = 0xC, /* Signaling Message */ 219 bcmPTP_MESSAGE_TYPE_MANAGEMENT = 0xD, /* Management Message */ 220 bcmPTP_MESSAGE_TYPE_ARP = 0xFF /* ARP Message not in PTP Standard */ 221 } bcm_ptp_message_type_t; 222 223 /* PTP tlvType enumeration. Ref. IEEE Std. 1588-2008, Chapter 14.1.1. */ 224 typedef enum bcm_ptp_tlv_type_e { 225 bcmPTPTlvTypeManagement = 0x0001, /* Management TLV type. */ 226 bcmPTPTlvTypeManagementErrorStatus = 0x0002, /* Management error status TLV type. */ 227 bcmPTPTlvTypeOrganizationExtension = 0x0003, /* Organization extension TLV type. */ 228 bcmPTPTlvTypeRequestUnicastTransmission = 0x0004, /* Request unicast transmission TLV 229 type. */ 230 bcmPTPTlvTypeGrantUnicastTransmission = 0x0005, /* Grant unicast transmission TLV type. */ 231 bcmPTPTlvTypeCancelUnicastTransmission = 0x0006, /* Cancel unicast transmission TLV type. */ 232 bcmPTPTlvTypeAckCancelUnicastTransmission = 0x0007 /* Acknowledge cancel unicast 233 transmission TLV type. */ 234 } bcm_ptp_tlv_type_t; 235 236 typedef struct bcm_ptp_cb_types_s { 237 SHR_BITDCL w[_SHR_BITDCLSIZE(bcmPTPCallbackCount)]; 238 } bcm_ptp_cb_types_t; 239 240 typedef int (*bcm_ptp_ext_stack_io_wr_fn_ptr)( 241 void *cookie, 242 uint32 address, 243 uint32 value); 244 245 typedef int (*bcm_ptp_ext_stack_io_rd_fn_ptr)( 246 void *cookie, 247 uint32 address, 248 uint32 *value); 249 250 /* PTP External Stack Processor Info object */ 251 typedef struct bcm_ptp_external_stack_info_s { 252 uint32 flags; /* Control flags */ 253 bcm_ptp_stack_id_t id; /* PTP stack identifier */ 254 uint16 ethertype; /* RCPU ethertype */ 255 uint16 signature; /* RCPU signature */ 256 uint16 tpid; /* RCPU tpid */ 257 uint16 vlan; /* RCPU vlan */ 258 uint8 vlan_pri; /* VLAN priority. External Stack 259 Processor Only. */ 260 uint16 reflected_ethertype; /* RCPU reflected ethertype */ 261 bcm_mac_t switch_mac; /* Switch MAC address */ 262 bcm_mac_t host_mac; /* Host MAC address. External Stack 263 Processor Only. */ 264 bcm_mac_t top_mac; /* ToP stack MAC address. External Stack 265 Processor Only. */ 266 bcm_ip_t host_ip_addr; /* host IPv4 address. External Stack 267 Processor Only. */ 268 bcm_ip_t top_ip_addr; /* ToP IPv4 address. External Stack 269 Processor Only. */ 270 bcm_port_t port; /* ToP port. External Stack Processor 271 Only. */ 272 bcm_ptp_ext_stack_io_rd_fn_ptr read_fn; /* PCI Read Function */ 273 bcm_ptp_ext_stack_io_wr_fn_ptr write_fn; /* PCI Write Function */ 274 void *cookie; /* User-specified identifer for external 275 stack */ 276 } bcm_ptp_external_stack_info_t; 277 278 /* PTP Stack Info object */ 279 typedef struct bcm_ptp_stack_info_s { 280 uint32 flags; /* control flags */ 281 bcm_ptp_stack_id_t id; /* PTP stack identifier */ 282 bcm_ptp_external_stack_info_t *ext_stack_info; /* External Stack Info. External Stack 283 Processor Only. */ 284 } bcm_ptp_stack_info_t; 285 286 /* Clock Quality */ 287 typedef struct bcm_ptp_clock_quality_s { 288 uint8 clock_class; /* Clock Class */ 289 bcm_ptp_clock_accuracy_t clock_accuracy; /* Clock Accuracy */ 290 uint16 offset_scaled_log_variance; /* Offset Scaled Log Variance */ 291 } bcm_ptp_clock_quality_t; 292 293 /* PTP Port Identity Structure */ 294 typedef struct bcm_ptp_port_identity_s { 295 bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */ 296 uint16 port_number; /* Port Number */ 297 } bcm_ptp_port_identity_t; 298 299 /* Clock Instance Information */ 300 typedef struct bcm_ptp_clock_info_s { 301 uint32 flags; /* Flags */ 302 int clock_num; /* Clock Identifier (numeric) */ 303 bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */ 304 bcm_ptp_clock_type_t type; /* PTP Clock Type */ 305 uint16 num_ports; /* Number of Ports */ 306 uint8 clock_class; /* Clock Class */ 307 uint8 domain_number; /* Domain Number */ 308 uint16 scaled_log_variance; /* Scaled Log Variance */ 309 uint8 priority1; /* Priority 1 */ 310 uint8 priority2; /* Priority 2 */ 311 uint8 slaveonly; /* Slave Only */ 312 uint8 twostep; /* Two Step */ 313 uint8 tc_primary_domain; /* Transparent Clock Primary Domain */ 314 bcm_ptp_delay_mechanism_t tc_delay_mechanism; /* Transparent Clock Delay Mechanism */ 315 uint8 announce_receipt_timeout_minimum; /* Announce Receipt Timeout Minimum */ 316 uint8 announce_receipt_timeout_default; /* Announce Receipt Timeout Default */ 317 uint8 announce_receipt_timeout_maximum; /* Announce Receipt Timeout Maximum */ 318 int log_announce_interval_minimum; /* Log Announce Interval Minimum */ 319 int log_announce_interval_default; /* Log Announce Interval Default */ 320 int log_announce_interval_maximum; /* Log Announce Interval Maximum */ 321 int log_sync_interval_minimum; /* Log Sync Interval Minimum */ 322 int log_sync_interval_default; /* Log Sync Interval Default */ 323 int log_sync_interval_maximum; /* Log Sync Interval Maximum */ 324 int log_min_delay_req_interval_minimum; /* Log min PDelay request interval or 325 log min delay request interval 326 minimum */ 327 int log_min_delay_req_interval_default; /* Log min PDelay request interval or 328 log min delay request interval 329 default */ 330 int log_min_delay_req_interval_maximum; /* Log min PDelay request interval or 331 log min delay request interval 332 maximum */ 333 uint8 domain_number_minimum; /* Domain Number minimum */ 334 uint8 domain_number_default; /* Domain Number default */ 335 uint8 domain_number_maximum; /* Domain Number maximum */ 336 uint8 priority1_minimum; /* Priority 1 minimum */ 337 uint8 priority1_default; /* Priority 1 default */ 338 uint8 priority1_maximum; /* Priority 1 maximum */ 339 uint8 priority2_minimum; /* Priority 2 minimum */ 340 uint8 priority2_default; /* Priority 2 default */ 341 uint8 priority2_maximum; /* Priority 2 maximum */ 342 uint8 number_virtual_interfaces; /* unused */ 343 uint8 local_priority; /* Local priority of the clock */ 344 uint8 max_steps_removed; /* maxStepsRemoved for the PTP clock */ 345 uint32 holdover_in_spec_secs; /* Holdover In-Spec time for the PTP 346 clock in seconds */ 347 } bcm_ptp_clock_info_t; 348 349 /* PTP Clock Dataset flags */ 350 #define BCM_PTP_DATASET_TWOSTEP_ONLY 0x0001 /* Specifies Two-step only */ 351 #define BCM_PTP_DATASET_SLAVE_ONLY 0x0002 /* Specifies Slave Only */ 352 353 /* PTP Default Dataset */ 354 typedef struct bcm_ptp_default_dataset_s { 355 uint32 flags; /* Flags */ 356 uint16 number_ports; /* Number of ports */ 357 uint8 priority1; /* Priority 1 */ 358 uint8 priority2; /* Priority 2 */ 359 uint8 domain_number; /* Domain number */ 360 bcm_ptp_clock_quality_t clock_quality; /* Clock quality */ 361 bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */ 362 uint8 local_priority; /* local priority of clock */ 363 uint8 max_steps_removed; /* maxStepsRemoved for the PTP clock */ 364 } bcm_ptp_default_dataset_t; 365 366 /* PTP Current Dataset */ 367 typedef struct bcm_ptp_current_dataset_s { 368 uint16 steps_removed; /* Steps Removed from Master */ 369 uint64 offset_from_master; /* Offset from Master in nanoseconds */ 370 uint64 mean_path_delay; /* Mean Path Delay in nanoseconds */ 371 } bcm_ptp_current_dataset_t; 372 373 /* PTP Parent Dataset */ 374 typedef struct bcm_ptp_parent_dataset_s { 375 bcm_ptp_port_identity_t parent_port_identity; /* Parent Port Identity */ 376 uint8 ps; /* ps */ 377 uint16 observed_parent_offset_scaled_log_variance; /* Observed Parent Offset Scaled Log 378 Variance */ 379 uint32 observed_parent_clock_phase_change_rate; /* Observed Parent Clock Phase Change 380 Rate */ 381 uint8 grandmaster_priority1; /* Grandmaster Priority 1 */ 382 bcm_ptp_clock_quality_t grandmaster_clock_quality; /* Grandmaster Clock quality */ 383 uint8 grandmaster_priority2; /* Grandmaster Priority 2 */ 384 bcm_ptp_clock_identity_t grandmaster_identity; /* Grandmaster Identity */ 385 } bcm_ptp_parent_dataset_t; 386 387 /* PTP Transparent Clock Default Dataset */ 388 typedef struct bcm_ptp_transparent_clock_default_dataset_s { 389 bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */ 390 uint16 number_ports; /* Number Of Ports */ 391 bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */ 392 uint8 primary_domain; /* Primary Domain */ 393 } bcm_ptp_transparent_clock_default_dataset_t; 394 395 /* PTP Transparent Clock Default Dataset */ 396 typedef struct bcm_ptp_transparent_clock_port_dataset_s { 397 bcm_ptp_port_identity_t port_identity; /* Clock Port identity */ 398 uint8 faulty; /* Faulty */ 399 int log_min_pdelay_req_interval; /* Log Minimun Peer Delay Interval */ 400 uint64 peer_mean_path_delay; /* Peer Mean Path Delay in Nanoseconds */ 401 } bcm_ptp_transparent_clock_port_dataset_t; 402 403 /* Coordinated Universal Time (UTC) dataset definiton */ 404 typedef struct bcm_ptp_utc_s { 405 uint16 utc_offset; /* Current UTC offset */ 406 uint8 leap61; /* 1-> Plus one second, 0-> No leap second. */ 407 uint8 leap59; /* 1-> Minus one second, 0-> No leap second. */ 408 uint8 utc_valid; /* 1-> Correct offset to UTC, 0-> No sync to UTC. */ 409 } bcm_ptp_utc_t; 410 411 /* Clock data traceability */ 412 typedef struct bcm_ptp_trace_s { 413 uint8 time_traceable; /* Time traceable */ 414 uint8 frequency_traceable; /* Frequency traceable */ 415 uint8 check_trc_flag_enable; /* Time tracability flag of announce message 416 will be checked for valid time channel 417 when enable */ 418 } bcm_ptp_trace_t; 419 420 /* PTP Timescale properties */ 421 typedef struct bcm_ptp_timescale_s { 422 bcm_ptp_time_source_t time_source; /* PTP time source */ 423 uint8 ptp_timescale; /* PTP timescale */ 424 } bcm_ptp_timescale_t; 425 426 /* PTP Time Properties Dataset */ 427 typedef struct bcm_ptp_time_properties_s { 428 bcm_ptp_utc_t utc_info; /* UTC properties */ 429 bcm_ptp_trace_t trace_info; /* Trace properties */ 430 bcm_ptp_timescale_t timescale_info; /* Timescale properties */ 431 uint32 ptp_pkt_flags; /* PTP packet flags */ 432 } bcm_ptp_time_properties_t; 433 434 /* PTP Network Protocol enumeration (See IEEE 1588, Chapter 7.4.1) */ 435 typedef enum bcm_ptp_protocol_e { 436 bcmPTPUDPIPv4 = 1, /* Ethernet / UDP / IPv4 */ 437 bcmPTPUDPIPv6 = 2, /* Ethernet / UDP / IPv6 */ 438 bcmPTPIEEE8023 = 3 /* Ethernet Layer 2 */ 439 } bcm_ptp_protocol_t; 440 441 /* PTP Clock Port Type enumeration. */ 442 typedef enum bcm_ptp_port_type_e { 443 bcmPTPPortTypeStandard = 1, /* Master-or-Slave port type */ 444 bcmPTPPortTypeMasterOnly = 2, /* Master-only port type */ 445 bcmPTPPortTypeSlaveOnly = 3, /* Slave-only port type */ 446 bcmPTPPortTypeVirtual = 4, /* Virtual port type as defined in 447 G.8275.1(Annex-C) */ 448 bcmPTPPortTypeCustomizedVirtual = 5 /* Customized virtual port type */ 449 } bcm_ptp_port_type_t; 450 451 /* PTP Timestamp Source enumeration. */ 452 typedef enum bcm_ptp_timestamp_mechanism_e { 453 bcmPTPToPTimestamps = 0x01, /* Internal ToP timestamps */ 454 bcmPTPRCPUTimestamps = 0x02, /* Timestamps from switch */ 455 bcmPTPPhyCorrectionTimestamps = 0x11, /* Timestamps from PHY CF update */ 456 bcmPTPMac32CorrectionTimestamps = 0x12, /* Timestamps from Unimac 32-bit update */ 457 bcmPTPMac48CorrectionTimestamps = 0x14 /* Timestamps from Unimac 48-bit update */ 458 } bcm_ptp_timestamp_mechanism_t; 459 460 /* PTP Clock Port address */ 461 typedef struct bcm_ptp_clock_port_address_s { 462 bcm_ptp_protocol_t addr_type; /* Clock Port address type */ 463 uint8 address[BCM_PTP_MAX_NETW_ADDR_SIZE]; /* Address */ 464 } bcm_ptp_clock_port_address_t; 465 466 /* Bits in Port Rx Packets Criteria Mask */ 467 #define BCM_PTP_RXMAP_ACCEPT_MULTICAST (0x01) /* Port should accept 468 packets with PTP 469 multicast destination 470 address */ 471 #define BCM_PTP_RXMAP_MATCH_OUTER_VLAN (0x02) /* Port should check 472 incoming packet outer 473 VLAN vs 474 rx_packets_vlan */ 475 #define BCM_PTP_RXMAP_MATCH_INNER_VLAN (0x04) /* Port should check 476 incoming packet inner 477 VLAN vs 478 rx_packets_vlan */ 479 #define BCM_PTP_RXMAP_MATCH_INGRESS_PORT (0x08) /* Port should check 480 incoming ingress port 481 vs 482 rx_packets_port_mask */ 483 #define BCM_PTP_RXMAP_MATCH_ANY_ADDR (0x10) /* Port should NOT check 484 incoming destination 485 address vs port 486 address */ 487 488 /* virtual PTP port information */ 489 typedef struct bcm_ptp_clock_port_virtual_info_s { 490 uint8 clock_class; /* clock class */ 491 bcm_ptp_clock_accuracy_t clock_accuracy; /* clock accuracy */ 492 uint16 offset_scaled_log_variance; /* offset scaled log variance */ 493 uint16 steps_removed; /* steps removed */ 494 uint8 GM_prio2; /* GM priority2 */ 495 int tod_offset_sec; /* PTP Offset Seconds Added */ 496 int tod_offset_ns; /* PTP Offset Nanoseconds Added */ 497 bcm_ptp_tod_format_t format; /* PTP TOD Format */ 498 uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */ 499 uint8 mask_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Mask String (null terminated) */ 500 uint16 ether_type; /* Ethertype for TOD pkts */ 501 uint8 onepps_in_gpio; /* GPIO pin for 1PPS input. Required 502 only for 503 bcmPTPPortTypeCustomizedVirtual */ 504 bcm_ptp_tod_source_t tod_source; /* PTP TOD Source */ 505 uint32 tod_baud_rate; /* PTP ToD baud rate */ 506 } bcm_ptp_clock_port_virtual_info_t; 507 508 /* PTP Clock Port information */ 509 typedef struct bcm_ptp_clock_port_info_s { 510 bcm_ptp_clock_port_address_t port_address; /* Clock Port address */ 511 bcm_mac_t mac; /* MAC address */ 512 uint8 multicast_l2_size; /* Multicast L2 header size (octets) */ 513 uint8 multicast_l2[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Multicast L2 header */ 514 uint8 multicast_pdelay_l2_size; /* Multicast Peer-Delay L2 header size 515 (octets) */ 516 uint8 multicast_pdelay_l2[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Multicast Peer-Delay L2 header */ 517 uint8 multicast_tx_enable; /* Multicast transmit enable */ 518 bcm_ptp_port_type_t port_type; /* Port Type */ 519 uint8 announce_receipt_timeout; /* Announce receipt timeout */ 520 int log_announce_interval; /* Log Announce interval */ 521 int log_sync_interval; /* Log Sync interval */ 522 int log_min_delay_req_interval; /* Log Minimum Delay Request interval */ 523 bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */ 524 bcm_ptp_timestamp_mechanism_t rx_timestamp_mechanism; /* Receive Timestamp Mechanism */ 525 uint16 rx_packets_vlan; /* Port Rx Packets Vlan */ 526 uint32 rx_packets_port_mask_high32; /* Port Rx Packets Mask High bits */ 527 uint32 rx_packets_port_mask_low32; /* Port Rx Packets Mask Low bits */ 528 uint8 rx_packets_criteria_mask; /* Port Rx Packets Criteria Mask */ 529 uint8 local_priority; /* Local priority of the clock port */ 530 bcm_ptp_clock_port_virtual_info_t vport_info; /* configuration of virtual port */ 531 } bcm_ptp_clock_port_info_t; 532 533 /* PTP Clock Port Dataset */ 534 typedef struct bcm_ptp_port_dataset_s { 535 bcm_ptp_port_identity_t port_identity; /* Clock Port identity */ 536 uint8 port_state; /* Port state. */ 537 int log_min_delay_req_interval; /* Log minimum delay request interval */ 538 uint64 peer_mean_path_delay; /* Peer Mean path delay (nanoseconds) */ 539 int log_announce_interval; /* Log Announce interval */ 540 uint8 announce_receipt_timeout; /* Announce receipt timeout */ 541 int log_sync_interval; /* Log synchronization interval */ 542 bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */ 543 int log_min_pdelay_req_interval; /* Log minimum peer delay request 544 interval */ 545 uint8 version_number; /* Version Number */ 546 uint8 local_priority; /* clock port's local priority */ 547 uint8 not_slave; /* notSlave config of the clock port */ 548 int signal_fail; /* Boolean indicating signal_fail for a 549 port */ 550 } bcm_ptp_port_dataset_t; 551 552 /* PTP Clock Peer address */ 553 typedef struct bcm_ptp_clock_peer_address_s { 554 uint8 raw_l2_header_length; /* Raw L2 Header Length */ 555 uint8 raw_l2_header[BCM_PTP_MAX_L2_HEADER_LENGTH]; /* Raw L2 Header */ 556 bcm_ptp_protocol_t addr_type; /* Peer Port address type */ 557 bcm_ip_t ipv4_addr; /* Peer IPv4 address */ 558 bcm_ip6_t ipv6_addr; /* Peer IPv6 address */ 559 } bcm_ptp_clock_peer_address_t; 560 561 /* PTP Peer Info Structure */ 562 typedef struct bcm_ptp_clock_peer_s { 563 bcm_ptp_clock_identity_t clock_identity; /* Clock Identity */ 564 uint16 remote_port_number; /* Remote Clock Port Number */ 565 uint16 local_port_number; /* Local Clock Port Number */ 566 bcm_ptp_clock_peer_address_t peer_address; /* Peer Port address */ 567 bcm_ptp_timestamp_mechanism_t tx_timestamp_mech; /* Send Timestamp Mechanism */ 568 int log_peer_delay_request_interval; /* Log Peer Delay Request Interval */ 569 int log_sync_interval; /* Log Sync Interval */ 570 int announce_receive_timeout; /* Announce Receive Timeout */ 571 int log_announce_interval; /* Log Announce Interval */ 572 int log_delay_request_interval; /* Log Delay Request Interval */ 573 bcm_ptp_delay_mechanism_t delay_mechanism; /* Delay Mechanism */ 574 } bcm_ptp_clock_peer_t; 575 576 /* PTP Peer Unicast Master Entry */ 577 typedef struct bcm_ptp_clock_unicast_master_s { 578 int log_sync_interval; /* PTP Clock Log Sync Interval */ 579 int log_announce_interval; /* PTP Clock Log Announce Interval */ 580 int log_query_interval; /* PTP Clock Log Query Interval */ 581 int log_min_delay_request_interval; /* PTP Clock Log Minimun Delay Request 582 Interval */ 583 bcm_ptp_clock_peer_address_t address; /* PTP Clock Master address */ 584 } bcm_ptp_clock_unicast_master_t; 585 586 /* PTP TOD IN */ 587 typedef struct bcm_ptp_tod_input_s { 588 bcm_ptp_tod_source_t source; /* PTP TOD Source */ 589 bcm_ptp_clock_peer_address_t peer_address; /* Peer Address For TOD Over Ethernet */ 590 int tod_offset_sec; /* PTP Offset Seconds Added */ 591 int tod_offset_ns; /* PTP Offset Nanoseconds Added */ 592 bcm_ptp_tod_format_t format; /* PTP TOD Format */ 593 uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */ 594 uint8 mask_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Mask String (null terminated) */ 595 uint32 tod_baud_rate; /* PTP ToD baud rate */ 596 } bcm_ptp_tod_input_t; 597 598 /* ptp channel configuration flags */ 599 #define BCM_PTP_CHANNEL_SYNCE_CONFIG_NO_L1MUX_SELECT 0x0 /* Synce input config 600 will be done without 601 L1 mux config */ 602 603 /* PTP Synce Clock type enumeration. */ 604 typedef enum bcm_ptp_synce_clock_type_e { 605 bcmPTPSynceClockPrimary = 0x00, /* PTP Synce Clock Primary */ 606 bcmPTPSynceClockSecondary = 0x01 /* PTP Synce Clock Secondary */ 607 } bcm_ptp_synce_clock_type_t; 608 609 /* PTP TOD Channel */ 610 typedef struct bcm_ptp_channel_s { 611 bcm_ptp_source_type_t type; /* PTP Channel Source Type */ 612 bcm_ptp_timestamp_source_t source; /* TSGPIO pin index or syncE port index */ 613 int frequency; /* PTP Channel Frequency */ 614 int tod_index; /* PTP Channel Index */ 615 int freq_priority; /* PTP Channel Frequency Priority */ 616 int freq_enabled; /* PTP Channel Frequency Enabled */ 617 int time_prio; /* PTP Channel Time Priority */ 618 int time_enabled; /* PTP Channel Time Enabled */ 619 int freq_assumed_QL; /* PTP Channel Requency Assumed QL */ 620 int time_assumed_QL; /* PTP Channel Time Assumed QL */ 621 int assumed_QL_enabled; /* PTP Channel Assumed QL Enabled */ 622 int resolution; /* PTP Channel Resolution */ 623 bcm_ptp_synce_port_t synce_input_port; /* PTP SyncE input port */ 624 bcm_ptp_synce_clock_type_t synce_input_clk_type; /* PTP SyncE Input Clock type */ 625 uint32 synce_config_flags; /* PTP synce configuration flags */ 626 } bcm_ptp_channel_t; 627 628 /* PTP GPIO PIN */ 629 typedef int bcm_ptp_gpio_pin_t; 630 631 /* PTP Signal Out */ 632 typedef struct bcm_ptp_signal_output_s { 633 bcm_ptp_gpio_pin_t pin; /* PTP Signal GPIO pin */ 634 int frequency; /* PTP Signal Frequency */ 635 int phase_lock; /* PTP Phase Lock */ 636 int pulse_width_ns; /* PTP Pulse Width */ 637 int pulse_offset_ns; /* PTP Pulse Offset */ 638 bcm_ptp_synce_port_t synce_output_port; /* PTP SyncE output port */ 639 } bcm_ptp_signal_output_t; 640 641 /* PTP TOD OUT */ 642 typedef struct bcm_ptp_tod_output_s { 643 bcm_ptp_tod_source_t source; /* PTP TOD Source */ 644 bcm_ptp_clock_peer_address_t peer_address; /* Peer Address For TOD Over Ethernet */ 645 int tod_offset_src; /* PTP Offset Seconds Added */ 646 int tod_offset_ns; /* PTP Offset Nanoseconds Added */ 647 uint32 tod_delay_ns; /* PTP Delay Added in Nanoseconds */ 648 bcm_ptp_tod_format_t format; /* PTP TOD Format */ 649 int frequency; /* PTP Signal Frequency */ 650 int format_str_len; /* PTP Format String Length */ 651 uint8 format_str[BCM_PTP_MAX_TOD_FORMAT_STRING]; /* PTP Format String (null terminated) */ 652 uint32 tod_baud_rate; /* PTP ToD baud rate */ 653 } bcm_ptp_tod_output_t; 654 655 /* PTP Timesource Status */ 656 typedef struct bcm_ptp_timesource_status_s { 657 int tod_status; /* PTP Timesource TOD Status */ 658 int phase_status; /* PTP Timesource Phase Status */ 659 int frequency_status; /* PTP Timesource Frequency Status */ 660 } bcm_ptp_timesource_status_t; 661 662 /* PTP Call Back Function Message Data Type */ 663 typedef struct bcm_ptp_cb_msg_s { 664 uint32 flags; /* Flags */ 665 bcm_ptp_protocol_t protocol; /* PTP Protocol Type */ 666 int src_addr_offset; /* Source Address Offset */ 667 int msg_offset; /* Offset to the Start of Message */ 668 uint32 length; /* Length of the Message */ 669 uint8 *data; /* Pointer to addtional data */ 670 } bcm_ptp_cb_msg_t; 671 672 /* PTP PHY Sync Function Input Data Type */ 673 typedef struct bcm_ptp_sync_phy_input_s { 674 uint32 flags; /* Flags */ 675 int framesync_pin; /* Pin to be used for PHY Framesync (SYNC_IN1) */ 676 int freq_pin; /* Pin configured for PHY 4KHz reference. -1 for BS 677 HB */ 678 uint64 reference_time; /* DPLL Reference time to be programmed into PHYs */ 679 } bcm_ptp_sync_phy_input_t; 680 681 /* PTP BS TIME INFO GET Function output Data Type */ 682 typedef struct bcm_ptp_bs_time_info_s { 683 uint64 bshb0_time; /* BS0HB TS0 time to be programmed into PHY */ 684 uint64 bshb1_time; /* BS1HB TS0 time to be programmed into PHY */ 685 int64 systime_bs0_sec; /* BS0HB ptp systime seconds to be programmed into 686 PHY */ 687 int systime_bs0_nsec; /* BS0HB ptp systime nseconds to be programmed into 688 PHY */ 689 int64 systime_bs1_sec; /* BS1HB ptp systime seconds to be programmed into 690 PHY */ 691 int systime_bs1_nsec; /* BS1HB ptp systime nseconds to be programmed into 692 PHY */ 693 } bcm_ptp_bs_time_info_t; 694 695 /* PTP Servo Types. */ 696 typedef enum bcm_ptp_servo_type_e { 697 bcmPTPServoTypeExt = 0, /* 3rd-party servo. */ 698 bcmPTPServoTypeBCM = 1 /* Broadcom Phase Profile Servo. */ 699 } bcm_ptp_servo_type_t; 700 701 /* PTP Servo FLL State. */ 702 typedef enum bcm_ptp_fll_state_e { 703 bcmPTPFLLStateAcquiring, /* FLL acquiring lock. */ 704 bcmPTPFLLStateWarmup, /* FLL warmup state. */ 705 bcmPTPFLLStateFastLoop, /* FLL fast loop. */ 706 bcmPTPFLLStateNormal, /* FLL normal loop. */ 707 bcmPTPFLLStateBridge, /* FLL bridge state. */ 708 bcmPTPFLLStateHoldover /* FLL holdover state. */ 709 } bcm_ptp_fll_state_t; 710 711 /* PTP Servo State. */ 712 typedef enum bcm_ptp_servo_state_e { 713 bcmPtpServoStateAcquiring = bcmPTPFLLStateAcquiring, /* acquiring lock. */ 714 bcmPtpServoStateWarmup = bcmPTPFLLStateWarmup, /* warmup state. */ 715 bcmPtpServoStateFastLoop = bcmPTPFLLStateFastLoop, /* fast loop. */ 716 bcmPtpServoStateNormal = bcmPTPFLLStateNormal, /* normal loop. */ 717 bcmPtpServoStateBridge = bcmPTPFLLStateBridge, /* bridge state. */ 718 bcmPtpServoStateHoldover = bcmPTPFLLStateHoldover, /* holdover state. */ 719 bcmPtpServoStateInitial, /* initial state. */ 720 bcmPtpServoStateUnqualified, /* unqualified. */ 721 bcmPtpServoStateFreqLocked, /* freq locked. */ 722 bcmPtpServoStateTimeLocked, /* time locked. */ 723 bcmPtpServoStateHoldoverInSpec, /* holdover in spec. */ 724 bcmPtpServoStateHoldoverOutOfSpec, /* holdover out of spec */ 725 bcmPtpServoStateFreerun, /* free-run. */ 726 bcmPtpServoStateLast /* Last. */ 727 } bcm_ptp_servo_state_t; 728 729 /* PTP Servo Locked Status. */ 730 typedef enum bcm_ptp_servo_lock_status_e { 731 bcmPTPServoStatusUnlocked, /* Servo in Unlocked State. */ 732 bcmPTPServoStatusFreqLocked, /* Servo only Frequency locked. */ 733 bcmPTPServoStatusPhaseLocked, /* Servo only Phase locked. */ 734 bcmPTPServoStatusFreqPhaseLocked /* Servo Frequency and Phase both 735 locked. */ 736 } bcm_ptp_servo_lock_status_t; 737 738 /* PTP Timesource Redundant Status */ 739 typedef enum bcm_ptp_redundant_status_e { 740 bcm_ptp_redundant_active = 0, 741 bcm_ptp_redundant_standby = 1, 742 bcm_ptp_redundant_transition_to_active = 2, 743 bcm_ptp_redundant_transition_to_standby = 3 744 } bcm_ptp_redundant_status_t; 745 746 /* Telecom clock type as defined in Table.1 of ITU-T G8275.1 */ 747 typedef enum bcm_ptp_g8275p1_clock_type_e { 748 bcmPtpG8275P1ClockTypeTelecomGM = 0, /* Telecom GM - Master-only OC/BC. */ 749 bcmPtpG8275P1ClockTypeTelecomBC = 1, /* Telecom BC -Boundary clock. */ 750 bcmPtpG8275P1ClockTypeTelecomTSC = 2 /* Telecom SC - Slave-only OC . */ 751 } bcm_ptp_g8275p1_clock_type_t; 752 753 /* Telecom clock state as defined in ITU-T G8275.1 */ 754 typedef enum bcm_ptp_g8275p1_clock_state_e { 755 bcmPtpG8275P1ClockStateFreeRun = 0, /* clock not synchronized/synchronizing 756 to a time source. */ 757 bcmPtpG8275P1ClockStateLocked = 1, /* clock synchronized to a time source 758 with acceptable accuracy. */ 759 bcmPtpG8275P1ClockStateHoldoverInSpec = 2, /* clock no-longer synchronized to a 760 time source but with performance 761 within desired specification. */ 762 bcmPtpG8275P1ClockStateHoldoverOutOfSpec = 3 /* clock no-longer synchronized to a 763 time source and performance NOT 764 within desired specification. */ 765 } bcm_ptp_g8275p1_clock_state_t; 766 767 /* 768 * G781 Quality level values that can be mapped to ITU-T G8275.1 specific 769 * frequency source category 770 */ 771 typedef enum bcm_ptp_g8275p1_quality_level_e { 772 bcmPtpG8275P1QlInvalid = 0, /* Invalid QL. */ 773 bcmPtpG8275P1QlOptIPrc = 0x10, /* ITU-T G.781 QL Option I. */ 774 bcmPtpG8275P1QlOptISsua = 0x11, /* ITU-T G.781 QL Option I. */ 775 bcmPtpG8275P1QlOptISsub = 0x12, /* ITU-T G.781 QL Option I. */ 776 bcmPtpG8275P1QlOptIIPrs = 0x20, /* ITU-T G.781 QL Option II. */ 777 bcmPtpG8275P1QlOptIISt2 = 0x21, /* ITU-T G.781 QL Option II. */ 778 bcmPtpG8275P1QlOptIISt3e = 0x22, /* ITU-T G.781 QL Option II. */ 779 bcmPtpG8275P1QlNaSlv = 0xff /* Not Applicable (packet slave). */ 780 } bcm_ptp_g8275p1_quality_level_t; 781 782 /* clock traceability information */ 783 typedef struct bcm_ptp_g8275p1_clock_traceability_info_s { 784 bcm_ptp_g8275p1_clock_type_t clock_type; /* Telecom clock type */ 785 bcm_ptp_g8275p1_clock_state_t clock_state; /* Telecom clock state */ 786 bcm_ptp_g8275p1_quality_level_t ql; /* Clock quality level */ 787 int freq_traceable; /* Boolean value - 1:traceable 788 0:non-traceable */ 789 } bcm_ptp_g8275p1_clock_traceability_info_t; 790 791 /* PTP Telecom G8265 Profile Pktmaster State */ 792 typedef enum bcm_ptp_telecom_g8265_pktmaster_state_e { 793 bcm_ptp_telecom_g8265_pktmaster_state_unused = 0, 794 bcm_ptp_telecom_g8265_pktmaster_state_init = 1, 795 bcm_ptp_telecom_g8265_pktmaster_state_valid = 2 796 } bcm_ptp_telecom_g8265_pktmaster_state_t; 797 798 /* PTP ITU-T G.781 synchronization network options */ 799 typedef enum bcm_ptp_telecom_g8265_network_option_e { 800 bcm_ptp_telecom_g8265_network_option_disable = 0, 801 bcm_ptp_telecom_g8265_network_option_I = 1, 802 bcm_ptp_telecom_g8265_network_option_II = 2, 803 bcm_ptp_telecom_g8265_network_option_III = 3 804 } bcm_ptp_telecom_g8265_network_option_t; 805 806 /* PTP ITU-T G.781 Quality Levels */ 807 typedef enum bcm_ptp_telecom_g8265_quality_level_e { 808 bcm_ptp_telecom_g8265_ql_invalid = 0, 809 bcm_ptp_telecom_g8265_ql_I_prc = 0x10, /* ITU-T G.781 QL Option I */ 810 bcm_ptp_telecom_g8265_ql_I_ssua = 0x11, /* ITU-T G.781 QL Option I */ 811 bcm_ptp_telecom_g8265_ql_I_ssub = 0x12, /* ITU-T G.781 QL Option I */ 812 bcm_ptp_telecom_g8265_ql_I_sec = 0x13, /* ITU-T G.781 QL Option I */ 813 bcm_ptp_telecom_g8265_ql_I_dnu = 0x14, /* ITU-T G.781 QL Option I */ 814 bcm_ptp_telecom_g8265_ql_II_prs = 0x20, /* ITU-T G.781 QL Option II */ 815 bcm_ptp_telecom_g8265_ql_II_stu = 0x21, /* ITU-T G.781 QL Option II */ 816 bcm_ptp_telecom_g8265_ql_II_st2 = 0x22, /* ITU-T G.781 QL Option II */ 817 bcm_ptp_telecom_g8265_ql_II_tnc = 0x23, /* ITU-T G.781 QL Option II */ 818 bcm_ptp_telecom_g8265_ql_II_st3e = 0x24, /* ITU-T G.781 QL Option II */ 819 bcm_ptp_telecom_g8265_ql_II_st3 = 0x25, /* ITU-T G.781 QL Option II */ 820 bcm_ptp_telecom_g8265_ql_II_smc = 0x26, /* ITU-T G.781 QL Option II */ 821 bcm_ptp_telecom_g8265_ql_II_prov = 0x28, /* ITU-T G.781 QL Option II */ 822 bcm_ptp_telecom_g8265_ql_II_dus = 0x29, /* ITU-T G.781 QL Option II */ 823 bcm_ptp_telecom_g8265_ql_III_unk = 0x30, /* ITU-T G.781 QL Option III */ 824 bcm_ptp_telecom_g8265_ql_III_sec = 0x31, /* ITU-T G.781 QL Option III */ 825 bcm_ptp_telecom_g8265_ql_na_slv = 0xff /* Not Applicable (packet slave) */ 826 } bcm_ptp_telecom_g8265_quality_level_t; 827 828 /* PTP Telecom G8265 Packet Timing Signal Fail Data */ 829 typedef struct bcm_ptp_telecom_g8265_ptsf_s { 830 uint8 loss_announce; /* Count of Announce Message Loss */ 831 uint8 loss_sync; /* Count of Sync Message Loss */ 832 uint8 unusable; 833 uint8 loss_timing_sync; /* Count of Timing Sync Message Loss */ 834 uint8 loss_timing_sync_ts; /* Count of Sync Message Timestamps Loss */ 835 uint8 loss_timing_delay; /* Count of Timing Delay Request Message Loss */ 836 uint32 counter; 837 uint64 timestamp; 838 } bcm_ptp_telecom_g8265_ptsf_t; 839 840 /* PTP Telecom G8265 Message Receipt Timeouts (msec) */ 841 typedef struct bcm_ptp_telecom_g8265_receipt_timeouts_s { 842 uint32 announce; 843 uint32 sync; 844 uint32 delay_resp; 845 } bcm_ptp_telecom_g8265_receipt_timeouts_t; 846 847 /* PTP Telecom G8265 Message Elapsed Times (msec) */ 848 typedef struct bcm_ptp_telecom_g8265_elapsed_times_s { 849 uint32 announce; 850 uint32 sync; 851 uint32 sync_ts; 852 uint32 delay_resp; 853 } bcm_ptp_telecom_g8265_elapsed_times_t; 854 855 /* PTP Telecom G8265 Packet timing and PDV statistics */ 856 typedef struct bcm_ptp_telecom_g8265_pktstats_s { 857 uint64 pdv_scaled_allan_var; 858 } bcm_ptp_telecom_g8265_pktstats_t; 859 860 /* PTP Telecom G8265 Priority */ 861 typedef struct bcm_ptp_telecom_g8265_priority_s { 862 uint8 override; 863 uint16 value; 864 } bcm_ptp_telecom_g8265_priority_t; 865 866 /* PTP Query Window Statistics */ 867 typedef struct bcm_ptp_window_stats_s { 868 uint8 min; 869 uint16 max; 870 uint16 fall_events; 871 uint16 rise_events; 872 } bcm_ptp_window_stats_t; 873 874 /* PTP Telecom G8265 Pckmaster Historical Information and QL Degradation */ 875 typedef struct bcm_ptp_telecom_g8265_hql_s { 876 bcm_ptp_window_stats_t clock_class_window; 877 uint8 degrade_ql; 878 uint32 counter; 879 uint64 timestamp; 880 } bcm_ptp_telecom_g8265_hql_t; 881 882 /* PTP Telecom G8265 Profile Packet Master Selector Data */ 883 typedef struct bcm_ptp_telecom_g8265_selector_s { 884 uint8 lockout; 885 uint8 non_reversion; 886 uint8 wait_to_restore; 887 uint64 wait_sec; 888 } bcm_ptp_telecom_g8265_selector_t; 889 890 /* PTP Telecom G8265 Profile PacketMaster Data */ 891 typedef struct bcm_ptp_telecom_g8265_pktmaster_s { 892 bcm_ptp_port_identity_t port_identity; /* Port Identity */ 893 bcm_ptp_clock_port_address_t port_address; /* Clock Port address */ 894 uint8 clock_class; /* Clock Class */ 895 bcm_ptp_telecom_g8265_quality_level_t quality_level; /* Quality Level */ 896 uint8 grandmaster_priority1; /* Grandmaster Priority1 */ 897 uint8 grandmaster_priority2; /* Grandmaster Priority2 */ 898 bcm_ptp_telecom_g8265_priority_t priority; /* G8265 Priority */ 899 bcm_ptp_telecom_g8265_selector_t selector; /* G8265 Selector */ 900 bcm_ptp_telecom_g8265_ptsf_t ptsf; /* G8265 Ptsf */ 901 bcm_ptp_telecom_g8265_elapsed_times_t elapsed_times; /* G8265 Elapsed Times */ 902 bcm_ptp_telecom_g8265_pktstats_t pktstats; /* G8265 Packet Stats */ 903 bcm_ptp_telecom_g8265_hql_t hql; /* G8265 HQL */ 904 bcm_ptp_telecom_g8265_pktmaster_state_t state; /* G8265 Pktmaster State */ 905 uint32 fmds_counter; /* G8265 FMDS counter */ 906 } bcm_ptp_telecom_g8265_pktmaster_t; 907 908 /* PTP Telecom G8265 Profile Data */ 909 typedef struct bcm_ptp_telecom_g8265_profile_s { 910 bcm_ptp_telecom_g8265_network_option_t network_option; /* G8265 Packet Network Option */ 911 bcm_ptp_telecom_g8265_receipt_timeouts_t receipt_timeouts; /* G8265 Packet Receipt Timeouts */ 912 bcm_ptp_telecom_g8265_pktstats_t thresholds; /* G8265 Packet Stats Thresholds */ 913 int previous_gm; /* Previous Grandmaster */ 914 int selected_gm; /* Selected Grandmaster */ 915 bcm_ptp_telecom_g8265_pktmaster_t gm[BCM_PTP_TELECOM_MAX_NUMBER_PKTMASTERS]; /* Grandmaster */ 916 } bcm_ptp_telecom_g8265_profile_t; 917 918 /* PTP foreign master data and metadata. */ 919 typedef struct bcm_ptp_foreign_master_entry_s { 920 bcm_ptp_port_identity_t port_identity; /* Clock port identity. */ 921 bcm_ptp_clock_port_address_t address; /* Clock port address. */ 922 uint8 clockClass; /* PTP clockClass. */ 923 uint8 grandmasterPriority1; /* GM PTP priority1. */ 924 uint8 grandmasterPriority2; /* GM PTP priority2. */ 925 bcm_ptp_window_stats_t clockClass_window; /* PTP clockClass query-window 926 statistics. */ 927 uint32 ms_since_sync; /* Milliseconds since last Sync message. */ 928 uint32 ms_since_sync_ts; /* Milliseconds since last Sync 929 timestamp message (Sync or 930 Follow_Up). */ 931 uint32 ms_since_del_resp; /* Milliseconds since last Delay_Resp 932 message. */ 933 uint16 announce_messages; /* Number of announce messages. */ 934 uint64 pdv_scaled_allan_var; /* MTSD scaled Allan variance (nsec-sq). */ 935 uint16 offset_scaled_log_variance; /* log variance field of announce msg. */ 936 bcm_ptp_clock_accuracy_t clock_accuracy; /* Clock Accuracy */ 937 uint16 steps_removed; /* steps removed field of announce msg. */ 938 bcm_ptp_clock_identity_t grandmaster_identity; /* Grandmaster Id field of announce msg. */ 939 bcm_gport_t phy_port; /* module num and phy port of card on 940 which foreign master is seen */ 941 } bcm_ptp_foreign_master_entry_t; 942 943 /* PTP foreign master dataset. */ 944 typedef struct bcm_ptp_foreign_master_dataset_s { 945 uint8 num_foreign_masters; /* Number of foreign masters. */ 946 uint8 current_best_master; /* Best foreign master index. */ 947 bcm_ptp_foreign_master_entry_t foreign_master[10]; /* Foreign masters. */ 948 } bcm_ptp_foreign_master_dataset_t; 949 950 /* Peer dataset entry. */ 951 typedef struct bcm_ptp_peer_entry_s { 952 uint16 local_port_number; /* Local port number. */ 953 bcm_ptp_clock_identity_t clock_identity; /* Peer clock identity. */ 954 bcm_ptp_clock_port_address_t port_address; /* Peer port address. */ 955 uint64 tx_announces; /* Tx Announce messages. */ 956 uint64 rx_announces; /* Rx Announce messages. */ 957 uint64 tx_syncs; /* Tx Sync messages. */ 958 uint64 rx_syncs; /* Rx Sync messages. */ 959 uint64 tx_followups; /* Tx Follow_Up messages. */ 960 uint64 rx_followups; /* Rx Follow_Up messages. */ 961 uint64 tx_delayreqs; /* Tx Delay_Req messages. */ 962 uint64 rx_delayreqs; /* Rx Delay_Req messages. */ 963 uint64 tx_delayresps; /* Tx Delay_Resp messages. */ 964 uint64 rx_delayresps; /* Rx Delay_Resp messages. */ 965 uint64 tx_mgmts; /* Tx Management messages. */ 966 uint64 rx_mgmts; /* Rx Management messages. */ 967 uint64 tx_signals; /* Tx Signaling messages. */ 968 uint64 rx_signals; /* Rx Signaling messages. */ 969 uint64 rejected; /* Rejected messages. */ 970 bcm_gport_t phy_port; /* module num and phy port of card on 971 which peer is seen */ 972 } bcm_ptp_peer_entry_t; 973 974 /* Packet count statistics. */ 975 typedef struct bcm_ptp_packet_counters_s { 976 uint32 packets_transmitted; /* Packets transmitted. */ 977 uint32 packets_received; /* Packets received. */ 978 uint32 packets_discarded; /* Packets discarded. */ 979 uint32 rcpu_encap_packets_received; /* RCPU-encapsulated packets received. */ 980 uint32 ipv4_packets_received; /* IPv4 packets received. */ 981 uint32 ipv6_packets_received; /* IPv6 packets received. */ 982 uint32 l2_ptp_packets_received; /* L2 PTP packets received. */ 983 uint32 udp_ptp_packets_received; /* UDP PTP packets received. */ 984 uint32 enduro_sync_packets_transmitted; /* Enduro sync packets transmitted. */ 985 uint32 enduro_sync_packets_received; /* Enduro sync packets received. */ 986 uint32 rx_queue_overflows; /* Rx queue overflows. */ 987 uint32 port_packets_transmitted[32]; /* Per-port packets transmitted. */ 988 uint32 port_packets_received[32]; /* Per-port packets received. */ 989 uint32 port_packets_discarded[32]; /* Per-port packets discarded. */ 990 } bcm_ptp_packet_counters_t; 991 992 /* Phase Offsets for Path Asymmetry. */ 993 typedef struct bcm_ptp_phase_offset_s { 994 int64 reported_phase_offset; /* Report Phase Offset. */ 995 int64 delta_phase_offset; /* Delta Phase Offset. */ 996 int64 fixed_phase_offset; /* Fixed Phase Offset. */ 997 int use_fixed_phase_offset; /* Flag to use fixed phase offset. */ 998 int phase_slew_rate_ppb; /* Max slew rate phase offset is changed. */ 999 uint32 sync_phase_offset_ns; /* Max offset to adjust by slew. */ 1000 } bcm_ptp_phase_offset_t; 1001 1002 /* PTP callback result/decision. */ 1003 typedef enum bcm_ptp_callback_e { 1004 bcmPTPCallbackReject, /* Callback rejects action. */ 1005 bcmPTPCallbackAccept /* Callback accepts action. */ 1006 } bcm_ptp_callback_t; 1007 1008 /* Signaling arbiter message data. */ 1009 typedef struct bcm_ptp_cb_signaling_arbiter_msg_s { 1010 int flags; /* Flags. */ 1011 bcm_ptp_stack_id_t ptp_id; /* PTP stack ID. */ 1012 int clock_num; /* PTP clock number. */ 1013 int port_num; /* PTP clock port number. */ 1014 bcm_ptp_cb_msg_t *msg; /* Message data and dimensions. */ 1015 bcm_ptp_clock_info_t *clock_info; /* PTP clock instance information. */ 1016 bcm_ptp_tlv_type_t *tlv_type; /* Signaling message TLV type. */ 1017 bcm_ptp_message_type_t *messageType; /* PTP message type. */ 1018 int *logInterMessagePeriod; /* PTP message logInterMessagePeriod. */ 1019 uint32 *durationField; /* PTP message service duration. */ 1020 bcm_ptp_clock_peer_t *slave; /* PTP slave. */ 1021 } bcm_ptp_cb_signaling_arbiter_msg_t; 1022 1023 /* Signaling arbiter callback function. */ 1024 typedef bcm_ptp_callback_t (*bcm_ptp_signaling_arbiter_t)( 1025 int unit, 1026 bcm_ptp_cb_signaling_arbiter_msg_t *amsg, 1027 void *user_data); 1028 1029 /* C-TDEV alarm callback data. */ 1030 typedef struct bcm_ptp_ctdev_alarm_data_s { 1031 uint64 freq_corr_ppt; /* Frequency correction (ppt). */ 1032 int num_tau; /* Number of timescales over which 1033 C-TDEV is calculated. */ 1034 int tau_sec[BCM_PTP_CTDEV_NUM_TIMESCALES_MAX]; /* Timescales, tau. */ 1035 uint64 tdev_psec[BCM_PTP_CTDEV_NUM_TIMESCALES_MAX]; /* C-TDEV(tau). */ 1036 uint32 elapsed_sec; /* Elapsed data time for C-TDEV 1037 calculations. */ 1038 } bcm_ptp_ctdev_alarm_data_t; 1039 1040 /* C-TDEV alarm callback function. */ 1041 typedef int (*bcm_ptp_ctdev_alarm_cb)( 1042 int unit, 1043 bcm_ptp_stack_id_t ptp_id, 1044 int clock_num, 1045 bcm_ptp_ctdev_alarm_data_t *ctdev_alarm_data); 1046 1047 /* PTP servo oscillator data types */ 1048 typedef enum bcm_ptp_osc_type_e { 1049 bcmPTPOscTypeRB, /* Rubidium Oscillator */ 1050 bcmPTPOscTypeDOCXO, /* Double oven OCXO */ 1051 bcmPTPOscTypeOCXO, /* OCXO */ 1052 bcmPTPOscTypeMiniOCXO, /* Mini OCXO */ 1053 bcmPTPOscTypeTCXO /* TOCXO */ 1054 } bcm_ptp_osc_type_t; 1055 1056 /* PTP servo transport mode types */ 1057 typedef enum bcm_ptp_transport_mode_e { 1058 bcmPTPTransportModeEthernet, /* PTP Ethernet mode */ 1059 bcmPTPTransportModeDSL, /* PTP DSL mode */ 1060 bcmPTPTransportModeMicrowave, /* PTP microwave mode */ 1061 bcmPTPTransportModeSONET, /* PTP SONET mode */ 1062 bcmPTPTransportModeSlowEthernet, /* PTP Slow Ethernet mode */ 1063 bcmPTPTransportModeHighJitter /* PTP High Jitter */ 1064 } bcm_ptp_transport_mode_t; 1065 1066 /* PTP Servo Configuration Data Type */ 1067 typedef struct bcm_ptp_servo_config_s { 1068 bcm_ptp_osc_type_t osc_type; /* Local oscillator type */ 1069 bcm_ptp_transport_mode_t transport_mode; /* PTP transport mode */ 1070 uint32 ptp_phase_mode; /* Bit-mapped phase mode of servo loop */ 1071 int freq_corr_hourly; /* OCXO frequency offset sampled hourly 1072 - (deprecated) */ 1073 bcm_ptp_timestamp_t time_corr_hourly; /* Timestamp for hourly frequency offset 1074 - (deprecated) */ 1075 int freq_calib_factory; /* OCXO frequency offset at factory - 1076 (deprecated) */ 1077 bcm_ptp_timestamp_t time_calib_factory; /* Timestamp for factory frequency 1078 offset - (deprecated) */ 1079 uint32 bridge_time; /* Bridge time in seconds */ 1080 int freq_corr; /* OCXO frequency offset. */ 1081 bcm_ptp_timestamp_t freq_corr_time; /* Timestamp for frequency offset. */ 1082 bcm_ptp_servo_type_t servo; /* Servo type. */ 1083 uint32 flags; /* Servo configuration flags. */ 1084 uint32 filter_profile; /* Servo filter selection. */ 1085 } bcm_ptp_servo_config_t; 1086 1087 /* PTP Servo Status Information. */ 1088 typedef struct bcm_ptp_servo_status_s { 1089 bcm_ptp_servo_state_t servo_state; /* servo state enumeration. */ 1090 uint32 servo_state_dur; /* servo state duration (sec). */ 1091 bcm_ptp_servo_lock_status_t lock_status; /* Servo Locked Status 1092 (Locked/Unlocked). */ 1093 } bcm_ptp_servo_status_t; 1094 1095 /* ESMC definitions and data types. */ 1096 typedef enum bcm_esmc_network_option_e { 1097 bcm_esmc_network_option_g781_I = 1, 1098 bcm_esmc_network_option_g781_II = 2, 1099 bcm_esmc_network_option_g781_III = 3 1100 } bcm_esmc_network_option_t; 1101 1102 typedef enum bcm_esmc_quality_level_e { 1103 bcm_esmc_g781_I_ql_prc = 0x0100, 1104 bcm_esmc_g781_I_ql_ssua = 0x0101, 1105 bcm_esmc_g781_I_ql_ssub = 0x0102, 1106 bcm_esmc_g781_I_ql_sec = 0x0103, 1107 bcm_esmc_g781_I_ql_dnu = 0x0104, 1108 bcm_esmc_g781_I_ql_inv0 = 0x010f, 1109 bcm_esmc_g781_I_ql_inv1 = 0x011f, 1110 bcm_esmc_g781_I_ql_inv3 = 0x013f, 1111 bcm_esmc_g781_I_ql_inv5 = 0x015f, 1112 bcm_esmc_g781_I_ql_inv6 = 0x016f, 1113 bcm_esmc_g781_I_ql_inv7 = 0x017f, 1114 bcm_esmc_g781_I_ql_inv9 = 0x019f, 1115 bcm_esmc_g781_I_ql_inv10 = 0x01af, 1116 bcm_esmc_g781_I_ql_inv12 = 0x01cf, 1117 bcm_esmc_g781_I_ql_inv13 = 0x01df, 1118 bcm_esmc_g781_I_ql_inv14 = 0x01ef, 1119 bcm_esmc_g781_I_ql_failed = 0x01ff, 1120 bcm_esmc_g781_I_ql_nsupp = 0x01ff, 1121 bcm_esmc_g781_I_ql_unc = 0x01ff, 1122 bcm_esmc_g781_II_ql_prs = 0x0200, 1123 bcm_esmc_g781_II_ql_stu = 0x0201, 1124 bcm_esmc_g781_II_ql_st2 = 0x0202, 1125 bcm_esmc_g781_II_ql_tnc = 0x0203, 1126 bcm_esmc_g781_II_ql_st3e = 0x0204, 1127 bcm_esmc_g781_II_ql_st3 = 0x0205, 1128 bcm_esmc_g781_II_ql_smc = 0x0206, 1129 bcm_esmc_g781_II_ql_prov = 0x0207, 1130 bcm_esmc_g781_II_ql_dus = 0x0208, 1131 bcm_esmc_g781_II_ql_inv2 = 0x022f, 1132 bcm_esmc_g781_II_ql_inv3 = 0x023f, 1133 bcm_esmc_g781_II_ql_inv5 = 0x025f, 1134 bcm_esmc_g781_II_ql_inv6 = 0x026f, 1135 bcm_esmc_g781_II_ql_inv8 = 0x028f, 1136 bcm_esmc_g781_II_ql_inv9 = 0x029f, 1137 bcm_esmc_g781_II_ql_inv11 = 0x02bf, 1138 bcm_esmc_g781_II_ql_failed = 0x02ff, 1139 bcm_esmc_g781_II_ql_nsupp = 0x02ff, 1140 bcm_esmc_g781_II_ql_unc = 0x02ff, 1141 bcm_esmc_g781_III_ql_unk = 0x0300, 1142 bcm_esmc_g781_III_ql_sec = 0x0301, 1143 bcm_esmc_g781_III_ql_inv1 = 0x031f, 1144 bcm_esmc_g781_III_ql_inv2 = 0x032f, 1145 bcm_esmc_g781_III_ql_inv3 = 0x033f, 1146 bcm_esmc_g781_III_ql_inv4 = 0x034f, 1147 bcm_esmc_g781_III_ql_inv5 = 0x035f, 1148 bcm_esmc_g781_III_ql_inv6 = 0x036f, 1149 bcm_esmc_g781_III_ql_inv7 = 0x037f, 1150 bcm_esmc_g781_III_ql_inv8 = 0x038f, 1151 bcm_esmc_g781_III_ql_inv9 = 0x039f, 1152 bcm_esmc_g781_III_ql_inv10 = 0x03af, 1153 bcm_esmc_g781_III_ql_inv12 = 0x03cf, 1154 bcm_esmc_g781_III_ql_inv13 = 0x03df, 1155 bcm_esmc_g781_III_ql_inv14 = 0x03ef, 1156 bcm_esmc_g781_III_ql_inv15 = 0x03ff, 1157 bcm_esmc_g781_III_ql_failed = 0x03ff, 1158 bcm_esmc_g781_III_ql_nsupp = 0x03ff, 1159 bcm_esmc_g781_III_ql_unc = 0x03ff, 1160 bcm_esmc_ql_unresolvable = 0xffff 1161 } bcm_esmc_quality_level_t; 1162 1163 /* 1164 * Extended Synchronous Status Message (SSM) codes for various synce 1165 * clock types as per ITU-T G.8264Amd2 1166 */ 1167 typedef enum bcm_esmc_essm_code_e { 1168 bcmEsmcEssmCodeNone = 0x0, /* default operating mode - no G.8264Amd2 1169 support */ 1170 bcmEsmcEssmCodeEEC = 0xFF, /* synce clock type - EEC/G.781 */ 1171 bcmEsmcEssmCodePRTC = 0x20, /* synce clock type - PRTC */ 1172 bcmEsmcEssmCodeEPRTC = 0x21, /* synce clock type - ePRTC */ 1173 bcmEsmcEssmCodeEEEC = 0x22 /* synce clock type - eEEC */ 1174 } bcm_esmc_essm_code_t; 1175 1176 typedef enum bcm_esmc_pdu_type_e { 1177 bcm_esmc_pdu_type_info, 1178 bcm_esmc_pdu_type_event 1179 } bcm_esmc_pdu_type_t; 1180 1181 typedef struct bcm_esmc_pdu_data_s { 1182 bcm_mac_t source_mac; 1183 bcm_esmc_pdu_type_t pdu_type; 1184 bcm_esmc_quality_level_t ql; 1185 uint8 ssm_code; 1186 bcm_esmc_essm_code_t essm_code; /* synce clock type as per G.8264amd2 */ 1187 uint8 essm_flag; /* bit 0 means mixed EEC/eEEC and bit 1 mean 1188 partial chain */ 1189 uint8 essm_eec_count; /* Number of cascaded EEC as per G.8264amd2 */ 1190 uint8 essm_eeec_count; /* Number of cascaded eEEC as per G.8264amd2 */ 1191 } bcm_esmc_pdu_data_t; 1192 1193 typedef int (*bcm_esmc_rx_cb)( 1194 int unit, 1195 int stack_id, 1196 int ingress_port, 1197 bcm_esmc_pdu_data_t *pdu_data); 1198 1199 typedef struct bcm_tdpll_input_clock_ql_change_cb_data_s { 1200 int input_clk_index; 1201 bcm_esmc_quality_level_t prior_ql; 1202 bcm_esmc_quality_level_t current_ql; 1203 } bcm_tdpll_input_clock_ql_change_cb_data_t; 1204 1205 typedef int (*bcm_tdpll_input_clock_ql_change_cb)( 1206 int unit, 1207 int stack_id, 1208 bcm_tdpll_input_clock_ql_change_cb_data_t *cb_data); 1209 1210 /* T-DPLL definitions and data types. */ 1211 #define BCM_TDPLL_INPUT_CLOCK_NUM_GPIO (6) 1212 #define BCM_TDPLL_INPUT_CLOCK_NUM_SYNCE (2) 1213 #define BCM_TDPLL_INPUT_CLOCK_NUM_1588 (2) 1214 #define BCM_TDPLL_INPUT_CLOCK_NUM_MAX (BCM_TDPLL_INPUT_CLOCK_NUM_GPIO + \ 1215 BCM_TDPLL_INPUT_CLOCK_NUM_SYNCE + \ 1216 BCM_TDPLL_INPUT_CLOCK_NUM_1588) 1217 1218 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_BROADSYNC (2) 1219 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_SYNCE (4) 1220 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_1588 (1) 1221 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO (6) 1222 #define BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX (BCM_TDPLL_OUTPUT_CLOCK_NUM_BROADSYNC + \ 1223 BCM_TDPLL_OUTPUT_CLOCK_NUM_SYNCE + \ 1224 BCM_TDPLL_OUTPUT_CLOCK_NUM_1588 + \ 1225 BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO) 1226 1227 #define BCM_TDPLL_DPLL_INSTANCE_NUM_MAX (BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX - \ 1228 BCM_TDPLL_OUTPUT_CLOCK_NUM_GPIO) 1229 1230 typedef enum bcm_tdpll_dpll_bandwidth_units_e { 1231 bcm_tdpll_dpll_bandwidth_mHz, 1232 bcm_tdpll_dpll_bandwidth_Hz, 1233 bcm_tdpll_dpll_bandwidth_kHz 1234 } bcm_tdpll_dpll_bandwidth_units_t; 1235 1236 typedef struct bcm_tdpll_dpll_bandwidth_s { 1237 uint32 value; 1238 bcm_tdpll_dpll_bandwidth_units_t units; 1239 } bcm_tdpll_dpll_bandwidth_t; 1240 1241 typedef enum bcm_tdpll_dpll_phase_mode_e { 1242 bcm_tdpll_dpll_phase_mode_none, 1243 bcm_tdpll_dpll_phase_mode_pbo, 1244 bcm_tdpll_dpll_phase_mode_pboslew 1245 } bcm_tdpll_dpll_phase_mode_t; 1246 1247 typedef struct bcm_tdpll_dpll_phase_control_s { 1248 bcm_tdpll_dpll_phase_mode_t mode; 1249 int offset_ns; 1250 } bcm_tdpll_dpll_phase_control_t; 1251 1252 typedef struct bcm_tdpll_dpll_properties_s { 1253 bcm_tdpll_dpll_bandwidth_t bandwidth; 1254 bcm_tdpll_dpll_phase_control_t phase_control; 1255 } bcm_tdpll_dpll_properties_t; 1256 1257 typedef struct bcm_tdpll_dpll_bindings_s { 1258 SHR_BITDCL input_clocks[_SHR_BITDCLSIZE(BCM_TDPLL_INPUT_CLOCK_NUM_MAX)]; 1259 SHR_BITDCL output_clocks[_SHR_BITDCLSIZE(BCM_TDPLL_OUTPUT_CLOCK_NUM_MAX)]; 1260 } bcm_tdpll_dpll_bindings_t; 1261 1262 typedef struct bcm_tdpll_dpll_instance_s { 1263 int index; 1264 bcm_tdpll_dpll_bindings_t bindings; 1265 bcm_tdpll_dpll_properties_t properties; 1266 int reference; 1267 } bcm_tdpll_dpll_instance_t; 1268 1269 typedef struct bcm_tdpll_input_clock_l1mux_s { 1270 int index; 1271 int port; 1272 } bcm_tdpll_input_clock_l1mux_t; 1273 1274 typedef struct bcm_tdpll_input_clock_frequency_s { 1275 uint32 clock; 1276 uint32 tsevent; 1277 int tsevent_quotient; 1278 } bcm_tdpll_input_clock_frequency_t; 1279 1280 typedef enum bcm_tdpll_input_clock_monitor_type_e { 1281 bcm_tdpll_input_clock_monitor_type_soft_warn, 1282 bcm_tdpll_input_clock_monitor_type_hard_accept, 1283 bcm_tdpll_input_clock_monitor_type_hard_reject 1284 } bcm_tdpll_input_clock_monitor_type_t; 1285 1286 typedef enum bcm_tdpll_notification_type_e { 1287 bcmTdpllNotificationTypeRefchange 1288 } bcm_tdpll_notification_type_t; 1289 1290 typedef enum bcm_tdpll_callback_type_e { 1291 bcmTdpllCallbackTypeMonitor, 1292 bcmTdpllCallbackTypeSelector, 1293 bcmTdpllCallbackTypeNotification 1294 } bcm_tdpll_callback_type_t; 1295 1296 typedef struct bcm_tdpll_input_clock_monitor_s { 1297 uint64 tsevent_dt; 1298 uint64 tsevent_time; 1299 uint64 tsevent_num; 1300 uint64 dt_ns; 1301 uint64 dtref_ns; 1302 uint64 dt_sum_ns; 1303 uint64 dtref_sum_ns; 1304 uint64 prior_evnum; 1305 uint32 numev_sum; 1306 int freq_error_ppb; 1307 int over_soft_warn_threshold; 1308 int under_hard_accept_threshold; 1309 int over_hard_reject_threshold; 1310 uint32 num_missing_tsevent; 1311 } bcm_tdpll_input_clock_monitor_t; 1312 1313 typedef struct bcm_tdpll_input_clock_select_s { 1314 bcm_esmc_quality_level_t ql; 1315 int priority; 1316 int lockout; 1317 } bcm_tdpll_input_clock_select_t; 1318 1319 typedef struct bcm_tdpll_input_clock_s { 1320 int index; 1321 bcm_tdpll_input_clock_l1mux_t l1mux; 1322 bcm_mac_t mac; 1323 uint32 state; 1324 bcm_tdpll_input_clock_frequency_t frequency; 1325 bcm_tdpll_input_clock_monitor_t monitor; 1326 bcm_tdpll_input_clock_select_t select; 1327 int dpll_use[BCM_TDPLL_DPLL_INSTANCE_NUM_MAX]; 1328 } bcm_tdpll_input_clock_t; 1329 1330 typedef struct bcm_tdpll_input_clock_monitor_cb_data_s { 1331 int index; 1332 bcm_tdpll_input_clock_monitor_type_t monitor_type; 1333 int monitor_value; 1334 } bcm_tdpll_input_clock_monitor_cb_data_t; 1335 1336 typedef int (*bcm_tdpll_input_clock_monitor_cb)( 1337 int unit, 1338 int stack_id, 1339 bcm_tdpll_input_clock_monitor_cb_data_t *cb_data); 1340 1341 typedef struct bcm_tdpll_input_clock_selector_cb_data_s { 1342 int dpll_index; 1343 int prior_selected_clock; 1344 int selected_clock; 1345 } bcm_tdpll_input_clock_selector_cb_data_t; 1346 1347 typedef int (*bcm_tdpll_input_clock_selector_cb)( 1348 int unit, 1349 int stack_id, 1350 bcm_tdpll_input_clock_selector_cb_data_t *cb_data); 1351 1352 typedef struct bcm_tdpll_input_clock_ref_change_cb_data_s { 1353 bcm_tdpll_notification_type_t noti_type; 1354 int dpll_index; 1355 int prior_selected_clock; 1356 int selected_clock; 1357 } bcm_tdpll_input_clock_ref_change_cb_data_t; 1358 1359 typedef struct bcm_tdpll_input_clock_cb_data_s { 1360 bcm_tdpll_callback_type_t callback_type; 1361 void *cb_info; 1362 } bcm_tdpll_input_clock_cb_data_t; 1363 1364 typedef int (*bcm_tdpll_input_clock_cb)( 1365 int unit, 1366 int stack_id, 1367 bcm_tdpll_input_clock_cb_data_t *cb_data); 1368 1369 typedef struct bcm_tdpll_output_clock_frequency_s { 1370 uint32 synth; 1371 uint32 tsevent; 1372 int tsevent_quotient; 1373 uint32 deriv; 1374 int deriv_quotient; 1375 } bcm_tdpll_output_clock_frequency_t; 1376 1377 typedef struct bcm_tdpll_output_clock_s { 1378 int index; 1379 uint32 state; 1380 bcm_tdpll_output_clock_frequency_t frequency; 1381 } bcm_tdpll_output_clock_t; 1382 1383 typedef enum bcm_tdpll_holdover_mode_e { 1384 bcm_tdpll_holdover_mode_instantaneous, 1385 bcm_tdpll_holdover_mode_avg1s, 1386 bcm_tdpll_holdover_mode_manual, 1387 bcm_tdpll_holdover_mode_fast_average, 1388 bcm_tdpll_holdover_mode_slow_average 1389 } bcm_tdpll_holdover_mode_t; 1390 1391 /* Frequency correction */ 1392 typedef int32 bcm_tdpll_frequency_correction_t; 1393 1394 typedef struct bcm_tdpll_holdover_data_s { 1395 bcm_tdpll_frequency_correction_t freq_instantaneous; 1396 bcm_tdpll_frequency_correction_t freq_avg1s; 1397 bcm_tdpll_frequency_correction_t freq_manual; 1398 bcm_tdpll_frequency_correction_t freq_fast_average; 1399 bcm_tdpll_frequency_correction_t freq_slow_average; 1400 int freq_fast_average_valid; 1401 int freq_slow_average_valid; 1402 bcm_tdpll_holdover_mode_t mode; 1403 } bcm_tdpll_holdover_data_t; 1404 1405 typedef struct bcm_ptp_servo_threshold_s { 1406 int32 bcmPtpServoThresholdFreqLock; 1407 int32 bcmPtpServoThresholdFreqUnlock; 1408 int32 bcmPtpServoThresholdPhaseLock; 1409 int32 bcmPtpServoThresholdPhaseUnlock; 1410 } bcm_ptp_servo_threshold_t; 1411 1412 /* Clock Port Drop Packet count statistics. */ 1413 typedef struct bcm_ptp_clock_port_packet_drop_counters_s { 1414 uint32 domain_mismatch; /* default DS domain number mismatch. */ 1415 uint32 memory_alloc_failure; /* memory allocation failed. */ 1416 uint32 pkt_len_too_short; /* Invalid packet length. */ 1417 uint32 pkt_rcvd_on_bad_port_state; /* PTP packet received on bad port state */ 1418 uint32 ptp_profile_mismatch; /* PTP profile does not match. */ 1419 uint32 clock_port_mismatch; /* No match to clock port */ 1420 uint32 ptp_packet_parsing_failure; /* Assigned to clock port, but failed 1421 PTP parsing. */ 1422 uint32 unicast_delreq_from_unknown_slave; /* Unicast Delay Request from unknown 1423 slave. */ 1424 uint32 announce_rcvd_on_master_only_port; /* Announce message received on master 1425 only port. */ 1426 uint32 announce_rcvd_with_invalid_steps_removed_field; /* Announce message with invalid steps 1427 removed field. */ 1428 uint32 announce_from_unknown_unicast_master; /* Announce message received from a 1429 master not present in unicast master 1430 table. */ 1431 uint32 announce_rcvd_on_gps_timesource_ptp_port; /* Announce message received on a ptp 1432 port having timesource as GPS. */ 1433 uint32 sync_rcvd_invalid; /* Invalid sync packet (e.g duplicate 1434 sync packet). */ 1435 uint32 sync_rcvd_on_ptp_port_without_master; /* sync packet received on port on which 1436 master is not present. */ 1437 } bcm_ptp_clock_port_packet_drop_counters_t; 1438 1439 #define BCM_PTP_TELECOM_G8265_MAP_QUALITY_LEVEL_CLOCK_CLASS(ql, clock_class) \ 1440 do { \ 1441 switch (ql) { \ 1442 case bcm_ptp_telecom_g8265_ql_II_prs: \ 1443 clock_class = 80; \ 1444 break; \ 1445 case bcm_ptp_telecom_g8265_ql_II_stu: \ 1446 /* Fall through. */ \ 1447 case bcm_ptp_telecom_g8265_ql_III_unk: \ 1448 clock_class = 82; \ 1449 break; \ 1450 case bcm_ptp_telecom_g8265_ql_I_prc: \ 1451 clock_class = 84; \ 1452 break; \ 1453 case bcm_ptp_telecom_g8265_ql_II_st2: \ 1454 clock_class = 86; \ 1455 break; \ 1456 case bcm_ptp_telecom_g8265_ql_I_ssua: \ 1457 /* Fall through. */ \ 1458 case bcm_ptp_telecom_g8265_ql_II_tnc: \ 1459 clock_class = 90; \ 1460 break; \ 1461 case bcm_ptp_telecom_g8265_ql_I_ssub: \ 1462 clock_class = 96; \ 1463 break; \ 1464 case bcm_ptp_telecom_g8265_ql_II_st3e: \ 1465 clock_class = 100; \ 1466 break; \ 1467 case bcm_ptp_telecom_g8265_ql_II_st3: \ 1468 clock_class = 102; \ 1469 break; \ 1470 case bcm_ptp_telecom_g8265_ql_I_sec: \ 1471 /* Fall through. */ \ 1472 case bcm_ptp_telecom_g8265_ql_III_sec: \ 1473 clock_class = 104; \ 1474 break; \ 1475 case bcm_ptp_telecom_g8265_ql_II_smc: \ 1476 clock_class = 106; \ 1477 break; \ 1478 case bcm_ptp_telecom_g8265_ql_II_prov: \ 1479 clock_class = 108; \ 1480 break; \ 1481 case bcm_ptp_telecom_g8265_ql_I_dnu: \ 1482 /* Fall through. */ \ 1483 case bcm_ptp_telecom_g8265_ql_II_dus: \ 1484 clock_class = 110; \ 1485 break; \ 1486 case bcm_ptp_telecom_g8265_ql_na_slv: \ 1487 /* Not applicable (packet slave). */ \ 1488 clock_class = 255; \ 1489 break; \ 1490 default: \ 1491 /* \ 1492 * Mapping unsuccessful. \ 1493 * Maximum alternate PTP profile clockClass value \ 1494 * in the range [68,122] used by telecom profile. \ 1495 * Ref. IEEE Std. 1588-2008, Clause 7.6.2.4. \ 1496 */ \ 1497 clock_class = 122; \ 1498 } \ 1499 } while (0) 1500 1501 #ifndef BCM_HIDE_DISPATCHABLE 1502 1503 /* Initialize the PTP subsystem */ 1504 extern int bcm_ptp_init( 1505 int unit); 1506 1507 /* Shut down the PTP subsystem */ 1508 extern int bcm_ptp_detach( 1509 int unit); 1510 1511 /* Create a PTP stack instance */ 1512 extern int bcm_ptp_stack_create( 1513 int unit, 1514 bcm_ptp_stack_info_t *ptp_info); 1515 1516 /* Destroy a PTP stack instance */ 1517 extern int bcm_ptp_stack_destroy( 1518 int unit, 1519 bcm_ptp_stack_id_t ptp_id); 1520 1521 /* Get structure corresponding to a PTP stack instance */ 1522 extern int bcm_ptp_stack_get( 1523 int unit, 1524 bcm_ptp_stack_id_t ptp_id, 1525 bcm_ptp_stack_info_t *ptp_info); 1526 1527 /* Get structure arary corresponding to all PTP stack instances */ 1528 extern int bcm_ptp_stack_get_all( 1529 int unit, 1530 int max_size, 1531 bcm_ptp_stack_info_t *ptp_info, 1532 int *no_of_stacks); 1533 1534 /* Set Time Of Day format for PTP stack instance. */ 1535 extern int bcm_ptp_time_format_set( 1536 int unit, 1537 bcm_ptp_stack_id_t ptp_id, 1538 bcm_ptp_time_type_t type); 1539 1540 #endif /* BCM_HIDE_DISPATCHABLE */ 1541 1542 /* Callback function type for PTP */ 1543 typedef int (*bcm_ptp_cb)( 1544 int unit, 1545 bcm_ptp_stack_id_t ptp_id, 1546 int clock_num, 1547 uint32 clock_port, 1548 bcm_ptp_cb_type_t type, 1549 bcm_ptp_cb_msg_t *msg, 1550 void *user_data); 1551 1552 #ifndef BCM_HIDE_DISPATCHABLE 1553 1554 /* Register a callback for handling PTP */ 1555 extern int bcm_ptp_cb_register( 1556 int unit, 1557 bcm_ptp_cb_types_t cb_types, 1558 bcm_ptp_cb cb, 1559 void *user_data); 1560 1561 /* Unregister a callback for handling PTP */ 1562 extern int bcm_ptp_cb_unregister( 1563 int unit, 1564 bcm_ptp_cb_types_t cb_types, 1565 bcm_ptp_cb cb); 1566 1567 /* Register an arbiter function for PTP signaling messages */ 1568 extern int bcm_ptp_signaling_arbiter_register( 1569 int unit, 1570 bcm_ptp_stack_id_t ptp_id, 1571 int clock_num, 1572 bcm_ptp_signaling_arbiter_t arb, 1573 void *user_data); 1574 1575 /* Unregister the PTP signaling arbiter for the specified clock */ 1576 extern int bcm_ptp_signaling_arbiter_unregister( 1577 int unit, 1578 bcm_ptp_stack_id_t ptp_id, 1579 int clock_num); 1580 1581 /* Create PTP Clock instance. */ 1582 extern int bcm_ptp_clock_create( 1583 int unit, 1584 bcm_ptp_stack_id_t ptp_id, 1585 bcm_ptp_clock_info_t *clock_info); 1586 1587 /* Get PTP Clock instance information. */ 1588 extern int bcm_ptp_clock_get( 1589 int unit, 1590 bcm_ptp_stack_id_t ptp_id, 1591 int clock_num, 1592 bcm_ptp_clock_info_t *clock_info); 1593 1594 /* Set PTP Clock instance user description. */ 1595 extern int bcm_ptp_clock_user_description_set( 1596 int unit, 1597 bcm_ptp_stack_id_t ptp_id, 1598 int clock_num, 1599 uint8 *desc); 1600 1601 /* Get PTP Clock instance default dataset. */ 1602 extern int bcm_ptp_clock_default_dataset_get( 1603 int unit, 1604 bcm_ptp_stack_id_t ptp_id, 1605 int clock_num, 1606 bcm_ptp_default_dataset_t *dataset); 1607 1608 /* Get PTP Clock instance current dataset. */ 1609 extern int bcm_ptp_clock_current_dataset_get( 1610 int unit, 1611 bcm_ptp_stack_id_t ptp_id, 1612 int clock_num, 1613 bcm_ptp_current_dataset_t *dataset); 1614 1615 /* Get PTP Clock instance parent dataset. */ 1616 extern int bcm_ptp_clock_parent_dataset_get( 1617 int unit, 1618 bcm_ptp_stack_id_t ptp_id, 1619 int clock_num, 1620 bcm_ptp_parent_dataset_t *dataset); 1621 1622 /* Get PTP Clock instance time properties. */ 1623 extern int bcm_ptp_clock_time_properties_get( 1624 int unit, 1625 bcm_ptp_stack_id_t ptp_id, 1626 int clock_num, 1627 bcm_ptp_time_properties_t *data); 1628 1629 /* Get foreign master dataset. */ 1630 extern int bcm_ptp_foreign_master_dataset_get( 1631 int unit, 1632 bcm_ptp_stack_id_t ptp_id, 1633 int clock_num, 1634 int port_num, 1635 bcm_ptp_foreign_master_dataset_t *data_set); 1636 1637 /* Get PTP Clock priority 1. */ 1638 extern int bcm_ptp_clock_priority1_get( 1639 int unit, 1640 bcm_ptp_stack_id_t ptp_id, 1641 int clock_num, 1642 uint32 *priority1); 1643 1644 /* Set PTP Clock priority 1. */ 1645 extern int bcm_ptp_clock_priority1_set( 1646 int unit, 1647 bcm_ptp_stack_id_t ptp_id, 1648 int clock_num, 1649 uint32 priority1); 1650 1651 /* Get PTP Clock priority 2. */ 1652 extern int bcm_ptp_clock_priority2_get( 1653 int unit, 1654 bcm_ptp_stack_id_t ptp_id, 1655 int clock_num, 1656 uint32 *priority2); 1657 1658 /* Set PTP Clock priority 2. */ 1659 extern int bcm_ptp_clock_priority2_set( 1660 int unit, 1661 bcm_ptp_stack_id_t ptp_id, 1662 int clock_num, 1663 uint32 priority2); 1664 1665 /* Get PTP Clock local priority. */ 1666 extern int bcm_ptp_clock_local_priority_get( 1667 int unit, 1668 bcm_ptp_stack_id_t ptp_id, 1669 int clock_num, 1670 uint8 *local_priority); 1671 1672 /* Set PTP Clock local priority. */ 1673 extern int bcm_ptp_clock_local_priority_set( 1674 int unit, 1675 bcm_ptp_stack_id_t ptp_id, 1676 int clock_num, 1677 uint8 local_priority); 1678 1679 /* Get maxStepsRemoved configured for the PTP clock. */ 1680 extern int bcm_ptp_clock_max_steps_removed_get( 1681 int unit, 1682 bcm_ptp_stack_id_t ptp_id, 1683 int clock_num, 1684 uint8 *max_steps_removed); 1685 1686 /* Set maxStepsRemoved for the PTP clock. */ 1687 extern int bcm_ptp_clock_max_steps_removed_set( 1688 int unit, 1689 bcm_ptp_stack_id_t ptp_id, 1690 int clock_num, 1691 uint8 max_steps_removed); 1692 1693 /* Get PTP Clock domain. */ 1694 extern int bcm_ptp_clock_domain_get( 1695 int unit, 1696 bcm_ptp_stack_id_t ptp_id, 1697 int clock_num, 1698 uint32 *domain); 1699 1700 /* Set PTP Clock domain. */ 1701 extern int bcm_ptp_clock_domain_set( 1702 int unit, 1703 bcm_ptp_stack_id_t ptp_id, 1704 int clock_num, 1705 uint32 domain); 1706 1707 /* Get PTP Clock slave only. */ 1708 extern int bcm_ptp_clock_slaveonly_get( 1709 int unit, 1710 bcm_ptp_stack_id_t ptp_id, 1711 int clock_num, 1712 uint32 *slaveonly); 1713 1714 /* Set PTP Clock slave only. */ 1715 extern int bcm_ptp_clock_slaveonly_set( 1716 int unit, 1717 bcm_ptp_stack_id_t ptp_id, 1718 int clock_num, 1719 uint32 slaveonly); 1720 1721 /* Get PTP Clock Accuracy info. */ 1722 extern int bcm_ptp_clock_accuracy_get( 1723 int unit, 1724 bcm_ptp_stack_id_t ptp_id, 1725 int clock_num, 1726 bcm_ptp_clock_accuracy_t *accuracy); 1727 1728 /* Set PTP Clock Accuracy info. */ 1729 extern int bcm_ptp_clock_accuracy_set( 1730 int unit, 1731 bcm_ptp_stack_id_t ptp_id, 1732 int clock_num, 1733 bcm_ptp_clock_accuracy_t *accuracy); 1734 1735 /* Get PTP Clock Quality info. */ 1736 extern int bcm_ptp_clock_quality_get( 1737 int unit, 1738 bcm_ptp_stack_id_t ptp_id, 1739 int clock_num, 1740 bcm_ptp_clock_quality_t *clock_quality, 1741 uint32 flags); 1742 1743 /* Set PTP Clock Quality info. */ 1744 extern int bcm_ptp_clock_quality_set( 1745 int unit, 1746 bcm_ptp_stack_id_t ptp_id, 1747 int clock_num, 1748 bcm_ptp_clock_quality_t clock_quality, 1749 uint32 flags); 1750 1751 /* 1752 * Gets applicable clock class value for given clock traceability 1753 * information. 1754 */ 1755 extern int bcm_ptp_g8275p1_traceability_info_clock_class_map( 1756 int unit, 1757 bcm_ptp_stack_id_t ptp_id, 1758 int clock_num, 1759 bcm_ptp_g8275p1_clock_traceability_info_t traceability_info, 1760 uint8 *clock_class); 1761 1762 /* Get PTP Clock Time. */ 1763 extern int bcm_ptp_clock_time_get( 1764 int unit, 1765 bcm_ptp_stack_id_t ptp_id, 1766 int clock_num, 1767 bcm_ptp_timestamp_t *time); 1768 1769 /* Set PTP Clock Time. */ 1770 extern int bcm_ptp_clock_time_set( 1771 int unit, 1772 bcm_ptp_stack_id_t ptp_id, 1773 int clock_num, 1774 bcm_ptp_timestamp_t *time); 1775 1776 /* Get PTP Clock Timescale info. */ 1777 extern int bcm_ptp_clock_timescale_get( 1778 int unit, 1779 bcm_ptp_stack_id_t ptp_id, 1780 int clock_num, 1781 bcm_ptp_timescale_t *timescale); 1782 1783 /* Set PTP Clock Timescale info. */ 1784 extern int bcm_ptp_clock_timescale_set( 1785 int unit, 1786 bcm_ptp_stack_id_t ptp_id, 1787 int clock_num, 1788 bcm_ptp_timescale_t *timescale); 1789 1790 /* Get PTP Clock Traceability info. */ 1791 extern int bcm_ptp_clock_traceability_get( 1792 int unit, 1793 bcm_ptp_stack_id_t ptp_id, 1794 int clock_num, 1795 bcm_ptp_trace_t *trace); 1796 1797 /* Set PTP Clock Traceability info. */ 1798 extern int bcm_ptp_clock_traceability_set( 1799 int unit, 1800 bcm_ptp_stack_id_t ptp_id, 1801 int clock_num, 1802 bcm_ptp_trace_t *trace); 1803 1804 /* Get PTP Clock UTC info. */ 1805 extern int bcm_ptp_clock_utc_get( 1806 int unit, 1807 bcm_ptp_stack_id_t ptp_id, 1808 int clock_num, 1809 bcm_ptp_utc_t *utc); 1810 1811 /* Set PTP Clock UTC info. */ 1812 extern int bcm_ptp_clock_utc_set( 1813 int unit, 1814 bcm_ptp_stack_id_t ptp_id, 1815 int clock_num, 1816 bcm_ptp_utc_t *utc); 1817 1818 /* Configure PTP Clock Port information. */ 1819 extern int bcm_ptp_clock_port_configure( 1820 int unit, 1821 bcm_ptp_stack_id_t ptp_id, 1822 int clock_num, 1823 uint32 clock_port, 1824 bcm_ptp_clock_port_info_t *info); 1825 1826 /* Get PTP Clock Port Identity. */ 1827 extern int bcm_ptp_clock_port_identity_get( 1828 int unit, 1829 bcm_ptp_stack_id_t ptp_id, 1830 int clock_num, 1831 uint32 clock_port, 1832 bcm_ptp_port_identity_t *identity); 1833 1834 /* Get PTP Clock Port Type. */ 1835 extern int bcm_ptp_clock_port_type_get( 1836 int unit, 1837 bcm_ptp_stack_id_t ptp_id, 1838 int clock_num, 1839 uint32 clock_port, 1840 bcm_ptp_port_type_t *type); 1841 1842 /* Get PTP Clock Port Protocol. */ 1843 extern int bcm_ptp_clock_port_protocol_get( 1844 int unit, 1845 bcm_ptp_stack_id_t ptp_id, 1846 int clock_num, 1847 uint32 clock_port, 1848 bcm_ptp_protocol_t *protocol); 1849 1850 /* Get PTP Clock Port MAC Address. */ 1851 extern int bcm_ptp_clock_port_mac_get( 1852 int unit, 1853 bcm_ptp_stack_id_t ptp_id, 1854 int clock_num, 1855 uint32 clock_port, 1856 bcm_mac_t *mac); 1857 1858 /* Get PTP Clock Port Information. */ 1859 extern int bcm_ptp_clock_port_info_get( 1860 int unit, 1861 bcm_ptp_stack_id_t ptp_id, 1862 int clock_num, 1863 uint32 clock_port, 1864 bcm_ptp_clock_port_info_t *info); 1865 1866 /* Get PTP Clock Port Dataset Information. */ 1867 extern int bcm_ptp_clock_port_dataset_get( 1868 int unit, 1869 bcm_ptp_stack_id_t ptp_id, 1870 int clock_num, 1871 uint32 clock_port, 1872 bcm_ptp_port_dataset_t *dataset); 1873 1874 /* Get PTP Clock Port Delay Mechanism. */ 1875 extern int bcm_ptp_clock_port_delay_mechanism_get( 1876 int unit, 1877 bcm_ptp_stack_id_t ptp_id, 1878 int clock_num, 1879 uint32 clock_port, 1880 uint32 *delay_mechanism); 1881 1882 /* Set PTP Clock Port Delay Mechanism. */ 1883 extern int bcm_ptp_clock_port_delay_mechanism_set( 1884 int unit, 1885 bcm_ptp_stack_id_t ptp_id, 1886 int clock_num, 1887 uint32 clock_port, 1888 uint32 delay_mechanism); 1889 1890 /* Set PTP Clock Port Latency. */ 1891 extern int bcm_ptp_clock_port_latency_set( 1892 int unit, 1893 bcm_ptp_stack_id_t ptp_id, 1894 int clock_num, 1895 uint32 clock_port, 1896 uint32 latency_in, 1897 uint32 latency_out); 1898 1899 /* Set PTP Clock Port Log Announce Interval. */ 1900 extern int bcm_ptp_clock_port_log_announce_interval_set( 1901 int unit, 1902 bcm_ptp_stack_id_t ptp_id, 1903 int clock_num, 1904 uint32 clock_port, 1905 int interval); 1906 1907 /* Get PTP Clock Port Log Announce interval. */ 1908 extern int bcm_ptp_clock_port_log_announce_interval_get( 1909 int unit, 1910 bcm_ptp_stack_id_t ptp_id, 1911 int clock_num, 1912 uint32 clock_port, 1913 int *interval); 1914 1915 /* Get PTP Clock Port Announce Receipt Timeout. */ 1916 extern int bcm_ptp_clock_port_announce_receipt_timeout_get( 1917 int unit, 1918 bcm_ptp_stack_id_t ptp_id, 1919 int clock_num, 1920 uint32 clock_port, 1921 uint32 *timeout); 1922 1923 /* Set PTP Clock Port Announce Receipt Timeout. */ 1924 extern int bcm_ptp_clock_port_announce_receipt_timeout_set( 1925 int unit, 1926 bcm_ptp_stack_id_t ptp_id, 1927 int clock_num, 1928 uint32 clock_port, 1929 uint32 timeout); 1930 1931 /* Get PTP Clock Port Log Sync Interval. */ 1932 extern int bcm_ptp_clock_port_log_sync_interval_get( 1933 int unit, 1934 bcm_ptp_stack_id_t ptp_id, 1935 int clock_num, 1936 uint32 clock_port, 1937 int *interval); 1938 1939 /* Set PTP Clock Port Log Sync Interval. */ 1940 extern int bcm_ptp_clock_port_log_sync_interval_set( 1941 int unit, 1942 bcm_ptp_stack_id_t ptp_id, 1943 int clock_num, 1944 uint32 clock_port, 1945 int interval); 1946 1947 /* Get PTP Clock Port Version Number. */ 1948 extern int bcm_ptp_clock_port_version_number_get( 1949 int unit, 1950 bcm_ptp_stack_id_t ptp_id, 1951 int clock_num, 1952 uint32 clock_port, 1953 uint32 *version); 1954 1955 /* Get PTP Clock Port Log Min PDelay Request Interval. */ 1956 extern int bcm_ptp_clock_port_log_min_pdelay_req_interval_get( 1957 int unit, 1958 bcm_ptp_stack_id_t ptp_id, 1959 int clock_num, 1960 uint32 clock_port, 1961 int *interval); 1962 1963 /* Set PTP Clock Port Log Min Peer Delay Request Interval. */ 1964 extern int bcm_ptp_clock_port_log_min_pdelay_req_interval_set( 1965 int unit, 1966 bcm_ptp_stack_id_t ptp_id, 1967 int clock_num, 1968 uint32 clock_port, 1969 int interval); 1970 1971 /* Get PTP Clock Port Log Min Delay Request Interval. */ 1972 extern int bcm_ptp_clock_port_log_min_delay_req_interval_get( 1973 int unit, 1974 bcm_ptp_stack_id_t ptp_id, 1975 int clock_num, 1976 uint32 clock_port, 1977 int *interval); 1978 1979 /* Set PTP Clock Port Log Min Delay Request Interval. */ 1980 extern int bcm_ptp_clock_port_log_min_delay_req_interval_set( 1981 int unit, 1982 bcm_ptp_stack_id_t ptp_id, 1983 int clock_num, 1984 uint32 clock_port, 1985 int interval); 1986 1987 /* Enable PTP Clock Port. */ 1988 extern int bcm_ptp_clock_port_enable( 1989 int unit, 1990 bcm_ptp_stack_id_t ptp_id, 1991 int clock_num, 1992 uint32 clock_port); 1993 1994 /* Disable PTP Clock Port. */ 1995 extern int bcm_ptp_clock_port_disable( 1996 int unit, 1997 bcm_ptp_stack_id_t ptp_id, 1998 int clock_num, 1999 uint32 clock_port); 2000 2001 /* Add PTP Clock Static Unicast Slave */ 2002 extern int bcm_ptp_static_unicast_slave_add( 2003 int unit, 2004 bcm_ptp_stack_id_t ptp_id, 2005 int clock_num, 2006 int port_num, 2007 bcm_ptp_clock_peer_t *slave_info); 2008 2009 /* List PTP Clock Static Unicast Slaves */ 2010 extern int bcm_ptp_static_unicast_slave_list( 2011 int unit, 2012 bcm_ptp_stack_id_t ptp_id, 2013 int clock_num, 2014 int port_num, 2015 int max_num_slaves, 2016 int *num_slaves, 2017 bcm_ptp_clock_peer_t *slave_info); 2018 2019 /* Remove PTP Clock Static Unicast Slave */ 2020 extern int bcm_ptp_static_unicast_slave_remove( 2021 int unit, 2022 bcm_ptp_stack_id_t ptp_id, 2023 int clock_num, 2024 int port_num, 2025 bcm_ptp_clock_peer_t *slave_info); 2026 2027 /* Clear All PTP Clock Static Unicast Slaves */ 2028 extern int bcm_ptp_static_unicast_slave_table_clear( 2029 int unit, 2030 bcm_ptp_stack_id_t ptp_id, 2031 int clock_num, 2032 int port_num); 2033 2034 /* Get PTP Clock Static Unicast Master Table Size */ 2035 extern int bcm_ptp_static_unicast_master_table_size_get( 2036 int unit, 2037 bcm_ptp_stack_id_t ptp_id, 2038 int clock_num, 2039 int port_num, 2040 int *max_table_entries); 2041 2042 /* Add PTP Clock Static Unicast Master Entry */ 2043 extern int bcm_ptp_static_unicast_master_add( 2044 int unit, 2045 bcm_ptp_stack_id_t ptp_id, 2046 int clock_num, 2047 int port_num, 2048 bcm_ptp_clock_unicast_master_t *master_info); 2049 2050 /* List PTP Unicast Static Master Table */ 2051 extern int bcm_ptp_static_unicast_master_list( 2052 int unit, 2053 bcm_ptp_stack_id_t ptp_id, 2054 int clock_num, 2055 int port_num, 2056 int max_num_masters, 2057 int *num_masters, 2058 bcm_ptp_clock_peer_address_t *master_addr); 2059 2060 /* Remove PTP Clock Static Unicast Master Entry */ 2061 extern int bcm_ptp_static_unicast_master_remove( 2062 int unit, 2063 bcm_ptp_stack_id_t ptp_id, 2064 int clock_num, 2065 int port_num, 2066 bcm_ptp_clock_peer_address_t *master_info); 2067 2068 /* Clear PTP Clock Static Unicast Master Table */ 2069 extern int bcm_ptp_static_unicast_master_table_clear( 2070 int unit, 2071 bcm_ptp_stack_id_t ptp_id, 2072 int clock_num, 2073 int port_num); 2074 2075 /* Add PTP Clock Signaled Unicast Master Entry */ 2076 extern int bcm_ptp_signaled_unicast_master_add( 2077 int unit, 2078 bcm_ptp_stack_id_t ptp_id, 2079 int clock_num, 2080 int port_num, 2081 bcm_ptp_clock_unicast_master_t *master_info, 2082 uint32 mask); 2083 2084 /* Remove PTP Clock Signaled Unicast Master Entry */ 2085 extern int bcm_ptp_signaled_unicast_master_remove( 2086 int unit, 2087 bcm_ptp_stack_id_t ptp_id, 2088 int clock_num, 2089 int port_num, 2090 bcm_ptp_clock_peer_address_t *master_info); 2091 2092 /* Clear All PTP Clock Static Unicast Slaves */ 2093 extern int bcm_ptp_signaled_unicast_slave_table_clear( 2094 int unit, 2095 bcm_ptp_stack_id_t ptp_id, 2096 int clock_num, 2097 int port_num, 2098 int callstack); 2099 2100 /* List PTP Clock Signaled Unicast Slaves */ 2101 extern int bcm_ptp_signaled_unicast_slave_list( 2102 int unit, 2103 bcm_ptp_stack_id_t ptp_id, 2104 int clock_num, 2105 int port_num, 2106 int max_num_slaves, 2107 int *num_slaves, 2108 bcm_ptp_clock_peer_t *slave_info); 2109 2110 /* Set PTP Slave's Default Unicast Request Duration */ 2111 extern int bcm_ptp_unicast_request_duration_set( 2112 int unit, 2113 bcm_ptp_stack_id_t ptp_id, 2114 int clock_num, 2115 int port_num, 2116 uint32 duration); 2117 2118 /* Get PTP Slave's Default Unicast Request Duration */ 2119 extern int bcm_ptp_unicast_request_duration_get( 2120 int unit, 2121 bcm_ptp_stack_id_t ptp_id, 2122 int clock_num, 2123 int port_num, 2124 uint32 *duration); 2125 2126 /* Set PTP Master's Minimum Allowed Unicast Request Duration */ 2127 extern int bcm_ptp_unicast_request_duration_min_set( 2128 int unit, 2129 bcm_ptp_stack_id_t ptp_id, 2130 int clock_num, 2131 int port_num, 2132 uint32 duration_min); 2133 2134 /* Get PTP Master's Minimum Allowed Unicast Request Duration */ 2135 extern int bcm_ptp_unicast_request_duration_min_get( 2136 int unit, 2137 bcm_ptp_stack_id_t ptp_id, 2138 int clock_num, 2139 int port_num, 2140 uint32 *duration_min); 2141 2142 /* Set PTP Master's Maximum Allowed Unicast Request Duration */ 2143 extern int bcm_ptp_unicast_request_duration_max_set( 2144 int unit, 2145 bcm_ptp_stack_id_t ptp_id, 2146 int clock_num, 2147 int port_num, 2148 uint32 duration_max); 2149 2150 /* Get PTP Master's Maximum Allowed Unicast Request Duration */ 2151 extern int bcm_ptp_unicast_request_duration_max_get( 2152 int unit, 2153 bcm_ptp_stack_id_t ptp_id, 2154 int clock_num, 2155 int port_num, 2156 uint32 *duration_max); 2157 2158 /* Get PTP Clock Acceptable Master Table Size */ 2159 extern int bcm_ptp_acceptable_master_table_size_get( 2160 int unit, 2161 bcm_ptp_stack_id_t ptp_id, 2162 int clock_num, 2163 int port_num, 2164 int *max_table_entries); 2165 2166 /* Add PTP Clock Acceptable Master Entry */ 2167 extern int bcm_ptp_acceptable_master_add( 2168 int unit, 2169 bcm_ptp_stack_id_t ptp_id, 2170 int clock_num, 2171 int port_num, 2172 int priority1_alt_value, 2173 bcm_ptp_clock_peer_address_t *master_info); 2174 2175 /* List PTP Acceptable Master Entries */ 2176 extern int bcm_ptp_acceptable_master_list( 2177 int unit, 2178 bcm_ptp_stack_id_t ptp_id, 2179 int clock_num, 2180 int port_num, 2181 int max_num_masters, 2182 int *num_masters, 2183 bcm_ptp_clock_peer_address_t *master_addr); 2184 2185 /* Remove PTP Clock Acceptable Master Entry */ 2186 extern int bcm_ptp_acceptable_master_remove( 2187 int unit, 2188 bcm_ptp_stack_id_t ptp_id, 2189 int clock_num, 2190 int port_num, 2191 bcm_ptp_clock_peer_address_t *master_info); 2192 2193 /* Clear PTP Clock Acceptable Master Table */ 2194 extern int bcm_ptp_acceptable_master_table_clear( 2195 int unit, 2196 bcm_ptp_stack_id_t ptp_id, 2197 int clock_num, 2198 int port_num); 2199 2200 /* Get PTP Clock Acceptable Master Enabled state */ 2201 extern int bcm_ptp_acceptable_master_enabled_get( 2202 int unit, 2203 bcm_ptp_stack_id_t ptp_id, 2204 int clock_num, 2205 int port_num, 2206 uint8 *enabled); 2207 2208 /* Set PTP Clock Acceptable Master Enabled state */ 2209 extern int bcm_ptp_acceptable_master_enabled_set( 2210 int unit, 2211 bcm_ptp_stack_id_t ptp_id, 2212 int clock_num, 2213 int port_num, 2214 uint8 enabled); 2215 2216 /* Get PTP Clock Primary Domain */ 2217 extern int bcm_ptp_primary_domain_get( 2218 int unit, 2219 bcm_ptp_stack_id_t ptp_id, 2220 int clock_num, 2221 int *primary_domain); 2222 2223 /* Set PTP Clock Primary Domain */ 2224 extern int bcm_ptp_primary_domain_set( 2225 int unit, 2226 bcm_ptp_stack_id_t ptp_id, 2227 int clock_num, 2228 int primary_domain); 2229 2230 /* Get PTP Transparent Clock Default Dataset */ 2231 extern int bcm_ptp_transparent_clock_default_dataset_get( 2232 int unit, 2233 bcm_ptp_stack_id_t ptp_id, 2234 int clock_num, 2235 bcm_ptp_transparent_clock_default_dataset_t *data_set); 2236 2237 /* Get PTP Transparent Clock Port Dataset */ 2238 extern int bcm_ptp_transparent_clock_port_dataset_get( 2239 int unit, 2240 bcm_ptp_stack_id_t ptp_id, 2241 int clock_num, 2242 uint16 clock_port, 2243 bcm_ptp_transparent_clock_port_dataset_t *data_set); 2244 2245 /* Set PTP TOD Input Sources */ 2246 extern int bcm_ptp_tod_input_sources_set( 2247 int unit, 2248 bcm_ptp_stack_id_t ptp_id, 2249 int clock_num, 2250 int num_tod_sources, 2251 bcm_ptp_tod_input_t *tod_sources); 2252 2253 /* Get PTP Input Timesource Status */ 2254 extern int bcm_ptp_timesource_input_status_get( 2255 int unit, 2256 bcm_ptp_stack_id_t ptp_id, 2257 int clock_num, 2258 bcm_ptp_timesource_status_t *status); 2259 2260 /* Get PTP TOD Input Sources */ 2261 extern int bcm_ptp_tod_input_sources_get( 2262 int unit, 2263 bcm_ptp_stack_id_t ptp_id, 2264 int clock_num, 2265 int *num_tod_sources, 2266 bcm_ptp_tod_input_t *tod_sources); 2267 2268 /* Get PTP input channels. */ 2269 extern int bcm_ptp_input_channels_get( 2270 int unit, 2271 bcm_ptp_stack_id_t ptp_id, 2272 int clock_num, 2273 int *num_channels, 2274 bcm_ptp_channel_t *channels); 2275 2276 /* Set PTP Input Channels */ 2277 extern int bcm_ptp_input_channels_set( 2278 int unit, 2279 bcm_ptp_stack_id_t ptp_id, 2280 int clock_num, 2281 int num_channels, 2282 bcm_ptp_channel_t *channels); 2283 2284 /* Set PTP Input Channels Precedence Mode */ 2285 extern int bcm_ptp_input_channel_precedence_mode_set( 2286 int unit, 2287 bcm_ptp_stack_id_t ptp_id, 2288 int clock_num, 2289 int channel_select_mode); 2290 2291 /* Set PTP Input Channels Switching Mode */ 2292 extern int bcm_ptp_input_channel_switching_mode_set( 2293 int unit, 2294 bcm_ptp_stack_id_t ptp_id, 2295 int clock_num, 2296 int channel_switching_mode); 2297 2298 /* Set PTP TOD Output */ 2299 extern int bcm_ptp_tod_output_set( 2300 int unit, 2301 bcm_ptp_stack_id_t ptp_id, 2302 int clock_num, 2303 int *tod_output_id, 2304 bcm_ptp_tod_output_t *output_info); 2305 2306 /* Get PTP TOD Output */ 2307 extern int bcm_ptp_tod_output_get( 2308 int unit, 2309 bcm_ptp_stack_id_t ptp_id, 2310 int clock_num, 2311 int *tod_output_count, 2312 bcm_ptp_tod_output_t *tod_output); 2313 2314 /* Remove PTP TOD Output */ 2315 extern int bcm_ptp_tod_output_remove( 2316 int unit, 2317 bcm_ptp_stack_id_t ptp_id, 2318 int clock_num, 2319 int tod_output_id); 2320 2321 /* Set PTP Signal Output */ 2322 extern int bcm_ptp_signal_output_set( 2323 int unit, 2324 bcm_ptp_stack_id_t ptp_id, 2325 int clock_num, 2326 int *signal_output_id, 2327 bcm_ptp_signal_output_t *output_info); 2328 2329 /* Get PTP Signal Output */ 2330 extern int bcm_ptp_signal_output_get( 2331 int unit, 2332 bcm_ptp_stack_id_t ptp_id, 2333 int clock_num, 2334 int *signal_output_count, 2335 bcm_ptp_signal_output_t *signal_output_id); 2336 2337 /* Remove PTP Signal Output */ 2338 extern int bcm_ptp_signal_output_remove( 2339 int unit, 2340 bcm_ptp_stack_id_t ptp_id, 2341 int clock_num, 2342 int signal_output_id); 2343 2344 /* Synchronize PHY clock to the TOP clock */ 2345 extern int bcm_ptp_sync_phy( 2346 int unit, 2347 bcm_ptp_stack_id_t ptp_id, 2348 int clock_num, 2349 bcm_ptp_sync_phy_input_t sync_input); 2350 2351 /* Get BSHB timestamp for PHY DPLL configuration */ 2352 extern int bcm_ptp_bs_time_info_get( 2353 int unit, 2354 bcm_ptp_stack_id_t ptp_id, 2355 int clock_num, 2356 bcm_ptp_bs_time_info_t *time); 2357 2358 /* Get PTP servo configuration properties */ 2359 extern int bcm_ptp_servo_configuration_get( 2360 int unit, 2361 bcm_ptp_stack_id_t ptp_id, 2362 int clock_num, 2363 bcm_ptp_servo_config_t *config); 2364 2365 /* Set PTP servo configuration properties */ 2366 extern int bcm_ptp_servo_configuration_set( 2367 int unit, 2368 bcm_ptp_stack_id_t ptp_id, 2369 int clock_num, 2370 bcm_ptp_servo_config_t *config); 2371 2372 /* Get PTP servo status. */ 2373 extern int bcm_ptp_servo_status_get( 2374 int unit, 2375 bcm_ptp_stack_id_t ptp_id, 2376 int clock_num, 2377 bcm_ptp_servo_status_t *status); 2378 2379 /* Set servo threshold configuration data. */ 2380 extern int bcm_ptp_servo_threshold_set( 2381 int unit, 2382 bcm_ptp_stack_id_t ptp_id, 2383 int clock_num, 2384 bcm_ptp_servo_threshold_t *threshold); 2385 2386 /* Get servo threshold configuration data. */ 2387 extern int bcm_ptp_servo_threshold_get( 2388 int unit, 2389 bcm_ptp_stack_id_t ptp_id, 2390 int clock_num, 2391 bcm_ptp_servo_threshold_t *threshold); 2392 2393 /* Get peer dataset. */ 2394 extern int bcm_ptp_peer_dataset_get( 2395 int unit, 2396 bcm_ptp_stack_id_t ptp_id, 2397 int clock_num, 2398 int port_num, 2399 int max_num_peers, 2400 bcm_ptp_peer_entry_t *peers, 2401 int *num_peers); 2402 2403 /* Get PTP Peer aging-time for cleanup. */ 2404 extern int bcm_ptp_clock_peer_age_timer_get( 2405 int unit, 2406 bcm_ptp_stack_id_t ptp_id, 2407 int clock_num, 2408 uint8 *aging_time); 2409 2410 /* Set PTP Peer aging-time for cleanup. */ 2411 extern int bcm_ptp_clock_peer_age_timer_set( 2412 int unit, 2413 bcm_ptp_stack_id_t ptp_id, 2414 int clock_num, 2415 uint8 aging_time); 2416 2417 /* Get PTP flag field override mask/value. */ 2418 extern int bcm_ptp_pkt_flags_override_get( 2419 int unit, 2420 bcm_ptp_stack_id_t ptp_id, 2421 int clock_num, 2422 uint32 *override_flag, 2423 uint32 *override_value); 2424 2425 /* Set PTP flag field override mask/value. */ 2426 extern int bcm_ptp_pkt_flags_override_set( 2427 int unit, 2428 bcm_ptp_stack_id_t ptp_id, 2429 int clock_num, 2430 uint32 override_flag, 2431 uint32 override_value); 2432 2433 /* Get packet counts/statistics. */ 2434 extern int bcm_ptp_packet_counters_get( 2435 int unit, 2436 bcm_ptp_stack_id_t ptp_id, 2437 int clock_num, 2438 bcm_ptp_packet_counters_t *counters); 2439 2440 #endif /* BCM_HIDE_DISPATCHABLE */ 2441 2442 /* 2443 * Bits#13:0 of "counter_bitmap" indicates a PTP packet counter. When 2444 * set to 1, will clear the corresponding packet counter. Bits#31:14 are 2445 * ignored. 2446 */ 2447 #define BCM_PTP_PKT_COUNTER_TX (1 << 0) 2448 #define BCM_PTP_PKT_COUNTER_RX (1 << 1) 2449 #define BCM_PTP_PKT_COUNTER_DISCARD (1 << 2) 2450 #define BCM_PTP_PKT_COUNTER_RCPU_ENCAP_RX (1 << 3) 2451 #define BCM_PTP_PKT_COUNTER_IPV4_RX (1 << 4) 2452 #define BCM_PTP_PKT_COUNTER_IPV6_RX (1 << 5) 2453 #define BCM_PTP_PKT_COUNTER_L2_RX (1 << 6) 2454 #define BCM_PTP_PKT_COUNTER_UDP_RX (1 << 7) 2455 #define BCM_PTP_PKT_COUNTER_ENDUROSYNC_TX (1 << 8) 2456 #define BCM_PTP_PKT_COUNTER_ENDUROSYNC_RX (1 << 9) 2457 #define BCM_PTP_PKT_COUNTER_RXQUEUE_OVERFLOWS (1 << 10) 2458 #define BCM_PTP_PKT_COUNTER_PORT_TX (1 << 11) 2459 #define BCM_PTP_PKT_COUNTER_PORT_RX (1 << 12) 2460 #define BCM_PTP_PKT_COUNTER_PORT_DISCARD (1 << 13) 2461 #define BCM_PTP_PKT_COUNTER_ALL (0x3FFF) /* clear all packet 2462 counters ( both common 2463 and port-specific). */ 2464 #define BCM_PTP_PKT_COUNTER_COMMON (0x07FF) /* clear all common 2465 packet counters */ 2466 #define BCM_PTP_PKT_COUNTER_PORT_SPECIFIC (0x3800) /* clear all 2467 port-specific packet 2468 counters */ 2469 2470 #ifndef BCM_HIDE_DISPATCHABLE 2471 2472 /* Clear PTP packet counters/statistics. */ 2473 extern int bcm_ptp_packet_counters_clear( 2474 int unit, 2475 bcm_ptp_stack_id_t ptp_id, 2476 int clock_num, 2477 int port_num, 2478 uint32 counter_bitmap); 2479 2480 /* Set phase offsets for path asymmetry compensation. */ 2481 extern int bcm_ptp_phase_offset_set( 2482 int unit, 2483 bcm_ptp_stack_id_t ptp_id, 2484 int clock_num, 2485 const bcm_ptp_phase_offset_t *offset); 2486 2487 /* Get phase offsets for path asymmetry compensation. */ 2488 extern int bcm_ptp_phase_offset_get( 2489 int unit, 2490 bcm_ptp_stack_id_t ptp_id, 2491 int clock_num, 2492 bcm_ptp_phase_offset_t *offset); 2493 2494 /* ESMC PDU transmit (Tx). */ 2495 extern int bcm_esmc_tx( 2496 int unit, 2497 int stack_id, 2498 bcm_pbmp_t pbmp, 2499 bcm_esmc_pdu_data_t *esmc_pdu_data); 2500 2501 /* Register ESMC PDU Rx callback. */ 2502 extern int bcm_esmc_rx_callback_register( 2503 int unit, 2504 int stack_id, 2505 bcm_esmc_rx_cb rx_cb); 2506 2507 /* Unregister ESMC PDU Rx callback. */ 2508 extern int bcm_esmc_rx_callback_unregister( 2509 int unit, 2510 int stack_id); 2511 2512 /* Get ESMC PDU tunneling-enabled Boolean. */ 2513 extern int bcm_esmc_tunnel_get( 2514 int unit, 2515 int stack_id, 2516 int *enable); 2517 2518 /* Set ESMC PDU tunneling-enabled Boolean. */ 2519 extern int bcm_esmc_tunnel_set( 2520 int unit, 2521 int stack_id, 2522 int enable); 2523 2524 /* Get ITU-T G.781 networking option for SyncE. */ 2525 extern int bcm_esmc_g781_option_get( 2526 int unit, 2527 int stack_id, 2528 bcm_esmc_network_option_t *g781_option); 2529 2530 /* Set ITU-T G.781 networking option for SyncE. */ 2531 extern int bcm_esmc_g781_option_set( 2532 int unit, 2533 int stack_id, 2534 bcm_esmc_network_option_t g781_option); 2535 2536 /* 2537 * Get synchronization status message (SSM) code corresponding to ITU-T 2538 * G.781 quality level (QL). 2539 */ 2540 extern int bcm_esmc_QL_SSM_map( 2541 int unit, 2542 bcm_esmc_network_option_t opt, 2543 bcm_esmc_quality_level_t ql, 2544 uint8 *ssm_code); 2545 2546 /* 2547 * Get ITU-T G.781 quality level (QL) corresponding to synchronization 2548 * status message (SSM) code. 2549 */ 2550 extern int bcm_esmc_SSM_QL_map( 2551 int unit, 2552 bcm_esmc_network_option_t opt, 2553 uint8 ssm_code, 2554 bcm_esmc_quality_level_t *ql); 2555 2556 /* Register input clock esmc quality change callback. */ 2557 extern int bcm_tdpll_input_clock_ql_change_callback_register( 2558 int unit, 2559 int stack_id, 2560 bcm_tdpll_input_clock_ql_change_cb ql_change_cb); 2561 2562 /* Unregister input clock reference selection callback. */ 2563 extern int bcm_tdpll_input_clock_ql_change_callback_unregister( 2564 int unit, 2565 int stack_id); 2566 2567 /* Get logical DPLL instance input/output bindings. */ 2568 extern int bcm_tdpll_dpll_bindings_get( 2569 int unit, 2570 int stack_id, 2571 int dpll_index, 2572 bcm_tdpll_dpll_bindings_t *bindings); 2573 2574 /* Set logical DPLL instance input/output bindings. */ 2575 extern int bcm_tdpll_dpll_bindings_set( 2576 int unit, 2577 int stack_id, 2578 int dpll_index, 2579 bcm_tdpll_dpll_bindings_t *bindings); 2580 2581 /* Get reference clocks for DPLL instances. */ 2582 extern int bcm_tdpll_dpll_reference_get( 2583 int unit, 2584 int stack_id, 2585 int max_num_dpll, 2586 int *dpll_ref, 2587 int *num_dpll); 2588 2589 /* Get DPLL bandwidth. */ 2590 extern int bcm_tdpll_dpll_bandwidth_get( 2591 int unit, 2592 int stack_id, 2593 int dpll_index, 2594 bcm_tdpll_dpll_bandwidth_t *bandwidth); 2595 2596 /* Set DPLL bandwidth. */ 2597 extern int bcm_tdpll_dpll_bandwidth_set( 2598 int unit, 2599 int stack_id, 2600 int dpll_index, 2601 bcm_tdpll_dpll_bandwidth_t *bandwidth); 2602 2603 /* Get DPLL instance's phase control configuration. */ 2604 extern int bcm_tdpll_dpll_phase_control_get( 2605 int unit, 2606 int stack_id, 2607 int dpll_index, 2608 bcm_tdpll_dpll_phase_control_t *phase_control); 2609 2610 /* Set DPLL instance's phase control configuration. */ 2611 extern int bcm_tdpll_dpll_phase_control_set( 2612 int unit, 2613 int stack_id, 2614 int dpll_index, 2615 bcm_tdpll_dpll_phase_control_t *phase_control); 2616 2617 /* 2618 * Start/stop T-DPLL input clock monitoring, reference selection, and 2619 * switching state machine 2620 */ 2621 extern int bcm_tdpll_input_clock_control( 2622 int unit, 2623 int stack_id, 2624 int enable); 2625 2626 /* Get MAC address of input clock. */ 2627 extern int bcm_tdpll_input_clock_mac_get( 2628 int unit, 2629 int stack_id, 2630 int clock_index, 2631 bcm_mac_t *mac); 2632 2633 /* Set MAC address of input clock. */ 2634 extern int bcm_tdpll_input_clock_mac_set( 2635 int unit, 2636 int stack_id, 2637 int clock_index, 2638 bcm_mac_t *mac); 2639 2640 /* 2641 * Get fractional frequency error of an input clock from input-clock 2642 * monitoring process. 2643 */ 2644 extern int bcm_tdpll_input_clock_frequency_error_get( 2645 int unit, 2646 int stack_id, 2647 int clock_index, 2648 int *freq_error_ppb); 2649 2650 /* 2651 * Get monitor threshold state of an input clock from input-clock 2652 * monitoring process. 2653 */ 2654 extern int bcm_tdpll_input_clock_threshold_state_get( 2655 int unit, 2656 int stack_id, 2657 int clock_index, 2658 bcm_tdpll_input_clock_monitor_type_t threshold_type, 2659 int *threshold_state); 2660 2661 /* Get input clock enable Boolean. */ 2662 extern int bcm_tdpll_input_clock_enable_get( 2663 int unit, 2664 int stack_id, 2665 int clock_index, 2666 int *enable); 2667 2668 /* Set input-clock enable Boolean. */ 2669 extern int bcm_tdpll_input_clock_enable_set( 2670 int unit, 2671 int stack_id, 2672 int clock_index, 2673 int enable); 2674 2675 /* Get L1 mux mapping (mux index and port number) of input clock. */ 2676 extern int bcm_tdpll_input_clock_l1mux_get( 2677 int unit, 2678 int stack_id, 2679 int clock_index, 2680 bcm_tdpll_input_clock_l1mux_t *l1mux); 2681 2682 /* Set L1 mux mapping (mux index and port number) of input clock. */ 2683 extern int bcm_tdpll_input_clock_l1mux_set( 2684 int unit, 2685 int stack_id, 2686 int clock_index, 2687 bcm_tdpll_input_clock_l1mux_t *l1mux); 2688 2689 /* 2690 * Get valid Boolean of an input clock from input-clock monitoring 2691 * process. 2692 */ 2693 extern int bcm_tdpll_input_clock_valid_get( 2694 int unit, 2695 int stack_id, 2696 int clock_index, 2697 int *valid); 2698 2699 /* Set input-clock valid Boolean from monitoring process. */ 2700 extern int bcm_tdpll_input_clock_valid_set( 2701 int unit, 2702 int stack_id, 2703 int clock_index, 2704 int valid); 2705 2706 /* Get input clock frequency. */ 2707 extern int bcm_tdpll_input_clock_frequency_get( 2708 int unit, 2709 int stack_id, 2710 int clock_index, 2711 uint32 *clock_frequency, 2712 uint32 *tsevent_frequency); 2713 2714 /* Set input clock frequency. */ 2715 extern int bcm_tdpll_input_clock_frequency_set( 2716 int unit, 2717 int stack_id, 2718 int clock_index, 2719 uint32 clock_frequency, 2720 uint32 tsevent_frequency); 2721 2722 /* Get input clock quality level (QL). */ 2723 extern int bcm_tdpll_input_clock_ql_get( 2724 int unit, 2725 int stack_id, 2726 int clock_index, 2727 bcm_esmc_quality_level_t *ql); 2728 2729 /* Set input clock quality level (QL). */ 2730 extern int bcm_tdpll_input_clock_ql_set( 2731 int unit, 2732 int stack_id, 2733 int clock_index, 2734 bcm_esmc_quality_level_t ql); 2735 2736 /* Get input clock priority for reference selection. */ 2737 extern int bcm_tdpll_input_clock_priority_get( 2738 int unit, 2739 int stack_id, 2740 int clock_index, 2741 int *priority); 2742 2743 /* Set input clock priority for reference selection. */ 2744 extern int bcm_tdpll_input_clock_priority_set( 2745 int unit, 2746 int stack_id, 2747 int clock_index, 2748 int priority); 2749 2750 /* Get input clock lockout Boolean for reference selection. */ 2751 extern int bcm_tdpll_input_clock_lockout_get( 2752 int unit, 2753 int stack_id, 2754 int clock_index, 2755 int *lockout); 2756 2757 /* Set input clock lockout Boolean for reference selection. */ 2758 extern int bcm_tdpll_input_clock_lockout_set( 2759 int unit, 2760 int stack_id, 2761 int clock_index, 2762 int lockout); 2763 2764 /* Get input clock monitoring interval. */ 2765 extern int bcm_tdpll_input_clock_monitor_interval_get( 2766 int unit, 2767 int stack_id, 2768 uint32 *monitor_interval); 2769 2770 /* Set input clock monitoring interval. */ 2771 extern int bcm_tdpll_input_clock_monitor_interval_set( 2772 int unit, 2773 int stack_id, 2774 uint32 monitor_interval); 2775 2776 /* 2777 * Get monitor threshold for input-clock valid classification required in 2778 * reference selection. 2779 */ 2780 extern int bcm_tdpll_input_clock_monitor_threshold_get( 2781 int unit, 2782 int stack_id, 2783 bcm_tdpll_input_clock_monitor_type_t threshold_type, 2784 uint32 *threshold); 2785 2786 /* 2787 * Set monitor threshold for input-clock valid classification required in 2788 * reference selection. 2789 */ 2790 extern int bcm_tdpll_input_clock_monitor_threshold_set( 2791 int unit, 2792 int stack_id, 2793 bcm_tdpll_input_clock_monitor_type_t threshold_type, 2794 uint32 threshold); 2795 2796 /* Get QL-enabled Boolean for reference selection. */ 2797 extern int bcm_tdpll_input_clock_ql_enabled_get( 2798 int unit, 2799 int stack_id, 2800 int dpll_index, 2801 int *ql_enabled); 2802 2803 /* Set QL-enabled Boolean for reference selection. */ 2804 extern int bcm_tdpll_input_clock_ql_enabled_set( 2805 int unit, 2806 int stack_id, 2807 int dpll_index, 2808 int ql_enabled); 2809 2810 /* Get revertive mode Boolean for reference selection and switching. */ 2811 extern int bcm_tdpll_input_clock_revertive_get( 2812 int unit, 2813 int stack_id, 2814 int dpll_index, 2815 int *revertive); 2816 2817 /* Set revertive mode Boolean for reference selection and switching. */ 2818 extern int bcm_tdpll_input_clock_revertive_set( 2819 int unit, 2820 int stack_id, 2821 int dpll_index, 2822 int revertive); 2823 2824 /* Get best (i.e. selected) reference for a DPLL instance. */ 2825 extern int bcm_tdpll_input_clock_best_get( 2826 int unit, 2827 int stack_id, 2828 int dpll_index, 2829 int *best_clock); 2830 2831 /* Register input clock monitoring callback. */ 2832 extern int bcm_tdpll_input_clock_monitor_callback_register( 2833 int unit, 2834 int stack_id, 2835 bcm_tdpll_input_clock_monitor_cb monitor_cb); 2836 2837 /* Unregister input clock monitoring callback. */ 2838 extern int bcm_tdpll_input_clock_monitor_callback_unregister( 2839 int unit, 2840 int stack_id); 2841 2842 /* Register input clock reference selection callback. */ 2843 extern int bcm_tdpll_input_clock_selector_callback_register( 2844 int unit, 2845 int stack_id, 2846 bcm_tdpll_input_clock_selector_cb selector_cb); 2847 2848 /* Unregister input clock reference selection callback. */ 2849 extern int bcm_tdpll_input_clock_selector_callback_unregister( 2850 int unit, 2851 int stack_id); 2852 2853 /* Registers input clock callback function. */ 2854 extern int bcm_tdpll_input_clock_callback_register( 2855 int unit, 2856 int stack_id, 2857 bcm_tdpll_callback_type_t type, 2858 bcm_tdpll_input_clock_cb callback); 2859 2860 /* Unregisters input clock callback function. */ 2861 extern int bcm_tdpll_input_clock_callback_unregister( 2862 int unit, 2863 int stack_id, 2864 bcm_tdpll_callback_type_t type); 2865 2866 /* Get output clock enable Boolean. */ 2867 extern int bcm_tdpll_output_clock_enable_get( 2868 int unit, 2869 int stack_id, 2870 int clock_index, 2871 int *enable); 2872 2873 /* Set output clock enable Boolean. */ 2874 extern int bcm_tdpll_output_clock_enable_set( 2875 int unit, 2876 int stack_id, 2877 int clock_index, 2878 int enable); 2879 2880 /* Get output-clock (synthesizer) frequency. */ 2881 extern int bcm_tdpll_output_clock_synth_frequency_get( 2882 int unit, 2883 int stack_id, 2884 int clock_index, 2885 uint32 *synth_frequency, 2886 uint32 *tsevent_frequency); 2887 2888 /* Set output-clock (synthesizer) frequency. */ 2889 extern int bcm_tdpll_output_clock_synth_frequency_set( 2890 int unit, 2891 int stack_id, 2892 int clock_index, 2893 uint32 synth_frequency, 2894 uint32 tsevent_frequency); 2895 2896 /* Get synthesizer derivative-clock frequency. */ 2897 extern int bcm_tdpll_output_clock_deriv_frequency_get( 2898 int unit, 2899 int stack_id, 2900 int clock_index, 2901 uint32 *deriv_frequency); 2902 2903 /* Set synthesizer derivative clock frequency. */ 2904 extern int bcm_tdpll_output_clock_deriv_frequency_set( 2905 int unit, 2906 int stack_id, 2907 int clock_index, 2908 uint32 deriv_frequency); 2909 2910 /* Get holdover configuration data. */ 2911 extern int bcm_tdpll_output_clock_holdover_data_get( 2912 int unit, 2913 int stack_id, 2914 int clock_index, 2915 bcm_tdpll_holdover_data_t *hdata); 2916 2917 /* Set manual holdover frequency correction. */ 2918 extern int bcm_tdpll_output_clock_holdover_frequency_set( 2919 int unit, 2920 int stack_id, 2921 int clock_index, 2922 bcm_tdpll_frequency_correction_t hfreq); 2923 2924 /* Get holdover mode. */ 2925 extern int bcm_tdpll_output_clock_holdover_mode_get( 2926 int unit, 2927 int stack_id, 2928 int clock_index, 2929 bcm_tdpll_holdover_mode_t *hmode); 2930 2931 /* Set holdover mode. */ 2932 extern int bcm_tdpll_output_clock_holdover_mode_set( 2933 int unit, 2934 int stack_id, 2935 int clock_index, 2936 bcm_tdpll_holdover_mode_t hmode); 2937 2938 /* Reset holdover frequency calculations. */ 2939 extern int bcm_tdpll_output_clock_holdover_reset( 2940 int unit, 2941 int stack_id, 2942 int clock_index); 2943 2944 /* Execute state machine for Rx ESMC PDU. */ 2945 extern int bcm_tdpll_esmc_rx_state_machine( 2946 int unit, 2947 int stack_id, 2948 int ingress_port, 2949 bcm_esmc_pdu_data_t *esmc_pdu_data); 2950 2951 /* Get quality level (QL) for ESMC. */ 2952 extern int bcm_tdpll_esmc_ql_get( 2953 int unit, 2954 int stack_id, 2955 int dpll_index, 2956 bcm_esmc_quality_level_t *ql); 2957 2958 /* Set quality level (QL) for ESMC. */ 2959 extern int bcm_tdpll_esmc_ql_set( 2960 int unit, 2961 int stack_id, 2962 int dpll_index, 2963 bcm_esmc_quality_level_t ql); 2964 2965 /* Get quality level (QL) for ESMC during holdover. */ 2966 extern int bcm_tdpll_esmc_holdover_ql_get( 2967 int unit, 2968 int stack_id, 2969 int dpll_index, 2970 bcm_esmc_quality_level_t *ql); 2971 2972 /* Set quality level (QL) for ESMC during holdover. */ 2973 extern int bcm_tdpll_esmc_holdover_ql_set( 2974 int unit, 2975 int stack_id, 2976 int dpll_index, 2977 bcm_esmc_quality_level_t ql); 2978 2979 /* Get MAC address for ESMC. */ 2980 extern int bcm_tdpll_esmc_mac_get( 2981 int unit, 2982 int stack_id, 2983 int dpll_index, 2984 bcm_mac_t *mac); 2985 2986 /* Set MAC address for ESMC. */ 2987 extern int bcm_tdpll_esmc_mac_set( 2988 int unit, 2989 int stack_id, 2990 int dpll_index, 2991 bcm_mac_t *mac); 2992 2993 /* Get ESMC PDU receive (Rx) enable state. */ 2994 extern int bcm_tdpll_esmc_rx_enable_get( 2995 int unit, 2996 int stack_id, 2997 int *enable); 2998 2999 /* Set ESMC PDU receive (Rx) enable state. */ 3000 extern int bcm_tdpll_esmc_rx_enable_set( 3001 int unit, 3002 int stack_id, 3003 int enable); 3004 3005 /* Get ESMC PDU transmit (Tx) enable state. */ 3006 extern int bcm_tdpll_esmc_tx_enable_get( 3007 int unit, 3008 int stack_id, 3009 int dpll_index, 3010 int *enable); 3011 3012 /* Set ESMC PDU transmit (Tx) enable state. */ 3013 extern int bcm_tdpll_esmc_tx_enable_set( 3014 int unit, 3015 int stack_id, 3016 int dpll_index, 3017 int enable); 3018 3019 /* Get port bitmap for ESMC Rx. */ 3020 extern int bcm_tdpll_esmc_rx_portbitmap_get( 3021 int unit, 3022 int stack_id, 3023 int dpll_index, 3024 bcm_pbmp_t *pbmp); 3025 3026 /* Set port bitmap for ESMC Rx. */ 3027 extern int bcm_tdpll_esmc_rx_portbitmap_set( 3028 int unit, 3029 int stack_id, 3030 int dpll_index, 3031 bcm_pbmp_t pbmp); 3032 3033 /* Get port bitmap for ESMC Tx. */ 3034 extern int bcm_tdpll_esmc_tx_portbitmap_get( 3035 int unit, 3036 int stack_id, 3037 int dpll_index, 3038 bcm_pbmp_t *pbmp); 3039 3040 /* Set port bitmap for ESMC Tx. */ 3041 extern int bcm_tdpll_esmc_tx_portbitmap_set( 3042 int unit, 3043 int stack_id, 3044 int dpll_index, 3045 bcm_pbmp_t pbmp); 3046 3047 /* Set synce clock type as per ITU-T G8264amd2. */ 3048 extern int bcm_tdpll_esmc_essm_code_set( 3049 int unit, 3050 int stack_id, 3051 int dpll_index, 3052 bcm_esmc_essm_code_t essm_code); 3053 3054 /* Get synce clock type as per ITU-T G8264amd2 */ 3055 extern int bcm_tdpll_esmc_essm_code_get( 3056 int unit, 3057 int stack_id, 3058 int dpll_index, 3059 bcm_esmc_essm_code_t *essm_code); 3060 3061 #endif /* BCM_HIDE_DISPATCHABLE */ 3062 3063 /* TDPLL event callback type */ 3064 typedef enum bcm_tdpll_event_cb_type_e { 3065 bcmTdpllEventCbTypeQlChange, /* QL change in ESMC Rx. */ 3066 bcmTdpllEventCbTypeEsmcTimeout, /* Timeout of ESMC Rx PDUs. */ 3067 bcmTdpllEventCbTypeSynceTsMiss, /* SyncE TS event missed. */ 3068 bcmTdpllEventCbTypeLinkDown, /* port linkdown notification. */ 3069 bcmTdpllEventCbTypeMax /* Number of event types supported. */ 3070 } bcm_tdpll_event_cb_type_t; 3071 3072 typedef struct bcm_tdpll_event_cb_data_s { 3073 bcm_tdpll_event_cb_type_t cb_event_type; /* event type that triggered the 3074 callback . */ 3075 void *cb_data; 3076 } bcm_tdpll_event_cb_data_t; 3077 3078 typedef struct bcm_tdpll_ql_change_event_cb_data_s { 3079 bcm_tdpll_event_cb_type_t event_type; /* event type that triggered the 3080 callback. */ 3081 bcm_port_t port; /* Ingress port number for which the QL 3082 change is seen */ 3083 bcm_esmc_quality_level_t ql_old; /* previous QL. */ 3084 bcm_esmc_quality_level_t ql_new; /* current QL. */ 3085 } bcm_tdpll_ql_change_event_cb_data_t; 3086 3087 typedef struct bcm_tdpll_esmc_timeout_event_cb_data_s { 3088 bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */ 3089 bcm_port_t port; /* Ingress port number for which the 3090 ESMC timeout is seen */ 3091 } bcm_tdpll_esmc_timeout_event_cb_data_t; 3092 3093 typedef struct bcm_tdpll_synce_ts_miss_event_cb_data_s { 3094 bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */ 3095 bcm_port_t port; /* Ingress port number for which the TS 3096 event loss is detected */ 3097 } bcm_tdpll_synce_ts_miss_event_cb_data_t; 3098 3099 typedef struct bcm_tdpll_port_linkdown_event_cb_data_s { 3100 bcm_tdpll_event_cb_type_t event_type; /* Event callback type. */ 3101 bcm_port_t port; /* Ingress port number for which the 3102 port linkdown is detected */ 3103 } bcm_tdpll_port_linkdown_event_cb_data_t; 3104 3105 /* prototype for callback function to register for events. */ 3106 typedef int (*bcm_tdpll_event_cb_f)( 3107 int unit, 3108 int stack_id, 3109 bcm_tdpll_event_cb_data_t *data); 3110 3111 #ifndef BCM_HIDE_DISPATCHABLE 3112 3113 /* 3114 * Register the callback for TDPLL related notifications. To be used with 3115 * external DPLL 3116 */ 3117 extern int bcm_tdpll_event_callback_register( 3118 int unit, 3119 int stack_id, 3120 bcm_tdpll_event_cb_f event_cb); 3121 3122 /* 3123 * Unregister the callback for TDPLL related notifications. To be used 3124 * with external DPLL 3125 */ 3126 extern int bcm_tdpll_event_callback_unregister( 3127 int unit, 3128 int stack_id); 3129 3130 /* Initialize Telecom G8265 Profile */ 3131 extern int bcm_ptp_telecom_g8265_init( 3132 int unit, 3133 bcm_ptp_stack_id_t ptp_id, 3134 int clock_num); 3135 3136 /* Get Telecom G8265 Profile Network Option */ 3137 extern int bcm_ptp_telecom_g8265_network_option_get( 3138 int unit, 3139 bcm_ptp_stack_id_t ptp_id, 3140 int clock_num, 3141 bcm_ptp_telecom_g8265_network_option_t *network_option); 3142 3143 /* Set Telecom G8265 Profile Network Option */ 3144 extern int bcm_ptp_telecom_g8265_network_option_set( 3145 int unit, 3146 bcm_ptp_stack_id_t ptp_id, 3147 int clock_num, 3148 bcm_ptp_telecom_g8265_network_option_t network_option); 3149 3150 /* Set Telecom G8265 Quality Level */ 3151 extern int bcm_ptp_telecom_g8265_quality_level_set( 3152 int unit, 3153 bcm_ptp_stack_id_t ptp_id, 3154 int clock_num, 3155 bcm_ptp_telecom_g8265_quality_level_t ql); 3156 3157 /* Set Telecom G8265 Profile Message Receipt Timeout */ 3158 extern int bcm_ptp_telecom_g8265_receipt_timeout_set( 3159 int unit, 3160 bcm_ptp_stack_id_t ptp_id, 3161 int clock_num, 3162 bcm_ptp_message_type_t message_type, 3163 uint32 receipt_timeout); 3164 3165 /* Get Telecom G8265 Profile Message Receipt Timeout */ 3166 extern int bcm_ptp_telecom_g8265_receipt_timeout_get( 3167 int unit, 3168 bcm_ptp_stack_id_t ptp_id, 3169 int clock_num, 3170 bcm_ptp_message_type_t message_type, 3171 uint32 *receipt_timeout); 3172 3173 /* Set Telecom G8265 Profile Packet Stats Thresholds */ 3174 extern int bcm_ptp_telecom_g8265_pktstats_thresholds_set( 3175 int unit, 3176 bcm_ptp_stack_id_t ptp_id, 3177 int clock_num, 3178 bcm_ptp_telecom_g8265_pktstats_t thresholds); 3179 3180 /* Get Telecom G8265 Profile Packet Stats Thresholds */ 3181 extern int bcm_ptp_telecom_g8265_pktstats_thresholds_get( 3182 int unit, 3183 bcm_ptp_stack_id_t ptp_id, 3184 int clock_num, 3185 bcm_ptp_telecom_g8265_pktstats_t *thresholds); 3186 3187 /* List Telecom G8265 Profile Packet Masters */ 3188 extern int bcm_ptp_telecom_g8265_packet_master_list( 3189 int unit, 3190 bcm_ptp_stack_id_t ptp_id, 3191 int clock_num, 3192 int max_master_count, 3193 int *num_masters, 3194 int *best_master, 3195 bcm_ptp_telecom_g8265_pktmaster_t *pktmaster); 3196 3197 /* Get Telecom G8265 Profile Best Packet Master */ 3198 extern int bcm_ptp_telecom_g8265_packet_master_best_get( 3199 int unit, 3200 bcm_ptp_stack_id_t ptp_id, 3201 int clock_num, 3202 bcm_ptp_telecom_g8265_pktmaster_t *pktmaster); 3203 3204 /* Add Telecom G8265 Profile Packet Master */ 3205 extern int bcm_ptp_telecom_g8265_packet_master_add( 3206 int unit, 3207 bcm_ptp_stack_id_t ptp_id, 3208 int clock_num, 3209 int port_num, 3210 bcm_ptp_clock_port_address_t *address); 3211 3212 /* Get Telecom G8265 Profile Packet Master By Address */ 3213 extern int bcm_ptp_telecom_g8265_packet_master_get( 3214 int unit, 3215 bcm_ptp_stack_id_t ptp_id, 3216 int clock_num, 3217 bcm_ptp_clock_port_address_t *address, 3218 bcm_ptp_telecom_g8265_pktmaster_t *pktmaster); 3219 3220 /* Remove Telecom G8265 Profile Packet Master */ 3221 extern int bcm_ptp_telecom_g8265_packet_master_remove( 3222 int unit, 3223 bcm_ptp_stack_id_t ptp_id, 3224 int clock_num, 3225 int port_num, 3226 bcm_ptp_clock_port_address_t *address); 3227 3228 /* Set Telecom G8265 Profile Packet Master Lockout */ 3229 extern int bcm_ptp_telecom_g8265_packet_master_lockout_set( 3230 int unit, 3231 bcm_ptp_stack_id_t ptp_id, 3232 int clock_num, 3233 uint8 lockout, 3234 bcm_ptp_clock_port_address_t *address); 3235 3236 /* Set Telecom G8265 Profile Packet Master Non-Reservation Mode */ 3237 extern int bcm_ptp_telecom_g8265_packet_master_non_reversion_set( 3238 int unit, 3239 bcm_ptp_stack_id_t ptp_id, 3240 int clock_num, 3241 uint8 nonres, 3242 bcm_ptp_clock_port_address_t *address); 3243 3244 /* Set Telecom G8265 Profile Duration Wait */ 3245 extern int bcm_ptp_telecom_g8265_packet_master_wait_duration_set( 3246 int unit, 3247 bcm_ptp_stack_id_t ptp_id, 3248 int clock_num, 3249 uint64 wait_sec, 3250 bcm_ptp_clock_port_address_t *address); 3251 3252 /* Set Telecom G8265 Profile Packet Master Priority Override */ 3253 extern int bcm_ptp_telecom_g8265_packet_master_priority_override( 3254 int unit, 3255 bcm_ptp_stack_id_t ptp_id, 3256 int clock_num, 3257 uint8 override, 3258 bcm_ptp_clock_port_address_t *address); 3259 3260 /* Set Telecom G8265 Profile Packet Master Priority */ 3261 extern int bcm_ptp_telecom_g8265_packet_master_priority_set( 3262 int unit, 3263 bcm_ptp_stack_id_t ptp_id, 3264 int clock_num, 3265 uint16 priority, 3266 bcm_ptp_clock_port_address_t *address); 3267 3268 /* Shutdown Telecom G8265 Profile */ 3269 extern int bcm_ptp_telecom_g8265_shutdown( 3270 int unit); 3271 3272 /* Get enable/disable state of modular system functionality. */ 3273 extern int bcm_ptp_modular_enable_get( 3274 int unit, 3275 bcm_ptp_stack_id_t ptp_id, 3276 int clock_num, 3277 int *enable, 3278 uint32 *flags); 3279 3280 /* Set enable/disable state of modular system functionality. */ 3281 extern int bcm_ptp_modular_enable_set( 3282 int unit, 3283 bcm_ptp_stack_id_t ptp_id, 3284 int clock_num, 3285 int enable, 3286 uint32 flags); 3287 3288 /* Get verbose program control option of modular system functionality. */ 3289 extern int bcm_ptp_modular_verbose_get( 3290 int unit, 3291 bcm_ptp_stack_id_t ptp_id, 3292 int clock_num, 3293 int *verbose); 3294 3295 /* Set verbose program control option of modular system functionality. */ 3296 extern int bcm_ptp_modular_verbose_set( 3297 int unit, 3298 bcm_ptp_stack_id_t ptp_id, 3299 int clock_num, 3300 int verbose); 3301 3302 /* Get PHY port bitmap. */ 3303 extern int bcm_ptp_modular_portbitmap_get( 3304 int unit, 3305 bcm_ptp_stack_id_t ptp_id, 3306 int clock_num, 3307 bcm_pbmp_t *pbmp); 3308 3309 /* Set PHY port bitmap. */ 3310 extern int bcm_ptp_modular_portbitmap_set( 3311 int unit, 3312 bcm_ptp_stack_id_t ptp_id, 3313 int clock_num, 3314 bcm_pbmp_t pbmp); 3315 3316 /* Get PHY timestamping configuration state and data. */ 3317 extern int bcm_ptp_modular_phyts_get( 3318 int unit, 3319 bcm_ptp_stack_id_t ptp_id, 3320 int clock_num, 3321 int *phyts, 3322 int *framesync_pin); 3323 3324 /* Set PHY timestamping configuration state and data. */ 3325 extern int bcm_ptp_modular_phyts_set( 3326 int unit, 3327 bcm_ptp_stack_id_t ptp_id, 3328 int clock_num, 3329 int phyts, 3330 int framesync_pin); 3331 3332 /* Get enable/disable state of C-TDEV processing. */ 3333 extern int bcm_ptp_ctdev_enable_get( 3334 int unit, 3335 bcm_ptp_stack_id_t ptp_id, 3336 int clock_num, 3337 int *enable, 3338 uint32 *flags); 3339 3340 /* Set enable/disable state of C-TDEV processing. */ 3341 extern int bcm_ptp_ctdev_enable_set( 3342 int unit, 3343 bcm_ptp_stack_id_t ptp_id, 3344 int clock_num, 3345 int enable, 3346 uint32 flags); 3347 3348 /* Get verbose program control option of C-TDEV processing. */ 3349 extern int bcm_ptp_ctdev_verbose_get( 3350 int unit, 3351 bcm_ptp_stack_id_t ptp_id, 3352 int clock_num, 3353 int *verbose); 3354 3355 /* Set verbose program control option of C-TDEV processing. */ 3356 extern int bcm_ptp_ctdev_verbose_set( 3357 int unit, 3358 bcm_ptp_stack_id_t ptp_id, 3359 int clock_num, 3360 int verbose); 3361 3362 /* Get C-TDEV recursive algorithm forgetting factor (alpha). */ 3363 extern int bcm_ptp_ctdev_alpha_get( 3364 int unit, 3365 bcm_ptp_stack_id_t ptp_id, 3366 int clock_num, 3367 uint16 *alpha_numerator, 3368 uint16 *alpha_denominator); 3369 3370 /* Set C-TDEV recursive algorithm forgetting factor (alpha). */ 3371 extern int bcm_ptp_ctdev_alpha_set( 3372 int unit, 3373 bcm_ptp_stack_id_t ptp_id, 3374 int clock_num, 3375 uint16 alpha_numerator, 3376 uint16 alpha_denominator); 3377 3378 /* Register a C-TDEV alarm callback function. */ 3379 extern int bcm_ptp_ctdev_alarm_callback_register( 3380 int unit, 3381 bcm_ptp_stack_id_t ptp_id, 3382 int clock_num, 3383 bcm_ptp_ctdev_alarm_cb alarm_cb); 3384 3385 /* Unregister a C-TDEV alarm callback function. */ 3386 extern int bcm_ptp_ctdev_alarm_callback_unregister( 3387 int unit, 3388 bcm_ptp_stack_id_t ptp_id, 3389 int clock_num); 3390 3391 /* Set or Clear the drop counters for a clock port. */ 3392 extern int bcm_ptp_clock_port_drop_counters_enable_set( 3393 int unit, 3394 bcm_ptp_stack_id_t ptp_id, 3395 int clock_num, 3396 uint32 clock_port, 3397 int enable); 3398 3399 /* Set or Clear the drop counters for a clock port. */ 3400 extern int bcm_ptp_clock_port_drop_counters_get( 3401 int unit, 3402 bcm_ptp_stack_id_t ptp_id, 3403 int clock_num, 3404 uint32 clock_port, 3405 bcm_ptp_clock_port_packet_drop_counters_t *per_port_packet_drop_counters); 3406 3407 /* Set flags to be used for overriding BMCA */ 3408 extern int bcm_ptp_clock_bmca_override_set( 3409 int unit, 3410 bcm_ptp_stack_id_t ptp_id, 3411 int clock_num, 3412 uint32 flags, 3413 uint32 enable_mask); 3414 3415 /* Get flags to be used for overriding BMCA */ 3416 extern int bcm_ptp_clock_bmca_override_get( 3417 int unit, 3418 bcm_ptp_stack_id_t ptp_id, 3419 int clock_num, 3420 uint32 *flags, 3421 uint32 *enable_mask); 3422 3423 #endif /* BCM_HIDE_DISPATCHABLE */ 3424 3425 /* Macros required for APTS automatic switching feature. */ 3426 #define BCM_PTP_CLOCK_APTS_MAX_FREQ_SOURCES (3) /* Max number of 3427 frequency sources 3428 supported */ 3429 #define BCM_PTP_CLOCK_APTS_MAX_TIME_SOURCES (2) /* Max number of time 3430 sources supported */ 3431 3432 /* APTS supported sources. */ 3433 typedef enum bcm_ptp_clock_apts_source_e { 3434 bcmPtpClockAptsSourceSynceInternalDpll = 0x01, 3435 bcmPtpClockAptsSourceSynceExternalDpll = 0x02, 3436 bcmPtpClockAptsSourceGps = 0x04, 3437 bcmPtpClockAptsSourcePtp = 0x08, 3438 bcmPtpClockAptsSourceLast = 0xFFFF 3439 } bcm_ptp_clock_apts_source_t; 3440 3441 /* Supported APTS operating modes. */ 3442 typedef enum bcm_ptp_clock_apts_mode_e { 3443 bcmPtpClockAptsModeSyncEGps, /* Frequency source: SyncE, Time source: 3444 GPS */ 3445 bcmPtpClockAptsModeSyncEPtp, 3446 bcmPtpClockAptsModeGpsGps, 3447 bcmPtpClockAptsModePtpPtp, 3448 bcmPtpClockAptsModeSyncEHoldover, 3449 bcmPtpClockAptsModeHoldoverHoldover, 3450 bcmPtpClockAptsModeLast 3451 } bcm_ptp_clock_apts_mode_t; 3452 3453 #ifndef BCM_HIDE_DISPATCHABLE 3454 3455 /* 3456 * This API is used to enable/disable the APTS automatic switching 3457 * feature. 3458 */ 3459 extern int bcm_ptp_clock_apts_enable_get( 3460 int unit, 3461 bcm_ptp_stack_id_t ptp_id, 3462 int clock_num, 3463 int *enable); 3464 3465 /* 3466 * This API is used to enable/disable the APTS automatic switching 3467 * feature. 3468 */ 3469 extern int bcm_ptp_clock_apts_enable_set( 3470 int unit, 3471 bcm_ptp_stack_id_t ptp_id, 3472 int clock_num, 3473 int enable); 3474 3475 /* 3476 * This API is used to get the priority order for time and frequency 3477 * sources. 3478 */ 3479 extern int bcm_ptp_clock_apts_source_prio_get( 3480 int unit, 3481 bcm_ptp_stack_id_t ptp_id, 3482 int clock_num, 3483 int *num_sources, 3484 bcm_ptp_clock_apts_source_t *priority_list); 3485 3486 /* 3487 * This API is used to get the priority order for time and frequency 3488 * sources. 3489 */ 3490 extern int bcm_ptp_clock_apts_source_prio_set( 3491 int unit, 3492 bcm_ptp_stack_id_t ptp_id, 3493 int clock_num, 3494 int num_sources, 3495 bcm_ptp_clock_apts_source_t *priority_list); 3496 3497 /* 3498 * This API can be used by the user application to retrieve the current 3499 * operating mode of the APTS system. 3500 */ 3501 extern int bcm_ptp_clock_apts_mode_get( 3502 int unit, 3503 bcm_ptp_stack_id_t ptp_id, 3504 int clock_num, 3505 bcm_ptp_clock_apts_mode_t *current_mode); 3506 3507 /* 3508 * This API is used by the to indicate if a time and/or frequency source 3509 * is available or not. 3510 */ 3511 extern int bcm_ptp_clock_apts_source_enable_get( 3512 int unit, 3513 bcm_ptp_stack_id_t ptp_id, 3514 int clock_num, 3515 bcm_ptp_clock_apts_source_t source, 3516 int *enable); 3517 3518 /* 3519 * This API is used by the to indicate if a time and/or frequency source 3520 * is available or not. 3521 */ 3522 extern int bcm_ptp_clock_apts_source_enable_set( 3523 int unit, 3524 bcm_ptp_stack_id_t ptp_id, 3525 int clock_num, 3526 bcm_ptp_clock_apts_source_t source, 3527 int enable); 3528 3529 #endif /* BCM_HIDE_DISPATCHABLE */ 3530 3531 /* PTP External PHY sync - Pin to be used for PHY Framesync (SYNC_IN1) */ 3532 typedef enum bcm_ptp_extphy_framesync_pin_e { 3533 bcm_ptp_extphy_framesync_pin_tsgpio0 = 0, /* TS GPIO0 */ 3534 bcm_ptp_extphy_framesync_pin_tsgpio1 = 1, /* TS GPIO1 */ 3535 bcm_ptp_extphy_framesync_pin_gpio0 = 2, /* GPIO0 */ 3536 bcm_ptp_extphy_framesync_pin_gpio1 = 3, /* GPIO1 */ 3537 bcm_ptp_extphy_framesync_pin_gpio2 = 4, /* GPIO2 */ 3538 bcm_ptp_extphy_framesync_pin_gpio3 = 5 /* GPIO3 */ 3539 } bcm_ptp_extphy_framesync_pin_t; 3540 3541 /* PTP External PHY sync - Pin configured for PHY 4KHz reference */ 3542 typedef enum bcm_ptp_extphy_freq_pin_e { 3543 bcm_ptp_extphy_freq_pin_bs0_hb = -1, /* BS0 Heartbit */ 3544 bcm_ptp_extphy_freq_pin_bs1_hb = -2 /* BS1 hearbit */ 3545 } bcm_ptp_extphy_freq_pin_t; 3546 3547 /* 3548 * PHY sync user function that will be called while running phy sync 3549 * state machine 3550 */ 3551 typedef int (*bcm_ptp_external_phy_sync)( 3552 int unit, 3553 int stack_id, 3554 int clock_num, 3555 bcm_pbmp_t pbm, 3556 uint64 ref_phase); 3557 3558 /* PTP external PHY config */ 3559 typedef struct bcm_ptp_external_phy_config_s { 3560 bcm_ptp_extphy_framesync_pin_t framesync_pin; /* Pin to be used for PHY Framesync 3561 (SYNC_IN1) e.g. GPIO3 */ 3562 bcm_ptp_extphy_freq_pin_t freq_pin; /* Pin configured for PHY 4KHz reference 3563 - BS0 HB or BS1 HB */ 3564 uint64 cpu_latency_nsec; /* Latency to configure external phy 3565 ports */ 3566 bcm_pbmp_t pbm; /* external phy port bitmap e.g ge0-ge3 */ 3567 bcm_ptp_external_phy_sync ext_physync_func; /* PHY sync user function will be called 3568 while running phy sync state machine */ 3569 } bcm_ptp_external_phy_config_t; 3570 3571 #ifndef BCM_HIDE_DISPATCHABLE 3572 3573 /* Run state machine to synchronize CMIC time with external PHY time */ 3574 extern int bcm_ptp_external_phy_synchronize( 3575 int unit, 3576 bcm_ptp_stack_id_t ptp_id, 3577 int clock_num, 3578 bcm_ptp_external_phy_config_t extphy_config); 3579 3580 #endif /* defined(INCLUDE_PTP) */ 3581 3582 #endif /* BCM_HIDE_DISPATCHABLE */ 3583 3584 #endif /* __BCM_PTP_H__ */