18c2ecf20Sopenharmony_ci/* Copyright © 2005 Agere Systems Inc.
28c2ecf20Sopenharmony_ci * All rights reserved.
38c2ecf20Sopenharmony_ci *   http://www.agere.com
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * SOFTWARE LICENSE
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This software is provided subject to the following terms and conditions,
88c2ecf20Sopenharmony_ci * which you should read carefully before using the software.  Using this
98c2ecf20Sopenharmony_ci * software indicates your acceptance of these terms and conditions.  If you do
108c2ecf20Sopenharmony_ci * not agree with these terms and conditions, do not use the software.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Copyright © 2005 Agere Systems Inc.
138c2ecf20Sopenharmony_ci * All rights reserved.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci * Redistribution and use in source or binary forms, with or without
168c2ecf20Sopenharmony_ci * modifications, are permitted provided that the following conditions are met:
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci * . Redistributions of source code must retain the above copyright notice, this
198c2ecf20Sopenharmony_ci *    list of conditions and the following Disclaimer as comments in the code as
208c2ecf20Sopenharmony_ci *    well as in the documentation and/or other materials provided with the
218c2ecf20Sopenharmony_ci *    distribution.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * . Redistributions in binary form must reproduce the above copyright notice,
248c2ecf20Sopenharmony_ci *    this list of conditions and the following Disclaimer in the documentation
258c2ecf20Sopenharmony_ci *    and/or other materials provided with the distribution.
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * . Neither the name of Agere Systems Inc. nor the names of the contributors
288c2ecf20Sopenharmony_ci *    may be used to endorse or promote products derived from this software
298c2ecf20Sopenharmony_ci *    without specific prior written permission.
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * Disclaimer
328c2ecf20Sopenharmony_ci *
338c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
348c2ecf20Sopenharmony_ci * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
358c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
368c2ecf20Sopenharmony_ci * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
378c2ecf20Sopenharmony_ci * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
388c2ecf20Sopenharmony_ci * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
398c2ecf20Sopenharmony_ci * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
408c2ecf20Sopenharmony_ci * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
418c2ecf20Sopenharmony_ci * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
428c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
438c2ecf20Sopenharmony_ci * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
448c2ecf20Sopenharmony_ci * DAMAGE.
458c2ecf20Sopenharmony_ci *
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define DRIVER_NAME "et131x"
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* EEPROM registers */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* LBCIF Register Groups (addressed via 32-bit offsets) */
538c2ecf20Sopenharmony_ci#define LBCIF_DWORD0_GROUP       0xAC
548c2ecf20Sopenharmony_ci#define LBCIF_DWORD1_GROUP       0xB0
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/* LBCIF Registers (addressed via 8-bit offsets) */
578c2ecf20Sopenharmony_ci#define LBCIF_ADDRESS_REGISTER   0xAC
588c2ecf20Sopenharmony_ci#define LBCIF_DATA_REGISTER      0xB0
598c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_REGISTER   0xB1
608c2ecf20Sopenharmony_ci#define LBCIF_STATUS_REGISTER    0xB2
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* LBCIF Control Register Bits */
638c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_SEQUENTIAL_READ   0x01
648c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_PAGE_WRITE        0x02
658c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_EEPROM_RELOAD     0x08
668c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_TWO_BYTE_ADDR     0x20
678c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_I2C_WRITE         0x40
688c2ecf20Sopenharmony_ci#define LBCIF_CONTROL_LBCIF_ENABLE      0x80
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* LBCIF Status Register Bits */
718c2ecf20Sopenharmony_ci#define LBCIF_STATUS_PHY_QUEUE_AVAIL    0x01
728c2ecf20Sopenharmony_ci#define LBCIF_STATUS_I2C_IDLE           0x02
738c2ecf20Sopenharmony_ci#define LBCIF_STATUS_ACK_ERROR          0x04
748c2ecf20Sopenharmony_ci#define LBCIF_STATUS_GENERAL_ERROR      0x08
758c2ecf20Sopenharmony_ci#define LBCIF_STATUS_CHECKSUM_ERROR     0x40
768c2ecf20Sopenharmony_ci#define LBCIF_STATUS_EEPROM_PRESENT     0x80
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* START OF GLOBAL REGISTER ADDRESS MAP */
798c2ecf20Sopenharmony_ci/* 10bit registers
808c2ecf20Sopenharmony_ci *
818c2ecf20Sopenharmony_ci * Tx queue start address reg in global address map at address 0x0000
828c2ecf20Sopenharmony_ci * tx queue end address reg in global address map at address 0x0004
838c2ecf20Sopenharmony_ci * rx queue start address reg in global address map at address 0x0008
848c2ecf20Sopenharmony_ci * rx queue end address reg in global address map at address 0x000C
858c2ecf20Sopenharmony_ci */
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* structure for power management control status reg in global address map
888c2ecf20Sopenharmony_ci * located at address 0x0010
898c2ecf20Sopenharmony_ci *	jagcore_rx_rdy	bit 9
908c2ecf20Sopenharmony_ci *	jagcore_tx_rdy	bit 8
918c2ecf20Sopenharmony_ci *	phy_lped_en	bit 7
928c2ecf20Sopenharmony_ci *	phy_sw_coma	bit 6
938c2ecf20Sopenharmony_ci *	rxclk_gate	bit 5
948c2ecf20Sopenharmony_ci *	txclk_gate	bit 4
958c2ecf20Sopenharmony_ci *	sysclk_gate	bit 3
968c2ecf20Sopenharmony_ci *	jagcore_rx_en	bit 2
978c2ecf20Sopenharmony_ci *	jagcore_tx_en	bit 1
988c2ecf20Sopenharmony_ci *	gigephy_en	bit 0
998c2ecf20Sopenharmony_ci */
1008c2ecf20Sopenharmony_ci#define ET_PM_PHY_SW_COMA		0x40
1018c2ecf20Sopenharmony_ci#define ET_PMCSR_INIT			0x38
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* Interrupt status reg at address 0x0018
1048c2ecf20Sopenharmony_ci */
1058c2ecf20Sopenharmony_ci#define	ET_INTR_TXDMA_ISR	0x00000008
1068c2ecf20Sopenharmony_ci#define ET_INTR_TXDMA_ERR	0x00000010
1078c2ecf20Sopenharmony_ci#define ET_INTR_RXDMA_XFR_DONE	0x00000020
1088c2ecf20Sopenharmony_ci#define ET_INTR_RXDMA_FB_R0_LOW	0x00000040
1098c2ecf20Sopenharmony_ci#define ET_INTR_RXDMA_FB_R1_LOW	0x00000080
1108c2ecf20Sopenharmony_ci#define ET_INTR_RXDMA_STAT_LOW	0x00000100
1118c2ecf20Sopenharmony_ci#define ET_INTR_RXDMA_ERR	0x00000200
1128c2ecf20Sopenharmony_ci#define ET_INTR_WATCHDOG	0x00004000
1138c2ecf20Sopenharmony_ci#define ET_INTR_WOL		0x00008000
1148c2ecf20Sopenharmony_ci#define ET_INTR_PHY		0x00010000
1158c2ecf20Sopenharmony_ci#define ET_INTR_TXMAC		0x00020000
1168c2ecf20Sopenharmony_ci#define ET_INTR_RXMAC		0x00040000
1178c2ecf20Sopenharmony_ci#define ET_INTR_MAC_STAT	0x00080000
1188c2ecf20Sopenharmony_ci#define ET_INTR_SLV_TIMEOUT	0x00100000
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* Interrupt mask register at address 0x001C
1218c2ecf20Sopenharmony_ci * Interrupt alias clear mask reg at address 0x0020
1228c2ecf20Sopenharmony_ci * Interrupt status alias reg at address 0x0024
1238c2ecf20Sopenharmony_ci *
1248c2ecf20Sopenharmony_ci * Same masks as above
1258c2ecf20Sopenharmony_ci */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Software reset reg at address 0x0028
1288c2ecf20Sopenharmony_ci * 0:	txdma_sw_reset
1298c2ecf20Sopenharmony_ci * 1:	rxdma_sw_reset
1308c2ecf20Sopenharmony_ci * 2:	txmac_sw_reset
1318c2ecf20Sopenharmony_ci * 3:	rxmac_sw_reset
1328c2ecf20Sopenharmony_ci * 4:	mac_sw_reset
1338c2ecf20Sopenharmony_ci * 5:	mac_stat_sw_reset
1348c2ecf20Sopenharmony_ci * 6:	mmc_sw_reset
1358c2ecf20Sopenharmony_ci *31:	selfclr_disable
1368c2ecf20Sopenharmony_ci */
1378c2ecf20Sopenharmony_ci#define ET_RESET_ALL	0x007F
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* SLV Timer reg at address 0x002C (low 24 bits)
1408c2ecf20Sopenharmony_ci */
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* MSI Configuration reg at address 0x0030
1438c2ecf20Sopenharmony_ci */
1448c2ecf20Sopenharmony_ci#define ET_MSI_VECTOR	0x0000001F
1458c2ecf20Sopenharmony_ci#define ET_MSI_TC	0x00070000
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* Loopback reg located at address 0x0034
1488c2ecf20Sopenharmony_ci */
1498c2ecf20Sopenharmony_ci#define ET_LOOP_MAC	0x00000001
1508c2ecf20Sopenharmony_ci#define ET_LOOP_DMA	0x00000002
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* GLOBAL Module of JAGCore Address Mapping
1538c2ecf20Sopenharmony_ci * Located at address 0x0000
1548c2ecf20Sopenharmony_ci */
1558c2ecf20Sopenharmony_cistruct global_regs {				/* Location: */
1568c2ecf20Sopenharmony_ci	u32 txq_start_addr;			/*  0x0000 */
1578c2ecf20Sopenharmony_ci	u32 txq_end_addr;			/*  0x0004 */
1588c2ecf20Sopenharmony_ci	u32 rxq_start_addr;			/*  0x0008 */
1598c2ecf20Sopenharmony_ci	u32 rxq_end_addr;			/*  0x000C */
1608c2ecf20Sopenharmony_ci	u32 pm_csr;				/*  0x0010 */
1618c2ecf20Sopenharmony_ci	u32 unused;				/*  0x0014 */
1628c2ecf20Sopenharmony_ci	u32 int_status;				/*  0x0018 */
1638c2ecf20Sopenharmony_ci	u32 int_mask;				/*  0x001C */
1648c2ecf20Sopenharmony_ci	u32 int_alias_clr_en;			/*  0x0020 */
1658c2ecf20Sopenharmony_ci	u32 int_status_alias;			/*  0x0024 */
1668c2ecf20Sopenharmony_ci	u32 sw_reset;				/*  0x0028 */
1678c2ecf20Sopenharmony_ci	u32 slv_timer;				/*  0x002C */
1688c2ecf20Sopenharmony_ci	u32 msi_config;				/*  0x0030 */
1698c2ecf20Sopenharmony_ci	u32 loopback;				/*  0x0034 */
1708c2ecf20Sopenharmony_ci	u32 watchdog_timer;			/*  0x0038 */
1718c2ecf20Sopenharmony_ci};
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/* START OF TXDMA REGISTER ADDRESS MAP */
1748c2ecf20Sopenharmony_ci/* txdma control status reg at address 0x1000
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_ci#define ET_TXDMA_CSR_HALT	0x00000001
1778c2ecf20Sopenharmony_ci#define ET_TXDMA_DROP_TLP	0x00000002
1788c2ecf20Sopenharmony_ci#define ET_TXDMA_CACHE_THRS	0x000000F0
1798c2ecf20Sopenharmony_ci#define ET_TXDMA_CACHE_SHIFT	4
1808c2ecf20Sopenharmony_ci#define ET_TXDMA_SNGL_EPKT	0x00000100
1818c2ecf20Sopenharmony_ci#define ET_TXDMA_CLASS		0x00001E00
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* structure for txdma packet ring base address hi reg in txdma address map
1848c2ecf20Sopenharmony_ci * located at address 0x1004
1858c2ecf20Sopenharmony_ci * Defined earlier (u32)
1868c2ecf20Sopenharmony_ci */
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci/* structure for txdma packet ring base address low reg in txdma address map
1898c2ecf20Sopenharmony_ci * located at address 0x1008
1908c2ecf20Sopenharmony_ci * Defined earlier (u32)
1918c2ecf20Sopenharmony_ci */
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* structure for txdma packet ring number of descriptor reg in txdma address
1948c2ecf20Sopenharmony_ci * map.  Located at address 0x100C
1958c2ecf20Sopenharmony_ci *
1968c2ecf20Sopenharmony_ci * 31-10: unused
1978c2ecf20Sopenharmony_ci * 9-0: pr ndes
1988c2ecf20Sopenharmony_ci */
1998c2ecf20Sopenharmony_ci#define ET_DMA12_MASK		0x0FFF	/* 12 bit mask for DMA12W types */
2008c2ecf20Sopenharmony_ci#define ET_DMA12_WRAP		0x1000
2018c2ecf20Sopenharmony_ci#define ET_DMA10_MASK		0x03FF	/* 10 bit mask for DMA10W types */
2028c2ecf20Sopenharmony_ci#define ET_DMA10_WRAP		0x0400
2038c2ecf20Sopenharmony_ci#define ET_DMA4_MASK		0x000F	/* 4 bit mask for DMA4W types */
2048c2ecf20Sopenharmony_ci#define ET_DMA4_WRAP		0x0010
2058c2ecf20Sopenharmony_ci
2068c2ecf20Sopenharmony_ci#define INDEX12(x)	((x) & ET_DMA12_MASK)
2078c2ecf20Sopenharmony_ci#define INDEX10(x)	((x) & ET_DMA10_MASK)
2088c2ecf20Sopenharmony_ci#define INDEX4(x)	((x) & ET_DMA4_MASK)
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci/* 10bit DMA with wrap
2118c2ecf20Sopenharmony_ci * txdma tx queue write address reg in txdma address map at 0x1010
2128c2ecf20Sopenharmony_ci * txdma tx queue write address external reg in txdma address map at 0x1014
2138c2ecf20Sopenharmony_ci * txdma tx queue read address reg in txdma address map at 0x1018
2148c2ecf20Sopenharmony_ci *
2158c2ecf20Sopenharmony_ci * u32
2168c2ecf20Sopenharmony_ci * txdma status writeback address hi reg in txdma address map at0x101C
2178c2ecf20Sopenharmony_ci * txdma status writeback address lo reg in txdma address map at 0x1020
2188c2ecf20Sopenharmony_ci *
2198c2ecf20Sopenharmony_ci * 10bit DMA with wrap
2208c2ecf20Sopenharmony_ci * txdma service request reg in txdma address map at 0x1024
2218c2ecf20Sopenharmony_ci * structure for txdma service complete reg in txdma address map at 0x1028
2228c2ecf20Sopenharmony_ci *
2238c2ecf20Sopenharmony_ci * 4bit DMA with wrap
2248c2ecf20Sopenharmony_ci * txdma tx descriptor cache read index reg in txdma address map at 0x102C
2258c2ecf20Sopenharmony_ci * txdma tx descriptor cache write index reg in txdma address map at 0x1030
2268c2ecf20Sopenharmony_ci *
2278c2ecf20Sopenharmony_ci * txdma error reg in txdma address map at address 0x1034
2288c2ecf20Sopenharmony_ci * 0: PyldResend
2298c2ecf20Sopenharmony_ci * 1: PyldRewind
2308c2ecf20Sopenharmony_ci * 4: DescrResend
2318c2ecf20Sopenharmony_ci * 5: DescrRewind
2328c2ecf20Sopenharmony_ci * 8: WrbkResend
2338c2ecf20Sopenharmony_ci * 9: WrbkRewind
2348c2ecf20Sopenharmony_ci */
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/* Tx DMA Module of JAGCore Address Mapping
2378c2ecf20Sopenharmony_ci * Located at address 0x1000
2388c2ecf20Sopenharmony_ci */
2398c2ecf20Sopenharmony_cistruct txdma_regs {			/* Location: */
2408c2ecf20Sopenharmony_ci	u32 csr;			/*  0x1000 */
2418c2ecf20Sopenharmony_ci	u32 pr_base_hi;			/*  0x1004 */
2428c2ecf20Sopenharmony_ci	u32 pr_base_lo;			/*  0x1008 */
2438c2ecf20Sopenharmony_ci	u32 pr_num_des;			/*  0x100C */
2448c2ecf20Sopenharmony_ci	u32 txq_wr_addr;		/*  0x1010 */
2458c2ecf20Sopenharmony_ci	u32 txq_wr_addr_ext;		/*  0x1014 */
2468c2ecf20Sopenharmony_ci	u32 txq_rd_addr;		/*  0x1018 */
2478c2ecf20Sopenharmony_ci	u32 dma_wb_base_hi;		/*  0x101C */
2488c2ecf20Sopenharmony_ci	u32 dma_wb_base_lo;		/*  0x1020 */
2498c2ecf20Sopenharmony_ci	u32 service_request;		/*  0x1024 */
2508c2ecf20Sopenharmony_ci	u32 service_complete;		/*  0x1028 */
2518c2ecf20Sopenharmony_ci	u32 cache_rd_index;		/*  0x102C */
2528c2ecf20Sopenharmony_ci	u32 cache_wr_index;		/*  0x1030 */
2538c2ecf20Sopenharmony_ci	u32 tx_dma_error;		/*  0x1034 */
2548c2ecf20Sopenharmony_ci	u32 desc_abort_cnt;		/*  0x1038 */
2558c2ecf20Sopenharmony_ci	u32 payload_abort_cnt;		/*  0x103c */
2568c2ecf20Sopenharmony_ci	u32 writeback_abort_cnt;	/*  0x1040 */
2578c2ecf20Sopenharmony_ci	u32 desc_timeout_cnt;		/*  0x1044 */
2588c2ecf20Sopenharmony_ci	u32 payload_timeout_cnt;	/*  0x1048 */
2598c2ecf20Sopenharmony_ci	u32 writeback_timeout_cnt;	/*  0x104c */
2608c2ecf20Sopenharmony_ci	u32 desc_error_cnt;		/*  0x1050 */
2618c2ecf20Sopenharmony_ci	u32 payload_error_cnt;		/*  0x1054 */
2628c2ecf20Sopenharmony_ci	u32 writeback_error_cnt;	/*  0x1058 */
2638c2ecf20Sopenharmony_ci	u32 dropped_tlp_cnt;		/*  0x105c */
2648c2ecf20Sopenharmony_ci	u32 new_service_complete;	/*  0x1060 */
2658c2ecf20Sopenharmony_ci	u32 ethernet_packet_cnt;	/*  0x1064 */
2668c2ecf20Sopenharmony_ci};
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* END OF TXDMA REGISTER ADDRESS MAP */
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ci/* START OF RXDMA REGISTER ADDRESS MAP */
2718c2ecf20Sopenharmony_ci/* structure for control status reg in rxdma address map
2728c2ecf20Sopenharmony_ci * Located at address 0x2000
2738c2ecf20Sopenharmony_ci *
2748c2ecf20Sopenharmony_ci * CSR
2758c2ecf20Sopenharmony_ci * 0: halt
2768c2ecf20Sopenharmony_ci * 1-3: tc
2778c2ecf20Sopenharmony_ci * 4: fbr_big_endian
2788c2ecf20Sopenharmony_ci * 5: psr_big_endian
2798c2ecf20Sopenharmony_ci * 6: pkt_big_endian
2808c2ecf20Sopenharmony_ci * 7: dma_big_endian
2818c2ecf20Sopenharmony_ci * 8-9: fbr0_size
2828c2ecf20Sopenharmony_ci * 10: fbr0_enable
2838c2ecf20Sopenharmony_ci * 11-12: fbr1_size
2848c2ecf20Sopenharmony_ci * 13: fbr1_enable
2858c2ecf20Sopenharmony_ci * 14: unused
2868c2ecf20Sopenharmony_ci * 15: pkt_drop_disable
2878c2ecf20Sopenharmony_ci * 16: pkt_done_flush
2888c2ecf20Sopenharmony_ci * 17: halt_status
2898c2ecf20Sopenharmony_ci * 18-31: unused
2908c2ecf20Sopenharmony_ci */
2918c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_HALT		0x0001
2928c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR0_SIZE_LO	0x0100
2938c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR0_SIZE_HI	0x0200
2948c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR0_ENABLE	0x0400
2958c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR1_SIZE_LO	0x0800
2968c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR1_SIZE_HI	0x1000
2978c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_FBR1_ENABLE	0x2000
2988c2ecf20Sopenharmony_ci#define ET_RXDMA_CSR_HALT_STATUS	0x00020000
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci/* structure for dma writeback lo reg in rxdma address map
3018c2ecf20Sopenharmony_ci * located at address 0x2004
3028c2ecf20Sopenharmony_ci * Defined earlier (u32)
3038c2ecf20Sopenharmony_ci */
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci/* structure for dma writeback hi reg in rxdma address map
3068c2ecf20Sopenharmony_ci * located at address 0x2008
3078c2ecf20Sopenharmony_ci * Defined earlier (u32)
3088c2ecf20Sopenharmony_ci */
3098c2ecf20Sopenharmony_ci
3108c2ecf20Sopenharmony_ci/* structure for number of packets done reg in rxdma address map
3118c2ecf20Sopenharmony_ci * located at address 0x200C
3128c2ecf20Sopenharmony_ci *
3138c2ecf20Sopenharmony_ci * 31-8: unused
3148c2ecf20Sopenharmony_ci * 7-0: num done
3158c2ecf20Sopenharmony_ci */
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/* structure for max packet time reg in rxdma address map
3188c2ecf20Sopenharmony_ci * located at address 0x2010
3198c2ecf20Sopenharmony_ci *
3208c2ecf20Sopenharmony_ci * 31-18: unused
3218c2ecf20Sopenharmony_ci * 17-0: time done
3228c2ecf20Sopenharmony_ci */
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci/* structure for rx queue read address reg in rxdma address map
3258c2ecf20Sopenharmony_ci * located at address 0x2014
3268c2ecf20Sopenharmony_ci * Defined earlier (u32)
3278c2ecf20Sopenharmony_ci */
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ci/* structure for rx queue read address external reg in rxdma address map
3308c2ecf20Sopenharmony_ci * located at address 0x2018
3318c2ecf20Sopenharmony_ci * Defined earlier (u32)
3328c2ecf20Sopenharmony_ci */
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/* structure for rx queue write address reg in rxdma address map
3358c2ecf20Sopenharmony_ci * located at address 0x201C
3368c2ecf20Sopenharmony_ci * Defined earlier (u32)
3378c2ecf20Sopenharmony_ci */
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci/* structure for packet status ring base address lo reg in rxdma address map
3408c2ecf20Sopenharmony_ci * located at address 0x2020
3418c2ecf20Sopenharmony_ci * Defined earlier (u32)
3428c2ecf20Sopenharmony_ci */
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci/* structure for packet status ring base address hi reg in rxdma address map
3458c2ecf20Sopenharmony_ci * located at address 0x2024
3468c2ecf20Sopenharmony_ci * Defined earlier (u32)
3478c2ecf20Sopenharmony_ci */
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/* structure for packet status ring number of descriptors reg in rxdma address
3508c2ecf20Sopenharmony_ci * map.  Located at address 0x2028
3518c2ecf20Sopenharmony_ci *
3528c2ecf20Sopenharmony_ci * 31-12: unused
3538c2ecf20Sopenharmony_ci * 11-0: psr ndes
3548c2ecf20Sopenharmony_ci */
3558c2ecf20Sopenharmony_ci#define ET_RXDMA_PSR_NUM_DES_MASK	0xFFF
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci/* structure for packet status ring available offset reg in rxdma address map
3588c2ecf20Sopenharmony_ci * located at address 0x202C
3598c2ecf20Sopenharmony_ci *
3608c2ecf20Sopenharmony_ci * 31-13: unused
3618c2ecf20Sopenharmony_ci * 12: psr avail wrap
3628c2ecf20Sopenharmony_ci * 11-0: psr avail
3638c2ecf20Sopenharmony_ci */
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci/* structure for packet status ring full offset reg in rxdma address map
3668c2ecf20Sopenharmony_ci * located at address 0x2030
3678c2ecf20Sopenharmony_ci *
3688c2ecf20Sopenharmony_ci * 31-13: unused
3698c2ecf20Sopenharmony_ci * 12: psr full wrap
3708c2ecf20Sopenharmony_ci * 11-0: psr full
3718c2ecf20Sopenharmony_ci */
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/* structure for packet status ring access index reg in rxdma address map
3748c2ecf20Sopenharmony_ci * located at address 0x2034
3758c2ecf20Sopenharmony_ci *
3768c2ecf20Sopenharmony_ci * 31-5: unused
3778c2ecf20Sopenharmony_ci * 4-0: psr_ai
3788c2ecf20Sopenharmony_ci */
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci/* structure for packet status ring minimum descriptors reg in rxdma address
3818c2ecf20Sopenharmony_ci * map.  Located at address 0x2038
3828c2ecf20Sopenharmony_ci *
3838c2ecf20Sopenharmony_ci * 31-12: unused
3848c2ecf20Sopenharmony_ci * 11-0: psr_min
3858c2ecf20Sopenharmony_ci */
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/* structure for free buffer ring base lo address reg in rxdma address map
3888c2ecf20Sopenharmony_ci * located at address 0x203C
3898c2ecf20Sopenharmony_ci * Defined earlier (u32)
3908c2ecf20Sopenharmony_ci */
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* structure for free buffer ring base hi address reg in rxdma address map
3938c2ecf20Sopenharmony_ci * located at address 0x2040
3948c2ecf20Sopenharmony_ci * Defined earlier (u32)
3958c2ecf20Sopenharmony_ci */
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/* structure for free buffer ring number of descriptors reg in rxdma address
3988c2ecf20Sopenharmony_ci * map.  Located at address 0x2044
3998c2ecf20Sopenharmony_ci *
4008c2ecf20Sopenharmony_ci * 31-10: unused
4018c2ecf20Sopenharmony_ci * 9-0: fbr ndesc
4028c2ecf20Sopenharmony_ci */
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ci/* structure for free buffer ring 0 available offset reg in rxdma address map
4058c2ecf20Sopenharmony_ci * located at address 0x2048
4068c2ecf20Sopenharmony_ci * Defined earlier (u32)
4078c2ecf20Sopenharmony_ci */
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/* structure for free buffer ring 0 full offset reg in rxdma address map
4108c2ecf20Sopenharmony_ci * located at address 0x204C
4118c2ecf20Sopenharmony_ci * Defined earlier (u32)
4128c2ecf20Sopenharmony_ci */
4138c2ecf20Sopenharmony_ci
4148c2ecf20Sopenharmony_ci/* structure for free buffer cache 0 full offset reg in rxdma address map
4158c2ecf20Sopenharmony_ci * located at address 0x2050
4168c2ecf20Sopenharmony_ci *
4178c2ecf20Sopenharmony_ci * 31-5: unused
4188c2ecf20Sopenharmony_ci * 4-0: fbc rdi
4198c2ecf20Sopenharmony_ci */
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ci/* structure for free buffer ring 0 minimum descriptor reg in rxdma address map
4228c2ecf20Sopenharmony_ci * located at address 0x2054
4238c2ecf20Sopenharmony_ci *
4248c2ecf20Sopenharmony_ci * 31-10: unused
4258c2ecf20Sopenharmony_ci * 9-0: fbr min
4268c2ecf20Sopenharmony_ci */
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci/* structure for free buffer ring 1 base address lo reg in rxdma address map
4298c2ecf20Sopenharmony_ci * located at address 0x2058 - 0x205C
4308c2ecf20Sopenharmony_ci * Defined earlier (RXDMA_FBR_BASE_LO_t and RXDMA_FBR_BASE_HI_t)
4318c2ecf20Sopenharmony_ci */
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci/* structure for free buffer ring 1 number of descriptors reg in rxdma address
4348c2ecf20Sopenharmony_ci * map.  Located at address 0x2060
4358c2ecf20Sopenharmony_ci * Defined earlier (RXDMA_FBR_NUM_DES_t)
4368c2ecf20Sopenharmony_ci */
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci/* structure for free buffer ring 1 available offset reg in rxdma address map
4398c2ecf20Sopenharmony_ci * located at address 0x2064
4408c2ecf20Sopenharmony_ci * Defined Earlier (RXDMA_FBR_AVAIL_OFFSET_t)
4418c2ecf20Sopenharmony_ci */
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_ci/* structure for free buffer ring 1 full offset reg in rxdma address map
4448c2ecf20Sopenharmony_ci * located at address 0x2068
4458c2ecf20Sopenharmony_ci * Defined Earlier (RXDMA_FBR_FULL_OFFSET_t)
4468c2ecf20Sopenharmony_ci */
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/* structure for free buffer cache 1 read index reg in rxdma address map
4498c2ecf20Sopenharmony_ci * located at address 0x206C
4508c2ecf20Sopenharmony_ci * Defined Earlier (RXDMA_FBC_RD_INDEX_t)
4518c2ecf20Sopenharmony_ci */
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/* structure for free buffer ring 1 minimum descriptor reg in rxdma address map
4548c2ecf20Sopenharmony_ci * located at address 0x2070
4558c2ecf20Sopenharmony_ci * Defined Earlier (RXDMA_FBR_MIN_DES_t)
4568c2ecf20Sopenharmony_ci */
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/* Rx DMA Module of JAGCore Address Mapping
4598c2ecf20Sopenharmony_ci * Located at address 0x2000
4608c2ecf20Sopenharmony_ci */
4618c2ecf20Sopenharmony_cistruct rxdma_regs {					/* Location: */
4628c2ecf20Sopenharmony_ci	u32 csr;					/*  0x2000 */
4638c2ecf20Sopenharmony_ci	u32 dma_wb_base_lo;				/*  0x2004 */
4648c2ecf20Sopenharmony_ci	u32 dma_wb_base_hi;				/*  0x2008 */
4658c2ecf20Sopenharmony_ci	u32 num_pkt_done;				/*  0x200C */
4668c2ecf20Sopenharmony_ci	u32 max_pkt_time;				/*  0x2010 */
4678c2ecf20Sopenharmony_ci	u32 rxq_rd_addr;				/*  0x2014 */
4688c2ecf20Sopenharmony_ci	u32 rxq_rd_addr_ext;				/*  0x2018 */
4698c2ecf20Sopenharmony_ci	u32 rxq_wr_addr;				/*  0x201C */
4708c2ecf20Sopenharmony_ci	u32 psr_base_lo;				/*  0x2020 */
4718c2ecf20Sopenharmony_ci	u32 psr_base_hi;				/*  0x2024 */
4728c2ecf20Sopenharmony_ci	u32 psr_num_des;				/*  0x2028 */
4738c2ecf20Sopenharmony_ci	u32 psr_avail_offset;				/*  0x202C */
4748c2ecf20Sopenharmony_ci	u32 psr_full_offset;				/*  0x2030 */
4758c2ecf20Sopenharmony_ci	u32 psr_access_index;				/*  0x2034 */
4768c2ecf20Sopenharmony_ci	u32 psr_min_des;				/*  0x2038 */
4778c2ecf20Sopenharmony_ci	u32 fbr0_base_lo;				/*  0x203C */
4788c2ecf20Sopenharmony_ci	u32 fbr0_base_hi;				/*  0x2040 */
4798c2ecf20Sopenharmony_ci	u32 fbr0_num_des;				/*  0x2044 */
4808c2ecf20Sopenharmony_ci	u32 fbr0_avail_offset;				/*  0x2048 */
4818c2ecf20Sopenharmony_ci	u32 fbr0_full_offset;				/*  0x204C */
4828c2ecf20Sopenharmony_ci	u32 fbr0_rd_index;				/*  0x2050 */
4838c2ecf20Sopenharmony_ci	u32 fbr0_min_des;				/*  0x2054 */
4848c2ecf20Sopenharmony_ci	u32 fbr1_base_lo;				/*  0x2058 */
4858c2ecf20Sopenharmony_ci	u32 fbr1_base_hi;				/*  0x205C */
4868c2ecf20Sopenharmony_ci	u32 fbr1_num_des;				/*  0x2060 */
4878c2ecf20Sopenharmony_ci	u32 fbr1_avail_offset;				/*  0x2064 */
4888c2ecf20Sopenharmony_ci	u32 fbr1_full_offset;				/*  0x2068 */
4898c2ecf20Sopenharmony_ci	u32 fbr1_rd_index;				/*  0x206C */
4908c2ecf20Sopenharmony_ci	u32 fbr1_min_des;				/*  0x2070 */
4918c2ecf20Sopenharmony_ci};
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci/* END OF RXDMA REGISTER ADDRESS MAP */
4948c2ecf20Sopenharmony_ci
4958c2ecf20Sopenharmony_ci/* START OF TXMAC REGISTER ADDRESS MAP */
4968c2ecf20Sopenharmony_ci/* structure for control reg in txmac address map
4978c2ecf20Sopenharmony_ci * located at address 0x3000
4988c2ecf20Sopenharmony_ci *
4998c2ecf20Sopenharmony_ci * bits
5008c2ecf20Sopenharmony_ci * 31-8: unused
5018c2ecf20Sopenharmony_ci * 7: cklseg_disable
5028c2ecf20Sopenharmony_ci * 6: ckbcnt_disable
5038c2ecf20Sopenharmony_ci * 5: cksegnum
5048c2ecf20Sopenharmony_ci * 4: async_disable
5058c2ecf20Sopenharmony_ci * 3: fc_disable
5068c2ecf20Sopenharmony_ci * 2: mcif_disable
5078c2ecf20Sopenharmony_ci * 1: mif_disable
5088c2ecf20Sopenharmony_ci * 0: txmac_en
5098c2ecf20Sopenharmony_ci */
5108c2ecf20Sopenharmony_ci#define ET_TX_CTRL_FC_DISABLE	0x0008
5118c2ecf20Sopenharmony_ci#define ET_TX_CTRL_TXMAC_ENABLE	0x0001
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci/* structure for shadow pointer reg in txmac address map
5148c2ecf20Sopenharmony_ci * located at address 0x3004
5158c2ecf20Sopenharmony_ci * 31-27: reserved
5168c2ecf20Sopenharmony_ci * 26-16: txq rd ptr
5178c2ecf20Sopenharmony_ci * 15-11: reserved
5188c2ecf20Sopenharmony_ci * 10-0: txq wr ptr
5198c2ecf20Sopenharmony_ci */
5208c2ecf20Sopenharmony_ci
5218c2ecf20Sopenharmony_ci/* structure for error count reg in txmac address map
5228c2ecf20Sopenharmony_ci * located at address 0x3008
5238c2ecf20Sopenharmony_ci *
5248c2ecf20Sopenharmony_ci * 31-12: unused
5258c2ecf20Sopenharmony_ci * 11-8: reserved
5268c2ecf20Sopenharmony_ci * 7-4: txq_underrun
5278c2ecf20Sopenharmony_ci * 3-0: fifo_underrun
5288c2ecf20Sopenharmony_ci */
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_ci/* structure for max fill reg in txmac address map
5318c2ecf20Sopenharmony_ci * located at address 0x300C
5328c2ecf20Sopenharmony_ci * 31-12: unused
5338c2ecf20Sopenharmony_ci * 11-0: max fill
5348c2ecf20Sopenharmony_ci */
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/* structure for cf parameter reg in txmac address map
5378c2ecf20Sopenharmony_ci * located at address 0x3010
5388c2ecf20Sopenharmony_ci * 31-16: cfep
5398c2ecf20Sopenharmony_ci * 15-0: cfpt
5408c2ecf20Sopenharmony_ci */
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci/* structure for tx test reg in txmac address map
5438c2ecf20Sopenharmony_ci * located at address 0x3014
5448c2ecf20Sopenharmony_ci * 31-17: unused
5458c2ecf20Sopenharmony_ci * 16: reserved
5468c2ecf20Sopenharmony_ci * 15: txtest_en
5478c2ecf20Sopenharmony_ci * 14-11: unused
5488c2ecf20Sopenharmony_ci * 10-0: txq test pointer
5498c2ecf20Sopenharmony_ci */
5508c2ecf20Sopenharmony_ci
5518c2ecf20Sopenharmony_ci/* structure for error reg in txmac address map
5528c2ecf20Sopenharmony_ci * located at address 0x3018
5538c2ecf20Sopenharmony_ci *
5548c2ecf20Sopenharmony_ci * 31-9: unused
5558c2ecf20Sopenharmony_ci * 8: fifo_underrun
5568c2ecf20Sopenharmony_ci * 7-6: unused
5578c2ecf20Sopenharmony_ci * 5: ctrl2_err
5588c2ecf20Sopenharmony_ci * 4: txq_underrun
5598c2ecf20Sopenharmony_ci * 3: bcnt_err
5608c2ecf20Sopenharmony_ci * 2: lseg_err
5618c2ecf20Sopenharmony_ci * 1: segnum_err
5628c2ecf20Sopenharmony_ci * 0: seg0_err
5638c2ecf20Sopenharmony_ci */
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci/* structure for error interrupt reg in txmac address map
5668c2ecf20Sopenharmony_ci * located at address 0x301C
5678c2ecf20Sopenharmony_ci *
5688c2ecf20Sopenharmony_ci * 31-9: unused
5698c2ecf20Sopenharmony_ci * 8: fifo_underrun
5708c2ecf20Sopenharmony_ci * 7-6: unused
5718c2ecf20Sopenharmony_ci * 5: ctrl2_err
5728c2ecf20Sopenharmony_ci * 4: txq_underrun
5738c2ecf20Sopenharmony_ci * 3: bcnt_err
5748c2ecf20Sopenharmony_ci * 2: lseg_err
5758c2ecf20Sopenharmony_ci * 1: segnum_err
5768c2ecf20Sopenharmony_ci * 0: seg0_err
5778c2ecf20Sopenharmony_ci */
5788c2ecf20Sopenharmony_ci
5798c2ecf20Sopenharmony_ci/* structure for error interrupt reg in txmac address map
5808c2ecf20Sopenharmony_ci * located at address 0x3020
5818c2ecf20Sopenharmony_ci *
5828c2ecf20Sopenharmony_ci * 31-2: unused
5838c2ecf20Sopenharmony_ci * 1: bp_req
5848c2ecf20Sopenharmony_ci * 0: bp_xonxoff
5858c2ecf20Sopenharmony_ci */
5868c2ecf20Sopenharmony_ci
5878c2ecf20Sopenharmony_ci/* Tx MAC Module of JAGCore Address Mapping
5888c2ecf20Sopenharmony_ci */
5898c2ecf20Sopenharmony_cistruct txmac_regs {			/* Location: */
5908c2ecf20Sopenharmony_ci	u32 ctl;			/*  0x3000 */
5918c2ecf20Sopenharmony_ci	u32 shadow_ptr;			/*  0x3004 */
5928c2ecf20Sopenharmony_ci	u32 err_cnt;			/*  0x3008 */
5938c2ecf20Sopenharmony_ci	u32 max_fill;			/*  0x300C */
5948c2ecf20Sopenharmony_ci	u32 cf_param;			/*  0x3010 */
5958c2ecf20Sopenharmony_ci	u32 tx_test;			/*  0x3014 */
5968c2ecf20Sopenharmony_ci	u32 err;			/*  0x3018 */
5978c2ecf20Sopenharmony_ci	u32 err_int;			/*  0x301C */
5988c2ecf20Sopenharmony_ci	u32 bp_ctrl;			/*  0x3020 */
5998c2ecf20Sopenharmony_ci};
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci/* END OF TXMAC REGISTER ADDRESS MAP */
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_ci/* START OF RXMAC REGISTER ADDRESS MAP */
6048c2ecf20Sopenharmony_ci
6058c2ecf20Sopenharmony_ci/* structure for rxmac control reg in rxmac address map
6068c2ecf20Sopenharmony_ci * located at address 0x4000
6078c2ecf20Sopenharmony_ci *
6088c2ecf20Sopenharmony_ci * 31-7: reserved
6098c2ecf20Sopenharmony_ci * 6: rxmac_int_disable
6108c2ecf20Sopenharmony_ci * 5: async_disable
6118c2ecf20Sopenharmony_ci * 4: mif_disable
6128c2ecf20Sopenharmony_ci * 3: wol_disable
6138c2ecf20Sopenharmony_ci * 2: pkt_filter_disable
6148c2ecf20Sopenharmony_ci * 1: mcif_disable
6158c2ecf20Sopenharmony_ci * 0: rxmac_en
6168c2ecf20Sopenharmony_ci */
6178c2ecf20Sopenharmony_ci#define ET_RX_CTRL_WOL_DISABLE	0x0008
6188c2ecf20Sopenharmony_ci#define ET_RX_CTRL_RXMAC_ENABLE	0x0001
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/* structure for Wake On Lan Control and CRC 0 reg in rxmac address map
6218c2ecf20Sopenharmony_ci * located at address 0x4004
6228c2ecf20Sopenharmony_ci * 31-16: crc
6238c2ecf20Sopenharmony_ci * 15-12: reserved
6248c2ecf20Sopenharmony_ci * 11: ignore_pp
6258c2ecf20Sopenharmony_ci * 10: ignore_mp
6268c2ecf20Sopenharmony_ci * 9: clr_intr
6278c2ecf20Sopenharmony_ci * 8: ignore_link_chg
6288c2ecf20Sopenharmony_ci * 7: ignore_uni
6298c2ecf20Sopenharmony_ci * 6: ignore_multi
6308c2ecf20Sopenharmony_ci * 5: ignore_broad
6318c2ecf20Sopenharmony_ci * 4-0: valid_crc 4-0
6328c2ecf20Sopenharmony_ci */
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_ci/* structure for CRC 1 and CRC 2 reg in rxmac address map
6358c2ecf20Sopenharmony_ci * located at address 0x4008
6368c2ecf20Sopenharmony_ci *
6378c2ecf20Sopenharmony_ci * 31-16: crc2
6388c2ecf20Sopenharmony_ci * 15-0: crc1
6398c2ecf20Sopenharmony_ci */
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ci/* structure for CRC 3 and CRC 4 reg in rxmac address map
6428c2ecf20Sopenharmony_ci * located at address 0x400C
6438c2ecf20Sopenharmony_ci *
6448c2ecf20Sopenharmony_ci * 31-16: crc4
6458c2ecf20Sopenharmony_ci * 15-0: crc3
6468c2ecf20Sopenharmony_ci */
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci/* structure for Wake On Lan Source Address Lo reg in rxmac address map
6498c2ecf20Sopenharmony_ci * located at address 0x4010
6508c2ecf20Sopenharmony_ci *
6518c2ecf20Sopenharmony_ci * 31-24: sa3
6528c2ecf20Sopenharmony_ci * 23-16: sa4
6538c2ecf20Sopenharmony_ci * 15-8: sa5
6548c2ecf20Sopenharmony_ci * 7-0: sa6
6558c2ecf20Sopenharmony_ci */
6568c2ecf20Sopenharmony_ci#define ET_RX_WOL_LO_SA3_SHIFT 24
6578c2ecf20Sopenharmony_ci#define ET_RX_WOL_LO_SA4_SHIFT 16
6588c2ecf20Sopenharmony_ci#define ET_RX_WOL_LO_SA5_SHIFT 8
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci/* structure for Wake On Lan Source Address Hi reg in rxmac address map
6618c2ecf20Sopenharmony_ci * located at address 0x4014
6628c2ecf20Sopenharmony_ci *
6638c2ecf20Sopenharmony_ci * 31-16: reserved
6648c2ecf20Sopenharmony_ci * 15-8: sa1
6658c2ecf20Sopenharmony_ci * 7-0: sa2
6668c2ecf20Sopenharmony_ci */
6678c2ecf20Sopenharmony_ci#define ET_RX_WOL_HI_SA1_SHIFT 8
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci/* structure for Wake On Lan mask reg in rxmac address map
6708c2ecf20Sopenharmony_ci * located at address 0x4018 - 0x4064
6718c2ecf20Sopenharmony_ci * Defined earlier (u32)
6728c2ecf20Sopenharmony_ci */
6738c2ecf20Sopenharmony_ci
6748c2ecf20Sopenharmony_ci/* structure for Unicast Packet Filter Address 1 reg in rxmac address map
6758c2ecf20Sopenharmony_ci * located at address 0x4068
6768c2ecf20Sopenharmony_ci *
6778c2ecf20Sopenharmony_ci * 31-24: addr1_3
6788c2ecf20Sopenharmony_ci * 23-16: addr1_4
6798c2ecf20Sopenharmony_ci * 15-8: addr1_5
6808c2ecf20Sopenharmony_ci * 7-0: addr1_6
6818c2ecf20Sopenharmony_ci */
6828c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR1_3_SHIFT 24
6838c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR1_4_SHIFT 16
6848c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR1_5_SHIFT 8
6858c2ecf20Sopenharmony_ci
6868c2ecf20Sopenharmony_ci/* structure for Unicast Packet Filter Address 2 reg in rxmac address map
6878c2ecf20Sopenharmony_ci * located at address 0x406C
6888c2ecf20Sopenharmony_ci *
6898c2ecf20Sopenharmony_ci * 31-24: addr2_3
6908c2ecf20Sopenharmony_ci * 23-16: addr2_4
6918c2ecf20Sopenharmony_ci * 15-8: addr2_5
6928c2ecf20Sopenharmony_ci * 7-0: addr2_6
6938c2ecf20Sopenharmony_ci */
6948c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR2_3_SHIFT 24
6958c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR2_4_SHIFT 16
6968c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR2_5_SHIFT 8
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci/* structure for Unicast Packet Filter Address 1 & 2 reg in rxmac address map
6998c2ecf20Sopenharmony_ci * located at address 0x4070
7008c2ecf20Sopenharmony_ci *
7018c2ecf20Sopenharmony_ci * 31-24: addr2_1
7028c2ecf20Sopenharmony_ci * 23-16: addr2_2
7038c2ecf20Sopenharmony_ci * 15-8: addr1_1
7048c2ecf20Sopenharmony_ci * 7-0: addr1_2
7058c2ecf20Sopenharmony_ci */
7068c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR2_1_SHIFT 24
7078c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR2_2_SHIFT 16
7088c2ecf20Sopenharmony_ci#define ET_RX_UNI_PF_ADDR1_1_SHIFT 8
7098c2ecf20Sopenharmony_ci
7108c2ecf20Sopenharmony_ci/* structure for Multicast Hash reg in rxmac address map
7118c2ecf20Sopenharmony_ci * located at address 0x4074 - 0x4080
7128c2ecf20Sopenharmony_ci * Defined earlier (u32)
7138c2ecf20Sopenharmony_ci */
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_ci/* structure for Packet Filter Control reg in rxmac address map
7168c2ecf20Sopenharmony_ci * located at address 0x4084
7178c2ecf20Sopenharmony_ci *
7188c2ecf20Sopenharmony_ci * 31-23: unused
7198c2ecf20Sopenharmony_ci * 22-16: min_pkt_size
7208c2ecf20Sopenharmony_ci * 15-4: unused
7218c2ecf20Sopenharmony_ci * 3: filter_frag_en
7228c2ecf20Sopenharmony_ci * 2: filter_uni_en
7238c2ecf20Sopenharmony_ci * 1: filter_multi_en
7248c2ecf20Sopenharmony_ci * 0: filter_broad_en
7258c2ecf20Sopenharmony_ci */
7268c2ecf20Sopenharmony_ci#define ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT		16
7278c2ecf20Sopenharmony_ci#define ET_RX_PFCTRL_FRAG_FILTER_ENABLE		0x0008
7288c2ecf20Sopenharmony_ci#define ET_RX_PFCTRL_UNICST_FILTER_ENABLE	0x0004
7298c2ecf20Sopenharmony_ci#define ET_RX_PFCTRL_MLTCST_FILTER_ENABLE	0x0002
7308c2ecf20Sopenharmony_ci#define ET_RX_PFCTRL_BRDCST_FILTER_ENABLE	0x0001
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci/* structure for Memory Controller Interface Control Max Segment reg in rxmac
7338c2ecf20Sopenharmony_ci * address map.  Located at address 0x4088
7348c2ecf20Sopenharmony_ci *
7358c2ecf20Sopenharmony_ci * 31-10: reserved
7368c2ecf20Sopenharmony_ci * 9-2: max_size
7378c2ecf20Sopenharmony_ci * 1: fc_en
7388c2ecf20Sopenharmony_ci * 0: seg_en
7398c2ecf20Sopenharmony_ci */
7408c2ecf20Sopenharmony_ci#define ET_RX_MCIF_CTRL_MAX_SEG_SIZE_SHIFT	2
7418c2ecf20Sopenharmony_ci#define ET_RX_MCIF_CTRL_MAX_SEG_FC_ENABLE	0x0002
7428c2ecf20Sopenharmony_ci#define ET_RX_MCIF_CTRL_MAX_SEG_ENABLE		0x0001
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci/* structure for Memory Controller Interface Water Mark reg in rxmac address
7458c2ecf20Sopenharmony_ci * map.  Located at address 0x408C
7468c2ecf20Sopenharmony_ci *
7478c2ecf20Sopenharmony_ci * 31-26: unused
7488c2ecf20Sopenharmony_ci * 25-16: mark_hi
7498c2ecf20Sopenharmony_ci * 15-10: unused
7508c2ecf20Sopenharmony_ci * 9-0: mark_lo
7518c2ecf20Sopenharmony_ci */
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci/* structure for Rx Queue Dialog reg in rxmac address map.
7548c2ecf20Sopenharmony_ci * located at address 0x4090
7558c2ecf20Sopenharmony_ci *
7568c2ecf20Sopenharmony_ci * 31-26: reserved
7578c2ecf20Sopenharmony_ci * 25-16: rd_ptr
7588c2ecf20Sopenharmony_ci * 15-10: reserved
7598c2ecf20Sopenharmony_ci * 9-0: wr_ptr
7608c2ecf20Sopenharmony_ci */
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_ci/* structure for space available reg in rxmac address map.
7638c2ecf20Sopenharmony_ci * located at address 0x4094
7648c2ecf20Sopenharmony_ci *
7658c2ecf20Sopenharmony_ci * 31-17: reserved
7668c2ecf20Sopenharmony_ci * 16: space_avail_en
7678c2ecf20Sopenharmony_ci * 15-10: reserved
7688c2ecf20Sopenharmony_ci * 9-0: space_avail
7698c2ecf20Sopenharmony_ci */
7708c2ecf20Sopenharmony_ci
7718c2ecf20Sopenharmony_ci/* structure for management interface reg in rxmac address map.
7728c2ecf20Sopenharmony_ci * located at address 0x4098
7738c2ecf20Sopenharmony_ci *
7748c2ecf20Sopenharmony_ci * 31-18: reserved
7758c2ecf20Sopenharmony_ci * 17: drop_pkt_en
7768c2ecf20Sopenharmony_ci * 16-0: drop_pkt_mask
7778c2ecf20Sopenharmony_ci */
7788c2ecf20Sopenharmony_ci
7798c2ecf20Sopenharmony_ci/* structure for Error reg in rxmac address map.
7808c2ecf20Sopenharmony_ci * located at address 0x409C
7818c2ecf20Sopenharmony_ci *
7828c2ecf20Sopenharmony_ci * 31-4: unused
7838c2ecf20Sopenharmony_ci * 3: mif
7848c2ecf20Sopenharmony_ci * 2: async
7858c2ecf20Sopenharmony_ci * 1: pkt_filter
7868c2ecf20Sopenharmony_ci * 0: mcif
7878c2ecf20Sopenharmony_ci */
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci/* Rx MAC Module of JAGCore Address Mapping
7908c2ecf20Sopenharmony_ci */
7918c2ecf20Sopenharmony_cistruct rxmac_regs {					/* Location: */
7928c2ecf20Sopenharmony_ci	u32 ctrl;					/*  0x4000 */
7938c2ecf20Sopenharmony_ci	u32 crc0;					/*  0x4004 */
7948c2ecf20Sopenharmony_ci	u32 crc12;					/*  0x4008 */
7958c2ecf20Sopenharmony_ci	u32 crc34;					/*  0x400C */
7968c2ecf20Sopenharmony_ci	u32 sa_lo;					/*  0x4010 */
7978c2ecf20Sopenharmony_ci	u32 sa_hi;					/*  0x4014 */
7988c2ecf20Sopenharmony_ci	u32 mask0_word0;				/*  0x4018 */
7998c2ecf20Sopenharmony_ci	u32 mask0_word1;				/*  0x401C */
8008c2ecf20Sopenharmony_ci	u32 mask0_word2;				/*  0x4020 */
8018c2ecf20Sopenharmony_ci	u32 mask0_word3;				/*  0x4024 */
8028c2ecf20Sopenharmony_ci	u32 mask1_word0;				/*  0x4028 */
8038c2ecf20Sopenharmony_ci	u32 mask1_word1;				/*  0x402C */
8048c2ecf20Sopenharmony_ci	u32 mask1_word2;				/*  0x4030 */
8058c2ecf20Sopenharmony_ci	u32 mask1_word3;				/*  0x4034 */
8068c2ecf20Sopenharmony_ci	u32 mask2_word0;				/*  0x4038 */
8078c2ecf20Sopenharmony_ci	u32 mask2_word1;				/*  0x403C */
8088c2ecf20Sopenharmony_ci	u32 mask2_word2;				/*  0x4040 */
8098c2ecf20Sopenharmony_ci	u32 mask2_word3;				/*  0x4044 */
8108c2ecf20Sopenharmony_ci	u32 mask3_word0;				/*  0x4048 */
8118c2ecf20Sopenharmony_ci	u32 mask3_word1;				/*  0x404C */
8128c2ecf20Sopenharmony_ci	u32 mask3_word2;				/*  0x4050 */
8138c2ecf20Sopenharmony_ci	u32 mask3_word3;				/*  0x4054 */
8148c2ecf20Sopenharmony_ci	u32 mask4_word0;				/*  0x4058 */
8158c2ecf20Sopenharmony_ci	u32 mask4_word1;				/*  0x405C */
8168c2ecf20Sopenharmony_ci	u32 mask4_word2;				/*  0x4060 */
8178c2ecf20Sopenharmony_ci	u32 mask4_word3;				/*  0x4064 */
8188c2ecf20Sopenharmony_ci	u32 uni_pf_addr1;				/*  0x4068 */
8198c2ecf20Sopenharmony_ci	u32 uni_pf_addr2;				/*  0x406C */
8208c2ecf20Sopenharmony_ci	u32 uni_pf_addr3;				/*  0x4070 */
8218c2ecf20Sopenharmony_ci	u32 multi_hash1;				/*  0x4074 */
8228c2ecf20Sopenharmony_ci	u32 multi_hash2;				/*  0x4078 */
8238c2ecf20Sopenharmony_ci	u32 multi_hash3;				/*  0x407C */
8248c2ecf20Sopenharmony_ci	u32 multi_hash4;				/*  0x4080 */
8258c2ecf20Sopenharmony_ci	u32 pf_ctrl;					/*  0x4084 */
8268c2ecf20Sopenharmony_ci	u32 mcif_ctrl_max_seg;				/*  0x4088 */
8278c2ecf20Sopenharmony_ci	u32 mcif_water_mark;				/*  0x408C */
8288c2ecf20Sopenharmony_ci	u32 rxq_diag;					/*  0x4090 */
8298c2ecf20Sopenharmony_ci	u32 space_avail;				/*  0x4094 */
8308c2ecf20Sopenharmony_ci
8318c2ecf20Sopenharmony_ci	u32 mif_ctrl;					/*  0x4098 */
8328c2ecf20Sopenharmony_ci	u32 err_reg;					/*  0x409C */
8338c2ecf20Sopenharmony_ci};
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci/* END OF RXMAC REGISTER ADDRESS MAP */
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci/* START OF MAC REGISTER ADDRESS MAP */
8388c2ecf20Sopenharmony_ci/* structure for configuration #1 reg in mac address map.
8398c2ecf20Sopenharmony_ci * located at address 0x5000
8408c2ecf20Sopenharmony_ci *
8418c2ecf20Sopenharmony_ci * 31: soft reset
8428c2ecf20Sopenharmony_ci * 30: sim reset
8438c2ecf20Sopenharmony_ci * 29-20: reserved
8448c2ecf20Sopenharmony_ci * 19: reset rx mc
8458c2ecf20Sopenharmony_ci * 18: reset tx mc
8468c2ecf20Sopenharmony_ci * 17: reset rx func
8478c2ecf20Sopenharmony_ci * 16: reset tx fnc
8488c2ecf20Sopenharmony_ci * 15-9: reserved
8498c2ecf20Sopenharmony_ci * 8: loopback
8508c2ecf20Sopenharmony_ci * 7-6: reserved
8518c2ecf20Sopenharmony_ci * 5: rx flow
8528c2ecf20Sopenharmony_ci * 4: tx flow
8538c2ecf20Sopenharmony_ci * 3: syncd rx en
8548c2ecf20Sopenharmony_ci * 2: rx enable
8558c2ecf20Sopenharmony_ci * 1: syncd tx en
8568c2ecf20Sopenharmony_ci * 0: tx enable
8578c2ecf20Sopenharmony_ci */
8588c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_SOFT_RESET		0x80000000
8598c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_SIM_RESET		0x40000000
8608c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RESET_RXMC		0x00080000
8618c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RESET_TXMC		0x00040000
8628c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RESET_RXFUNC	0x00020000
8638c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RESET_TXFUNC	0x00010000
8648c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_LOOPBACK		0x00000100
8658c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RX_FLOW		0x00000020
8668c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_TX_FLOW		0x00000010
8678c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_RX_ENABLE		0x00000004
8688c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_TX_ENABLE		0x00000001
8698c2ecf20Sopenharmony_ci#define ET_MAC_CFG1_WAIT		0x0000000A	/* RX & TX syncd */
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_ci/* structure for configuration #2 reg in mac address map.
8728c2ecf20Sopenharmony_ci * located at address 0x5004
8738c2ecf20Sopenharmony_ci * 31-16: reserved
8748c2ecf20Sopenharmony_ci * 15-12: preamble
8758c2ecf20Sopenharmony_ci * 11-10: reserved
8768c2ecf20Sopenharmony_ci * 9-8: if mode
8778c2ecf20Sopenharmony_ci * 7-6: reserved
8788c2ecf20Sopenharmony_ci * 5: huge frame
8798c2ecf20Sopenharmony_ci * 4: length check
8808c2ecf20Sopenharmony_ci * 3: undefined
8818c2ecf20Sopenharmony_ci * 2: pad crc
8828c2ecf20Sopenharmony_ci * 1: crc enable
8838c2ecf20Sopenharmony_ci * 0: full duplex
8848c2ecf20Sopenharmony_ci */
8858c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_PREAMBLE_SHIFT	12
8868c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_MASK		0x0300
8878c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_1000		0x0200
8888c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_100		0x0100
8898c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_HUGE_FRAME	0x0020
8908c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_LEN_CHECK	0x0010
8918c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_PAD_CRC	0x0004
8928c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_CRC_ENABLE	0x0002
8938c2ecf20Sopenharmony_ci#define ET_MAC_CFG2_IFMODE_FULL_DPLX	0x0001
8948c2ecf20Sopenharmony_ci
8958c2ecf20Sopenharmony_ci/* structure for Interpacket gap reg in mac address map.
8968c2ecf20Sopenharmony_ci * located at address 0x5008
8978c2ecf20Sopenharmony_ci *
8988c2ecf20Sopenharmony_ci * 31: reserved
8998c2ecf20Sopenharmony_ci * 30-24: non B2B ipg 1
9008c2ecf20Sopenharmony_ci * 23: undefined
9018c2ecf20Sopenharmony_ci * 22-16: non B2B ipg 2
9028c2ecf20Sopenharmony_ci * 15-8: Min ifg enforce
9038c2ecf20Sopenharmony_ci * 7-0: B2B ipg
9048c2ecf20Sopenharmony_ci *
9058c2ecf20Sopenharmony_ci * structure for half duplex reg in mac address map.
9068c2ecf20Sopenharmony_ci * located at address 0x500C
9078c2ecf20Sopenharmony_ci * 31-24: reserved
9088c2ecf20Sopenharmony_ci * 23-20: Alt BEB trunc
9098c2ecf20Sopenharmony_ci * 19: Alt BEB enable
9108c2ecf20Sopenharmony_ci * 18: BP no backoff
9118c2ecf20Sopenharmony_ci * 17: no backoff
9128c2ecf20Sopenharmony_ci * 16: excess defer
9138c2ecf20Sopenharmony_ci * 15-12: re-xmit max
9148c2ecf20Sopenharmony_ci * 11-10: reserved
9158c2ecf20Sopenharmony_ci * 9-0: collision window
9168c2ecf20Sopenharmony_ci */
9178c2ecf20Sopenharmony_ci
9188c2ecf20Sopenharmony_ci/* structure for Maximum Frame Length reg in mac address map.
9198c2ecf20Sopenharmony_ci * located at address 0x5010: bits 0-15 hold the length.
9208c2ecf20Sopenharmony_ci */
9218c2ecf20Sopenharmony_ci
9228c2ecf20Sopenharmony_ci/* structure for Reserve 1 reg in mac address map.
9238c2ecf20Sopenharmony_ci * located at address 0x5014 - 0x5018
9248c2ecf20Sopenharmony_ci * Defined earlier (u32)
9258c2ecf20Sopenharmony_ci */
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci/* structure for Test reg in mac address map.
9288c2ecf20Sopenharmony_ci * located at address 0x501C
9298c2ecf20Sopenharmony_ci * test: bits 0-2, rest unused
9308c2ecf20Sopenharmony_ci */
9318c2ecf20Sopenharmony_ci
9328c2ecf20Sopenharmony_ci/* structure for MII Management Configuration reg in mac address map.
9338c2ecf20Sopenharmony_ci * located at address 0x5020
9348c2ecf20Sopenharmony_ci *
9358c2ecf20Sopenharmony_ci * 31: reset MII mgmt
9368c2ecf20Sopenharmony_ci * 30-6: unused
9378c2ecf20Sopenharmony_ci * 5: scan auto increment
9388c2ecf20Sopenharmony_ci * 4: preamble suppress
9398c2ecf20Sopenharmony_ci * 3: undefined
9408c2ecf20Sopenharmony_ci * 2-0: mgmt clock reset
9418c2ecf20Sopenharmony_ci */
9428c2ecf20Sopenharmony_ci#define ET_MAC_MIIMGMT_CLK_RST	0x0007
9438c2ecf20Sopenharmony_ci
9448c2ecf20Sopenharmony_ci/* structure for MII Management Command reg in mac address map.
9458c2ecf20Sopenharmony_ci * located at address 0x5024
9468c2ecf20Sopenharmony_ci * bit 1: scan cycle
9478c2ecf20Sopenharmony_ci * bit 0: read cycle
9488c2ecf20Sopenharmony_ci */
9498c2ecf20Sopenharmony_ci
9508c2ecf20Sopenharmony_ci/* structure for MII Management Address reg in mac address map.
9518c2ecf20Sopenharmony_ci * located at address 0x5028
9528c2ecf20Sopenharmony_ci * 31-13: reserved
9538c2ecf20Sopenharmony_ci * 12-8: phy addr
9548c2ecf20Sopenharmony_ci * 7-5: reserved
9558c2ecf20Sopenharmony_ci * 4-0: register
9568c2ecf20Sopenharmony_ci */
9578c2ecf20Sopenharmony_ci#define ET_MAC_MII_ADDR(phy, reg)	((phy) << 8 | (reg))
9588c2ecf20Sopenharmony_ci
9598c2ecf20Sopenharmony_ci/* structure for MII Management Control reg in mac address map.
9608c2ecf20Sopenharmony_ci * located at address 0x502C
9618c2ecf20Sopenharmony_ci * 31-16: reserved
9628c2ecf20Sopenharmony_ci * 15-0: phy control
9638c2ecf20Sopenharmony_ci */
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_ci/* structure for MII Management Status reg in mac address map.
9668c2ecf20Sopenharmony_ci * located at address 0x5030
9678c2ecf20Sopenharmony_ci * 31-16: reserved
9688c2ecf20Sopenharmony_ci * 15-0: phy control
9698c2ecf20Sopenharmony_ci */
9708c2ecf20Sopenharmony_ci#define ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK 0xFFFF
9718c2ecf20Sopenharmony_ci
9728c2ecf20Sopenharmony_ci/* structure for MII Management Indicators reg in mac address map.
9738c2ecf20Sopenharmony_ci * located at address 0x5034
9748c2ecf20Sopenharmony_ci * 31-3: reserved
9758c2ecf20Sopenharmony_ci * 2: not valid
9768c2ecf20Sopenharmony_ci * 1: scanning
9778c2ecf20Sopenharmony_ci * 0: busy
9788c2ecf20Sopenharmony_ci */
9798c2ecf20Sopenharmony_ci#define ET_MAC_MGMT_BUSY	0x00000001	/* busy */
9808c2ecf20Sopenharmony_ci#define ET_MAC_MGMT_WAIT	0x00000005	/* busy | not valid */
9818c2ecf20Sopenharmony_ci
9828c2ecf20Sopenharmony_ci/* structure for Interface Control reg in mac address map.
9838c2ecf20Sopenharmony_ci * located at address 0x5038
9848c2ecf20Sopenharmony_ci *
9858c2ecf20Sopenharmony_ci * 31: reset if module
9868c2ecf20Sopenharmony_ci * 30-28: reserved
9878c2ecf20Sopenharmony_ci * 27: tbi mode
9888c2ecf20Sopenharmony_ci * 26: ghd mode
9898c2ecf20Sopenharmony_ci * 25: lhd mode
9908c2ecf20Sopenharmony_ci * 24: phy mode
9918c2ecf20Sopenharmony_ci * 23: reset per mii
9928c2ecf20Sopenharmony_ci * 22-17: reserved
9938c2ecf20Sopenharmony_ci * 16: speed
9948c2ecf20Sopenharmony_ci * 15: reset pe100x
9958c2ecf20Sopenharmony_ci * 14-11: reserved
9968c2ecf20Sopenharmony_ci * 10: force quiet
9978c2ecf20Sopenharmony_ci * 9: no cipher
9988c2ecf20Sopenharmony_ci * 8: disable link fail
9998c2ecf20Sopenharmony_ci * 7: reset gpsi
10008c2ecf20Sopenharmony_ci * 6-1: reserved
10018c2ecf20Sopenharmony_ci * 0: enable jabber protection
10028c2ecf20Sopenharmony_ci */
10038c2ecf20Sopenharmony_ci#define ET_MAC_IFCTRL_GHDMODE	(1 << 26)
10048c2ecf20Sopenharmony_ci#define ET_MAC_IFCTRL_PHYMODE	(1 << 24)
10058c2ecf20Sopenharmony_ci
10068c2ecf20Sopenharmony_ci/* structure for Interface Status reg in mac address map.
10078c2ecf20Sopenharmony_ci * located at address 0x503C
10088c2ecf20Sopenharmony_ci *
10098c2ecf20Sopenharmony_ci * 31-10: reserved
10108c2ecf20Sopenharmony_ci * 9: excess_defer
10118c2ecf20Sopenharmony_ci * 8: clash
10128c2ecf20Sopenharmony_ci * 7: phy_jabber
10138c2ecf20Sopenharmony_ci * 6: phy_link_ok
10148c2ecf20Sopenharmony_ci * 5: phy_full_duplex
10158c2ecf20Sopenharmony_ci * 4: phy_speed
10168c2ecf20Sopenharmony_ci * 3: pe100x_link_fail
10178c2ecf20Sopenharmony_ci * 2: pe10t_loss_carrier
10188c2ecf20Sopenharmony_ci * 1: pe10t_sqe_error
10198c2ecf20Sopenharmony_ci * 0: pe10t_jabber
10208c2ecf20Sopenharmony_ci */
10218c2ecf20Sopenharmony_ci
10228c2ecf20Sopenharmony_ci/* structure for Mac Station Address, Part 1 reg in mac address map.
10238c2ecf20Sopenharmony_ci * located at address 0x5040
10248c2ecf20Sopenharmony_ci *
10258c2ecf20Sopenharmony_ci * 31-24: Octet6
10268c2ecf20Sopenharmony_ci * 23-16: Octet5
10278c2ecf20Sopenharmony_ci * 15-8: Octet4
10288c2ecf20Sopenharmony_ci * 7-0: Octet3
10298c2ecf20Sopenharmony_ci */
10308c2ecf20Sopenharmony_ci#define ET_MAC_STATION_ADDR1_OC6_SHIFT 24
10318c2ecf20Sopenharmony_ci#define ET_MAC_STATION_ADDR1_OC5_SHIFT 16
10328c2ecf20Sopenharmony_ci#define ET_MAC_STATION_ADDR1_OC4_SHIFT 8
10338c2ecf20Sopenharmony_ci
10348c2ecf20Sopenharmony_ci/* structure for Mac Station Address, Part 2 reg in mac address map.
10358c2ecf20Sopenharmony_ci * located at address 0x5044
10368c2ecf20Sopenharmony_ci *
10378c2ecf20Sopenharmony_ci * 31-24: Octet2
10388c2ecf20Sopenharmony_ci * 23-16: Octet1
10398c2ecf20Sopenharmony_ci * 15-0: reserved
10408c2ecf20Sopenharmony_ci */
10418c2ecf20Sopenharmony_ci#define ET_MAC_STATION_ADDR2_OC2_SHIFT 24
10428c2ecf20Sopenharmony_ci#define ET_MAC_STATION_ADDR2_OC1_SHIFT 16
10438c2ecf20Sopenharmony_ci
10448c2ecf20Sopenharmony_ci/* MAC Module of JAGCore Address Mapping
10458c2ecf20Sopenharmony_ci */
10468c2ecf20Sopenharmony_cistruct mac_regs {					/* Location: */
10478c2ecf20Sopenharmony_ci	u32 cfg1;					/*  0x5000 */
10488c2ecf20Sopenharmony_ci	u32 cfg2;					/*  0x5004 */
10498c2ecf20Sopenharmony_ci	u32 ipg;					/*  0x5008 */
10508c2ecf20Sopenharmony_ci	u32 hfdp;					/*  0x500C */
10518c2ecf20Sopenharmony_ci	u32 max_fm_len;					/*  0x5010 */
10528c2ecf20Sopenharmony_ci	u32 rsv1;					/*  0x5014 */
10538c2ecf20Sopenharmony_ci	u32 rsv2;					/*  0x5018 */
10548c2ecf20Sopenharmony_ci	u32 mac_test;					/*  0x501C */
10558c2ecf20Sopenharmony_ci	u32 mii_mgmt_cfg;				/*  0x5020 */
10568c2ecf20Sopenharmony_ci	u32 mii_mgmt_cmd;				/*  0x5024 */
10578c2ecf20Sopenharmony_ci	u32 mii_mgmt_addr;				/*  0x5028 */
10588c2ecf20Sopenharmony_ci	u32 mii_mgmt_ctrl;				/*  0x502C */
10598c2ecf20Sopenharmony_ci	u32 mii_mgmt_stat;				/*  0x5030 */
10608c2ecf20Sopenharmony_ci	u32 mii_mgmt_indicator;				/*  0x5034 */
10618c2ecf20Sopenharmony_ci	u32 if_ctrl;					/*  0x5038 */
10628c2ecf20Sopenharmony_ci	u32 if_stat;					/*  0x503C */
10638c2ecf20Sopenharmony_ci	u32 station_addr_1;				/*  0x5040 */
10648c2ecf20Sopenharmony_ci	u32 station_addr_2;				/*  0x5044 */
10658c2ecf20Sopenharmony_ci};
10668c2ecf20Sopenharmony_ci
10678c2ecf20Sopenharmony_ci/* END OF MAC REGISTER ADDRESS MAP */
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci/* START OF MAC STAT REGISTER ADDRESS MAP */
10708c2ecf20Sopenharmony_ci/* structure for Carry Register One and it's Mask Register reg located in mac
10718c2ecf20Sopenharmony_ci * stat address map address 0x6130 and 0x6138.
10728c2ecf20Sopenharmony_ci *
10738c2ecf20Sopenharmony_ci * 31: tr64
10748c2ecf20Sopenharmony_ci * 30: tr127
10758c2ecf20Sopenharmony_ci * 29: tr255
10768c2ecf20Sopenharmony_ci * 28: tr511
10778c2ecf20Sopenharmony_ci * 27: tr1k
10788c2ecf20Sopenharmony_ci * 26: trmax
10798c2ecf20Sopenharmony_ci * 25: trmgv
10808c2ecf20Sopenharmony_ci * 24-17: unused
10818c2ecf20Sopenharmony_ci * 16: rbyt
10828c2ecf20Sopenharmony_ci * 15: rpkt
10838c2ecf20Sopenharmony_ci * 14: rfcs
10848c2ecf20Sopenharmony_ci * 13: rmca
10858c2ecf20Sopenharmony_ci * 12: rbca
10868c2ecf20Sopenharmony_ci * 11: rxcf
10878c2ecf20Sopenharmony_ci * 10: rxpf
10888c2ecf20Sopenharmony_ci * 9: rxuo
10898c2ecf20Sopenharmony_ci * 8: raln
10908c2ecf20Sopenharmony_ci * 7: rflr
10918c2ecf20Sopenharmony_ci * 6: rcde
10928c2ecf20Sopenharmony_ci * 5: rcse
10938c2ecf20Sopenharmony_ci * 4: rund
10948c2ecf20Sopenharmony_ci * 3: rovr
10958c2ecf20Sopenharmony_ci * 2: rfrg
10968c2ecf20Sopenharmony_ci * 1: rjbr
10978c2ecf20Sopenharmony_ci * 0: rdrp
10988c2ecf20Sopenharmony_ci */
10998c2ecf20Sopenharmony_ci
11008c2ecf20Sopenharmony_ci/* structure for Carry Register Two Mask Register reg in mac stat address map.
11018c2ecf20Sopenharmony_ci * located at address 0x613C
11028c2ecf20Sopenharmony_ci *
11038c2ecf20Sopenharmony_ci * 31-20: unused
11048c2ecf20Sopenharmony_ci * 19: tjbr
11058c2ecf20Sopenharmony_ci * 18: tfcs
11068c2ecf20Sopenharmony_ci * 17: txcf
11078c2ecf20Sopenharmony_ci * 16: tovr
11088c2ecf20Sopenharmony_ci * 15: tund
11098c2ecf20Sopenharmony_ci * 14: trfg
11108c2ecf20Sopenharmony_ci * 13: tbyt
11118c2ecf20Sopenharmony_ci * 12: tpkt
11128c2ecf20Sopenharmony_ci * 11: tmca
11138c2ecf20Sopenharmony_ci * 10: tbca
11148c2ecf20Sopenharmony_ci * 9: txpf
11158c2ecf20Sopenharmony_ci * 8: tdfr
11168c2ecf20Sopenharmony_ci * 7: tedf
11178c2ecf20Sopenharmony_ci * 6: tscl
11188c2ecf20Sopenharmony_ci * 5: tmcl
11198c2ecf20Sopenharmony_ci * 4: tlcl
11208c2ecf20Sopenharmony_ci * 3: txcl
11218c2ecf20Sopenharmony_ci * 2: tncl
11228c2ecf20Sopenharmony_ci * 1: tpfh
11238c2ecf20Sopenharmony_ci * 0: tdrp
11248c2ecf20Sopenharmony_ci */
11258c2ecf20Sopenharmony_ci
11268c2ecf20Sopenharmony_ci/* MAC STATS Module of JAGCore Address Mapping
11278c2ecf20Sopenharmony_ci */
11288c2ecf20Sopenharmony_cistruct macstat_regs {			/* Location: */
11298c2ecf20Sopenharmony_ci	u32 pad[32];			/*  0x6000 - 607C */
11308c2ecf20Sopenharmony_ci
11318c2ecf20Sopenharmony_ci	/* counters */
11328c2ecf20Sopenharmony_ci	u32 txrx_0_64_byte_frames;	/*  0x6080 */
11338c2ecf20Sopenharmony_ci	u32 txrx_65_127_byte_frames;	/*  0x6084 */
11348c2ecf20Sopenharmony_ci	u32 txrx_128_255_byte_frames;	/*  0x6088 */
11358c2ecf20Sopenharmony_ci	u32 txrx_256_511_byte_frames;	/*  0x608C */
11368c2ecf20Sopenharmony_ci	u32 txrx_512_1023_byte_frames;	/*  0x6090 */
11378c2ecf20Sopenharmony_ci	u32 txrx_1024_1518_byte_frames;	/*  0x6094 */
11388c2ecf20Sopenharmony_ci	u32 txrx_1519_1522_gvln_frames;	/*  0x6098 */
11398c2ecf20Sopenharmony_ci	u32 rx_bytes;			/*  0x609C */
11408c2ecf20Sopenharmony_ci	u32 rx_packets;			/*  0x60A0 */
11418c2ecf20Sopenharmony_ci	u32 rx_fcs_errs;		/*  0x60A4 */
11428c2ecf20Sopenharmony_ci	u32 rx_multicast_packets;	/*  0x60A8 */
11438c2ecf20Sopenharmony_ci	u32 rx_broadcast_packets;	/*  0x60AC */
11448c2ecf20Sopenharmony_ci	u32 rx_control_frames;		/*  0x60B0 */
11458c2ecf20Sopenharmony_ci	u32 rx_pause_frames;		/*  0x60B4 */
11468c2ecf20Sopenharmony_ci	u32 rx_unknown_opcodes;		/*  0x60B8 */
11478c2ecf20Sopenharmony_ci	u32 rx_align_errs;		/*  0x60BC */
11488c2ecf20Sopenharmony_ci	u32 rx_frame_len_errs;		/*  0x60C0 */
11498c2ecf20Sopenharmony_ci	u32 rx_code_errs;		/*  0x60C4 */
11508c2ecf20Sopenharmony_ci	u32 rx_carrier_sense_errs;	/*  0x60C8 */
11518c2ecf20Sopenharmony_ci	u32 rx_undersize_packets;	/*  0x60CC */
11528c2ecf20Sopenharmony_ci	u32 rx_oversize_packets;	/*  0x60D0 */
11538c2ecf20Sopenharmony_ci	u32 rx_fragment_packets;	/*  0x60D4 */
11548c2ecf20Sopenharmony_ci	u32 rx_jabbers;			/*  0x60D8 */
11558c2ecf20Sopenharmony_ci	u32 rx_drops;			/*  0x60DC */
11568c2ecf20Sopenharmony_ci	u32 tx_bytes;			/*  0x60E0 */
11578c2ecf20Sopenharmony_ci	u32 tx_packets;			/*  0x60E4 */
11588c2ecf20Sopenharmony_ci	u32 tx_multicast_packets;	/*  0x60E8 */
11598c2ecf20Sopenharmony_ci	u32 tx_broadcast_packets;	/*  0x60EC */
11608c2ecf20Sopenharmony_ci	u32 tx_pause_frames;		/*  0x60F0 */
11618c2ecf20Sopenharmony_ci	u32 tx_deferred;		/*  0x60F4 */
11628c2ecf20Sopenharmony_ci	u32 tx_excessive_deferred;	/*  0x60F8 */
11638c2ecf20Sopenharmony_ci	u32 tx_single_collisions;	/*  0x60FC */
11648c2ecf20Sopenharmony_ci	u32 tx_multiple_collisions;	/*  0x6100 */
11658c2ecf20Sopenharmony_ci	u32 tx_late_collisions;		/*  0x6104 */
11668c2ecf20Sopenharmony_ci	u32 tx_excessive_collisions;	/*  0x6108 */
11678c2ecf20Sopenharmony_ci	u32 tx_total_collisions;	/*  0x610C */
11688c2ecf20Sopenharmony_ci	u32 tx_pause_honored_frames;	/*  0x6110 */
11698c2ecf20Sopenharmony_ci	u32 tx_drops;			/*  0x6114 */
11708c2ecf20Sopenharmony_ci	u32 tx_jabbers;			/*  0x6118 */
11718c2ecf20Sopenharmony_ci	u32 tx_fcs_errs;		/*  0x611C */
11728c2ecf20Sopenharmony_ci	u32 tx_control_frames;		/*  0x6120 */
11738c2ecf20Sopenharmony_ci	u32 tx_oversize_frames;		/*  0x6124 */
11748c2ecf20Sopenharmony_ci	u32 tx_undersize_frames;	/*  0x6128 */
11758c2ecf20Sopenharmony_ci	u32 tx_fragments;		/*  0x612C */
11768c2ecf20Sopenharmony_ci	u32 carry_reg1;			/*  0x6130 */
11778c2ecf20Sopenharmony_ci	u32 carry_reg2;			/*  0x6134 */
11788c2ecf20Sopenharmony_ci	u32 carry_reg1_mask;		/*  0x6138 */
11798c2ecf20Sopenharmony_ci	u32 carry_reg2_mask;		/*  0x613C */
11808c2ecf20Sopenharmony_ci};
11818c2ecf20Sopenharmony_ci
11828c2ecf20Sopenharmony_ci/* END OF MAC STAT REGISTER ADDRESS MAP */
11838c2ecf20Sopenharmony_ci
11848c2ecf20Sopenharmony_ci/* START OF MMC REGISTER ADDRESS MAP */
11858c2ecf20Sopenharmony_ci/* Main Memory Controller Control reg in mmc address map.
11868c2ecf20Sopenharmony_ci * located at address 0x7000
11878c2ecf20Sopenharmony_ci */
11888c2ecf20Sopenharmony_ci#define ET_MMC_ENABLE		1
11898c2ecf20Sopenharmony_ci#define ET_MMC_ARB_DISABLE	2
11908c2ecf20Sopenharmony_ci#define ET_MMC_RXMAC_DISABLE	4
11918c2ecf20Sopenharmony_ci#define ET_MMC_TXMAC_DISABLE	8
11928c2ecf20Sopenharmony_ci#define ET_MMC_TXDMA_DISABLE	16
11938c2ecf20Sopenharmony_ci#define ET_MMC_RXDMA_DISABLE	32
11948c2ecf20Sopenharmony_ci#define ET_MMC_FORCE_CE		64
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci/* Main Memory Controller Host Memory Access Address reg in mmc
11978c2ecf20Sopenharmony_ci * address map.  Located at address 0x7004. Top 16 bits hold the address bits
11988c2ecf20Sopenharmony_ci */
11998c2ecf20Sopenharmony_ci#define ET_SRAM_REQ_ACCESS	1
12008c2ecf20Sopenharmony_ci#define ET_SRAM_WR_ACCESS	2
12018c2ecf20Sopenharmony_ci#define ET_SRAM_IS_CTRL		4
12028c2ecf20Sopenharmony_ci
12038c2ecf20Sopenharmony_ci/* structure for Main Memory Controller Host Memory Access Data reg in mmc
12048c2ecf20Sopenharmony_ci * address map.  Located at address 0x7008 - 0x7014
12058c2ecf20Sopenharmony_ci * Defined earlier (u32)
12068c2ecf20Sopenharmony_ci */
12078c2ecf20Sopenharmony_ci
12088c2ecf20Sopenharmony_ci/* Memory Control Module of JAGCore Address Mapping
12098c2ecf20Sopenharmony_ci */
12108c2ecf20Sopenharmony_cistruct mmc_regs {		/* Location: */
12118c2ecf20Sopenharmony_ci	u32 mmc_ctrl;		/*  0x7000 */
12128c2ecf20Sopenharmony_ci	u32 sram_access;	/*  0x7004 */
12138c2ecf20Sopenharmony_ci	u32 sram_word1;		/*  0x7008 */
12148c2ecf20Sopenharmony_ci	u32 sram_word2;		/*  0x700C */
12158c2ecf20Sopenharmony_ci	u32 sram_word3;		/*  0x7010 */
12168c2ecf20Sopenharmony_ci	u32 sram_word4;		/*  0x7014 */
12178c2ecf20Sopenharmony_ci};
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ci/* END OF MMC REGISTER ADDRESS MAP */
12208c2ecf20Sopenharmony_ci
12218c2ecf20Sopenharmony_ci/* JAGCore Address Mapping
12228c2ecf20Sopenharmony_ci */
12238c2ecf20Sopenharmony_cistruct address_map {
12248c2ecf20Sopenharmony_ci	struct global_regs global;
12258c2ecf20Sopenharmony_ci	/* unused section of global address map */
12268c2ecf20Sopenharmony_ci	u8 unused_global[4096 - sizeof(struct global_regs)];
12278c2ecf20Sopenharmony_ci	struct txdma_regs txdma;
12288c2ecf20Sopenharmony_ci	/* unused section of txdma address map */
12298c2ecf20Sopenharmony_ci	u8 unused_txdma[4096 - sizeof(struct txdma_regs)];
12308c2ecf20Sopenharmony_ci	struct rxdma_regs rxdma;
12318c2ecf20Sopenharmony_ci	/* unused section of rxdma address map */
12328c2ecf20Sopenharmony_ci	u8 unused_rxdma[4096 - sizeof(struct rxdma_regs)];
12338c2ecf20Sopenharmony_ci	struct txmac_regs txmac;
12348c2ecf20Sopenharmony_ci	/* unused section of txmac address map */
12358c2ecf20Sopenharmony_ci	u8 unused_txmac[4096 - sizeof(struct txmac_regs)];
12368c2ecf20Sopenharmony_ci	struct rxmac_regs rxmac;
12378c2ecf20Sopenharmony_ci	/* unused section of rxmac address map */
12388c2ecf20Sopenharmony_ci	u8 unused_rxmac[4096 - sizeof(struct rxmac_regs)];
12398c2ecf20Sopenharmony_ci	struct mac_regs mac;
12408c2ecf20Sopenharmony_ci	/* unused section of mac address map */
12418c2ecf20Sopenharmony_ci	u8 unused_mac[4096 - sizeof(struct mac_regs)];
12428c2ecf20Sopenharmony_ci	struct macstat_regs macstat;
12438c2ecf20Sopenharmony_ci	/* unused section of mac stat address map */
12448c2ecf20Sopenharmony_ci	u8 unused_mac_stat[4096 - sizeof(struct macstat_regs)];
12458c2ecf20Sopenharmony_ci	struct mmc_regs mmc;
12468c2ecf20Sopenharmony_ci	/* unused section of mmc address map */
12478c2ecf20Sopenharmony_ci	u8 unused_mmc[4096 - sizeof(struct mmc_regs)];
12488c2ecf20Sopenharmony_ci	/* unused section of address map */
12498c2ecf20Sopenharmony_ci	u8 unused_[1015808];
12508c2ecf20Sopenharmony_ci	u8 unused_exp_rom[4096];	/* MGS-size TBD */
12518c2ecf20Sopenharmony_ci	u8 unused__[524288];	/* unused section of address map */
12528c2ecf20Sopenharmony_ci};
12538c2ecf20Sopenharmony_ci
12548c2ecf20Sopenharmony_ci/* Defines for generic MII registers 0x00 -> 0x0F can be found in
12558c2ecf20Sopenharmony_ci * include/linux/mii.h
12568c2ecf20Sopenharmony_ci */
12578c2ecf20Sopenharmony_ci/* some defines for modem registers that seem to be 'reserved' */
12588c2ecf20Sopenharmony_ci#define PHY_INDEX_REG              0x10
12598c2ecf20Sopenharmony_ci#define PHY_DATA_REG               0x11
12608c2ecf20Sopenharmony_ci#define PHY_MPHY_CONTROL_REG       0x12
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_ci/* defines for specified registers */
12638c2ecf20Sopenharmony_ci#define PHY_LOOPBACK_CONTROL       0x13	/* TRU_VMI_LOOPBACK_CONTROL_1_REG 19 */
12648c2ecf20Sopenharmony_ci					/* TRU_VMI_LOOPBACK_CONTROL_2_REG 20 */
12658c2ecf20Sopenharmony_ci#define PHY_REGISTER_MGMT_CONTROL  0x15	/* TRU_VMI_MI_SEQ_CONTROL_REG     21 */
12668c2ecf20Sopenharmony_ci#define PHY_CONFIG                 0x16	/* TRU_VMI_CONFIGURATION_REG      22 */
12678c2ecf20Sopenharmony_ci#define PHY_PHY_CONTROL            0x17	/* TRU_VMI_PHY_CONTROL_REG        23 */
12688c2ecf20Sopenharmony_ci#define PHY_INTERRUPT_MASK         0x18	/* TRU_VMI_INTERRUPT_MASK_REG     24 */
12698c2ecf20Sopenharmony_ci#define PHY_INTERRUPT_STATUS       0x19	/* TRU_VMI_INTERRUPT_STATUS_REG   25 */
12708c2ecf20Sopenharmony_ci#define PHY_PHY_STATUS             0x1A	/* TRU_VMI_PHY_STATUS_REG         26 */
12718c2ecf20Sopenharmony_ci#define PHY_LED_1                  0x1B	/* TRU_VMI_LED_CONTROL_1_REG      27 */
12728c2ecf20Sopenharmony_ci#define PHY_LED_2                  0x1C	/* TRU_VMI_LED_CONTROL_2_REG      28 */
12738c2ecf20Sopenharmony_ci					/* TRU_VMI_LINK_CONTROL_REG       29 */
12748c2ecf20Sopenharmony_ci					/* TRU_VMI_TIMING_CONTROL_REG        */
12758c2ecf20Sopenharmony_ci
12768c2ecf20Sopenharmony_ci/* MI Register 10: Gigabit basic mode status reg(Reg 0x0A) */
12778c2ecf20Sopenharmony_ci#define ET_1000BT_MSTR_SLV 0x4000
12788c2ecf20Sopenharmony_ci
12798c2ecf20Sopenharmony_ci/* MI Register 16 - 18: Reserved Reg(0x10-0x12) */
12808c2ecf20Sopenharmony_ci
12818c2ecf20Sopenharmony_ci/* MI Register 19: Loopback Control Reg(0x13)
12828c2ecf20Sopenharmony_ci *	15:	mii_en
12838c2ecf20Sopenharmony_ci *	14:	pcs_en
12848c2ecf20Sopenharmony_ci *	13:	pmd_en
12858c2ecf20Sopenharmony_ci *	12:	all_digital_en
12868c2ecf20Sopenharmony_ci *	11:	replica_en
12878c2ecf20Sopenharmony_ci *	10:	line_driver_en
12888c2ecf20Sopenharmony_ci *	9-0:	reserved
12898c2ecf20Sopenharmony_ci */
12908c2ecf20Sopenharmony_ci
12918c2ecf20Sopenharmony_ci/* MI Register 20: Reserved Reg(0x14) */
12928c2ecf20Sopenharmony_ci
12938c2ecf20Sopenharmony_ci/* MI Register 21: Management Interface Control Reg(0x15)
12948c2ecf20Sopenharmony_ci *	15-11:	reserved
12958c2ecf20Sopenharmony_ci *	10-4:	mi_error_count
12968c2ecf20Sopenharmony_ci *	3:	reserved
12978c2ecf20Sopenharmony_ci *	2:	ignore_10g_fr
12988c2ecf20Sopenharmony_ci *	1:	reserved
12998c2ecf20Sopenharmony_ci *	0:	preamble_suppress_en
13008c2ecf20Sopenharmony_ci */
13018c2ecf20Sopenharmony_ci
13028c2ecf20Sopenharmony_ci/* MI Register 22: PHY Configuration Reg(0x16)
13038c2ecf20Sopenharmony_ci *	15:	crs_tx_en
13048c2ecf20Sopenharmony_ci *	14:	reserved
13058c2ecf20Sopenharmony_ci *	13-12:	tx_fifo_depth
13068c2ecf20Sopenharmony_ci *	11-10:	speed_downshift
13078c2ecf20Sopenharmony_ci *	9:	pbi_detect
13088c2ecf20Sopenharmony_ci *	8:	tbi_rate
13098c2ecf20Sopenharmony_ci *	7:	alternate_np
13108c2ecf20Sopenharmony_ci *	6:	group_mdio_en
13118c2ecf20Sopenharmony_ci *	5:	tx_clock_en
13128c2ecf20Sopenharmony_ci *	4:	sys_clock_en
13138c2ecf20Sopenharmony_ci *	3:	reserved
13148c2ecf20Sopenharmony_ci *	2-0:	mac_if_mode
13158c2ecf20Sopenharmony_ci */
13168c2ecf20Sopenharmony_ci#define ET_PHY_CONFIG_TX_FIFO_DEPTH	0x3000
13178c2ecf20Sopenharmony_ci
13188c2ecf20Sopenharmony_ci#define ET_PHY_CONFIG_FIFO_DEPTH_8	0x0000
13198c2ecf20Sopenharmony_ci#define ET_PHY_CONFIG_FIFO_DEPTH_16	0x1000
13208c2ecf20Sopenharmony_ci#define ET_PHY_CONFIG_FIFO_DEPTH_32	0x2000
13218c2ecf20Sopenharmony_ci#define ET_PHY_CONFIG_FIFO_DEPTH_64	0x3000
13228c2ecf20Sopenharmony_ci
13238c2ecf20Sopenharmony_ci/* MI Register 23: PHY CONTROL Reg(0x17)
13248c2ecf20Sopenharmony_ci *	15:	reserved
13258c2ecf20Sopenharmony_ci *	14:	tdr_en
13268c2ecf20Sopenharmony_ci *	13:	reserved
13278c2ecf20Sopenharmony_ci *	12-11:	downshift_attempts
13288c2ecf20Sopenharmony_ci *	10-6:	reserved
13298c2ecf20Sopenharmony_ci *	5:	jabber_10baseT
13308c2ecf20Sopenharmony_ci *	4:	sqe_10baseT
13318c2ecf20Sopenharmony_ci *	3:	tp_loopback_10baseT
13328c2ecf20Sopenharmony_ci *	2:	preamble_gen_en
13338c2ecf20Sopenharmony_ci *	1:	reserved
13348c2ecf20Sopenharmony_ci *	0:	force_int
13358c2ecf20Sopenharmony_ci */
13368c2ecf20Sopenharmony_ci
13378c2ecf20Sopenharmony_ci/* MI Register 24: Interrupt Mask Reg(0x18)
13388c2ecf20Sopenharmony_ci *	15-10:	reserved
13398c2ecf20Sopenharmony_ci *	9:	mdio_sync_lost
13408c2ecf20Sopenharmony_ci *	8:	autoneg_status
13418c2ecf20Sopenharmony_ci *	7:	hi_bit_err
13428c2ecf20Sopenharmony_ci *	6:	np_rx
13438c2ecf20Sopenharmony_ci *	5:	err_counter_full
13448c2ecf20Sopenharmony_ci *	4:	fifo_over_underflow
13458c2ecf20Sopenharmony_ci *	3:	rx_status
13468c2ecf20Sopenharmony_ci *	2:	link_status
13478c2ecf20Sopenharmony_ci *	1:	automatic_speed
13488c2ecf20Sopenharmony_ci *	0:	int_en
13498c2ecf20Sopenharmony_ci */
13508c2ecf20Sopenharmony_ci
13518c2ecf20Sopenharmony_ci/* MI Register 25: Interrupt Status Reg(0x19)
13528c2ecf20Sopenharmony_ci *	15-10:	reserved
13538c2ecf20Sopenharmony_ci *	9:	mdio_sync_lost
13548c2ecf20Sopenharmony_ci *	8:	autoneg_status
13558c2ecf20Sopenharmony_ci *	7:	hi_bit_err
13568c2ecf20Sopenharmony_ci *	6:	np_rx
13578c2ecf20Sopenharmony_ci *	5:	err_counter_full
13588c2ecf20Sopenharmony_ci *	4:	fifo_over_underflow
13598c2ecf20Sopenharmony_ci *	3:	rx_status
13608c2ecf20Sopenharmony_ci *	2:	link_status
13618c2ecf20Sopenharmony_ci *	1:	automatic_speed
13628c2ecf20Sopenharmony_ci *	0:	int_en
13638c2ecf20Sopenharmony_ci */
13648c2ecf20Sopenharmony_ci
13658c2ecf20Sopenharmony_ci/* MI Register 26: PHY Status Reg(0x1A)
13668c2ecf20Sopenharmony_ci *	15:	reserved
13678c2ecf20Sopenharmony_ci *	14-13:	autoneg_fault
13688c2ecf20Sopenharmony_ci *	12:	autoneg_status
13698c2ecf20Sopenharmony_ci *	11:	mdi_x_status
13708c2ecf20Sopenharmony_ci *	10:	polarity_status
13718c2ecf20Sopenharmony_ci *	9-8:	speed_status
13728c2ecf20Sopenharmony_ci *	7:	duplex_status
13738c2ecf20Sopenharmony_ci *	6:	link_status
13748c2ecf20Sopenharmony_ci *	5:	tx_status
13758c2ecf20Sopenharmony_ci *	4:	rx_status
13768c2ecf20Sopenharmony_ci *	3:	collision_status
13778c2ecf20Sopenharmony_ci *	2:	autoneg_en
13788c2ecf20Sopenharmony_ci *	1:	pause_en
13798c2ecf20Sopenharmony_ci *	0:	asymmetric_dir
13808c2ecf20Sopenharmony_ci */
13818c2ecf20Sopenharmony_ci#define ET_PHY_AUTONEG_STATUS	0x1000
13828c2ecf20Sopenharmony_ci#define ET_PHY_POLARITY_STATUS	0x0400
13838c2ecf20Sopenharmony_ci#define ET_PHY_SPEED_STATUS	0x0300
13848c2ecf20Sopenharmony_ci#define ET_PHY_DUPLEX_STATUS	0x0080
13858c2ecf20Sopenharmony_ci#define ET_PHY_LSTATUS		0x0040
13868c2ecf20Sopenharmony_ci#define ET_PHY_AUTONEG_ENABLE	0x0020
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ci/* MI Register 27: LED Control Reg 1(0x1B)
13898c2ecf20Sopenharmony_ci *	15-14:	reserved
13908c2ecf20Sopenharmony_ci *	13-12:	led_dup_indicate
13918c2ecf20Sopenharmony_ci *	11-10:	led_10baseT
13928c2ecf20Sopenharmony_ci *	9-8:	led_collision
13938c2ecf20Sopenharmony_ci *	7-4:	reserved
13948c2ecf20Sopenharmony_ci *	3-2:	pulse_dur
13958c2ecf20Sopenharmony_ci *	1:	pulse_stretch1
13968c2ecf20Sopenharmony_ci *	0:	pulse_stretch0
13978c2ecf20Sopenharmony_ci */
13988c2ecf20Sopenharmony_ci
13998c2ecf20Sopenharmony_ci/* MI Register 28: LED Control Reg 2(0x1C)
14008c2ecf20Sopenharmony_ci *	15-12:	led_link
14018c2ecf20Sopenharmony_ci *	11-8:	led_tx_rx
14028c2ecf20Sopenharmony_ci *	7-4:	led_100BaseTX
14038c2ecf20Sopenharmony_ci *	3-0:	led_1000BaseT
14048c2ecf20Sopenharmony_ci */
14058c2ecf20Sopenharmony_ci#define ET_LED2_LED_LINK	0xF000
14068c2ecf20Sopenharmony_ci#define ET_LED2_LED_TXRX	0x0F00
14078c2ecf20Sopenharmony_ci#define ET_LED2_LED_100TX	0x00F0
14088c2ecf20Sopenharmony_ci#define ET_LED2_LED_1000T	0x000F
14098c2ecf20Sopenharmony_ci
14108c2ecf20Sopenharmony_ci/* defines for LED control reg 2 values */
14118c2ecf20Sopenharmony_ci#define LED_VAL_1000BT			0x0
14128c2ecf20Sopenharmony_ci#define LED_VAL_100BTX			0x1
14138c2ecf20Sopenharmony_ci#define LED_VAL_10BT			0x2
14148c2ecf20Sopenharmony_ci#define LED_VAL_1000BT_100BTX		0x3 /* 1000BT on, 100BTX blink */
14158c2ecf20Sopenharmony_ci#define LED_VAL_LINKON			0x4
14168c2ecf20Sopenharmony_ci#define LED_VAL_TX			0x5
14178c2ecf20Sopenharmony_ci#define LED_VAL_RX			0x6
14188c2ecf20Sopenharmony_ci#define LED_VAL_TXRX			0x7 /* TX or RX */
14198c2ecf20Sopenharmony_ci#define LED_VAL_DUPLEXFULL		0x8
14208c2ecf20Sopenharmony_ci#define LED_VAL_COLLISION		0x9
14218c2ecf20Sopenharmony_ci#define LED_VAL_LINKON_ACTIVE		0xA /* Link on, activity blink */
14228c2ecf20Sopenharmony_ci#define LED_VAL_LINKON_RECV		0xB /* Link on, receive blink */
14238c2ecf20Sopenharmony_ci#define LED_VAL_DUPLEXFULL_COLLISION	0xC /* Duplex on, collision blink */
14248c2ecf20Sopenharmony_ci#define LED_VAL_BLINK			0xD
14258c2ecf20Sopenharmony_ci#define LED_VAL_ON			0xE
14268c2ecf20Sopenharmony_ci#define LED_VAL_OFF			0xF
14278c2ecf20Sopenharmony_ci
14288c2ecf20Sopenharmony_ci#define LED_LINK_SHIFT			12
14298c2ecf20Sopenharmony_ci#define LED_TXRX_SHIFT			8
14308c2ecf20Sopenharmony_ci#define LED_100TX_SHIFT			4
14318c2ecf20Sopenharmony_ci
14328c2ecf20Sopenharmony_ci/* MI Register 29 - 31: Reserved Reg(0x1D - 0x1E) */
1433