al_hal_an_lt_wrapper_regs.h revision 303975
1139743Simp/*-
29313Ssos*******************************************************************************
39313SsosCopyright (C) 2015 Annapurna Labs Ltd.
49313Ssos
59313SsosThis file may be licensed under the terms of the Annapurna Labs Commercial
69313SsosLicense Agreement.
79313Ssos
89313SsosAlternatively, this file can be distributed under the terms of the GNU General
99313SsosPublic License V2 as published by the Free Software Foundation and can be
109313Ssosfound at http://www.gnu.org/licenses/gpl-2.0.html
119313Ssos
129313SsosAlternatively, redistribution and use in source and binary forms, with or
139313Ssoswithout modification, are permitted provided that the following conditions are
149313Ssosmet:
1597748Sschweikh
169313Ssos    *     Redistributions of source code must retain the above copyright notice,
179313Ssos	  this list of conditions and the following disclaimer.
189313Ssos
199313Ssos    *     Redistributions in binary form must reproduce the above copyright
209313Ssos	  notice, this list of conditions and the following disclaimer in
219313Ssos	  the documentation and/or other materials provided with the
229313Ssos	  distribution.
239313Ssos
249313Ssos THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
259313Ssos ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
269313Ssos WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
279313Ssos DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
289313Ssos ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29116173Sobrien (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30116173Sobrien LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31116173Sobrien ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
329313Ssos (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
339313Ssos SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3412458Sbde
3546163Sluoqi*******************************************************************************/
3686555Smarcel
37112938Sphk/**
38112740Sphk *  @{
3966834Sphk * @file   al_hal_an_lt_wrapper_regs.h
4085012Sdes *
4124131Sbde * @brief ... registers
429313Ssos *
439313Ssos */
4424205Sbde
4566834Sphk#ifndef __AL_HAL_AN_LT_wrapper_REGS_H__
4654122Smarcel#define __AL_HAL_AN_LT_wrapper_REGS_H__
4754122Smarcel
4885012Sdes#include "al_hal_plat_types.h"
4985012Sdes
5085012Sdes#ifdef __cplusplus
5185012Sdesextern "C" {
52130453Sphk#endif
539313Ssos/*
5485012Sdes* Unit Registers
5514331Speter*/
5626364Smsmith
5726364Smsmith
5812458Sbde
59133816Stjrstruct al_an_lt_wrapper_gen {
60133816Stjr	/* [0x0] AN LT wrapper Version */
61140214Sobrien	uint32_t version;
62140214Sobrien	/* [0x4] AN LT general configuration */
63140214Sobrien	uint32_t cfg;
64140214Sobrien	uint32_t rsrvd[14];
6564907Smarcel};
6668583Smarcelstruct al_an_lt_wrapper_an_lt {
67133816Stjr	/* [0x0] AN LT register file address */
6868201Sobrien	uint32_t addr;
6964907Smarcel	/* [0x4] PCS register file data */
7064907Smarcel	uint32_t data;
7164907Smarcel	/* [0x8] AN LT control signals */
729313Ssos	uint32_t ctrl;
73144070Sbrooks	/* [0xc] AN LT status signals */
74144070Sbrooks	uint32_t status;
75144070Sbrooks	uint32_t rsrvd[4];
76144070Sbrooks};
7754122Smarcel
78104893Ssobomaxenum al_eth_an_lt_unit {
7954122Smarcel	AL_ETH_AN_LT_UNIT_32_BIT	= 0,
80130453Sphk	AL_ETH_AN_LT_UNIT_20_BIT	= 1,
8157998Snsayer	AL_ETH_AN_LT_UNIT_16_BIT	= 2,
8254122Smarcel};
8354122Smarcel
8454122Smarcelstruct al_an_lt_wrapper_regs {
8585127Sdes	uint32_t rsrvd_0[64];
86113991Sanholt	struct al_an_lt_wrapper_gen gen;                        /* [0x100] */
8786607Siedowse	struct al_an_lt_wrapper_an_lt an_lt[3];                 /* [0x140] */
8838672Sjkh};
8954122Smarcel
9054122Smarcel
91104893Ssobomax/*
92104893Ssobomax* Registers Fields
9354122Smarcel*/
9454122Smarcel
95130453Sphk
96130453Sphk/**** version register ****/
9757998Snsayer/*  Revision number (Minor) */
9857998Snsayer#define AN_LT_WRAPPER_GEN_VERSION_RELEASE_NUM_MINOR_MASK 0x000000FF
9954122Smarcel#define AN_LT_WRAPPER_GEN_VERSION_RELEASE_NUM_MINOR_SHIFT 0
10054122Smarcel/*  Revision number (Major) */
10154122Smarcel#define AN_LT_WRAPPER_GEN_VERSION_RELEASE_NUM_MAJOR_MASK 0x0000FF00
10254122Smarcel#define AN_LT_WRAPPER_GEN_VERSION_RELEASE_NUM_MAJOR_SHIFT 8
10354122Smarcel/*  Date of release */
10454122Smarcel#define AN_LT_WRAPPER_GEN_VERSION_DATE_DAY_MASK 0x001F0000
10585127Sdes#define AN_LT_WRAPPER_GEN_VERSION_DATE_DAY_SHIFT 16
10685127Sdes/*  Month of release */
107113991Sanholt#define AN_LT_WRAPPER_GEN_VERSION_DATA_MONTH_MASK 0x01E00000
108113991Sanholt#define AN_LT_WRAPPER_GEN_VERSION_DATA_MONTH_SHIFT 21
10954122Smarcel/*  Year of release (starting from 2000) */
11054122Smarcel#define AN_LT_WRAPPER_GEN_VERSION_DATE_YEAR_MASK 0x3E000000
111104893Ssobomax#define AN_LT_WRAPPER_GEN_VERSION_DATE_YEAR_SHIFT 25
11254122Smarcel/*  Reserved */
113130453Sphk#define AN_LT_WRAPPER_GEN_VERSION_RESERVED_MASK 0xC0000000
11457998Snsayer#define AN_LT_WRAPPER_GEN_VERSION_RESERVED_SHIFT 30
11554122Smarcel
11654122Smarcel/**** cfg register ****/
11754122Smarcel/*
11885127Sdes * selection between different bus widths:
119113991Sanholt * 0 ��� 16
12054122Smarcel * 1 ��� 20
121111742Sdes * 2 ��� 32
12254122Smarcel * 3 ��� N/A
12360938Sjake */
12483366Sjulian#define AN_LT_WRAPPER_GEN_CFG_AN_LT_SEL_RX_MASK 0x00000003
12554122Smarcel#define AN_LT_WRAPPER_GEN_CFG_AN_LT_SEL_RX_SHIFT 0
12654122Smarcel/*
12754122Smarcel * selection between different bus widths:
12860938Sjake * 0 ��� 16
12954122Smarcel * 1 ��� 20
13054122Smarcel * 2 ��� 32
131130453Sphk * 3 ��� N/A
132130453Sphk */
133130453Sphk#define AN_LT_WRAPPER_GEN_CFG_AN_LT_SEL_TX_MASK 0x0000000C
134130453Sphk#define AN_LT_WRAPPER_GEN_CFG_AN_LT_SEL_TX_SHIFT 2
135130453Sphk/* bypass the AN/LT block */
136130453Sphk#define AN_LT_WRAPPER_GEN_CFG_BYPASS_RX  (1 << 4)
137130453Sphk/* bypass the AN/LT block */
138130453Sphk#define AN_LT_WRAPPER_GEN_CFG_BYPASS_TX  (1 << 5)
139130453Sphk
140130453Sphk/**** addr register ****/
141130453Sphk/* Address value */
142130453Sphk#define AN_LT_WRAPPER_AN_LT_ADDR_VAL_MASK 0x000007FF
143130453Sphk#define AN_LT_WRAPPER_AN_LT_ADDR_VAL_SHIFT 0
144130453Sphk
145130453Sphk/**** data register ****/
146130453Sphk/* Data value */
147130453Sphk#define AN_LT_WRAPPER_AN_LT_DATA_VAL_MASK 0x0000FFFF
148130453Sphk#define AN_LT_WRAPPER_AN_LT_DATA_VAL_SHIFT 0
14957858Snsayer
150130453Sphk/**** ctrl register ****/
151130453Sphk/*
152130453Sphk * Default Auto-Negotiation Enable. If ���1���, the auto-negotiation process will
153130453Sphk * start after reset de-assertion. The application can also start the
154130453Sphk * auto-negotiation process by writing the KXAN_CONTROL.an_enable bit with ���1���.
155130453Sphk * Important: This signal is OR'ed with the KXAN_CONTROL.an_enable bit. Hence,
156130453Sphk * when asserted (1) the application is unable to disable autonegotiation and
157130453Sphk * writing the an_enable bit has no effect.
158130453Sphk * Note: Even if enabled by this pin, the application must write the correct
159130453Sphk * abilities in the KXAN_ABILITY_1/2/3 registers within 60ms from reset
160130453Sphk * deassertion (break_link_timer).
161130453Sphk */
162130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_AN_ENA  (1 << 0)
163130453Sphk/*
164130453Sphk * If set to 1, the Arbitration State Machine reached the TRANSMIT_DISABLE
165130453Sphk * state.
166130453Sphk */
167130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_AN_DIS_TIMER (1 << 1)
168130453Sphk
169130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_LINK_STATUS_KX (1 << 4)
170130453Sphk
171130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_LINK_STATUS_KX4 (1 << 5)
172130453Sphk
173130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_LINK_STATUS (1 << 6)
174130453Sphk/*
175130453Sphk * PHY LOS indication selection
176130453Sphk * 0 - Select input from the SerDes
177130453Sphk * 1 - Select register value from phy_los_in_def
178130453Sphk */
179130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_IN_SEL (1 << 8)
180130453Sphk/* PHY LOS default value */
181130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_IN_DEF (1 << 9)
182130453Sphk/* PHY LOS polarity */
183130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_IN_POL (1 << 10)
184130453Sphk/*
185130453Sphk * PHY LOS indication selection
186130453Sphk * 0 ��� select AN output
187130453Sphk * 1 - Select register value from phy_los_out_def
188130453Sphk * 2 - Select input from the SerDes
189130453Sphk * 3 ��� 0
190130453Sphk */
191130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_OUT_SEL_MASK 0x00003000
192130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_OUT_SEL_SHIFT 12
193130453Sphk/* PHY LOS default value */
194130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_OUT_DEF (1 << 14)
195130453Sphk/* PHY LOS polarity */
196130453Sphk#define AN_LT_WRAPPER_AN_LT_CTRL_PHY_LOS_OUT_POL (1 << 15)
197130453Sphk
198130453Sphk/**** status register ****/
199130453Sphk/* Auto-Negotiation Done. If ���1���, the auto-negotiation process has completed. */
200130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_DONE (1 << 0)
201130453Sphk/*
202130453Sphk * If set to 1, auto-negotiation is enabled on the link. It represents the
203130453Sphk * enable control bit KXAN_CONTROL.an_enable. When set to 1, the signals
204130453Sphk * an_status/an_select are valid.
205130453Sphk */
206130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_VAL (1 << 1)
207130453Sphk/*
208130453Sphk * If set to 0, auto-negotiation is in progress, if set to 1, the Arbitration
209130453Sphk * State Machine reached the AN_GOOD_CHECK state (i.e. before autonegotiation is
210130453Sphk * done, but the link no longer is used to transfer DME pages). Stays asserted
211130453Sphk * also during AN_GOOD (autoneg done).
212130453Sphk */
213130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_STATUS (1 << 2)
214130453Sphk/*
215130453Sphk * Selected Technology. Becomes valid when an_status is 1.
216130453Sphk * The selection mode number (from 0 to 24) corresponds to the Technology
217130453Sphk * Ability (A0-A24) from the ability pages (see 4.3.2.3 page 13). The mode
218130453Sphk * selection is based on the matching technology abilities and priority.
219130453Sphk * A value of 31 is an invalid setting that indicates that no common technology
220130453Sphk * could be resolved. The application should then inspect the base page results
221130453Sphk * to determine if the link is operable or not.
222130453Sphk */
223130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_SELECT_MASK 0x000001F0
224130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_SELECT_SHIFT 4
225130453Sphk/*
226130453Sphk * If set to 1, the Arbitration State Machine reached the TRANSMIT_DISABLE state
227130453Sphk */
228130453Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_AN_TR_DIS_STATUS (1 << 16)
229130453Sphk/*
230130453Sphk * FEC Enable. Asserts when autonegotiation base page exchange identified both
23183366Sjulian * link partners advertising FEC capability and at least one is requesting FEC.
23257858Snsayer * The signal stays constant following base page exchange until autonegotiation
23389306Salfred * is disabled or restarted.
23457858Snsayer * Note: the information can also be extracted from the base page exchange or
235112740Sphk * the BP_ETH_STATUS register.
236112740Sphk */
23757858Snsayer#define AN_LT_WRAPPER_AN_LT_STATUS_FEC_ENA (1 << 17)
23889319Salfred/*
23989319Salfred * Link Training Frame Lock. If set to 1 the training frame delineation has been
24057858Snsayer * acquired.
24157858Snsayer */
242112740Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_LT_LOCK (1 << 20)
243112740Sphk/*
244112740Sphk * If set to 0, link-training is in progress, if set to 1, the training is
245112740Sphk * completed and the PCS datapath has been enabled (phy_los_out no longer
246112740Sphk * gated).
24789306Salfred */
24857858Snsayer#define AN_LT_WRAPPER_AN_LT_STATUS_LT_STATUS (1 << 21)
24957858Snsayer/*
250112740Sphk * If set to 1, link-training is enabled on the link. It represents the enable
251112740Sphk * control bit PMD Control.taining enable. When set to 1, the signal lt_status
252112740Sphk * is valid
253112740Sphk */
254112740Sphk#define AN_LT_WRAPPER_AN_LT_STATUS_LT_VAL (1 << 22)
255112740Sphk
256130453Sphk#ifdef __cplusplus
25757858Snsayer}
25889306Salfred#endif
25957858Snsayer
26057858Snsayer#endif /* __AL_HAL_AN_LT_wrapper_REGS_H__ */
26157858Snsayer
26254122Smarcel/** @} end of ... group */
26354122Smarcel
26454122Smarcel
26554122Smarcel