4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _SYS_NXGE_NXGE_PHY_HW_H
26 #define _SYS_NXGE_NXGE_PHY_HW_H
32 #include <nxge_defs.h>
35 * Clause 45 and Clause 22 port/phy addresses 0 through 5 are reserved
36 * for on-chip serdes. So here the starting port is 6.
38 #define NXGE_MAX_PHY_PORTS 32
39 #define NXGE_EXT_PHY_PORT_ST 6
41 #define NXGE_PMA_PMD_DEV_ADDR 1
42 #define NXGE_PCS_DEV_ADDR 3
43 #define NXGE_DEV_ID_REG_1 2
44 #define NXGE_DEV_ID_REG_2 3
45 #define NXGE_PHY_ID_REG_1 2
46 #define NXGE_PHY_ID_REG_2 3
48 #define BCM8704_CHIP_ID 0x8704
49 #define BCM8706_CHIP_ID 0x8706
50 #define MRVL88X201X_CHIP_ID 0x5043
51 #define NLP2020_CHIP_ID 0x0211
54 * Description of BCM_PHY_ID_MASK:
55 * The first nibble (bits 0 through 3) is changed with every revision
56 * of the silicon. So these bits are masked out to support future revisions
57 * of the same chip. The third nibble (bits 8 through 11) is changed for
58 * different chips of the same family. So these bits are masked out to
59 * support chips of the same family.
61 #define BCM_PHY_ID_MASK 0xfffff0f0
62 #define BCM8704_DEV_ID 0x206033
63 #define BCM5464R_PHY_ID 0x2060b1
64 #define BCM8706_DEV_ID 0x206035
65 #define BCM5482_PHY_ID 0x143bcb1
66 #define MARVELL_88X_201X_DEV_ID 0x1410d24
67 #define MARVELL_88X201X_PHY_ID (MARVELL_88X_201X_DEV_ID & BCM_PHY_ID_MASK)
68 #define PHY_BCM8704_FAMILY (BCM8704_DEV_ID & BCM_PHY_ID_MASK)
69 #define PHY_BCM5464R_FAMILY (BCM5464R_PHY_ID & BCM_PHY_ID_MASK)
70 #define PHY_BCM5482_FAMILY (BCM5482_PHY_ID & BCM_PHY_ID_MASK)
72 * The default value is 0xa19410, after masking out model and revision
73 * (bits[9:0]) use 0xa19400 for any model or revision of the TN1010
75 #define TN1010_DEV_ID 0xa19400
77 * Description of TN1010_DEV_ID_MASK:
78 * The device ID assigned to Teranetics is stored in TN1010 register
79 * 1.2 and register 1.3 except bits[9:4] of register 1.3 for model number
80 * and bits[3:0] of register 1.3 for revision numbers. Use mask 0xfffffc00
81 * to mask off model number and revision number and keep TN1010's device
84 #define TN1010_DEV_ID_MASK 0xfffffc00
86 * The Netlogic device ID and mask:
87 * The device ID assigned to Netlogic is stored in AEL2020 register
88 * 1.2 and register 1.3 except bits[7:4] of register 1.3 have the model number
89 * and bits[3:0] of register 1.3 have the revision number. Use mask 0xffffff00
90 * to mask off model number and revision number and keep AEL2020 device
93 #define NLP2020_DEV_ID 0x3429000
94 #define NLP2020_DEV_ID_MASK 0xffffff00
96 #define CLAUSE_45_TYPE 1
97 #define CLAUSE_22_TYPE 2
99 /* IEEE802.3 Clause45 and Clause22 MDIO port addresses */
100 #define NEPTUNE_CLAUSE22_PORT_ADDR_BASE 10
101 #define NEPTUNE_CLAUSE45_PORT_ADDR_BASE 8
102 #define N2_CLAUSE45_PORT_ADDR_BASE 16
103 #define MRVL88X2011_NEPTUNE_PORT_ADDR_BASE 8
106 * Phy address for the second NIU port on Goa NEM card can be either
109 #define GOA_CLAUSE45_PORT_ADDR_BASE 16
110 #define ALT_GOA_CLAUSE45_PORT1_ADDR 20
113 * Phy addresses for AEL2020 used in QSFP for RF systems
115 #define NLP2020_CL45_PORT0_ADDR0 0x10
116 #define NLP2020_CL45_PORT0_ADDR1 0x12
117 #define NLP2020_CL45_PORT0_ADDR2 0x15
118 #define NLP2020_CL45_PORT0_ADDR3 0x17
119 #define NLP2020_CL45_PORT1_ADDR0 0x11
120 #define NLP2020_CL45_PORT1_ADDR1 0x13
121 #define NLP2020_CL45_PORT1_ADDR2 0x14
122 #define NLP2020_CL45_PORT1_ADDR3 0x16
125 * Phy addresses for Maramba support. Support for P0 will eventually
128 #define MARAMBA_P0_CLAUSE22_PORT_ADDR_BASE 10
129 #define MARAMBA_P1_CLAUSE22_PORT_ADDR_BASE 26
130 #define MARAMBA_CLAUSE45_PORT_ADDR_BASE 16
132 #define BCM8704_PMA_PMD_DEV_ADDR 1
133 #define BCM8704_PCS_DEV_ADDR 3
134 #define BCM8704_USER_DEV3_ADDR 3
135 #define BCM8704_PHYXS_ADDR 4
136 #define BCM8704_USER_DEV4_ADDR 4
138 /* Definitions for BCM 5464R PHY chip */
140 #define BCM5464R_PHY_ECR 16
141 #define BCM5464R_PHY_ESR 17
142 #define BCM5464R_RXERR_CNT 18
143 #define BCM5464R_FALSECS_CNT 19
144 #define BCM5464R_RX_NOTOK_CNT 20
145 #define BCM5464R_ER_DATA 21
146 #define BCM5464R_RES 22
147 #define BCM5464R_ER_ACC 23
148 #define BCM5464R_AUX_CTL 24
149 #define BCM5464R_AUX_S 25
150 #define BCM5464R_INTR_S 26
151 #define BCM5464R_INTR_M 27
152 #define BCM5464R_MISC 28
153 #define BCM5464R_MISC1 29
154 #define BCM5464R_TESTR1 30
156 #define PHY_BCM_5464R_OUI 0x001018
157 #define PHY_BCM_5464R_MODEL 0x0B
159 /* MARVELL PHY Definitions */
161 #define MRVL_88X2011_USER_DEV1_ADDR 1
162 #define MRVL_88X2011_USER_DEV2_ADDR 2
163 #define MRVL_88X2011_USER_DEV3_ADDR 3
164 #define MRVL_88X2011_USER_DEV4_ADDR 4
165 #define MRVL_88X2011_PMA_PMD_CTL_1 0x0000
166 #define MRVL_88X2011_PMA_PMD_STAT_1 0x0001
167 #define MRVL_88X2011_10G_PMD_STAT_2 0x0008
168 #define MRVL_88X2011_10G_PMD_TX_DIS 0x0009
169 #define MRVL_88X2011_10G_XGXS_LANE_STAT 0x0018
170 #define MRVL_88X2011_GEN_CTL 0x8300
171 #define MRVL_88X2011_LED_BLINK_CTL 0x8303
172 #define MRVL_88X2011_LED_8_TO_11_CTL 0x8306
174 /* MRVL88X2011 register control */
175 #define MRVL_88X2011_ENA_PMDTX 0x0000
176 #define MRVL_88X2011_ENA_XFPREFCLK 0x0001
177 #define MRVL_88X2011_LOOPBACK 0x1
178 #define MRVL_88X2011_LED_ACT 0x1
179 #define MRVL_88X2011_LNK_STATUS_OK 0x4
180 #define MRVL_88X2011_LED_BLK_MASK 0x70
181 #define MRVL_88X2011_LED_BLK_SHIFT 4
182 #define MRVL_88X2011_LED_BLK34MS 0x0
183 #define MRVL_88X2011_LED_BLK67MS 0x1
184 #define MRVL_88X2011_LED_BLK134MS 0x2
185 #define MRVL_88X2011_LED_BLK269MS 0x3
186 #define MRVL_88X2011_LED_BLK538MS 0x4
187 #define MRVL_88X2011_LED_CTL_OFF 0x0
188 #define MRVL_88X2011_LED_CTL_PCS_ERR 0x2
189 #define MRVL_88X2011_LED_CTL_PCS_ACT 0x5
190 #define MRVL_88X2011_LED_CTL_MASK 0x7
191 #define MRVL_88X2011_LED(n, v) ((v)<<((n)*4))
192 #define MRVL_88X2011_LED_STAT(n, v) ((v)>>((n)*4))
195 * MII Register 16: PHY Extended Control Register
198 typedef union _mii_phy_ecr_t
{
201 #ifdef _BIT_FIELDS_HTOL
202 uint16_t mac_phy_if_mode
: 1;
203 uint16_t dis_automdicross
: 1;
205 uint16_t intr_dis
: 1;
206 uint16_t force_intr
: 1;
207 uint16_t bypass_encdec
: 1;
208 uint16_t bypass_scrdes
: 1;
209 uint16_t bypass_mlt3
: 1;
210 uint16_t bypass_rx_sym
: 1;
211 uint16_t reset_scr
: 1;
212 uint16_t en_led_traffic
: 1;
213 uint16_t force_leds_on
: 1;
214 uint16_t force_leds_off
: 1;
216 uint16_t gmii_fifo_elas
: 1;
218 uint16_t gmii_fifo_elas
: 1;
220 uint16_t force_leds_off
: 1;
221 uint16_t force_leds_on
: 1;
222 uint16_t en_led_traffic
: 1;
223 uint16_t reset_scr
: 1;
224 uint16_t bypass_rx_sym
: 1;
225 uint16_t bypass_mlt3
: 1;
226 uint16_t bypass_scrdes
: 1;
227 uint16_t bypass_encdec
: 1;
228 uint16_t force_intr
: 1;
229 uint16_t intr_dis
: 1;
231 uint16_t dis_automdicross
: 1;
232 uint16_t mac_phy_if_mode
: 1;
235 } mii_phy_ecr_t
, *p_mii_phy_ecr_t
;
238 * MII Register 17: PHY Extended Status Register
240 typedef union _mii_phy_esr_t
{
243 #ifdef _BIT_FIELDS_HTOL
244 uint16_t anbpsfm
: 1;
245 uint16_t wsdwngr
: 1;
246 uint16_t mdi_crst
: 1;
248 uint16_t rmt_rx_s
: 1;
249 uint16_t loc_rx_s
: 1;
252 uint16_t crc_err
: 1;
253 uint16_t cext_err
: 1;
254 uint16_t bad_ssd
: 1;
255 uint16_t bad_esd
: 1;
258 uint16_t lock_err
: 1;
259 uint16_t mlt3_cerr
: 1;
261 uint16_t mlt3_cerr
: 1;
262 uint16_t lock_err
: 1;
265 uint16_t bad_esd
: 1;
266 uint16_t bad_ssd
: 1;
267 uint16_t cext_err
: 1;
268 uint16_t crc_err
: 1;
271 uint16_t loc_rx_s
: 1;
272 uint16_t rmt_rx_s
: 1;
274 uint16_t mdi_crst
: 1;
275 uint16_t wsdwngr
: 1;
276 uint16_t anbpsfm
: 1;
279 } mii_phy_esr_t
, *p_mii_phy_esr_t
;
282 * MII Register 18: Receive Error Counter Register
284 typedef union _mii_rxerr_cnt_t
{
287 uint16_t rx_err_cnt
: 16;
289 } mii_rxerr_cnt_t
, *p_mii_rxerr_cnt_t
;
292 * MII Register 19: False Carrier Sense Counter Register
294 typedef union _mii_falsecs_cnt_t
{
297 #ifdef _BIT_FIELDS_HTOL
299 uint16_t false_cs_cnt
: 8;
301 uint16_t false_cs_cnt
: 8;
305 } mii_falsecs_cnt_t
, *p_mii_falsecs_cnt_t
;
308 * MII Register 20: Receiver NOT_OK Counter Register
310 typedef union _mii_rx_notok_cnt_t
{
313 #ifdef _BIT_FIELDS_HTOL
314 uint16_t l_rx_notok_cnt
: 8;
315 uint16_t r_rx_notok_cnt
: 8;
317 uint16_t r_rx_notok_cnt
: 8;
318 uint16_t l_rx_notok_cnt
: 8;
321 } mii_rx_notok_cnt_t
, *p_mii_rx_notok_t
;
324 * MII Register 21: Expansion Register Data Register
326 typedef union _mii_er_data_t
{
331 } mii_er_data_t
, *p_mii_er_data_t
;
334 * MII Register 23: Expansion Register Access Register
336 typedef union _mii_er_acc_t
{
338 #ifdef _BIT_FIELDS_HTOL
348 } mii_er_acc_t
, *p_mii_er_acc_t
;
350 #define EXP_RXTX_PKT_CNT 0x0
351 #define EXP_INTR_STAT 0x1
352 #define MULTICOL_LED_SEL 0x4
353 #define MULTICOL_LED_FLASH_RATE_CTL 0x5
354 #define MULTICOL_LED_BLINK_CTL 0x6
355 #define CABLE_DIAG_CTL 0x10
356 #define CABLE_DIAG_RES 0x11
357 #define CABLE_DIAG_LEN_CH_2_1 0x12
358 #define CABLE_DIAG_LEN_CH_4_3 0x13
361 * MII Register 24: Auxiliary Control Register
363 typedef union _mii_aux_ctl_t
{
366 #ifdef _BIT_FIELDS_HTOL
368 uint16_t ext_pkt_len
: 1;
369 uint16_t edge_rate_ctl_1000
: 2;
371 uint16_t write_1
: 1;
373 uint16_t dis_partial_resp
: 1;
375 uint16_t edge_rate_ctl_100
: 2;
376 uint16_t diag_mode
: 1;
377 uint16_t shadow_reg_sel
: 3;
379 uint16_t shadow_reg_sel
: 3;
380 uint16_t diag_mode
: 1;
381 uint16_t edge_rate_ctl_100
: 2;
383 uint16_t dis_partial_resp
: 1;
385 uint16_t write_1
: 1;
387 uint16_t edge_rate_ctl_1000
: 2;
388 uint16_t ext_pkt_len
: 1;
392 } mii_aux_ctl_t
, *p_mii_aux_ctl_t
;
395 #define AUX_10BASET 0x1
396 #define AUX_PWR_CTL 0x2
397 #define AUX_MISC_TEST 0x4
398 #define AUX_MISC_CTL 0x7
401 * MII Register 25: Auxiliary Status Summary Register
403 typedef union _mii_aux_s_t
{
406 #ifdef _BIT_FIELDS_HTOL
407 uint16_t an_complete
: 1;
408 uint16_t an_complete_ack
: 1;
409 uint16_t an_ack_detect
: 1;
410 uint16_t an_ability_detect
: 1;
411 uint16_t an_np_wait
: 1;
413 uint16_t pd_fault
: 1;
414 uint16_t rmt_fault
: 1;
415 uint16_t an_page_rx
: 1;
416 uint16_t lp_an_ability
: 1;
417 uint16_t lp_np_ability
: 1;
419 uint16_t pause_res_rx_dir
: 1;
420 uint16_t pause_res_tx_dir
: 1;
422 uint16_t pause_res_tx_dir
: 1;
423 uint16_t pause_res_rx_dir
: 1;
425 uint16_t lp_np_ability
: 1;
426 uint16_t lp_an_ability
: 1;
427 uint16_t an_page_rx
: 1;
428 uint16_t rmt_fault
: 1;
429 uint16_t pd_fault
: 1;
431 uint16_t an_np_wait
: 1;
432 uint16_t an_ability_detect
: 1;
433 uint16_t an_ack_detect
: 1;
434 uint16_t an_complete_ack
: 1;
435 uint16_t an_complete
: 1;
438 } mii_aux_s_t
, *p_mii_aux_s_t
;
441 * MII Register 26, 27: Interrupt Status and Mask Registers
443 typedef union _mii_intr_t
{
446 #ifdef _BIT_FIELDS_HTOL
448 uint16_t illegal_pair_swap
: 1;
449 uint16_t mdix_status_change
: 1;
450 uint16_t exceed_hicnt_thres
: 1;
451 uint16_t exceed_locnt_thres
: 1;
452 uint16_t an_page_rx
: 1;
453 uint16_t hcd_nolink
: 1;
455 uint16_t neg_unsupported_hcd
: 1;
456 uint16_t scr_sync_err
: 1;
457 uint16_t rmt_rx_status_change
: 1;
458 uint16_t loc_rx_status_change
: 1;
459 uint16_t duplex_mode_change
: 1;
460 uint16_t link_speed_change
: 1;
461 uint16_t link_status_change
: 1;
462 uint16_t crc_err
: 1;
464 uint16_t crc_err
: 1;
465 uint16_t link_status_change
: 1;
466 uint16_t link_speed_change
: 1;
467 uint16_t duplex_mode_change
: 1;
468 uint16_t loc_rx_status_change
: 1;
469 uint16_t rmt_rx_status_change
: 1;
470 uint16_t scr_sync_err
: 1;
471 uint16_t neg_unsupported_hcd
: 1;
473 uint16_t hcd_nolink
: 1;
474 uint16_t an_page_rx
: 1;
475 uint16_t exceed_locnt_thres
: 1;
476 uint16_t exceed_hicnt_thres
: 1;
477 uint16_t mdix_status_change
: 1;
478 uint16_t illegal_pair_swap
: 1;
482 } mii_intr_t
, *p_mii_intr_t
;
485 * MII Register 28: Register 1C Access Register
487 typedef union _mii_misc_t
{
490 #ifdef _BIT_FIELDS_HTOL
492 uint16_t shadow_reg_sel
: 5;
496 uint16_t shadow_reg_sel
: 5;
500 } mii_misc_t
, *p_mii_misc_t
;
502 #define LINK_LED_MODE 0x2
503 #define CLK_ALIGN_CTL 0x3
504 #define WIRE_SP_RETRY 0x4
506 #define LED_STATUS 0x8
507 #define LED_CONTROL 0x9
508 #define AUTO_PWR_DOWN 0xA
513 * MII Register 29: Master/Slave Seed / HCD Status Register
516 typedef union _mii_misc1_t
{
519 #ifdef _BIT_FIELDS_HTOL
520 uint16_t en_shadow_reg
: 1;
524 uint16_t en_shadow_reg
: 1;
527 } mii_misc1_t
, *p_mii_misc1_t
;
530 * MII Register 30: Test Register 1
533 typedef union _mii_test1_t
{
536 #ifdef _BIT_FIELDS_HTOL
537 uint16_t crc_err_cnt_sel
: 1;
539 uint16_t manual_swap_mdi_st
: 1;
543 uint16_t manual_swap_mdi_st
: 1;
545 uint16_t crc_err_cnt_sel
: 1;
548 } mii_test1_t
, *p_mii_test1_t
;
551 /* Definitions of BCM8704 */
553 #define BCM8704_PMD_CONTROL_REG 0
554 #define BCM8704_PMD_STATUS_REG 0x1
555 #define BCM8704_PMD_ID_0_REG 0x2
556 #define BCM8704_PMD_ID_1_REG 0x3
557 #define BCM8704_PMD_SPEED_ABIL_REG 0x4
558 #define BCM8704_PMD_DEV_IN_PKG1_REG 0x5
559 #define BCM8704_PMD_DEV_IN_PKG2_REG 0x6
560 #define BCM8704_PMD_CONTROL2_REG 0x7
561 #define BCM8704_PMD_STATUS2_REG 0x8
562 #define BCM8704_PMD_TRANSMIT_DIS_REG 0x9
563 #define BCM8704_PMD_RECEIVE_SIG_DETECT 0xa
564 #define BCM8704_PMD_ORG_UNIQUE_ID_0_REG 0xe
565 #define BCM8704_PMD_ORG_UNIQUE_ID_1_REG 0xf
566 #define BCM8704_PCS_CONTROL_REG 0
567 #define BCM8704_PCS_STATUS1_REG 0x1
568 #define BCM8704_PCS_ID_0_REG 0x2
569 #define BCM8704_PCS_ID_1_REG 0x3
570 #define BCM8704_PCS_SPEED_ABILITY_REG 0x4
571 #define BCM8704_PCS_DEV_IN_PKG1_REG 0x5
572 #define BCM8704_PCS_DEV_IN_PKG2_REG 0x6
573 #define BCM8704_PCS_CONTROL2_REG 0x7
574 #define BCM8704_PCS_STATUS2_REG 0x8
575 #define BCM8704_PCS_ORG_UNIQUE_ID_0_REG 0xe
576 #define BCM8704_PCS_ORG_UNIQUE_ID_1_REG 0xf
577 #define BCM8704_PCS_STATUS_REG 0x18
578 #define BCM8704_10GBASE_R_PCS_STATUS_REG 0x20
579 #define BCM8704_10GBASE_R_PCS_STATUS2_REG 0x21
580 #define BCM8704_PHYXS_CONTROL_REG 0
581 #define BCM8704_PHYXS_STATUS_REG 0x1
582 #define BCM8704_PHY_ID_0_REG 0x2
583 #define BCM8704_PHY_ID_1_REG 0x3
584 #define BCM8704_PHYXS_SPEED_ABILITY_REG 0x4
585 #define BCM8704_PHYXS_DEV_IN_PKG2_REG 0x5
586 #define BCM8704_PHYXS_DEV_IN_PKG1_REG 0x6
587 #define BCM8704_PHYXS_STATUS2_REG 0x8
588 #define BCM8704_PHYXS_ORG_UNIQUE_ID_0_REG 0xe
589 #define BCM8704_PHYXS_ORG_UNIQUE_ID_1_REG 0xf
590 #define BCM8704_PHYXS_XGXS_LANE_STATUS_REG 0x18
591 #define BCM8704_PHYXS_XGXS_TEST_CONTROL_REG 0x19
592 #define BCM8704_USER_CONTROL_REG 0xC800
593 #define BCM8704_USER_ANALOG_CLK_REG 0xC801
594 #define BCM8704_USER_PMD_RX_CONTROL_REG 0xC802
595 #define BCM8704_USER_PMD_TX_CONTROL_REG 0xC803
596 #define BCM8704_USER_ANALOG_STATUS0_REG 0xC804
597 #define BCM8704_CHIP_ID_REG 0xC807
598 #define BCM8704_USER_OPTICS_DIGITAL_CTRL_REG 0xC808
599 #define BCM8704_USER_RX2_CONTROL1_REG 0x80C6
600 #define BCM8704_USER_RX1_CONTROL1_REG 0x80D6
601 #define BCM8704_USER_RX0_CONTROL1_REG 0x80E6
602 #define BCM8704_USER_TX_ALARM_STATUS_REG 0x9004
604 /* Rx Channel Control1 Register bits */
605 #define BCM8704_RXPOL_FLIP 0x20
607 typedef union _phyxs_control
{
610 #ifdef _BIT_FIELDS_HTOL
612 uint16_t loopback
: 1;
613 uint16_t speed_sel2
: 1;
615 uint16_t low_power
: 1;
617 uint16_t speed_sel1
: 1;
618 uint16_t speed_sel0
: 4;
622 uint16_t speed_sel0
: 4;
623 uint16_t speed_sel1
: 1;
625 uint16_t low_power
: 1;
627 uint16_t speed_sel2
: 1;
628 uint16_t loopback
: 1;
632 } phyxs_control_t
, *p_phyxs_control_t
, pcs_control_t
, *p_pcs_control_t
;
635 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc800) */
637 typedef union _control
{
640 #ifdef _BIT_FIELDS_HTOL
641 uint16_t optxenb_lvl
: 1;
642 uint16_t optxrst_lvl
: 1;
643 uint16_t opbiasflt_lvl
: 1;
644 uint16_t obtmpflt_lvl
: 1;
645 uint16_t opprflt_lvl
: 1;
646 uint16_t optxflt_lvl
: 1;
647 uint16_t optrxlos_lvl
: 1;
648 uint16_t oprxflt_lvl
: 1;
649 uint16_t optxon_lvl
: 1;
653 uint16_t optxon_lvl
: 1;
654 uint16_t oprxflt_lvl
: 1;
655 uint16_t optrxlos_lvl
: 1;
656 uint16_t optxflt_lvl
: 1;
657 uint16_t opprflt_lvl
: 1;
658 uint16_t obtmpflt_lvl
: 1;
659 uint16_t opbiasflt_lvl
: 1;
660 uint16_t optxrst_lvl
: 1;
661 uint16_t optxenb_lvl
: 1;
664 } control_t
, *p_control_t
;
666 typedef union _pmd_tx_control
{
669 #ifdef _BIT_FIELDS_HTOL
671 uint16_t xfp_clken
: 1;
672 uint16_t tx_dac_txd
: 2;
673 uint16_t tx_dac_txck
: 2;
674 uint16_t tsd_lpwren
: 1;
675 uint16_t tsck_lpwren
: 1;
676 uint16_t cmu_lpwren
: 1;
677 uint16_t sfiforst
: 1;
679 uint16_t sfiforst
: 1;
680 uint16_t cmu_lpwren
: 1;
681 uint16_t tsck_lpwren
: 1;
682 uint16_t tsd_lpwren
: 1;
683 uint16_t tx_dac_txck
: 2;
684 uint16_t tx_dac_txd
: 2;
685 uint16_t xfp_clken
: 1;
689 } pmd_tx_control_t
, *p_pmd_tx_control_t
;
692 /* PMD/Optics Digital Control Register (Dev=3 Addr=0xc808) */
694 typedef union _optics_dcntr
{
697 #ifdef _BIT_FIELDS_HTOL
698 uint16_t fault_mode
: 1;
699 uint16_t tx_pwrdown
: 1;
700 uint16_t rx_pwrdown
: 1;
701 uint16_t ext_flt_en
: 1;
702 uint16_t opt_rst
: 1;
703 uint16_t pcs_tx_inv_b
: 1;
704 uint16_t pcs_rx_inv
: 1;
706 uint16_t gpio_sel
: 2;
708 uint16_t lpbk_err_dis
: 1;
710 uint16_t txonoff_pwdwn_dis
: 1;
712 uint16_t txonoff_pwdwn_dis
: 1;
714 uint16_t lpbk_err_dis
: 1;
716 uint16_t gpio_sel
: 2;
718 uint16_t pcs_rx_inv
: 1;
719 uint16_t pcs_tx_inv_b
: 1;
720 uint16_t opt_rst
: 1;
721 uint16_t ext_flt_en
: 1;
722 uint16_t rx_pwrdown
: 1;
723 uint16_t tx_pwrdown
: 1;
724 uint16_t fault_mode
: 1;
727 } optics_dcntr_t
, *p_optics_dcntr_t
;
729 /* PMD Receive Signal Detect Register (Dev = 1 Register Address = 0x000A) */
731 #define PMD_RX_SIG_DET3 0x10
732 #define PMD_RX_SIG_DET2 0x08
733 #define PMD_RX_SIG_DET1 0x04
734 #define PMD_RX_SIG_DET0 0x02
735 #define GLOB_PMD_RX_SIG_OK 0x01
737 /* 10GBase-R PCS Status Register (Dev = 3, Register Address = 0x0020) */
739 #define PCS_10GBASE_RX_LINK_STATUS 0x1000
740 #define PCS_PRBS31_ABLE 0x0004
741 #define PCS_10GBASE_R_HI_BER 0x0002
742 #define PCS_10GBASE_R_PCS_BLK_LOCK 0x0001
744 /* XGXS Lane Status Register (Dev = 4, Register Address = 0x0018) */
746 #define XGXS_LANE_ALIGN_STATUS 0x1000
747 #define XGXS_PATTERN_TEST_ABILITY 0x0800
748 #define XGXS_LANE3_SYNC 0x0008
749 #define XGXS_LANE2_SYNC 0x0004
750 #define XGXS_LANE1_SYNC 0x0002
751 #define XGXS_LANE0_SYNC 0x0001
752 #define XGXS_LANE_STAT_MAGIC 0x0400
755 /* Teranetics TN1010 Definitions */
757 /* Teranetics TN1010 PHY MMD Addresses */
758 #define TN1010_PMA_PMD_DEV_ADDR 1
759 #define TN1010_PCS_DEV_ADDR 3
760 #define TN1010_PHYXS_DEV_ADDR 4
761 #define TN1010_AUTONEG_DEV_ADDR 7
762 #define TN1010_VENDOR_MMD1_DEV_ADDR 30
764 /* TN1010 PCS Control Register */
765 typedef union _tn1010_pcs_ctrl
{
768 #ifdef _BIT_FIELDS_HTOL
769 uint16_t reset
: 1; /* bit 15 */
770 uint16_t loopback
: 1; /* bit 14 */
771 uint16_t speed_sel2
: 1;
773 uint16_t low_power
: 1;
775 uint16_t speed_sel1
: 1; /* bit 6 */
776 uint16_t speed_sel0
: 4; /* bits[5:2] */
780 uint16_t speed_sel0
: 4; /* bits[5:2] */
781 uint16_t speed_sel1
: 1; /* bit 6 */
783 uint16_t low_power
: 1;
785 uint16_t speed_sel2
: 1;
786 uint16_t loopback
: 1; /* bit 14 */
787 uint16_t reset
: 1; /* bit 15 */
790 } tn1010_phyxs_ctrl_t
, *p_tn1010_phyxs_ctrl_t
;
792 /* TN1010 PHY XS Control Register */
793 typedef union _tn1010_phyxs_ctrl
{
796 #ifdef _BIT_FIELDS_HTOL
797 uint16_t reset
: 1; /* bit 15 */
798 uint16_t loopback
: 1; /* bit 14 */
799 uint16_t speed_sel2
: 1;
801 uint16_t low_power
: 1;
803 uint16_t speed_sel1
: 1; /* bit 6 */
804 uint16_t speed_sel0
: 4; /* bits[5:2] */
808 uint16_t speed_sel0
: 4; /* bits[5:2] */
809 uint16_t speed_sel1
: 1; /* bit 6 */
811 uint16_t low_power
: 1;
813 uint16_t speed_sel2
: 1;
814 uint16_t loopback
: 1; /* bit 14 */
815 uint16_t reset
: 1; /* bit 15 */
818 } tn1010_pcs_ctrl_t
, *p_tn1010_pcs_ctrl_t
;
820 /* TN1010 VENDOR MMD1 GPHY Control register 30.310 */
821 #define TN1010_SGMII_LOOPBACK 1
822 #define TN1010_DEEP_LOOPBACK 2
824 #define TN1010_PMD_CONTROL_REG 0
825 #define TN1010_PMD_STATUS_REG 1
826 #define TN1010_PMD_ID_HIGH_REG 2
827 #define TN1010_PMD_ID_LOW_REG 3
828 #define TN1010_PMD_SPEED_ABIL_REG 4
829 #define TN1010_PMD_DEV_IN_PKG1_REG 5
830 #define TN1010_PMD_DEV_IN_PKG2_REG 6
831 #define TN1010_PMD_CONTROL2_REG 7
832 #define TN1010_PMD_STATUS2_REG 8
833 #define TN1010_PMD_TRANSMIT_DIS_REG 9
834 #define TN1010_PMD_RECEIVE_SIG_DETECT 10
835 #define TN1010_PMD_ORG_UNIQUE_ID_0_REG 14
836 #define TN1010_PMD_ORG_UNIQUE_ID_1_REG 15
837 #define TN1010_PCS_CONTROL_REG 0
838 #define TN1010_PCS_STATUS1_REG 1
839 #define TN1010_PCS_ID_HIGH_REG 2
840 #define TN1010_PCS_ID_LOW_REG 3
841 #define TN1010_PCS_SPEED_ABILITY_REG 4
842 #define TN1010_PCS_DEV_IN_PKG1_REG 5
843 #define TN1010_PCS_DEV_IN_PKG2_REG 6
844 #define TN1010_PCS_CONTROL2_REG 7
845 #define TN1010_PCS_STATUS2_REG 8
846 #define TN1010_PCS_ORG_UNIQUE_ID_0_REG 14
847 #define TN1010_PCS_ORG_UNIQUE_ID_1_REG 15
848 #define TN1010_PCS_10GBASE_R_T_STATUS1_REG 32
849 #define TN1010_PCS_10GBASE_R_T_STATUS2_REG 33
850 #define TN1010_PHYXS_CONTROL_REG 0
851 #define TN1010_PHYXS_STATUS_REG 1
852 #define TN1010_PHY_ID_HIGH_REG 2
853 #define TN1010_PHY_ID_LOW_REG 3
854 #define TN1010_PHYXS_SPEED_ABILITY_REG 4
855 #define TN1010_PHYXS_DEV_IN_PKG2_REG 5
856 #define TN1010_PHYXS_DEV_IN_PKG1_REG 6
857 #define TN1010_PHYXS_STATUS2_REG 8
858 #define TN1010_PHYXS_ORG_UNIQUE_ID_0_REG 14
859 #define TN1010_PHYXS_ORG_UNIQUE_ID_1_REG 15
860 #define TN1010_PHYXS_XGXS_LANE_STATUS_REG 24
861 #define TN1010_PHYXS_XGXS_TEST_CONTROL_REG 25
863 #define TN1010_AUTONEG_CONTROL_REG 0
864 #define TN1010_AUTONEG_STATUS_REG 1
865 #define TN1010_AUTONEG_ID_HIGH_REG 2
866 #define TN1010_AUTONEG_ID_LOW_REG 3
867 #define TN1010_AUTONEG_DEV_IN_PKG1_REG 5
868 #define TN1010_AUTUNEG_DEV_IN_PKG2_REG 6
869 #define TN1010_AUTONEG_ORG_UNIQUE_ID_0_REG 14
870 #define TN1010_AUTONEG_ORG_UNIQUE_ID_1_REG 15
871 #define TN1010_AUTONEG_ADVERTISE_REG 16
872 #define TN1010_AUTONEG_PARTNER_ABILITY_REG 19
874 #define TN1010_VENDOR_MMD1_CONTROL_REG 0
875 #define TN1010_VENDOR_MMD1_STATUS_REG 1
876 #define TN1010_VENDOR_MMD1_ID_HIGH 2
877 #define TN1010_VENDOR_MMD1_ID_LOW 3
878 #define TN1010_VENDOR_MMD1_DEV_STATUS_REG 8
879 #define TN1010_VENDOR_MMD1_FNS_CONTROL_RER 9
880 #define TN1010_VENDOR_MMD1_PKG_ID_0_REG 14
881 #define TN1010_VENDOR_MMD1_PKG_ID_1_REG 15
882 #define TN1010_VENDOR_MMD1_GPHY_CTRL 310
884 /* Bits definitions of TN1010_AUTONEG_CONTROL_REG */
885 #define TN1010_AN_CTRL_RESET_BIT 0x8000 /* Reset */
886 #define TN1010_AN_CTRL_EN_BIT 0x1000 /* Enable autoneg */
887 #define TN1010_AN_CTRL_RESTART_BIT 0x200 /* Restart autoneg */
888 #define TN1010_AN_LINK_STAT_BIT 0x4 /* Link status */
890 /* Bits definitions of TN1010_PHYXS_CONTROL_REG */
891 #define TN1010_VENDOR_MMD1_AN_STAT_BITS 0xC0
894 * Shift right 6 bits so bits[7:6] becomes [1:0].
895 * Bits[7:6] of TN1010_VENDOR_MND1_STATUS_REG are for autoneg status
901 #define TN1010_VENDOR_MMD1_AN_STAT_SHIFT 6
903 /* Bit 4 of TN1010_VENDOR_MMD1_STATUS_REG is speed. 0: 10G, 1: 1G */
904 #define TN1010_VENDOR_MMD1_AN_SPEED_BIT 0x10
906 /* Shift right 4 bits so bit4 becomes bit0 */
907 #define TN1010_VENDOR_MMD1_AN_SPEED_SHIFT 4
910 * Definitions for Netlogic AEL2020 PHY
912 #define NLP2020_PMA_PMD_ADDR 1
913 #define NLP2020_PMA_PMD_CTL_REG 0
914 #define NLP2020_PMA_PMD_PHY_RST 0x8000
916 #define NLP2020_PMA_PMD_STAT1_REG 0x0001
917 #define NLP2020_PMA_PMD_LINK_UP 0x0004
919 #define NLP2020_PMA_PMD_RX_SIG_DET_REG 0x000A
920 #define NLP2020_PMA_PMD_RX_SIG_ON 0x0001
922 #define NLP2020_PMA_PMD_STAT2_REG 0x0008
924 #define NLP2020_OPT_SET_REG 0xC017
925 #define NLP2020_RXLOS_ACT_H 0x0020
927 #define NLP2020_TX_DRV_CTL1_REG 0xC241
928 #define NLP2020_TX_DRV_CTL1_PREEMP_EN 0xA000
930 #define NLP2020_TX_DRV_CTL2_REG 0xC243
931 #define NLP2020_TX_DRV_CTL2_EMP_VAL 0xFFD3
933 #define NLP2020_UC_CTL_REG 0xD092
934 #define NLP2020_UC_CTL_STOP 1
935 #define NLP2020_UC_CTL_START 0
937 #define NLP2020_UC_PC_START_REG 0xD080
938 #define NLP2020_UC_PC_START_VAL 0x100
940 #define NLP2020_PHY_PCS_ADDR 3
941 #define NLP2020_PHY_PCS_STAT1_REG 0x0001
942 #define NLP2020_PHY_PCS_LINK_UP 0x0004
944 #define NLP2020_PHY_PCS_10GBR_STAT1_REG 0x0020
945 #define NLP2020_PHY_PCS_10GBR_RX_LINK_UP 0x1000
947 #define NLP2020_PHY_PCS_STAT2_REG 0x0008
949 #define NLP2020_PHY_XS_ADDR 4
950 #define NLP2020_PHY_XS_STAT1_REG 0x0001
951 #define NLP2020_PHY_XS_LINK_UP 0x0004
953 #define NLP2020_PHY_XS_LN_ST_REG 0x0018
954 #define NLP2020_PHY_XS_LN_ALIGN_SYNC 0x100f
956 #define NLP2020_PHY_XS_STAT2_REG 0x0008
958 #define NLP2020_GPIO_ADDR 1
959 #define NLP2020_GPIO_CTL_REG 0xC108
960 #define NLP2020_GPIO_STAT_REG 0xC10C
961 #define NLP2020_GPIO_STAT_MD_SHIFT 0x0004
962 #define NLP2020_GPIO_STAT_MD_MASK 0x00f0
963 #define NLP2020_GPIO_PT3_CFG_REG 0xC113
965 #define NLP2020_GPIO_ACT 0x0a00
966 #define NLP2020_GPIO_INACT 0x0b00
968 #define NLP2020_I2C_SNOOP_DEV_ADDR 1
969 #define NLP2020_I2C_SNOOP_ADDR_REG 0xC30A
970 #define NLP2020_I2C_SNOOP_DATA_REG 0xC30B
971 #define NLP2020_I2C_SNOOP_STAT_REG 0xC30C
972 #define NLP2020_XCVR_I2C_ADDR 0x00A0
973 #define NLP2020_XCVR_I2C_ADDR_SH 0x0008
978 #define SFPP_COPPER_TWINAX 0x21
979 #define SFPP_FIBER 0x7
980 #define QSFP_FIBER 0xC
981 #define QSFP_COPPER_TWINAX 0x21
983 #define QSFP_MSA_CONN_REG 130
984 #define QSFP_MSA_LPM_REG 93
985 #define QSFP_MSA_LEN_REG 0x92
986 #define QSFP_MSA_LPM_HIGH 0x1
990 NXGE_NLP_CONN_COPPER_LT_7M
,
991 NXGE_NLP_CONN_COPPER_7M_ABOVE
995 * struct for PHY addr-value pairs
997 typedef struct _nxge_nlp_initseq_t
{
1000 } nxge_nlp_initseq_t
, *p_nxge_nlp_initseq_t
;
1003 * struct for PHY dev, register and value triple properties
1005 typedef struct _nxge_phy_mdio_val_t
{
1009 } nxge_phy_mdio_val_t
, *p_nxge_phy_mdio_val_t
;
1012 * struct for PHY register configurable property
1014 typedef struct _nxge_phy_prop_t
{
1016 p_nxge_phy_mdio_val_t arr
;
1017 } nxge_phy_prop_t
, *p_nxge_phy_prop_t
;
1023 #endif /* _SYS_NXGE_NXGE_PHY_HW_H */