openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

temod_doc.h (74393B)


      1 /*
      2 /*
      3    This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4    
      5    Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6 */
      7 /*!
      8 \page temod-doc TEMod Documentation
      9 
     10 \tableofcontents
     11 
     12 \section temod-intro Introduction to TEMod/EagleMod
     13 
     14 TSCE is a 28 nm quad link full physical layer interface designed to support link
     15 speeds from 10M up to 42G. It consists of the TSC PCS sublayer and the
     16 Eagle PMD sublayer.  TEMod, <b>T</b>DM Serdes controller <b>E</b>agle
     17 <b>Mod</b>ule, is the software driver for TSCE. The Eagle is also used
     18 standalone for non-PCS applications. EagleMod, <b>Eagle</b> <b>Mod</b>ule is the
     19 software driver for Eagle.
     20 
     21 TEMod is a source-code distributable C library that implements a hardware
     22 abstraction layer for all the configuration modes of the 10G Broadcom phy IPs.
     23 The phy can contain the PCS sub-layer working in concert with the PMD sub-layer,
     24 (in which case the phy is called TSCE) or can be the PMD sub-layer only (in
     25 which case the phy is called Eagle). The OSI reference model is shown below as a
     26 quick reference. However this document expects the reader to be familiar with
     27 not only general PHY architecture both the TSCE-PCS+PMD and the Eagle-PMD
     28 architectures.
     29 
     30 @image html osilayers.jpg "OSI LAYERS"
     31 
     32 Acronyms used in this document are at http://www.broadcom.com/press/glossary.php
     33 
     34 TEMod has an unambiguous interface to system platforms: Platforms can
     35 be software platforms like MDK, SDK, customer specific software OR validation
     36 platforms including HDL (verilog/systemVerilog/Vera) based testbenches.
     37 TEMod has a tiered structure which progressively encapsulates register accesses
     38 and sequences hiding complexities of register addressing, and access protocol
     39 implementations.  The first layer, 'Tier1 functions' each partially configure
     40 the TSCE. and are used to create comprehensive configurations in the
     41 calling 'Tier2' layers. Tier2 layers are called by PHYMod dispatch layers which
     42 are connected to PHYMod APIs. These APIs can be  called from customer code such
     43 as BCM APIs  or diag shell commnds in Broadcom-SDK,
     44 
     45 Tier1 procedures don't have a fixed argument list like in the past. They accept
     46 variable number of arguments and return success/failure code. If additional
     47 values need to be returned, calling layers pass references which the tier1s will
     48 modify. For example, to get the serdes Identification, pass a integer pointer
     49 to the tier1 which reads the serdes id.
     50 
     51 All tier1 functions operate on a single core. It can be used to access multiple
     52 lanes within the TSCE, sometimes simultaneously (a.k.a broadcast) but it cannot
     53 access multiple TSCEs simultaneously. This is true even for TSCE12 (which is
     54 built using 3 TSCE cores).
     55 
     56 TEMod documentation is created using doxygen and follows the TEMod code
     57 structure. The following files contain relevent documentation.
     58 
     59 \li \ref temod_doc.h : Basic documentation not specific to the code. (this file)
     60 \li \ref temod_cfg_seq.c : TSC PCS Tier1 sequences
     61 \li \ref temod_enum_defines.c : Enumerated type related functions.
     62 \li \ref temod_diagnostics.c : Diagnostic information of the PHY.
     63 \li \ref temod_sc_lkup_table.c :  The speed look up table in PCS.
     64 \li \ref eagle_tsc_interface.h :  Eagle PMD Tier1 sequences.
     65 
     66 TEMod configures PHYs per logical port. Usually a specific lane of the port is
     67 all that needs to be accessed to program the port.
     68 
     69 -# lane 0 -> quad lane modes
     70 -# lane 0/2 for dual modes
     71 -# lane '0/1/2/3' for single lane modes
     72 
     73 However the lanes can also be explicitly selected. The lane specific
     74 information, when operating on multiple lanes, is encoded in an integer type
     75 (usually 1 byte per lane). When the information doesn't 'fit' into 8 bits, we
     76 pass in multiple arguments as required.
     77 
     78 \section portmode-lane Port modes and lanes of TSCE
     79 
     80 TSCE is a quad lane PHY. It supports one or more ports based on port-modes.
     81 
     82 -# Single Port Mode
     83   -# All lanes combine to form a single port
     84 -# Dual Port Mode
     85   -# Lanes 0 and 1 combine to form a dual port
     86   -# Lanes 2 and 3 combine to form another dual port
     87 -# Tri1 Port Mode
     88   -# Lanes 2 and 3 combine to form a dual port
     89   -# Lanes 0 forms a single lane port
     90   -# Lanes 1 forms a single lane port
     91 -# Tri2 Port Mode
     92   -# Lanes 0 and 1 combine to form a dual port
     93   -# Lanes 2 forms a single lane port
     94   -# Lanes 3 forms a single lane port
     95 -# Quad Port Mode
     96   -# Lanes 0 forms a single lane port
     97   -# Lanes 1 forms a single lane port
     98   -# Lanes 2 forms a single lane port
     99   -# Lanes 3 forms a single lane port
    100 -# Multi Core Mode (TSCE12 only)
    101   -# Three cores are used to form a single core.
    102   -# Each of these 3 cores can be independent (and have all portmodes above)
    103   -# They combine to form a 100G/106G port (10 lanes, 2 lanes unused)
    104   -# They combine to form a 120G/127G port (12 lanes)
    105 -# QSGMII Port mode
    106   -# TBD.
    107 
    108 We can have 1/2/3/4 ports per core. Each port can support different speeds.
    109 
    110 \section regacc-sec TEMod Register Access Methods
    111 
    112 TSCE does not use traditional MDIO bus protocol but instead uses the  TO_TSC
    113 bus. TO_TSC is an 8 bit high speed bus, connected to the SBUS via an indirect
    114 accessing scheme at chip level. It has a 32 bit address with the following
    115 fields.
    116 
    117 -# Bits 15:0   : 16-bit register address.
    118 -# Bits 18:16 : AER mode. The ports and lanes affected are as follows.
    119   -# 0: Port 0 - one lane  (Logical Lane 0)
    120   -# 1: Port 1 - one lane  (Logical Lane 1)
    121   -# 2: Port 2 - one lane  (Logical Lane 2)
    122   -# 3: Port 3 - one lane  (Logical Lane 3)
    123   -# 4: Port 4 - two lanes (Logical Lanes 0 and 1)
    124   -# 5: Port 5 - two lanes (Logical Lanes 2 and 3)
    125   -# 6: Port 6 - four lane (Logical Lanes 0, 1, 2, and 3)
    126   -# 7: Undefined.
    127 -# Bits 23:19 : Port ID. The TSCE has up to 4 ports.
    128   -# 0:Port 0 ID = prtad_strap_dst
    129   -# 1:Port 1 ID = prtad_strap_dst + 1
    130   -# 2:Port 2 ID = prtad_strap_dst + 2
    131   -# 3:Port 3 ID = prtad_strap_dst + 3
    132 -# Bits 31:27 : Device ID (0 or PCS, 1 for PMD)
    133 
    134 prtad_strap_dst is a strap used to identify an instance of a TSCE within a chip.
    135 This value is inserted in the 23:19.
    136 
    137 To broadcast to registers of 4 lanes, set 18:16 to '6'. There is another
    138 elaborate broadcast mechanism involving a special register main0_prtad_bcast
    139 (broadcast to ports whose main0_multiPRTs_en bit are set). Ignore that. It is an
    140 artifact of TSC12 register access broadcast. The TSC12 does not have a 12 lane
    141 broadcast facility, though this information was in the works at one time.
    142 
    143 Typically the TSCE is embedded in port hardware. The PHY access is made by using
    144 a port level interface (there are a couple: SBUS or PBUS) mechanism. This
    145 mechanism writes to a memory (ucmem) in the port. Port logic will then translate
    146 this to TSCE understandable TO_TSC protocol. This indirection is true for both
    147 registers and memories. The next few sections explain the register and memory
    148 access mechanisms from the port level.
    149 
    150 \subsection bcst-sec The Port indirect address mechanism to access PHY
    151 
    152 TSCE Register accesses are performed by accessing the PORT_WC_UCMEM_DATA memory in
    153 the port sub-system. Software will have to access the memory and some
    154 associated port registers.
    155 
    156 \subsubsection irw TSC Register write.
    157 
    158 -#  Program PORT_WC_UCMEM_CTRL.ACCESS_MODE to 0
    159   -# 0 to access the TSC registers
    160   -# 1 to access the TSC ucode memory
    161 -#  Do a MEM_WR to the zeroth entry (16B or 128b) of PORT_WC_UCMEM_DATA memory
    162   -# 127-65 : Don't care
    163   -# 64     : 1 (reg. write)
    164   -# 63-48  : Write data
    165   -# 47-32  : Write Mask
    166   -# 31-0   : TSC Address
    167 
    168 \subsubsection irr TSC Register Read
    169 
    170 -#  Program PORT_WC_UCMEM_CTRL.ACCESS_MODE to 0
    171   -# 0 to access the TSC registers
    172   -# 1 to access the TSC ucode memory
    173 -#  Do a MEM_WR to the zeroth entry (16B or 128b) of PORT_WC_UCMEM_DATA memory
    174   -# 127-65 : Don't care
    175   -# 64     : 0 (reg. write)
    176   -# 63-48  : Don't care
    177   -# 47-32  : Don't care
    178   -# 31-0   : TSC Address
    179 -#  Do a MEM_RD to the zeroth entry (16B or 128b) of PORT_WC_UCMEM_DATA memory
    180   -# The read data will be in 47:32 of the zeroth entry.
    181 
    182 \subsubsection imr TSC Memory Write
    183 
    184 -#  Program PORT_WC_UCMEM_CTRL.ACCESS_MODE to 1
    185   -# 0 to access the TSC registers
    186   -# 1 to access the TSC ucode memory
    187 -#  Do a MEM_WR to any of the 2K entries of PORT_WC_UCMEM_DATA memory
    188   -# TSC ucode mem.addr. is got from the PORT_WC_UCMEM_DATA memory entry no.
    189   -# 127-0  : 16 bytes of data
    190 
    191 \subsubsection imw TSC Memory Read
    192 
    193 -#  Program PORT_WC_UCMEM_CTRL.ACCESS_MODE to 1
    194   -# 0 to access the TSC registers
    195   -# 1 to access the TSC ucode memory
    196 -#  Do a MEM_RD to any of the 2K entries of PORT_WC_UCMEM_DATA memory
    197   -# TSC ucode mem.addr. is got from the PORT_WC_UCMEM_DATA memory entry no.
    198   -# 127-0  : 16 bytes of data is returned on SBUS
    199 
    200 \section regmacro-sec User Register Access
    201 
    202 TEMod configures the PHY by accessing its registers. Since multiple platforms
    203 adopt TEMod, it has a virtual register access method to read, write, and modify
    204 registers.  TEMod uses a auto-generated macro set to identify registers
    205 individually. The macros call these virtual routines which eventually attach to
    206 platform specific register access methods, such as device driver functions or
    207 verilog tasks.
    208 
    209 The virtual register access function is described below using the 'read'
    210 function as an example. Write and modify are similarly implemented.
    211 
    212 \code
    213 Register: PHYID2 (Adr:0x0002). This is a read only IEEE Id. register
    214 READ_PHYID2r(pa, ...)
    215   -> phymod_tsc_iblk_read(pa, ...)
    216      -> PHYMOD_BUS_READ(pa, ...)
    217         -> phymod_bus_read(pa, ...)
    218            -> pa->read(...)
    219 \endcode
    220 
    221 The last function is actually a pointer to the read function supplied by the
    222 platform. For most chips it will be a PCIE transaction which calles an internal
    223 system bus (SBUS/PBUS for serial or parallel versions) protocol which the
    224 hardware translates to TO_TSC protocol bus of TSCE. For chips that just use the
    225 Eagle PHY (like FE3200), the the SBUS/PBUS translates to MDIO protocol. Note,
    226 both PCS and PMD registers are accessed similarly, differing only in their devid
    227 fields.
    228 
    229 Some user level examples for broadcom-SDK diagshells are listed below. For more
    230 details please refer to
    231 http://confluence.broadcom.com/display/NTSWSW/PHYMOD+Simulator and click on
    232 'SDK CLI with TSC/Eagle Simulator' The register access section has extensive
    233 examples of how to access registers.
    234 
    235 To read a PCS register, (0xabcd), do the following.
    236 \code
    237 BCM.0> phy xe0 0x0abcd  ## lane 0
    238 BCM.0> phy xe0 0x1abcd  ## lane 1
    239 BCM.0> phy xe0 0x2abcd  ## lane 2
    240 BCM.0> phy xe0 0x3abcd  ## lane 3
    241 \endcode
    242 
    243 Similarly, to write a PCS register, (0xabcd), do the following.
    244 \code
    245 BCM.0> phy xe0 0x'n'abcd  ## lane 'n'
    246 \endcode
    247 To broadcast write a PCS register, (0xabcd), do the following.
    248 \code
    249 BCM.0> phy xe0 0x6abcd  ## bits 18:16 -> 6 means broadcast
    250 \endcode
    251 
    252 PHYMod supports symbolic register access. This makes it easier to read
    253 registers without having to remember the addresses. Please note that the
    254 register name is transformed to an easier name. This will be reflected in the
    255 register documentation for TSCE.
    256 
    257 Here are some examples of how to use symbolic names.
    258 
    259 List the DME LOCK register. This gives the address and field info.
    260 \code
    261 BCM.0> phy xe0 AN_CL73_DME_LOCKr
    262 Port xe0:
    263 AN_CL73_DME_LOCKr [0x70109255] = 0x0000
    264         PD_DME_LOCK_TIMER_PERIOD<15:0>=0x0
    265 \endcode
    266 
    267 Let's say you know the address but not the symbolic name. You can do a reverse
    268 lookup
    269 
    270 \code
    271 BCM.0> phy xe0 list 0x9255
    272 Port xe0:
    273 Name:     AN_CL73_DME_LOCKr (AN_X1_TIMERS_CL73_DME_LOCK)
    274 Address:  0x9255 (1 copy only)
    275 Fields:   1
    276         PD_DME_LOCK_TIMER_PERIOD<15:0>
    277 \endcode
    278 
    279 Now let's read the laneswap register. (Note: We will now only read the relevent
    280 lane of the port. If there are two or four copies of these registers, you will
    281 have access only to the active lane of that port. For example if this is a
    282 single port mode  (like 40G) you will read the register in lane 0.
    283 
    284 \code
    285 BCM.0> phy xe0 raw LANE_SWAPr
    286 Port xe0:
    287 LANE_SWAPr [0x70109003] = 0x00e4
    288 \endcode
    289 
    290 Write to laneswap register
    291 \code
    292 BCM.0> phy xe0 LANE_SWAPr 0x1b
    293 BCM.0> phy xe0 raw LANE_SWAPr
    294 Port xe0:
    295 LANE_SWAPr [0x70109003] = 0x001b
    296 \endcode
    297 Reset the register. i.e. reset the register to the advertised post-reset
    298 default.
    299 \code
    300 BCM.0> phy xe0 reset LANE_SWAPr
    301 \endcode
    302 Verify that the reset took effect.
    303 \code
    304 BCM.0> phy xe0 raw LANE_SWAPr
    305 Port xe0:
    306 LANE_SWAPr [0x70109003] = 0x00e4
    307 \endcode
    308 
    309 Wild cards are allowed in symbolic access.
    310 You can list all registers:
    311 \code
    312 BCM.0> phy xe0 list *
    313 \endcode
    314 
    315 You can even reset all registers.
    316 \code
    317 BCM.0> phy xe0 reset *
    318 \endcode
    319 
    320 \section funclist-set The TEMod Tier1 function list.
    321 
    322 The list of Tier1 functions and documentation is in \ref temod_cfg_seq.c
    323 and \ref eagle_tsc_interface.h
    324 
    325 \section config-sec Configuration of the PHY
    326 
    327 The TSCE PHY has two PHY sub-layer components. The PCS and the PMD sub-layer.
    328 The PMD sub-layer is referred to as Eagle. The PCS layer is sometimes referred
    329 to as TSCE or PCS. The PHY is configured by configuring both PCS and PMD sub
    330 layers. The PHY driver in this case is called TEMod. In some applications where
    331 the switch talks to the fabric interface, for example, only the PMD sub-layer is
    332 used (aka Eagle). The PHY driver in this case is called EagleMod.
    333 
    334 The term 'PMD' encompasses both PMD/PMA sub layers and AFE. The Eagle PMD used
    335 in TSCE is a 40Gbps quad Serdes, basic configuration being a quad 10Gbps serdes
    336 targeted for optical and backplane applications. It supports raw data rates from
    337 6.25bps to 10.9375 Gbps.
    338 
    339 \subsection pcscfg-sec PCS Configuration
    340 
    341 PCS is configured while keeping the datapaths in reset.
    342 
    343 -# reset
    344 -# configure the PCS
    345 -# release reset
    346 
    347 PCS configuration is mainly dependent on the link baud rate.  This defines the
    348 speed at which to run the PCS. Speed will also define the number of lanes and
    349 portmode required.
    350 
    351 The PCS configuration can be done in one of four ways.
    352 
    353 -# canned configuration
    354 -# canned+override configuration
    355 -# custom configuragtion
    356 -# Bypass configuration
    357 
    358 TEMod only supports the first three methods. The fourth mode is used in debug
    359 efforts outside of TEMods control.
    360 
    361 \subsection cnspd canned configuration
    362 
    363 PCS has a built in table (aka Speed config Table or SC table), for all supported
    364 speeds. In canned configuration mode, TEMod selects the table entry of the
    365 required speed and triggers the speed config. hardware in PCS to configure all
    366 PCS sub-systems. This is the simplest mode of configuring the PCS. Note: A copy
    367 of the SC table is stored in TEMod, mostly for verification and override
    368 purposes. You can see it in \ref temod_sc_lkup_table.h as a structure
    369 #sc_table_entry_t
    370 
    371 \subsection cnospd canned+override speed
    372 
    373 In canned+override speed mode PCS uses the SC table for supported speeds,
    374 however but selectively overrides some of the configurations.
    375 
    376 \subsection custspd custom speed
    377 
    378 In custom speed mode PCS has four programmable SC table entries for four
    379 custom speeds. TEMod can set the complete entries with custom configuration.
    380 
    381 \subsection bypassspd bypass speed
    382 
    383 In bypass configuration mode the PCS SC table is not used. All sub-systems in
    384 PCS are to be configured by TEMod, and further the resets of PCS and PMD are to
    385 be orchestrated by TEMod.  <b>TEMod does not support this mode</b>. Raw register
    386 programming/scripts should be used for this purpose.
    387 
    388 Once the PCS is fully configured by any of the 3 (non bypass) methods above,
    389 TEMod writes to a speed register (SW_SPEED register) in PCS, and sets the
    390 SW_SPEED_CHANGE bit.  This triggers the PCS to fully configure itself.
    391 
    392 The next stage is to program the PMD.
    393 
    394 \subsection epmdcfg-sec PMD Configuration
    395 
    396 The comprehensive guide to Eagle PMD configuration is in the Eagle Programmers
    397 Guide.
    398 http://ingbu.broadcom.com/hsip/serdes/eagle/User%20Documentation/PMD/Eagle%20Programmers%20Guide.pdf
    399 
    400 A significant improvement in the PMD architecture is reset management and the
    401 relationship between resets and configuration. PMD supports the following reset
    402 controls.
    403 
    404 -# PMD hard reset. (power on) (comes from primary input only)
    405 -# PMD core Datapath reset  (comes from primary input and PMD register)
    406 -# PMD Lane Datapath reset (comes from primary input and PMD register)
    407 
    408 All configuration to PMD is done while the datapaths are in reset. All
    409 configuration is realized when PMD datapath is out of reset.
    410 
    411 The resets are controlled by both PCS and by TEMod. This is shown below.
    412 
    413 @image html pmd_resets.jpg "PMD RESETS"
    414 
    415 The Eagle PMD IP can be used in two ways.
    416 
    417 -# Independent (Standalone) (example SPDR2 chip)
    418 -# Dependent (PCS linked)   (example Trident2 chip)
    419 
    420 PMD is configured by a combination of TEMod and the PMD firmware (ucode). the
    421 ucode gets its information either from TEMod or from a mailbox register
    422 associated with the PCS. The configuration procedure depends on the link being
    423 set via auto-negotiation or forced speed. So there are multiple
    424 different procedures to bring the PMD to the required configuration (explained
    425 further below)
    426 
    427 Some mode/PCS agnostic PMD attributes are always configured by TEMod. For
    428 details, please refer to the Eagle Programmer's guide.
    429 
    430 As the general first step, TEMod takes PMD out of hard reset. This allows TEMod
    431 to access the PMD registers. However all configuration is done with the PMD
    432 datapaths kept in reset. The configuration takes effect, sort of atomically,
    433 when TEMod or PCS takes PMD datapaths out of reset.
    434 
    435 -# Take PMD out of hard reset
    436 -# Keep PMD in  datapath reset
    437 -# program core specific parameters
    438 -# program lane specific parameters
    439 -# Take PMD out of datapath reset
    440 
    441 \subsubsection ind-prog-sec Independent Mode Programming
    442 
    443 In this case, the TSC-PCS is not involved. The driver employed is 'EagleMod'.
    444 The required PMD configuration is done entirely by EagleMod. To program the PMD.
    445 The EagleMod sequence will look like so.
    446 
    447 -# Hold the PMD in reset
    448 -# Program the PMD as mentioned in \ref epmdcfg-sec
    449 -# Unreset the PMD
    450 
    451 \subsection dep-ecfg-sec PCS Dependent Mode PMD configuration
    452 
    453 In dependent mode configuration, PMD and PCS together form a PHY.  If the PHY is
    454 in forced speed mode PCS and PMD are fully configured by TEMod. In auto
    455 negotiation mode PCS is programmed by TEMod and certain aspects of PMD
    456 configuration are done by ucode using PCS hints.
    457 
    458 Forced speed and auto negotiation links require different treatment. In forced
    459 speed mode, PMD is configured entirely by TEMod. In auto negotiation modes, PMD
    460 configuration must be done after auto negotiationotiation has resolved the link
    461 rate. At this point TEMod cannot be involved, So PCS configures the PMD. The PCS
    462 writes the configuration to a PMD register which is picked up by the ucode,
    463 which then configures the PMD.  (ucode cannot program PMD without this info).
    464 
    465 PCS sends both per core and per lane 20 bit encoding to ucode as shown below.
    466 
    467 \li Core <b>dig_com_pmd_core_mode_status</b>:{Rsrvd[3:0], OTP_options[3:0], core_speed_id[7:0]}
    468 \li Lane <b>ckrst_ctrl_pmd_pmd_lane_mode_status</b>:{Rsrvd[4:0], CL72_en, scrambler_dis, eee_mode_en, lane_speed_id[7:0]}
    469 
    470 The PMD ucode reads the info in these registers, decodes it and configures PMD
    471 blocks. The ucode is directed to either honor or ignore these register by TEMod.
    472 TEMod provides this direction depending on the port being in auto negotiation or forced
    473 modes. Two PMD fields are used for this purpose
    474 
    475 \li core_config_from_pcs
    476 \li lane_config_from_pcs
    477 
    478 More details of this in the Eagle Programmer's guide.
    479 
    480 @image html phy28-pcs-pmd-cfg.jpg "PCS PMD CONFIGURATION"
    481 
    482 \subsection fs-mode-sec Forced speeds Mode
    483 
    484 In forced speed mode, the PCS and PMD are configured completely by TEMod.  The
    485 PHY configuration will be as shown below
    486 reset.
    487 -# Configure PMD as mentioned in \ref epmdcfg-sec
    488 -# Program the PCS (use one of the init, set up speed)
    489 -# (Wait for status update and read Status registers)
    490 -# (Compare PCS Stats)
    491 -# (PCS will release the PMD resets. PMD will start cranking)
    492 -# (Wait for PLL_LOCK. If PMD is out of reset, pll will lock)
    493 -# (Wait for PMD_LOCK. If PMD is out of reset and receeiving data PMD will lock)
    494 -# Wait for PCS_LINK
    495 
    496 -# Take PMD out of hard reset.
    497 -# Reset the config_from_pcs (to 0), so PMD config is software controlled.
    498 -# Reset PMD. This step is not needed if PCS is holding PMD in reset.
    499 -# Program the PMD as mentioned in \ref epmdcfg-sec
    500 -# Unreset PMD datapath. If PCS is holding PMD in reset, it will still be in reset.
    501 -# Program the PCS (init, set up speed)
    502 -# (Wait for status update and read Status registers)
    503 -# (Compare PCS Stats)
    504 -# (PCS will take PMD datapaths out of reset.)
    505 -# (Wait PLL_LOCK)
    506 -# (Wait PMD_LOCK)
    507 -# (Wait for PCS_LINK)
    508 
    509 Steps in parenthesis are not required, but are mentioned because they can
    510 be added in the driver for diagnostics.
    511 
    512 Note: QSGMII modes are different. It involves QSGMII PCS and not the TSCE PCS.
    513 
    514 -# TEMod sets TSCE-PCS in ILKN mode. (bypasses datapath into QSGMII PCS)
    515 -# TSC-PCS no longer controls the PMD resets.
    516 -# TEMod configures PMD for required speed.
    517 -# TEMod configures QSGMII-PCS (1G/100M/10M only for now)
    518 -# (Wait for PLL_LOCK. If PMD is out of reset, pll will lock)
    519 -# (Wait for PMD_LOCK. If PMD is out of reset and receeiving data PMD will lock)
    520 -# QSGMII-PCS will come out of reset when it sees pmd_lock.
    521 
    522 \subsection pmd-aneg-sec Auto-Negotiation Mode
    523 
    524 In auto negotiation modes, the PMD is first minimally configured so that the AN pages can
    525 be exchanged. Initially TEMod will set PMD for the relevant AN mode (CL37AN or
    526 CL73AN).  It will keep PMD in reset, configure it, and unreset it. After this
    527 the pages get exchanged and PCS will resolve the actual speed. It will now again
    528 put the
    529 PMD in reset, and reconfigure the PMD to the new resolved speed.
    530 
    531 The TEMod programming sequence for AN will look like so.
    532 
    533 -# TEMod configures PMD attributes.(for CL37 or CL73 exchange)
    534 -# TEMod sets cfg_from_PCS bit. (i.e. future programming from PCS)
    535 -# Unreset the PMD datapath.
    536 -# Program the PCS (for CL37 or CL73 auto negotiationotiation)
    537 -# TEMod creates a posedge on auto-neg_enable/restart bit in PCS.
    538 -# (now AN page exchange happens and resolves to a certain speed)
    539 -# (PCS will now reset the PMD)
    540 -# (PCS will configure the PMD with the help of ucode.)
    541 -# Wait for auto negotiation complete indication from PCS or PCS_LINK
    542 
    543 -# Set the config_from_pcs (to 1), so PMD config is software controlled.
    544 -# TEMod configures PMD.(for CL37 or CL73 exchange)
    545 -# TEMod sets cfg_from_PCS bit. (i.e. future programming from PCS)
    546 -# Unreset the PMD datapath.
    547 -# Program the PCS (for CL37 or CL73 auto negotiationotiation)
    548 -# TEMod starts auto negotiation via auto-neg_enable/restart bit in PCS.
    549 -# (now AN page exchange happens and resolves to a certain speed)
    550 -# (PCS will now reset the PMD)
    551 -# (PCS will configure the PMD with the help of ucode.)
    552 -# Wait for auto negotiation complete indication from PCS or PCS_LINK
    553 
    554 \section els-sec Lane Swap
    555 
    556 Lane swapping provides a means to associate any specific component of the MAC
    557 byte stream to any physical PMD lane. In simpler terms any physical data stream
    558 can be associated with any logical port by lane swapping. This association is
    559 configurable in both PCS and PMD sub-layers.
    560 
    561 The physical lanes in PMD can be switched to represent different logical lanes.
    562 TX and RX are independently software controlled. In the Eagle PMD, only the TX
    563 of lanes are swappable. RX is fixed.
    564 
    565 The PCS laneswap configuration works slightly differently. It is paired so that
    566 both TX and RX will be swapped at once.
    567 
    568 For a complete laneswap solution both PCS and PMD laneswapping should be used.
    569 The PCS should first be configured to 'fix' the RX. At this point, the RX paths
    570 will be correct, but the TX will not. The PMD should now be configured to 'fix'
    571 the TX. Thus, even though the PCS and PMD lane swapping are independent, TEMod
    572 must ensure that swapping is meaningful.
    573 
    574 Lane swapping also changes the configuration access. i.e. the physical lane
    575 being configured will be different from the logical lane due to lane swapping.
    576 Therefore swapping is configured while the datapath is in reset making it a
    577 static configuration. Dynamic swapping is not supported.
    578 
    579 As a simple example, consider the need to swap the physical RX lane 0 to logical
    580 port 3. The PCS is first configured to swap the entire RX/TX Lane 0 pair to
    581 logical port 3. The PMD is then configured to swap the tx of lane 3 to lane 0.
    582 
    583 From customers perspectives, they need to set the soc preperties
    584 xgxs_tx_lane_map and xgxs_rx_lane_map to control lane swap in the chip in order
    585 to compensate the lane swap in the board routing.   Historically the notation
    586 for WC platforms (TD+ and TR3) xgxs_tx_lane_map is physical lane base, but
    587 xgxs_rx_lane_map is the logic lane base.  The physical lane base notation is
    588 that the digit positions are based on physical lane as P3P2P1P0.
    589 
    590 - For example in WC, xgxs_tx_lane_map=0x2031 means
    591   - physical lane 3 is to connect to logic lane 2,
    592   - physical lane 2 is to connect to logic lane 0,
    593   - physical lane 1 is to connect to logic lane 3, and
    594   - physical lane 0 is to connect to logic lane 1.
    595 - Another WC example for xgxs_rx_lane_map=0x1320 which is logic lane base:
    596   it has
    597   - logic lane 3 is to connect to physical lane 1,
    598   - logic lane 2 is to connect to physical lane 3,
    599   - logic lane 1 is to connect to physical lane 2, and
    600   - logic lane 0 is to connect to physical lane 0.
    601 
    602 The notation for TD2 and TD2+ are the opposite: xgxs_tx_lane_map is logic lane
    603 base, and xgxs_rx_lane_map is the physical lane base due to different mapping
    604 design.
    605 
    606 Otherwise the rest of platforms for TSCE and TSCF should assume both
    607 xgxs_tx_lane_map and xgxs_rx_lane_map are all logic lane base.
    608 
    609 \image html phy28laneswap.jpg
    610 
    611 \section loopback-usage Loopbacks
    612 
    613 Loopbacks are controls to alter datapath for diagnostic purposes. At the PHY
    614 level the following loopbacks are supported. The term 'gloop' mean global loop
    615 backs and  'rloop' means remote loopback. In general loopbacks are supported for
    616 all speed modes.  TSCE does not support loopbacks when autonegotiation is
    617 enabled. TSCE does not support gloops when link training (CL72) is enabled.
    618 For ports which use autonegotiation or link training, the port has to be
    619 reconfigured to a similar forced speed configuration prior to loopback. When
    620 loopback is removed, the original configuration can be reapplied.
    621 For rloops, TSCE expects zero ppm offset with link partner. For non-zero PPM,
    622 the ppm offset of lane 0 will be applied to all lanes, which may cause
    623 inaccuracies.
    624 
    625 - PCS-gloop: Loop back data path to system before entering PMD. All PCS blocks
    626   are included.
    627 - PMD-gloop: Loop back data path to system before entering Analog
    628   serializers/deserializers. The entire PCS datapath is included along with PMD
    629   digital datapath.
    630 - PMD-rloop: Loop back data path to line before entering PCS TSCE supports only
    631   PMD  remote loopbacks.
    632 - PCS-rloop: Loop back data path to line before entering MAC TSCE does not
    633   support PCS remote loopbacks.
    634 
    635 @image html loopbacks.jpg "Loopbacks in PHY"
    636 
    637 \section prbs-usage PRBS and Pattern Generation.
    638 
    639 TSCE supports PRBS generation(TX) and check(RX) on a per lane basis. The TX and
    640 RX requiremens are decoupled. i.e. they can be on seperate PRBS patterns. This
    641 is the default mode in setting PRBS.  Please refer to the PRBS section (4.3.1)
    642 of the Eagle Programmer's guide for more details.
    643 
    644 When PRBS is enabled, PCS cannot send/receive any data and the PCS link comes
    645 down. The switch between PRBS and PCS is glitch free and controlled by TMod.
    646 When we switch from PRBS back to PCS, PCS will establish the link again. In
    647 other words TSCE can switch back and forth from PCS to PRBS. This is very
    648 important for KR channels where link training happens in PCS mode. When
    649 switching to PRBS, we need to do so without disrupting the trained
    650 transmittors/receivers.
    651 
    652 There are cases when the PCS is in single port mode (eg. 40G/42G MLD mode) where
    653 a switch to PRBS will cause it not only to restart auto negotiation, but also
    654 reset the PMD. If this is a trained link this will destroy the trained values
    655 of the transmittors/receivers.
    656 
    657 For single lane auto-neg lanes the problem is similar but slightly different.
    658 Consider two partner trying to bring up PRBS on a link.  The first port to send
    659 PRBS will bring the PCS link down on its partner, causing the partner to restart
    660 auto negotiation.  This transition has a flatline which the The local partner
    661 will receive  causing it to lose signal_detect.
    662 
    663 For autonegotiated ports, therefore, we have to disable PCS from restarting
    664 autonegotiation and resetting the PMD by overriding the PCS-to-PMD reset
    665 controls. This is done by setting 'an_good_trap'. A feature that 'traps' the
    666 PCS from completing OR restarting autonegiation.
    667 
    668 Following sequence shows how to switch between PCS and PRBS. Autonegotiation
    669 port variation is shown in parenthesis.
    670 
    671 - (For AN) Run CL73 (e.g. 1G-KX/10GKR etc. mode)
    672 - (For FS) Set up speed.
    673 - Wait for PCS link up (Happens after speed negotiation and CL72 training)
    674 - (For AN) Set an_good_trap to prevent AN from restarting.
    675 - (For AN) Force signal detect
    676 - Enable PRBS and check error count to reset the count.
    677 - Run PRBS.
    678 - Stop prbs
    679 - (For AN) Release an_good_trap
    680 - (For AN) Remove force signal detect
    681 - Wait for PCS link up again.
    682 
    683 We want the signal detect to be forced and an_good_trap to be set before PRBS is
    684 enabled on the remote partner. This forces the PRBS sequence to have 3 steps,
    685 which is a departure from previous procedures
    686 
    687 - PRBS_PREP (an_good_trap/sig_det)
    688 - PRBS_SET  (poly, yada yada)
    689 - PRBS_GET (link, error count)
    690 
    691 An example sequence of running PRBS in forced speeds using Broadcom SDK diag
    692 shell is shown below.
    693 \code
    694 # Put xe0 and xe1 are in 10G Forced speed mode.
    695 BCM.0> port xe0 an=f sp=10000
    696 BCM.0> port xe1 an=f sp=10000
    697 BCM.0> ps xe0,xe1
    698 ...
    699 BCM.0>
    700 BCM.0> link off
    701 BCM.0> PHY diag xe0 prbs set p=1
    702 BCM.0> PHY diag xe1 prbs set p=1
    703 BCM.0>
    704 BCM.0> PHY diag prbs xe0 get
    705 [you may get errors the first time. Ignore output]
    706 BCM.0> PHY diag xe0 prbs get
    707 xe0 : PRBS OK!
    708 BCM.0> PHY diag xe1 prbs get
    709 [you may get errors the first time. Ignore output]
    710 BCM.0> PHY diag xe1 prbs get
    711 xe1 : PRBS OK!
    712 BCM.0> PHY diag xe0 prbs clear
    713 BCM.0> PHY diag xe1 prbs clear
    714 \endcode
    715 
    716 A similar example sequence of running PRBS, but in autoneg mode is shown below.
    717 {Incomplete. FIXIE}
    718 \code
    719 # Put xe0 and xe1 are in Autoneg. Assume they will come up
    720 BCM.0> port xe0 an=t ...
    721 BCM.0> port xe1 an=t ....
    722 BCM.0> ps xe0,xe1
    723 ...
    724 BCM.0>
    725 BCM.0> link off
    726 BCM.0> PHY diag xe0 prbs set p=1
    727 BCM.0> PHY diag xe1 prbs set p=1
    728 BCM.0>
    729 BCM.0> PHY diag prbs xe0 get
    730 [you may get errors the first time. Ignore output]
    731 BCM.0> PHY diag xe0 prbs get
    732 xe0 : PRBS OK!
    733 BCM.0> PHY diag xe1 prbs get
    734 [you may get errors the first time. Ignore output]
    735 BCM.0> PHY diag xe1 prbs get
    736 xe1 : PRBS OK!
    737 BCM.0> PHY diag xe0 prbs clear
    738 BCM.0> PHY diag xe1 prbs clear
    739 \endcode
    740 
    741 \section cnotaft Configuration of CL72(training) and CL74(FEC) for TSCE
    742 
    743 CL72(Training) and CL74(FEC) are enabled to improve channel signal integrity.
    744 CL72 is physically implemented in the PMD sub-layer. CL74 is physically
    745 implemented in the PCS sub-layer. However these features are dependant on link
    746 data rates as well. So they are controlled by PCS or TMod as needed.  CL72 and
    747 CL74 are closely related features and hence are discussed together in this
    748 section.  However the controls for these features are not related and
    749 independently configured. The defaults, and controls are different for auto
    750 negotiation and forced speed modes. The controls can be static. For the
    751 SDK platform, the controls can be (config or SOC properties) or
    752 dynamic(BCM-APIs).
    753 
    754 A general rule of thumb is that features are controlled by software (TMod) in
    755 forced speed modes and by PMD microcode (ucode) in auto negotiation modes.
    756 They will eventually operate on the same set of registers, but the choice is
    757 made by the response time required. In auto-negotiation modes, where the
    758 configuration is known only after autonegotiation completes.
    759 
    760 We will discuss the differences in controls in the next two sub-sections.
    761 
    762 \subsection fsccl72774 Forced Speeds Mode Control of CL72 and CL74
    763 
    764 CL72 and CL84 are disabled by default for all forced speeds. It can
    765 be enabled for some speeds. This is not really an IEEE mandate but a Broadcom
    766 proprietary feature. Currently these features are  supported for 10G/10.5G
    767 20G/21G, 40G/42G speeds. Users can control these features dynamically.
    768 
    769 \subsubsection lnktrn Link Training (CL72)
    770 
    771 As mentioned before users can control CL72 dynamically. As an example, for SDK,
    772 CL72 can be controlled dynamically by BCM APIs.
    773 
    774 \code
    775 bcm_port_phy_control_set(0 /*unit*/,
    776                          p /*port*/,
    777                          BCM_PORT_PHY_CONTROL_CL72,
    778                          en /*0 -> disable, 1 -> enable */);
    779 \endcode
    780 
    781 \subsubsection fec-cntl FEC control (CL74)
    782 
    783 The platform is assumed to know the speeds for which CL74 should be enabled.
    784 Since enabling CL74 for non-CL74 speeds can have unpredictable results, hardware
    785 has additional controls to simply ignore CL74 controls for non-CL74 speeds.
    786 As an example, for SDK, CL74 can be controlled dynamically by BCM APIs.
    787 
    788 \code
    789 bcm_port_phy_control_set(0/*unit*/,
    790                          p/*port*/,
    791                          BCM_PORT_PHY_CONTROL_FORWARD_ERROR_CORRECTION,
    792                          en /*0 -> disable, 1 -> enable */);
    793 \endcode
    794 
    795 \subsection anccl72774 Auto-Negotiation Mode Control of CL72 and CL74
    796 
    797 CL37 auto negotiation cannot use CL72 or CL74. They are only advertisable in
    798 CL73 and CL37-BAM (proprietary) auto negotiation. In auto negotiation, the need to enable
    799 these features are only known after auto negotiationotiation and speed resolution. Hence
    800 these controls are handled by hardware/ucode rather than TMod.
    801 
    802 \subsubsection anlnktrn Link Training (CL72)
    803 
    804 Link training is enabled by default for CL73. It is not dynamically controlled.
    805 It is defined as a static 'config' property, similar to the port auto
    806 negotiation property.
    807 
    808 \code
    809 /* following two configs disable CL37 and enable CL73.  */
    810 phy_an_c73_xe1=1 /* CL73 an port */
    811 phy_an_c37_xe1=0 /* Not a CL37 an port */
    812 /* following config enables CL72 */
    813 phy_an_c72_xe=1
    814 /* following config disables CL74 */
    815 phy_an_c72_xe=0
    816 \endcode
    817 
    818 \subsubsection anfecctl FEC Control (CL74)
    819 If the speed supports FEC, than FEC can be advertised. If both partners advertse
    820 FEC, the link is established with FEC enabled. If one of them does <b>not</b>
    821 advertise FEC, the link will <b>still</b> come up but with FEC disabled. So FEC
    822 is controlled by simply not advertising FEC.
    823 
    824 \code
    825 /* following two configs disable CL37 and enable CL73.  */
    826 phy_an_c73_xe1=1 /* CL73 an port */
    827 phy_an_c37_xe1=0 /* Not a CL37 an port */
    828 /* following config enables FEC */
    829 phy_an_fec_xe=1
    830 /* following config disables FEC */
    831 phy_an_fec_xe=0
    832 \endcode
    833 
    834 \section pcs-func-ovr Overriding native with Customer PCS Functions.
    835 
    836 This capability is no longer supported. Please contact the TEMod team if you
    837 need this. (ravick@broadcom.com)
    838 
    839 \section eyescan EyeScan
    840 
    841 Eyescan utility measures link robustness. The SERDES slicer can be perturbed
    842 horizontally and vertically and subsequently measure the BER at different
    843 perturbations. Eyescan can be measured both intrusive and non-intrusive method.
    844 In case of non-intrusive method - the link continues to be live and the traffic
    845 can run normally. By default eyescan is running in a non-intrusive method.
    846 In case of intrusive method the traffic is sent (mostly PRBS using internal
    847 generator or the other link partner needs to generate the PRBS) and the
    848 error rates are recorded for a suite of perturbations and practical BER and
    849 margins can be extrapolated using linear fit in the Q-function domain.
    850 
    851 The slicer perturbation sweep can be both horizontal and vertical. The smallest
    852 variation of the horizontal and vertical (there are 64 in each 'direction) is
    853 called the 'step'. The perturbations are done across a range, defined by the
    854 minimum and maximum values of horizontal and vertical perturbations.
    855 
    856 When sweeps in both directions are performed, the eyescan is termed 2D (two
    857 dimensional). In many cases the horizontal is fixed and only a vertical is
    858 performed. This is termed 1D (one dimensional).
    859 
    860 The general high level sequence to execute Eyescan is
    861 
    862 - Bring links to required rates.
    863 - Enable traffic (PRBS) for intrusive mode. This will also bring down the link.
    864 - Run Eyescan code <-- there are different types as explained next.
    865 - Stop PRBS and switch back links to mission mode (original configuration) for
    866    intrusive mode only.
    867 
    868 TEMod, built on top of eagle PMD software infrastructure provides two types of
    869 eyescan information. (There is much nomenculator confusion)
    870 - The HighBER, or fast eyescan, or Type 2 eyescan
    871 - The LowBER, or custom eyescan or Type 1 eyescan.
    872 The next subsections will explain both methods in more detail.
    873 
    874 \subsection highber Fast Eyescan
    875   This method is controlled by the ucode.  All ranges, sample times and steps
    876 are fixed. The ucode generates the 2D info and stores it in ucode RAM and is
    877 extracted by software and provided as a 2D integer array to customer. It can
    878 also be printed on the screen as ASCII graphics. The ucode can be instructed to
    879 generate eyes on one or more lanes and the data acquisition is parallel. By default
    880 the commands run fast eyescan mode. Fast eyescan is supported in non-intrusive mode
    881 only.
    882 
    883 \code
    884 The commands are
    885 
    886 * init all  OR rc. whatever method to bring the ports up.
    887 * ps
    888 * Phy diag xe eyescan
    889 
    890 \endcode
    891 
    892 \subsection lowber Custom Eyescan
    893 This method allows flexibility to select the steps, range, sample time etc.
    894 It is generally slower but potentially more accurate and controllable. The ucode
    895 is setup per user's needs and it records the errors which software will extract.
    896 into a 2D integer array.  It can be printed on the screen as well
    897 
    898 The newer implementation has 2 slicers and so the link can continue to be live while
    899 the second slicer can be used  to check the eyescan. By default the eyescan is run on
    900 the second slicer (passive mode) so there is no instrusion on the regular data traffic.
    901 The eyescan can be run on the main link but this will be intrusive. the support is
    902 available to run lowber custom eyescan on the live link. This requires the user to run
    903 PRBS prior to Eyescan.
    904 \code
    905 The commands for custom eyescan in intrusive mode are
    906 
    907 1) Init all  OR rc. whatever method to bring the ports up.
    908 2) ps
    909 3) Linkscan off.
    910 4) Phy diag xe prbs set p=5
    911 5) Phy diag xe prbs get
    912 6) Phy diag xe prbs get
    913 7) Phy diag xe eyescan  type=3
    914 8) Phy diag pbm prbs clear
    915 
    916 The commands for custom eyescan in non-intrusive mode are
    917 
    918 1) Init all  OR rc. whatever method to bring the ports up.
    919 2) ps
    920 3) Phy diag xe eyescan  type=2
    921 \endcode
    922 
    923 \subsection eyes_cntl Eyescan controls
    924 
    925 At the User Interface (using SDK as an example), these parameters control the
    926 generation of the eye.
    927 - The type of Eyescan
    928  -# type=1  request fast eyescan (this is default)
    929  -# type=2  request custom eyescan
    930  -# type=3  request custom eyescan on live link.
    931 - flag
    932   -# '1' implies 1D
    933   -# if not provided, implies 2D
    934   -# no other values are valid
    935 - The limits of the sweep (defines the range)
    936   -# vertical_max
    937   -# vertical_min
    938   -# horizontal_max (specify this alone if requesting 1D)
    939   -# horizontal_min
    940 - the resolution (i.e. steps)
    941   -# sample_resolution (fixed for both Vertical and horizontal simultaneously)
    942   -# sample_resolution_v (to provide seperate vertical step)
    943 - counter
    944   -# defunct.
    945 - sample_time, time to run traffic to collect BER specified in ms
    946 
    947 \code
    948 Here is a sample of eyescan output.
    949 
    950   UI/64  : -30  -25  -20  -15  -10  -5    0    5    10   15   20   25   30
    951          : -|----|----|----|----|----|----|----|----|----|----|----|----|-
    952    225mV : 1111111111111111111111111111122222211111111111111111111111111
    953    213mV : 1111111111111111111111111222223333322221111111111111111111111
    954    200mV : 1111111111111111111111122233344455443322221111111111111111111
    955    188mV : 1111111111111111111112223344556677765433222211111111111111111
    956    175mV : 111111111111111111112233456677-+----7654332222111111111111111
    957    163mV : 1111111111111111112233456 :    :    : 76543322211111111111111
    958    150mV : 111111111111111112234567  :    :    :   654332222111111111111
    959    138mV : 1111111111111111223457    :    :    :    76543222211111111111
    960    131mV : 111111111111111223356:    :    :    :    :7543322221111111111
    961    125mV : 111111111111111223457+----+----+----+----+-654332221111111111
    962    119mV : 11111111111111223456 :    :    :    :    :7764432222111111111
    963    113mV : 11111111111111223457 :    :    :    :    :  65433222211111111
    964    106mV : 1111111111111223456  :    :    :    :    :  76543322211111111
    965    100mV : 1111111111111223467  :    :    :    :    :   7543322221111111
    966     94mV : 111111111111223457---+----+----+----+----+---7654332221111111
    967     88mV : 111111111111223467   :    :    :    :    :    764432222111111
    968     81mV : 11111111111223456    :    :    :    :    :    :65433222111111
    969     75mV : 11111111112223457    :    :    :    :    :    :76543222211111
    970     69mV : 1111111111223356:    :    :    :    :    :    : 6543322221111
    971     63mV : 11111111112234577----+----+----+----+----+----+-7654332221111
    972     56mV : 1111111112233467:    :    :    :    :    :    : 7754432222111
    973     50mV : 111111112223457 :    :    :    :    :    :    :  765433222211
    974     44mV : 111111112233467 :    :    :    :    :    :    :  775443222221
    975     38mV : 11111112223457  :    :    :    :    :    :    :   76543322222
    976     31mV : 11111112233467--+----+----+----+----+----+----+----7554332222
    977     25mV : 1111112223457   :    :    :    :    :    :    :    7654332222
    978     19mV : 1111112233467   :    :    :    :    :    :    :    :664433222
    979     13mV : 111111223456    :    :    :    :    :    :    :    : 65433322
    980      6mV : 111112223457    :    :    :    :    :    :    :    : 76543322
    981      0mV : 111112233567----+----+----+----+----+----+----+----+-76543332
    982     -6mV : 11111223346:    :    :    :    :    :    :    :    : 76543322
    983    -13mV : 111112223457    :    :    :    :    :    :    :    : 65443322
    984    -19mV : 1111112234567   :    :    :    :    :    :    :    :765433222
    985    -25mV : 1111112223457   :    :    :    :    :    :    :    7654332222
    986    -31mV : 1111111223456---+----+----+----+----+----+----+----7654332222
    987    -38mV : 11111112223457  :    :    :    :    :    :    :   76543322221
    988    -44mV : 111111112234567 :    :    :    :    :    :    :   75443222221
    989    -50mV : 11111111223345  :    :    :    :    :    :    :   65433222211
    990    -56mV : 1111111112234577:    :    :    :    :    :    :  654432222111
    991    -63mV : 1111111112233467+----+----+----+----+----+----+-7654332222111
    992    -69mV : 1111111111223457:    :    :    :    :    :    :76543322221111
    993    -75mV : 11111111112233467    :    :    :    :    :    :76543322211111
    994    -81mV : 11111111111223457    :    :    :    :    :    :65433222111111
    995    -88mV : 11111111111223346    :    :    :    :    :    765433222111111
    996    -94mV : 111111111111223457---+----+----+----+----+----654332221111111
    997   -100mV : 1111111111112233567  :    :    :    :    :   7644322221111111
    998   -106mV : 1111111111111223457  :    :    :    :    :   6543322211111111
    999   -113mV : 11111111111112233567 :    :    :    :    :  75433222211111111
   1000   -119mV : 11111111111111223457 :    :    :    :    : 765432222111111111
   1001   -125mV : 11111111111111223356-+----+----+----+----+-754332221111111111
   1002   -131mV : 111111111111111223457:    :    :    :    :7644322221111111111
   1003   -138mV : 1111111111111112223467    :    :    :    76543322211111111111
   1004   -150mV : 11111111111111111223456   :    :    :   765432222111111111111
   1005   -163mV : 1111111111111111112234567 :    :    :  6543322211111111111111
   1006   -175mV : 1111111111111111111223345667---+----+765432222111111111111111
   1007   -188mV : 11111111111111111111122334455677  776543322211111111111111111
   1008   -200mV : 1111111111111111111111222333445555554332221111111111111111111
   1009   -213mV : 1111111111111111111111112222233333332222111111111111111111111
   1010   -225mV : 1111111111111111111111111112222222222111111111111111111111111
   1011   -238mV : 1111111111111111111111111111111111111111111111111111111111111
   1012   -250mV : 1111111111111111111111111111111111111111111111111111111111111
   1013          : -|----|----|----|----|----|----|----|----|----|----|----|----|-
   1014   UI/64  : -30  -25  -20  -15  -10  -5    0    5    10   15   20   25   30
   1015 
   1016 \endcode
   1017 \section eee-phy EEE Features
   1018 
   1019 When no information is being transmiited, upper layers can provide a hint to PHY
   1020 layers to transmit low power idles (LPIs).  EEE supported PHYs can shutdown
   1021 until 'woken up' by the network.  TSCE does <b>not</b> support full featured
   1022 EEE. It only supports partial EEE, called the pass-thru mode. It can transfer
   1023 LPIs to the upper layers only but doesn't do any power optimization. It can also
   1024 convert LPIs to idles so upper layers do not see them. PHYMod controls the
   1025 ability to convert LPIs thus.
   1026 
   1027 - eee_control_set(...,  enable)
   1028   - enable = 1 : Allow LPI pass through. i.e. do not convert LPI.
   1029   - enable = 0 : Convert LPI to idle. So  MAC will not see it.
   1030 - eee_control_get(..., *info)
   1031   - info = 1 : LPI is going to pass through. i.e. no conversion to LPI
   1032   - info = 0 : LPI is being converted. So MAC will not see it.
   1033 - Default: EEE is disabled. i.e. LPI will get converted to Idle.
   1034 
   1035 \section tx-rx-ctl PHY TX and RX control
   1036 
   1037 The TX and RX paths of the entire TSCE can be independently controlled. There
   1038 are various components including
   1039 - Disable: This will disable PCS from generating any data. It will also not
   1040   receive any information from the MAC.
   1041 - Reset: This will reset the PCS. This will flush the FIFOs, reset the PMD, and
   1042   stop the PCS from receiving data from the MAC.
   1043 - Squelch: This will keep PCS active (i.e. PCS will transmit data) while
   1044   squelching the actual transmission at the PMD/Analog level.
   1045 - Power down: Power down the blocks.
   1046 
   1047 Any of these can be independantly controlled by a couple of PHYMod APIs
   1048 
   1049 -# Phymod_phy_power_set: Power down TX, RX or both including pcs and PMD
   1050 -# Phymod_phy_tx_lane_control:  Enum types control TX as follows
   1051   -# traffic disable/enable
   1052   -# reset/unreset
   1053   -# squelch/unsquelch
   1054 -# Phymod_phy_rx_lane_control: Enum types control RX as follows.
   1055   -#     rx reset
   1056   -#     rx squelch/unsquelch
   1057 
   1058 When platforms (eg SDK) disable/enable a port, TX/RX squelch on/off is applied.
   1059 
   1060 \section trg_phy_cfg_dis Phy Configuration Triage Reports
   1061 
   1062 TEMod supports category based diagnostics printouts in the diagnostics prompt.
   1063 Currently the following categories exist.
   1064 
   1065 -# TOPOLOGY: loopbacks/swaps/polarity/port modes
   1066 -# LINK STATE: sigdet/pll/pmd_lock/pcs_block/pcs_linkup
   1067 -# AUTONEG: type, abilities, resolved speed, link
   1068 -# SPEED:  speed set, hard table overrides, soft tables
   1069 -# TFC: PRBS/pkt_gen/PRTP/traffic details (only if enabled)
   1070 -# AN TIMERS: Various AN timers.
   1071 
   1072 With the command below, we can get a report of the link state
   1073 \code
   1074 BCM.0> phy diag xe0 pcs link
   1075 
   1076 +------------------------------------------------------------------------------+
   1077 | TRG ADR : 000165 LANE: 01    LINK STATE                   |   LH    |   LL   |
   1078 +-----------------------+-------------------+---------------+---------+--------+
   1079 | PMD PLL LOCK   : Y    | PCS SYNC   : Y    | PCS SYNC STAT : 0000    : 0000   |
   1080 | PMD SIG DETECT : NNYY | PCS LINK   : Y    | PCS LINK STAT : 0000    : 0000   |
   1081 | PMD LOCKED     : NNYY | PCS HI BER : 0000 | PCS HIGH BER  : 0000    : 0000   |
   1082 | PMD LATCH HI   : 0000 | PCS DESKEW : 0000 | PCS DESKEW    : 0000    : 0000   |
   1083 | PMD LATCH LO   : 0000 | PCS AMLOCK : 0000 | PCS AM LOCK   : 0000    : 0000   |
   1084 | RXLOCK LATCH HI: 0000 |                   |                                  |
   1085 | RXLOCK LATCH LO: 0000 |                   |                                  |
   1086 +-----------------------+-------------------+----------------------------------+
   1087 \endcode
   1088 
   1089 With the command below, we can get a report of various speed parameters
   1090 
   1091 \code
   1092 BCM.0> phy diag xe0 pcs speed
   1093 +------------------------------------------------------------------------------+
   1094 | TRG ADR : 000165 LANE: 01    SPEED                                           |
   1095 +---------------------+-----------------------------+-----------+--------------+
   1096 | ST [0]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1097 | ST [1]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1098 | ST [2]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1099 | ST [3]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1100 +---------------------+-----------------------------+-----------+--------------+
   1101 |                          OEN SET OVR VALUE                                   |
   1102 +----------------+----------------+--------------------------------------------+
   1103 | NUM LANES: 0x0 | FEC ENA  : 0x0 | PMA_OS_MODE_1                              |
   1104 | 64B66DECR: 0x0 | CHKEND   : 0x1 | SCR_MODE_BYPASS                            |
   1105 | FECENABL : 0x0 | REORDER  : 0x0 | ENCODE_MODE_NONE                           |
   1106 | CL36ENA  : 0x0 | SGMIISPD : 0x0 | R_DESCR1_MODE_BYPASS                       |
   1107 | CLKCNT0  : 0x0 | CLKCNT1  : 0x0 | DECODER_MODE_NONE                          |
   1108 | LP CNT0  : 0x0 | LP CNT1  : 0x0 | R_DESKEW_MODE_BYPASS                       |
   1109 | MACCRDGEN: 0x0 | REPLCNT  : 0x0 | DESC2_MODE_NONE                            |
   1110 | PCSCRDENA: 0x0 | CLK CNT  : 0x0 | R_DESC2_BYTE_DELETION_100M                 |
   1111 | PCSCRDGEN: 0x0 |                | BLOCKSYNC_MODE_NONE                        |
   1112 +----------------+--+-------------+------+------------------+------------------+
   1113 |        SPEED      |        STATS0      |      STATS1      |   CREDIT STATS   |
   1114 +-------------------+--------------------+------------------+------------------+
   1115 | SPD CHG VLD  0    |     OS MODE 1      | DESCR MODE BYPASS| SGMII SPD : 0000 |
   1116 | SPD CHG DONE 0    |    SCR MODE 64B    |DECODE MODE CL49  |  CLK CNT0 : 0033 |
   1117 | SPD RESOLVED 0028 |    ENC MODE CL49   |DESKEW MODE BYPASS|  CLK CNT1 : 0000 |
   1118 | #LN RESOLVED 0000 |BLKSYNC MODE CL49   |DESCR2 MODE CL49  |   LP CNT0 : 0001 |
   1119 | PLL DIV      0010 |   CL72  ENA : 01   |  BYTE  DEL NONE  |   LP CNT1 : 0000 |
   1120 | REF CLOCK    0000 | CHKEND  ENA : 00   |64b66DEC EN 0     |  MAC  CGC : 0004 |
   1121 |                   |    FEC  ENA : 00   |                  |  REP  CNT : 0000 |
   1122 |                   |REORDER  ENA : 00   |                  |PCS CRD EN : 0000 |
   1123 |                   |   CL36  ENA : 00   |                  |PCS CK CNT : 0000 |
   1124 |                   |                    |                  |CRDGEN CNT : 0000 |
   1125 +-------------------+--------------------+------------------+------------------+
   1126 
   1127 \endcode
   1128 
   1129 With the command below, we can get a report of various auto-negotiation parameters
   1130 
   1131 \code
   1132 BCM.0> phy diag xe0 pcs aneg
   1133 +------------------------------------------------------------------------------+
   1134 | TRG ADR : 000165 LANE: 01     AUTONEG                                        |
   1135 +-------------+-------------+------------------------------+-------------------+
   1136 | AN37: N     | AN73 : N    | AN HCD SPD : 1000M           |  AN LINK : DN     |
   1137 +-------------------+-------+------+-----------------------+-------------------+
   1138 | ANX4 CTRL: 0x0000 | ENS : 0x0000 | CL37 BAM:0x0000 BASE :0x0000              |
   1139 | ANX4 OVR0: 0x0000 | OVR1: 0x0000 | CL73 BAM:0x0000 BASE1:0x0000 BASE0:0x02A0 |
   1140 +-------------------+--------------+----+--------------------------------------+
   1141 |      CLAUSE 37    |      CLAUSE 73    |                                      |
   1142 +-------------------+-------------------+--------------------------------------+
   1143 | BAM ENA       : 0 | BAM  ENA     : 0  | NUM ADV LANES : 1                    |
   1144 | AN  ENA       : 0 | AN   ENA     : 0  | FAIL COUNT LIM: 0                    |
   1145 | SGMII ENA     : 0 | HPAM ENA     : 0  |                                      |
   1146 | BAM2SGMII ENA : 0 | BAM3HPAM ENA : 0  |                                      |
   1147 | SGMII2CL37 ENA: 0 | HPAM2CL73 ENA: 0  |                                      |
   1148 | AN RESTART    : 0 | AN RESTART   : 0  |                                      |
   1149 +-------------------+-------------------+--------------------------------------+
   1150 |            CL37 ABILITIES             |         CL73 ABILITIES               |
   1151 +---------------+-----------------------+-----------------+--------------------+
   1152 | SWRST DIS : 0 | ANRST DIS    :0       | NONCE OVR : 0   | NONCE VAL: 0       |
   1153 | PD 2 CL37 : 0 | NEXT PAGE    :0       | TX NONCE  : 0x15| BASE SEL : Rsvd    |
   1154 | HALF DUPLX: 0 | FULL DUPLEX  :0       | NEXT PAGE  : 0  | FEC      : 0       |
   1155 | PAUSE     : 0 | SGMII MASTER :0       | REMOTE FLT : 0  | PAUSE    : 0       |
   1156 | SGMII FDUP: 0 | SGMII SPD    :10Mb/s  |-----------------+--------------------|
   1157 | OVR1G ABIL: 0 | OVR1G PAGECNT:0       | 1000BASE KX : 0 | 10GBASE KX4 :0     |
   1158 | BAM CODE      : 0x0000                | 10GBASE KR  : 0 | 10GBASE KR4 :0     |
   1159 |---------------+-----------------------| 40GBASE CR4 : 0 | 100GBASE CR1:0     |
   1160 |                                       | HPAM_20GKR2 : 0 | BAM CODE    :0x0000|
   1161 |                                       | 20GBASE CR2 : 0 | 20GBASE KR2 : 0    |
   1162 +---------------------------------------+--------------------------------------+
   1163 |                               OVER1G ABILITIES                               |
   1164 +-------------------+--------------------+-----------------+-------------------+
   1165 | HG2         : 0   | FEC          : 0   | CL72         : 0|                   |
   1166 | 40GBASE X4  : 0   | 32P7GBASE X4 : 0   | 31P5GBASE X4 : 0| 25P455GBASE X4: 0 |
   1167 | 21GBASE X4  : 0   | 20GBASEX2 CX4: 0   | 20GBASE X2   : 0| 20GBASE X4    : 0 |
   1168 | 16GBASE X4  : 0   | 15P75GBASE X2: 0   | 15GBASE X4   : 0| 13GBASE X4    : 0 |
   1169 +-------------------+--------------------+-----------------+-------------------+
   1170 \endcode
   1171 
   1172 With the command below, we can get a report of various Traffic sub-configurations
   1173 
   1174 \code
   1175 BCM.0> phy diag xe0 pcs tfc
   1176 +------------------------------------------------------------------------------+
   1177 | TRG ADR : 000165 LANE: 01    INTERNAL TFC                                    |
   1178 +------------------------------------------+-----------------------------------+
   1179 | Traffic_type: MAC                      |                                     |
   1180 +------------------------------------------+-----------------------------------+
   1181 \endcode
   1182 
   1183 With the command below, we can get a report of various auto-negotiation timers
   1184 
   1185 \code
   1186 BCM.0> phy diag xe0 pcs antimers
   1187 +------------------------------------------------------------------------------+
   1188 | TRG ADR : 000165 LANE: 01    AN TIMERS                                       |
   1189 +--------------------------------------+---------------------------------------+
   1190 | CL37 RESTART          : 0x0000029A   | CL37 ACK               : 0x0000029A   |
   1191 | CL37 ERR              : 0x00000000   | CL37 LINK BREAK        : 0x000010ED   |
   1192 | CL73 ERR              : 0x00000000   | CL73 DME LOCK          : 0x000014D4   |
   1193 | LINK_UP               : 0x0000029A   | PS SD                  : 0x00000a6a   |
   1194 | SYNC STATUS           : 0x0000029A   | PD TO CL37             : 0x00000A6A   |
   1195 | IGNORE LINK           : 0x0000029A   | SGMII                  : 0x0000006B   |
   1196 | DME PAGE MIN          : 0x0000005F   | DME PAGE MAX           : 0x00000076   |
   1197 | FAIL INHIBIT W/O CL72 : 0x000014D5   | FAIL INHIBIT WITH CL72 : 0x00008382   |
   1198 +--------------------------------------+---------------------------------------+
   1199 \endcode
   1200 
   1201 With the command below, we can get a report of PCS state machines
   1202 
   1203 \code
   1204 BCM.0> phy diag xe0 pcs state
   1205 +------------------------------------------------------------------------------+
   1206 |                                 DEBUG STATE                                  |
   1207 +--------------------------------------+---------------------------------------+
   1208 | SC_DEBUG_STATE    : 0x0000ef74       |  FSM_STATUS : 0x0000EF74              |
   1209 | TLA_SEQUENCER STS : 0x00000001       |                                       |
   1210 +--------------------------------------+---------------------------------------+
   1211 \endcode
   1212 
   1213 With the catchall command below, we can get a comprehensive report of all PCS.
   1214 This is ssentially all the previous commands.
   1215 
   1216 \code
   1217 BCM.0> phy diag xe2 pcs
   1218 +------------------------------------------------------------------------------+
   1219 | TRG ADR : 000165 LANE: 01     TOPOLOGY                                       |
   1220 +-------------------+--------------------------+---------------+---------------+
   1221 | PCSLCL LPBK: NNNN | PCS LANE SWAP L2P : 3210 | TX POLARITY : 0 | PORT NUM : 0|
   1222 | PCSRMT LPBK: NNNN | PMD LANE ADDR IDX : 3210 |                 | SNGLMODE : 0|
   1223 | PMDDIG LPBK: NNNN | PMD TO AFE        : 3210 | RX POLARITY : 0 | PORT MODE: 0|
   1224 | PMDREM LPBK: NNNN |                          |                               |
   1225 +-------------------+--------------------------+-------------------------------+
   1226 | TRG ADR : 000165 LANE: 01    LINK STATE                   |   LH    |   LL   |
   1227 +-----------------------+-------------------+---------------+---------+--------+
   1228 | PMD PLL LOCK   : Y    | PCS SYNC   : Y    | PCS SYNC STAT : 0000    : 0000   |
   1229 | PMD SIG DETECT : NNYY | PCS LINK   : Y    | PCS LINK STAT : 0000    : 0000   |
   1230 | PMD LOCKED     : NNYY | PCS HI BER : 0000 | PCS HIGH BER  : 0000    : 0000   |
   1231 | PMD LATCH HI   : 0000 | PCS DESKEW : 0000 | PCS DESKEW    : 0000    : 0000   |
   1232 | PMD LATCH LO   : 0000 | PCS AMLOCK : 0000 | PCS AM LOCK   : 0000    : 0000   |
   1233 | RXLOCK LATCH HI: 0000 |                   |                                  |
   1234 | RXLOCK LATCH LO: 0000 |                   |                                  |
   1235 +-----------------------+-------------------+----------------------------------+
   1236 | TRG ADR : 000165 LANE: 01     AUTONEG                                        |
   1237 +-------------+-------------+------------------------------+-------------------+
   1238 | AN37: N     | AN73 : N    | AN HCD SPD : 1000M           |  AN LINK : DN     |
   1239 +-------------------+-------+------+-----------------------+-------------------+
   1240 | ANX4 CTRL: 0x0000 | ENS : 0x0000 | CL37 BAM:0x0000 BASE :0x0000              |
   1241 | ANX4 OVR0: 0x0000 | OVR1: 0x0000 | CL73 BAM:0x0000 BASE1:0x0000 BASE0:0x02A0 |
   1242 +-------------------+--------------+----+--------------------------------------+
   1243 |      CLAUSE 37    |      CLAUSE 73    |                                      |
   1244 +-------------------+-------------------+--------------------------------------+
   1245 | BAM ENA       : 0 | BAM  ENA     : 0  | NUM ADV LANES : 1                    |
   1246 | AN  ENA       : 0 | AN   ENA     : 0  | FAIL COUNT LIM: 0                    |
   1247 | SGMII ENA     : 0 | HPAM ENA     : 0  |                                      |
   1248 | BAM2SGMII ENA : 0 | BAM3HPAM ENA : 0  |                                      |
   1249 | SGMII2CL37 ENA: 0 | HPAM2CL73 ENA: 0  |                                      |
   1250 | AN RESTART    : 0 | AN RESTART   : 0  |                                      |
   1251 +-------------------+-------------------+--------------------------------------+
   1252 |            CL37 ABILITIES             |         CL73 ABILITIES               |
   1253 +---------------+-----------------------+-----------------+--------------------+
   1254 | SWRST DIS : 0 | ANRST DIS    :0       | NONCE OVR : 0   | NONCE VAL: 0       |
   1255 | PD 2 CL37 : 0 | NEXT PAGE    :0       | TX NONCE  : 0x15| BASE SEL : Rsvd    |
   1256 | HALF DUPLX: 0 | FULL DUPLEX  :0       | NEXT PAGE  : 0  | FEC      : 0       |
   1257 | PAUSE     : 0 | SGMII MASTER :0       | REMOTE FLT : 0  | PAUSE    : 0       |
   1258 | SGMII FDUP: 0 | SGMII SPD    :10Mb/s  |-----------------+--------------------|
   1259 | OVR1G ABIL: 0 | OVR1G PAGECNT:0       | 1000BASE KX : 0 | 10GBASE KX4 :0     |
   1260 | BAM CODE      : 0x0000                | 10GBASE KR  : 0 | 10GBASE KR4 :0     |
   1261 |---------------+-----------------------| 40GBASE CR4 : 0 | 100GBASE CR1:0     |
   1262 |                                       | HPAM_20GKR2 : 0 | BAM CODE    :0x0000|
   1263 |                                       | 20GBASE CR2 : 0 | 20GBASE KR2 : 0    |
   1264 +---------------------------------------+--------------------------------------+
   1265 |                               OVER1G ABILITIES                               |
   1266 +-------------------+--------------------+-----------------+-------------------+
   1267 | HG2         : 0   | FEC          : 0   | CL72         : 0|                   |
   1268 | 40GBASE X4  : 0   | 32P7GBASE X4 : 0   | 31P5GBASE X4 : 0| 25P455GBASE X4: 0 |
   1269 | 21GBASE X4  : 0   | 20GBASEX2 CX4: 0   | 20GBASE X2   : 0| 20GBASE X4    : 0 |
   1270 | 16GBASE X4  : 0   | 15P75GBASE X2: 0   | 15GBASE X4   : 0| 13GBASE X4    : 0 |
   1271 +-------------------+--------------------+-----------------+-------------------+
   1272 | TRG ADR : 000165 LANE: 01    SPEED                                           |
   1273 +---------------------+-----------------------------+-----------+--------------+
   1274 | ST [0]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1275 | ST [1]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1276 | ST [2]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1277 | ST [3]              | SPD_ILLEGAL                 | NUM LANES : 0            |
   1278 +---------------------+-----------------------------+-----------+--------------+
   1279 |                          OEN SET OVR VALUE                                   |
   1280 +----------------+----------------+--------------------------------------------+
   1281 | NUM LANES: 0x0 | FEC ENA  : 0x0 | PMA_OS_MODE_1                              |
   1282 | 64B66DECR: 0x0 | CHKEND   : 0x1 | SCR_MODE_BYPASS                            |
   1283 | FECENABL : 0x0 | REORDER  : 0x0 | ENCODE_MODE_NONE                           |
   1284 | CL36ENA  : 0x0 | SGMIISPD : 0x0 | R_DESCR1_MODE_BYPASS                       |
   1285 | CLKCNT0  : 0x0 | CLKCNT1  : 0x0 | DECODER_MODE_NONE                          |
   1286 | LP CNT0  : 0x0 | LP CNT1  : 0x0 | R_DESKEW_MODE_BYPASS                       |
   1287 | MACCRDGEN: 0x0 | REPLCNT  : 0x0 | DESC2_MODE_NONE                            |
   1288 | PCSCRDENA: 0x0 | CLK CNT  : 0x0 | R_DESC2_BYTE_DELETION_100M                 |
   1289 | PCSCRDGEN: 0x0 |                | BLOCKSYNC_MODE_NONE                        |
   1290 +----------------+--+-------------+------+------------------+------------------+
   1291 |        SPEED      |        STATS0      |      STATS1      |   CREDIT STATS   |
   1292 +-------------------+--------------------+------------------+------------------+
   1293 | SPD CHG VLD  0    |     OS MODE 1      | DESCR MODE BYPASS| SGMII SPD : 0000 |
   1294 | SPD CHG DONE 0    |    SCR MODE 64B    |DECODE MODE CL49  |  CLK CNT0 : 0033 |
   1295 | SPD RESOLVED 0028 |    ENC MODE CL49   |DESKEW MODE BYPASS|  CLK CNT1 : 0000 |
   1296 | #LN RESOLVED 0000 |BLKSYNC MODE CL49   |DESCR2 MODE CL49  |   LP CNT0 : 0001 |
   1297 | PLL DIV      0010 |   CL72  ENA : 01   |  BYTE  DEL NONE  |   LP CNT1 : 0000 |
   1298 | REF CLOCK    0000 | CHKEND  ENA : 00   |64b66DEC EN 0     |  MAC  CGC : 0004 |
   1299 |                   |    FEC  ENA : 00   |                  |  REP  CNT : 0000 |
   1300 |                   |REORDER  ENA : 00   |                  |PCS CRD EN : 0000 |
   1301 |                   |   CL36  ENA : 00   |                  |PCS CK CNT : 0000 |
   1302 |                   |                    |                  |CRDGEN CNT : 0000 |
   1303 +-------------------+--------------------+------------------+------------------+
   1304 
   1305 \endcode
   1306 
   1307 The PMD data dump has similarly controls. The DSC states are shown with the
   1308 command below.
   1309 
   1310 \code
   1311 BCM.0> phy diag xe0 dsc
   1312 
   1313 ***********************************
   1314 **** SERDES CORE DISPLAY STATE ****
   1315 ***********************************
   1316 
   1317 Average Die TMON_reg13bit = 5999
   1318 Temperature Force Val     = 255
   1319 Temperature Index         = 10  [40C to 48C]
   1320 Core Event Log Level      = 1
   1321 
   1322 Core DP Reset State       = 0
   1323 
   1324 Common Ucode Version       = 0xe10e
   1325 Common Ucode Minor Version = 0x0
   1326 AFE Hardware Version       = 0x0
   1327 
   1328 LN (CDRxN  ,UC_CFG) SD LCK RXPPM CLK90 CLKP1 PF(M,L) VGA DCO P1mV M1mV
   1329 DFE(1,2,3,4,5,dcd1,dcd2)   SLICER(ze,zo,pe,po,me,mo) TXPPM TXEQ(n1,m,p1,p2)
   1330 EYE(L,R,U,D) LINK_TIME
   1331 0 (OSx8.25,0x40)   1   1    0   42    21   7, 0    45   0    0   0   0,  0,  0,
   1332 0,  0,  0,  0 -54,-54,-54,-38,-14,-54      0    12,102, 0, 0    0, 0, 0, 0
   1333 3.6
   1334 \endcode
   1335 
   1336 The command below is yet to be implemented.
   1337 
   1338 \code
   1339 BCM.0> phy diag xe0 dsc ber
   1340 \endcode
   1341 The command below shows a variety of PMD core AND lane configurations.
   1342 \code
   1343 BCM.0> phy diag xe0 dsc config
   1344 
   1345 ***********************************
   1346 **** SERDES CORE CONFIGURATION ****
   1347 ***********************************
   1348 
   1349 uC Config VCO Rate   = 19 (10.250GHz)
   1350 Core Config from PCS = 0
   1351 
   1352 Lane Addr 0          = 0
   1353 Lane Addr 1          = 1
   1354 Lane Addr 2          = 2
   1355 Lane Addr 3          = 3
   1356 TX Lane Map 0        = 0
   1357 TX Lane Map 1        = 1
   1358 TX Lane Map 2        = 2
   1359 TX Lane Map 3        = 3
   1360 
   1361 *************************************
   1362 **** SERDES LANE 0 CONFIGURATION ****
   1363 *************************************
   1364 Auto-Neg Enabled      = 0
   1365 DFE on                = 0
   1366 Brdfe_on              = 0
   1367 Media Type            = 2
   1368 Unreliable LOS        = 1
   1369 Scrambling Disable    = 0
   1370 CL72 Emulation Enable = 0
   1371 Lane Config from PCS  = 0
   1372 
   1373 CL72 Training Enable  = 0
   1374 EEE Mode Enable       = 0
   1375 OSR Mode Force        = 1
   1376 OSR Mode Force Val    = 8
   1377 TX Polarity Invert    = 0
   1378 RX Polarity Invert    = 0
   1379 
   1380 TXFIR Post2           = 0
   1381 TXFIR Post3           = 0
   1382 TXFIR Override Enable = 0
   1383 TXFIR Main Override   = 102
   1384 TXFIR Pre Override    = 12
   1385 TXFIR Post Override   = 0
   1386 \endcode
   1387 Get CL72 specific information with this command
   1388 \code
   1389 BCM.0> phy diag xe0 dsc cl72
   1390 
   1391 ***********************************
   1392 **** SERDES CORE DISPLAY STATE ****
   1393 ***********************************
   1394 
   1395 Average Die TMON_reg13bit = 6025
   1396 Temperature Force Val     = 255
   1397 Temperature Index         = 10  [40C to 48C]
   1398 Core Event Log Level      = 1
   1399 
   1400 Core DP Reset State       = 0
   1401 
   1402 Common Ucode Version       = 0xe10e
   1403 Common Ucode Minor Version = 0x0
   1404 AFE Hardware Version       = 0x0
   1405 
   1406 LN (CDRxN  ,UC_CFG) SD LCK RXPPM CLK90 CLKP1 PF(M,L) VGA DCO P1mV M1mV
   1407 DFE(1,2,3,4,5,dcd1,dcd2)   SLICER(ze,zo,pe,po,me,mo) TXPPM TXEQ(n1,m,p1,p2)
   1408 EYE(L,R,U,D) LINK_TIME
   1409 0 (OSx8.25,0x40)   1   1    0   42    21   7, 0    45   0    0   0   0,  0,
   1410 0,  0,  0,  0,  0 -54,-54,-54,-38,-14,-54      0    12,102, 0, 0    0, 0, 0, 0
   1411 3.6
   1412 \endcode
   1413 Get DSC specific information with this command
   1414 \code
   1415 BCM.0> phy diag xe0 dsc debug
   1416 
   1417 ************************************
   1418 **** SERDES LANE 0 DEBUG STATUS ****
   1419 ************************************
   1420 
   1421 Restart Count       = 1
   1422 Reset Count         = 1
   1423 PMD Lock Count      = 2
   1424 
   1425 Disable Startup PF Adaptation           = 0
   1426 Disable Startup DC Adaptation           = 0
   1427 Disable Startup Slicer Offset Tuning    = 0
   1428 Disable Startup Clk90 offset Adaptation = 0
   1429 Disable Startup P1 level Tuning         = 0
   1430 Disable Startup Eye Adaptaion           = 0
   1431 Disable Startup All Adaptaion           = 0
   1432 
   1433 Disable Startup DFE Tap1 Adaptation = 0
   1434 Disable Startup DFE Tap2 Adaptation = 0
   1435 Disable Startup DFE Tap3 Adaptation = 0
   1436 Disable Startup DFE Tap4 Adaptation = 0
   1437 Disable Startup DFE Tap5 Adaptation = 0
   1438 Disable Startup DFE Tap1 DCD        = 0
   1439 Disable Startup DFE Tap2 DCD        = 0
   1440 
   1441 Disable Steady State PF Adaptation           = 0
   1442 Disable Steady State DC Adaptation           = 0
   1443 Disable Steady State Slicer Offset Tuning    = 0
   1444 Disable Steady State Clk90 offset Adaptation = 0
   1445 Disable Steady State P1 level Tuning         = 0
   1446 Disable Steady State Eye Adaptaion           = 0
   1447 Disable Steady State All Adaptaion           = 0
   1448 
   1449 Disable Steady State DFE Tap1 Adaptation = 0
   1450 Disable Steady State DFE Tap2 Adaptation = 0
   1451 Disable Steady State DFE Tap3 Adaptation = 0
   1452 Disable Steady State DFE Tap4 Adaptation = 0
   1453 Disable Steady State DFE Tap5 Adaptation = 0
   1454 Disable Steady State DFE Tap1 DCD        = 0
   1455 Disable Steady State DFE Tap2 DCD        = 0
   1456 
   1457 Retune after Reset    = 1
   1458 Clk90 offset Adjust   = 135
   1459 Clk90 offset Override = 0
   1460 Lane Event Log Level  = 2
   1461 \endcode
   1462 
   1463 \section TSCE12-intro TSCE12
   1464 
   1465 The TSCE12 is uses 3 TSCE cores to provide 12 physical 10G lanes. It can also be
   1466 configured as three, independent TSCs, each of which support 4 lanes. In the
   1467 first case it interfaces on the system side with a CMAC and in the second case
   1468 it interfaces with three, separate, XLMACs.
   1469 
   1470 When in three-core mode, the operations of the core are no different than the
   1471 TSCE. So this section discusses the case when the three cores operating with a
   1472 CMAC. Another block of logic also provides for 100G or 120G MLD.
   1473 
   1474 \subsection C_cfgconst_tsc12 100G configuration constraints in TSCE12
   1475 
   1476 To support 100G in three core mode, we have to select 10 out of 12 lanes. Two
   1477 lanes will be unused. So we have the notations of 4-4-2, 3-4-3, or 2-4-4 from
   1478 TSCE12.
   1479 
   1480 \li The 4-4-2 means the first and second cores deploy all 4 lanes, and the
   1481 third core deploys logic lanes 0 and 1.
   1482 
   1483 \li 3-4-3 means the first core provides lanes 0, 1, and 2, the second core
   1484 provides all 4 logic lanes, and the third code provides lane 0, 1, and 2.
   1485 
   1486 \li 2-4-4 means the first core provides logic lane0 and lane1, and the second
   1487 and third core provide all 4 logic lanes.
   1488 
   1489 The logic lane 0 of the individual core must always be active. In other words
   1490 the two unused lanes cannot be logic lane 0 in any 100G configuration.
   1491 
   1492 The logic lane order is the same for data striping. Also each core has lane swap
   1493 functions within the core that could be used to accommodate board routing lane
   1494 swap applications.
   1495 <b>NOTE:</b> In TR3 and Arad 100G HW, there is an MLD reorder register that
   1496 can achieve a restricted logical lane swap cross 3 cores. But in TD2+, the
   1497 lane swap is within a single core.
   1498 
   1499 \subsection tsc12-port-trn Configuration transitions
   1500 
   1501 Broadcom PHY ports could be easily reconfigured to meet wide applications, such
   1502 as lane swap, speed change, port size change (flex port). But due to the 100G HW
   1503 design, there is some limitation worth noting.
   1504 
   1505 In the 'before' column, the given configuration has a connection to 0-9 lanes
   1506 of the cable connector which provides 100G traffic. This type of connector is
   1507 not IEEE standard. In the after row, the given configuration has a connection to
   1508 1-10 lanes of the cable connector which provides 100G traffic. This type of
   1509 connector is for IXIA/IEEE testing. Note that the transition
   1510 table is written for a given board design/routing and lane swap is not required.
   1511 
   1512 The following table shows the possible configuration transitions for 100G forced
   1513 speed modes for different cabling.
   1514 
   1515 <table cellspacing=5>
   1516 <tr><td colspan=3><B>'Transition table' bit-mappings</B></td></tr>
   1517 <tr><td><B>Before(0-9)\\After(1-10)</B></td> <td><B>4-4-2</B></td> <td><B>3-4-3</B></td> <td><B>2-4-4</B>     </td></tr>
   1518 <tr><td>4-4-2</td> <td>Impossible</td> <td>OK</td>         <td>Impossible</td></tr>
   1519 <tr><td>4-4-2</td> <td>Impossible</td> <td>Impossible</td> <td>OK        </td></tr>
   1520 <tr><td>4-4-2</td> <td>Impossible</td> <td>Impossible</td> <td>Impossible</td></tr>
   1521 </table>
   1522 
   1523 \li The impossible mark applies to the configuration transitions that incur due
   1524 to 0-9 vs 1-10 lane selection between two types of cabling.
   1525 
   1526 \subsection cl37-100-an CL73 100G AN considerations
   1527 
   1528 For auto negotiation(AN), we need to first identify logic lane 0 to carry out
   1529 page exchanges and speed negotiation. Further the CL73 AN can negotiate to 100G,
   1530 40G, 10G KR, 10G-XAUI, or even 1G.  For 40G, the design would require a 4-lane
   1531 XLMAC bandwidth. Thus for the 4-4-2 configuration, only the lane 0 of the first
   1532 or second core can be used for auto negotiationotiation if 40G is a required
   1533 advertisable speed.  For the 3-4-3 configuration , only the second core can be
   1534 used. Similarly for 2-4-4 configuration, only the second and third core's lane 0
   1535 can be used.  Proper port configuration requires to setup the correct XLMAC out
   1536 of three XLMACs for speeds less than 100G. But for 100G ports, the logic lane 0
   1537 is not always in the first core. So some of the configuration settings are BRCM
   1538 TD2+ specific and we have to ensure the future BRCM products are backward
   1539 compatible.
   1540 
   1541 <table cellspacing=5>
   1542 <tr><td><B>Configuration</B></td> <td><B>Core for Lane</B></td></tr>
   1543 <tr><td>4-4-2</td> <td>1 or 2</td></tr>
   1544 <tr><td>3-4-3</td> <td>2     </td></tr>
   1545 <tr><td>2-4-4</td> <td>2 or 3</td></tr>
   1546 </table>
   1547 
   1548 To support configurations mentioned above, the driver would need the platform to
   1549 provide information (for example, in SDK we sould call them SOC properties)
   1550 - Lane configuration identification 4-4-2, 3-4-3, or 2-4-4.
   1551 - The core supporting  lane 0 for auto-negotiation.
   1552 For incompatible combinations of the soc properties, the platform should default
   1553 to a known working combination or handle the error appropriately.
   1554 
   1555 \section tsce_rcc TSCE Reference Clock Configuration
   1556 
   1557 TSCE can configured to use 156.25MHz or 125MHz reference clock.
   1558 
   1559 For PCS configuration, the reference clock frequency only matters for AN. And
   1560 used for tick generation, that is used in AN timers.
   1561 - Configure the main0_setup register specifying the reference clock.
   1562          Register: Main0_setup (Adr:0x9000)
   1563 - In the case of 125MHz reflck only: Set the tick override enable
   1564   and set the {tick_numerator_upper, tick_numerator_lower} = 19'd1875
   1565   and tick_denominator = 1. For 1255MHz refclk, hardware takes care of the tick
   1566   Register: Main0_tick_control_1(Adr:0x9007) and Main0_tick_control_0(Adr:9008)
   1567 
   1568 For PMD configuration,
   1569  - The pll_mode and the osr_mode are to be programmed based on the refclk.
   1570         Register: PLL_CAL_COM_CTL_7(Adr:0xd127) and CKRST_CTRL_OSR_MODE_CONTROL - OSR_MODE_CONTROL(Adr:0xd080)
   1571 - For 125MHz, set the heartbeat counter to 'd500. For 156.25MHz refclk, use the
   1572   default setting of `d625.
   1573        Register: DIG_COM_TOP_USER_CONTROL_0(Adr:0xd0f4)
   1574 - Always use default values for refclk_divcnt  refclk_divcnt_sel registers
   1575   This clock divider is used by the internal calibration logic to generate an
   1576   internal slow clock that is used for calibration.  If you switch to 125MHz
   1577   refclk, this internal clock is a little slower and total calibration time
   1578   will take a little longer but calibration will work fine with this. These
   1579   registers should only be used for debug to tweak calibration if needed.
   1580   Register: PLL_CAL_COM_CTL_5(Adr:0xd125) and PLL_CAL_COM_CTL_6(Adr:0xd126)
   1581 - The PMD ucode should support the configuration of pll_mode and osrmode for AN
   1582   speeds for the corresponding refclk.
   1583 
   1584 \section  tsce-fpc TSCE-PMD fractional plldiv configuration
   1585 
   1586 The PMD API "eagle_tsc_configure_pll", should be used for fractional plldiv
   1587 configuration. More details goto eagle API  #eagle_tsc_configure_pll
   1588 
   1589 \section  tsce_faq TSCE frequently asked questions (FAQ)
   1590 
   1591 - What are the different firmware load methods?
   1592 
   1593 The two firmware load methods are external and internal. External is fast
   1594 load. Internal load is slow load. External load is default way as it is faster.
   1595 */