1*dcec61dcSmiod /* $OpenBSD: if_urereg.h,v 1.13 2023/08/15 08:27:30 miod Exp $ */ 242c54c93Sjmatthew /*- 355929a15Skevlo * Copyright (c) 2015, 2016, 2019 Kevin Lo <kevlo@openbsd.org> 442c54c93Sjmatthew * All rights reserved. 542c54c93Sjmatthew * 642c54c93Sjmatthew * Redistribution and use in source and binary forms, with or without 742c54c93Sjmatthew * modification, are permitted provided that the following conditions 842c54c93Sjmatthew * are met: 942c54c93Sjmatthew * 1. Redistributions of source code must retain the above copyright 1042c54c93Sjmatthew * notice, this list of conditions and the following disclaimer. 1142c54c93Sjmatthew * 2. Redistributions in binary form must reproduce the above copyright 1242c54c93Sjmatthew * notice, this list of conditions and the following disclaimer in the 1342c54c93Sjmatthew * documentation and/or other materials provided with the distribution. 1442c54c93Sjmatthew * 1542c54c93Sjmatthew * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1642c54c93Sjmatthew * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1742c54c93Sjmatthew * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1842c54c93Sjmatthew * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1942c54c93Sjmatthew * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2042c54c93Sjmatthew * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2142c54c93Sjmatthew * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2242c54c93Sjmatthew * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2342c54c93Sjmatthew * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2442c54c93Sjmatthew * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2542c54c93Sjmatthew * SUCH DAMAGE. 2642c54c93Sjmatthew * 2742c54c93Sjmatthew * $FreeBSD$ 2842c54c93Sjmatthew */ 2942c54c93Sjmatthew 3042c54c93Sjmatthew #define URE_CONFIG_IDX 0 /* config number 1 */ 3142c54c93Sjmatthew #define URE_IFACE_IDX 0 3242c54c93Sjmatthew 3342c54c93Sjmatthew #define URE_CTL_READ 0x01 3442c54c93Sjmatthew #define URE_CTL_WRITE 0x02 3542c54c93Sjmatthew 3642c54c93Sjmatthew #define URE_TIMEOUT 1000 3742c54c93Sjmatthew #define URE_PHY_TIMEOUT 2000 3842c54c93Sjmatthew 3942c54c93Sjmatthew #define URE_BYTE_EN_DWORD 0xff 4042c54c93Sjmatthew #define URE_BYTE_EN_WORD 0x33 4142c54c93Sjmatthew #define URE_BYTE_EN_BYTE 0x11 4242c54c93Sjmatthew #define URE_BYTE_EN_SIX_BYTES 0x3f 4342c54c93Sjmatthew 4455929a15Skevlo #define URE_FRAMELEN(mtu) \ 4555929a15Skevlo (mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN) 4655929a15Skevlo #define URE_JUMBO_FRAMELEN (9 * 1024) 4755929a15Skevlo #define URE_JUMBO_MTU \ 4855929a15Skevlo (URE_JUMBO_FRAMELEN - ETHER_HDR_LEN - ETHER_CRC_LEN - \ 4955929a15Skevlo ETHER_VLAN_ENCAP_LEN) 5042c54c93Sjmatthew 5142c54c93Sjmatthew #define URE_PLA_IDR 0xc000 5242c54c93Sjmatthew #define URE_PLA_RCR 0xc010 538a3a1b1fSkevlo #define URE_PLA_RCR1 0xc012 5442c54c93Sjmatthew #define URE_PLA_RMS 0xc016 5542c54c93Sjmatthew #define URE_PLA_RXFIFO_CTRL0 0xc0a0 568a3a1b1fSkevlo #define URE_PLA_RXFIFO_FULL 0xc0a2 5742c54c93Sjmatthew #define URE_PLA_RXFIFO_CTRL1 0xc0a4 588a3a1b1fSkevlo #define URE_PLA_RX_FIFO_FULL 0xc0a6 5942c54c93Sjmatthew #define URE_PLA_RXFIFO_CTRL2 0xc0a8 608a3a1b1fSkevlo #define URE_PLA_RX_FIFO_EMPTY 0xc0aa 6142c54c93Sjmatthew #define URE_PLA_DMY_REG0 0xc0b0 6242c54c93Sjmatthew #define URE_PLA_FMC 0xc0b4 6342c54c93Sjmatthew #define URE_PLA_CFG_WOL 0xc0b6 6442c54c93Sjmatthew #define URE_PLA_TEREDO_CFG 0xc0bc 6555929a15Skevlo #define URE_PLA_MAR 0xcd00 6642c54c93Sjmatthew #define URE_PLA_BACKUP 0xd000 6742c54c93Sjmatthew #define URE_PLA_BDC_CR 0xd1a0 6842c54c93Sjmatthew #define URE_PLA_TEREDO_TIMER 0xd2cc 6942c54c93Sjmatthew #define URE_PLA_REALWOW_TIMER 0xd2e8 7055929a15Skevlo #define URE_PLA_SUSPEND_FLAG 0xd38a 7155929a15Skevlo #define URE_PLA_INDICATE_FALG 0xd38c 7255929a15Skevlo #define URE_PLA_EXTRA_STATUS 0xd398 738a3a1b1fSkevlo #define URE_PLA_GPHY_CTRL 0xd3ae 748a3a1b1fSkevlo #define URE_PLA_POL_GPIO_CTRL 0xdc6a 7542c54c93Sjmatthew #define URE_PLA_LEDSEL 0xdd90 7642c54c93Sjmatthew #define URE_PLA_LED_FEATURE 0xdd92 7742c54c93Sjmatthew #define URE_PLA_PHYAR 0xde00 7842c54c93Sjmatthew #define URE_PLA_BOOT_CTRL 0xe004 798a3a1b1fSkevlo #define URE_PLA_LWAKE_CTRL_REG 0xe007 8042c54c93Sjmatthew #define URE_PLA_GPHY_INTR_IMR 0xe022 8142c54c93Sjmatthew #define URE_PLA_EEE_CR 0xe040 8242c54c93Sjmatthew #define URE_PLA_EEEP_CR 0xe080 8342c54c93Sjmatthew #define URE_PLA_MAC_PWR_CTRL 0xe0c0 8442c54c93Sjmatthew #define URE_PLA_MAC_PWR_CTRL2 0xe0ca 8542c54c93Sjmatthew #define URE_PLA_MAC_PWR_CTRL3 0xe0cc 8642c54c93Sjmatthew #define URE_PLA_MAC_PWR_CTRL4 0xe0ce 8742c54c93Sjmatthew #define URE_PLA_WDT6_CTRL 0xe428 8842c54c93Sjmatthew #define URE_PLA_TCR0 0xe610 8942c54c93Sjmatthew #define URE_PLA_TCR1 0xe612 9042c54c93Sjmatthew #define URE_PLA_MTPS 0xe615 9142c54c93Sjmatthew #define URE_PLA_TXFIFO_CTRL 0xe618 928a3a1b1fSkevlo #define URE_PLA_TXFIFO_FULL 0xe61a 9355929a15Skevlo #define URE_PLA_RSTTALLY 0xe800 9442c54c93Sjmatthew #define URE_PLA_CR 0xe813 9542c54c93Sjmatthew #define URE_PLA_CRWECR 0xe81c 9655929a15Skevlo #define URE_PLA_CONFIG34 0xe820 9742c54c93Sjmatthew #define URE_PLA_CONFIG5 0xe822 9842c54c93Sjmatthew #define URE_PLA_PHY_PWR 0xe84c 9942c54c93Sjmatthew #define URE_PLA_OOB_CTRL 0xe84f 10042c54c93Sjmatthew #define URE_PLA_CPCR 0xe854 10142c54c93Sjmatthew #define URE_PLA_MISC_0 0xe858 10242c54c93Sjmatthew #define URE_PLA_MISC_1 0xe85a 10342c54c93Sjmatthew #define URE_PLA_OCP_GPHY_BASE 0xe86c 10442c54c93Sjmatthew #define URE_PLA_TELLYCNT 0xe890 10542c54c93Sjmatthew #define URE_PLA_SFF_STS_7 0xe8de 10642c54c93Sjmatthew #define URE_PLA_PHYSTATUS 0xe908 1078a3a1b1fSkevlo #define URE_PLA_CONFIG6 0xe90a 1088a3a1b1fSkevlo #define URE_PLA_USB_CFG 0xe952 10942c54c93Sjmatthew 11042c54c93Sjmatthew #define URE_USB_USB2PHY 0xb41e 1118a3a1b1fSkevlo #define URE_USB_SSPHYLINK1 0xb426 11242c54c93Sjmatthew #define URE_USB_SSPHYLINK2 0xb428 11342c54c93Sjmatthew #define URE_USB_U2P3_CTRL 0xb460 11442c54c93Sjmatthew #define URE_USB_CSR_DUMMY1 0xb464 11542c54c93Sjmatthew #define URE_USB_CSR_DUMMY2 0xb466 11642c54c93Sjmatthew #define URE_USB_DEV_STAT 0xb808 11742c54c93Sjmatthew #define URE_USB_CONNECT_TIMER 0xcbf8 11855929a15Skevlo #define URE_USB_MSC_TIMER 0xcbfc 11942c54c93Sjmatthew #define URE_USB_BURST_SIZE 0xcfc0 12055929a15Skevlo #define URE_USB_LPM_CONFIG 0xcfd8 1218a3a1b1fSkevlo #define URE_USB_ECM_OPTION 0xcfee 1228a3a1b1fSkevlo #define URE_USB_MISC_2 0xcfff 1238a3a1b1fSkevlo #define URE_USB_ECM_OP 0xd26b 1248a3a1b1fSkevlo #define URE_USB_GPHY_CTRL 0xd284 1258a3a1b1fSkevlo #define URE_USB_SPEED_OPTION 0xd32a 1268a3a1b1fSkevlo #define URE_USB_FW_CTRL 0xd334 1278a3a1b1fSkevlo #define URE_USB_FC_TIMER 0xd340 12842c54c93Sjmatthew #define URE_USB_USB_CTRL 0xd406 12942c54c93Sjmatthew #define URE_USB_PHY_CTRL 0xd408 13042c54c93Sjmatthew #define URE_USB_TX_AGG 0xd40a 13142c54c93Sjmatthew #define URE_USB_RX_BUF_TH 0xd40c 13255929a15Skevlo #define URE_USB_LPM_CTRL 0xd41a 13342c54c93Sjmatthew #define URE_USB_USB_TIMER 0xd428 13442c54c93Sjmatthew #define URE_USB_RX_EARLY_AGG 0xd42c 13555929a15Skevlo #define URE_USB_RX_EARLY_SIZE 0xd42e 13642c54c93Sjmatthew #define URE_USB_PM_CTRL_STATUS 0xd432 13742c54c93Sjmatthew #define URE_USB_TX_DMA 0xd434 13855929a15Skevlo #define URE_USB_UPT_RXDMA_OWN 0xd437 13942c54c93Sjmatthew #define URE_USB_TOLERANCE 0xd490 14055929a15Skevlo #define URE_USB_BMU_RESET 0xd4b0 1418a3a1b1fSkevlo #define URE_USB_BMU_CONFIG 0xd4b4 14255929a15Skevlo #define URE_USB_U1U2_TIMER 0xd4da 1438a3a1b1fSkevlo #define URE_USB_FW_TASK 0xd4e8 1448a3a1b1fSkevlo #define URE_USB_RX_AGGR_NUM 0xd4ee 14542c54c93Sjmatthew #define URE_USB_UPS_CTRL 0xd800 14655929a15Skevlo #define URE_USB_POWER_CUT 0xd80a 14742c54c93Sjmatthew #define URE_USB_MISC_0 0xd81a 14842c54c93Sjmatthew #define URE_USB_POWER_CUT 0xd80a 14942c54c93Sjmatthew #define URE_USB_AFE_CTRL2 0xd824 15055929a15Skevlo #define URE_USB_UPS_FLAGS 0xd848 15142c54c93Sjmatthew #define URE_USB_WDT11_CTRL 0xe43c 15242c54c93Sjmatthew 15342c54c93Sjmatthew /* OCP Registers. */ 15442c54c93Sjmatthew #define URE_OCP_ALDPS_CONFIG 0x2010 15542c54c93Sjmatthew #define URE_OCP_EEE_CONFIG1 0x2080 15642c54c93Sjmatthew #define URE_OCP_EEE_CONFIG2 0x2092 15742c54c93Sjmatthew #define URE_OCP_EEE_CONFIG3 0x2094 15842c54c93Sjmatthew #define URE_OCP_BASE_MII 0xa400 15942c54c93Sjmatthew #define URE_OCP_EEE_AR 0xa41a 16042c54c93Sjmatthew #define URE_OCP_EEE_DATA 0xa41c 16142c54c93Sjmatthew #define URE_OCP_PHY_STATUS 0xa420 16242c54c93Sjmatthew #define URE_OCP_POWER_CFG 0xa430 16342c54c93Sjmatthew #define URE_OCP_EEE_CFG 0xa432 16442c54c93Sjmatthew #define URE_OCP_SRAM_ADDR 0xa436 16542c54c93Sjmatthew #define URE_OCP_SRAM_DATA 0xa438 16642c54c93Sjmatthew #define URE_OCP_DOWN_SPEED 0xa442 16742c54c93Sjmatthew #define URE_OCP_EEE_ABLE 0xa5c4 16842c54c93Sjmatthew #define URE_OCP_EEE_ADV 0xa5d0 16942c54c93Sjmatthew #define URE_OCP_EEE_LPABLE 0xa5d2 1703dd6ed5fSkevlo #define URE_OCP_10GBT_CTRL 0xa5d4 17142c54c93Sjmatthew #define URE_OCP_PHY_STATE 0xa708 17242c54c93Sjmatthew #define URE_OCP_ADC_CFG 0xbc06 17342c54c93Sjmatthew 17442c54c93Sjmatthew /* SRAM Register. */ 17542c54c93Sjmatthew #define URE_SRAM_LPF_CFG 0x8012 17642c54c93Sjmatthew #define URE_SRAM_10M_AMP1 0x8080 17742c54c93Sjmatthew #define URE_SRAM_10M_AMP2 0x8082 17842c54c93Sjmatthew #define URE_SRAM_IMPEDANCE 0x8084 17942c54c93Sjmatthew 18055929a15Skevlo /* URE_PLA_RCR */ 18142c54c93Sjmatthew #define URE_RCR_AAP 0x00000001 18242c54c93Sjmatthew #define URE_RCR_APM 0x00000002 18342c54c93Sjmatthew #define URE_RCR_AM 0x00000004 18442c54c93Sjmatthew #define URE_RCR_AB 0x00000008 18542c54c93Sjmatthew #define URE_RCR_ACPT_ALL \ 18642c54c93Sjmatthew (URE_RCR_AAP | URE_RCR_APM | URE_RCR_AM | URE_RCR_AB) 1878a3a1b1fSkevlo #define URE_SLOT_EN 0x00000800 1888a3a1b1fSkevlo 1898a3a1b1fSkevlo /* URE_PLA_RCR1 */ 1908a3a1b1fSkevlo #define URE_INNER_VLAN 0x0040 1918a3a1b1fSkevlo #define URE_OUTER_VLAN 0x0080 19242c54c93Sjmatthew 19355929a15Skevlo /* URE_PLA_RXFIFO_CTRL0 */ 19442c54c93Sjmatthew #define URE_RXFIFO_THR1_NORMAL 0x00080002 19542c54c93Sjmatthew #define URE_RXFIFO_THR1_OOB 0x01800003 19642c54c93Sjmatthew 1978a3a1b1fSkevlo /* URE_PLA_RXFIFO_FULL */ 1988a3a1b1fSkevlo #define URE_RXFIFO_FULL_MASK 0x0fff 1998a3a1b1fSkevlo 20055929a15Skevlo /* URE_PLA_RXFIFO_CTRL1 */ 20142c54c93Sjmatthew #define URE_RXFIFO_THR2_FULL 0x00000060 20242c54c93Sjmatthew #define URE_RXFIFO_THR2_HIGH 0x00000038 20342c54c93Sjmatthew #define URE_RXFIFO_THR2_OOB 0x0000004a 20442c54c93Sjmatthew #define URE_RXFIFO_THR2_NORMAL 0x00a0 20542c54c93Sjmatthew 20655929a15Skevlo /* URE_PLA_RXFIFO_CTRL2 */ 20742c54c93Sjmatthew #define URE_RXFIFO_THR3_FULL 0x00000078 20842c54c93Sjmatthew #define URE_RXFIFO_THR3_HIGH 0x00000048 20942c54c93Sjmatthew #define URE_RXFIFO_THR3_OOB 0x0000005a 21042c54c93Sjmatthew #define URE_RXFIFO_THR3_NORMAL 0x0110 21142c54c93Sjmatthew 21255929a15Skevlo /* URE_PLA_TXFIFO_CTRL */ 21342c54c93Sjmatthew #define URE_TXFIFO_THR_NORMAL 0x00400008 21442c54c93Sjmatthew #define URE_TXFIFO_THR_NORMAL2 0x01000008 21542c54c93Sjmatthew 21655929a15Skevlo /* URE_PLA_DMY_REG0 */ 21742c54c93Sjmatthew #define URE_ECM_ALDPS 0x0002 21842c54c93Sjmatthew 21955929a15Skevlo /* URE_PLA_FMC */ 22042c54c93Sjmatthew #define URE_FMC_FCR_MCU_EN 0x0001 22142c54c93Sjmatthew 22255929a15Skevlo /* URE_PLA_EEEP_CR */ 22342c54c93Sjmatthew #define URE_EEEP_CR_EEEP_TX 0x0002 22442c54c93Sjmatthew 22555929a15Skevlo /* URE_PLA_WDT6_CTRL */ 226e19a17f1Skevlo #define URE_WDT6_SET_MODE 0x0010 22742c54c93Sjmatthew 22855929a15Skevlo /* URE_PLA_TCR0 */ 22942c54c93Sjmatthew #define URE_TCR0_AUTO_FIFO 0x0080 23055929a15Skevlo #define URE_TCR0_TX_EMPTY 0x0800 23142c54c93Sjmatthew 23255929a15Skevlo /* URE_PLA_TCR1 */ 23342c54c93Sjmatthew #define URE_VERSION_MASK 0x7cf0 23442c54c93Sjmatthew 23555929a15Skevlo /* URE_PLA_MTPS */ 23655929a15Skevlo #define MTPS_DEFAULT 96 23755929a15Skevlo #define MTPS_JUMBO 192 23855929a15Skevlo 23955929a15Skevlo /* URE_PLA_RSTTALLY */ 24055929a15Skevlo #define URE_TALLY_RESET 0x0001 24155929a15Skevlo 24255929a15Skevlo /* URE_PLA_CR */ 24342c54c93Sjmatthew #define URE_CR_RST 0x10 24442c54c93Sjmatthew #define URE_CR_RE 0x08 24542c54c93Sjmatthew #define URE_CR_TE 0x04 24642c54c93Sjmatthew 24755929a15Skevlo /* URE_PLA_CRWECR */ 24842c54c93Sjmatthew #define URE_CRWECR_NORAML 0x00 24942c54c93Sjmatthew #define URE_CRWECR_CONFIG 0xc0 25042c54c93Sjmatthew 25155929a15Skevlo /* URE_PLA_OOB_CTRL */ 25242c54c93Sjmatthew #define URE_DIS_MCU_CLROOB 0x01 25355929a15Skevlo #define URE_LINK_LIST_READY 0x02 25455929a15Skevlo #define URE_RXFIFO_EMPTY 0x10 25555929a15Skevlo #define URE_TXFIFO_EMPTY 0x20 25655929a15Skevlo #define URE_NOW_IS_OOB 0x80 25742c54c93Sjmatthew #define URE_FIFO_EMPTY (URE_TXFIFO_EMPTY | URE_RXFIFO_EMPTY) 25842c54c93Sjmatthew 25955929a15Skevlo /* URE_PLA_MISC_1 */ 26042c54c93Sjmatthew #define URE_RXDY_GATED_EN 0x0008 26142c54c93Sjmatthew 26255929a15Skevlo /* URE_PLA_SFF_STS_7 */ 26342c54c93Sjmatthew #define URE_MCU_BORW_EN 0x4000 26455929a15Skevlo #define URE_RE_INIT_LL 0x8000 26542c54c93Sjmatthew 26655929a15Skevlo /* URE_PLA_CPCR */ 2678a3a1b1fSkevlo #define URE_FLOW_CTRL_EN 0x0001 26842c54c93Sjmatthew #define URE_CPCR_RX_VLAN 0x0040 26942c54c93Sjmatthew 27055929a15Skevlo /* URE_PLA_TEREDO_CFG */ 27142c54c93Sjmatthew #define URE_TEREDO_SEL 0x8000 27242c54c93Sjmatthew #define URE_TEREDO_WAKE_MASK 0x7f00 27342c54c93Sjmatthew #define URE_TEREDO_RS_EVENT_MASK 0x00fe 27442c54c93Sjmatthew #define URE_OOB_TEREDO_EN 0x0001 27542c54c93Sjmatthew 27655929a15Skevlo /* URE_PLA_BDC_CR */ 27742c54c93Sjmatthew #define URE_ALDPS_PROXY_MODE 0x0001 27842c54c93Sjmatthew 27955929a15Skevlo /* URE_PLA_CONFIG34 */ 28055929a15Skevlo #define URE_LINK_OFF_WAKE_EN 0x0008 28155929a15Skevlo #define URE_LINK_ON_WAKE_EN 0x0010 28255929a15Skevlo 28355929a15Skevlo /* URE_PLA_CONFIG5 */ 28442c54c93Sjmatthew #define URE_LAN_WAKE_EN 0x0002 28542c54c93Sjmatthew 28655929a15Skevlo /* URE_PLA_LED_FEATURE */ 28742c54c93Sjmatthew #define URE_LED_MODE_MASK 0x0700 28842c54c93Sjmatthew 28955929a15Skevlo /* URE_PLA_PHY_PWR */ 29042c54c93Sjmatthew #define URE_TX_10M_IDLE_EN 0x0080 29142c54c93Sjmatthew #define URE_PFM_PWM_SWITCH 0x0040 29242c54c93Sjmatthew 29355929a15Skevlo /* URE_PLA_MAC_PWR_CTRL */ 29442c54c93Sjmatthew #define URE_D3_CLK_GATED_EN 0x00004000 29542c54c93Sjmatthew #define URE_MCU_CLK_RATIO 0x07010f07 29642c54c93Sjmatthew #define URE_MCU_CLK_RATIO_MASK 0x0f0f0f0f 29742c54c93Sjmatthew #define URE_ALDPS_SPDWN_RATIO 0x0f87 29842c54c93Sjmatthew 29955929a15Skevlo /* URE_PLA_MAC_PWR_CTRL2 */ 30055929a15Skevlo #define URE_MAC_CLK_SPDWN_EN 0x8000 30142c54c93Sjmatthew #define URE_EEE_SPDWN_RATIO 0x8007 3028a3a1b1fSkevlo #define URE_EEE_SPDWN_RATIO_MASK 0x00ff 30342c54c93Sjmatthew 30455929a15Skevlo /* URE_PLA_MAC_PWR_CTRL3 */ 30542c54c93Sjmatthew #define URE_L1_SPDWN_EN 0x0001 30655929a15Skevlo #define URE_U1U2_SPDWN_EN 0x0002 30755929a15Skevlo #define URE_SUSPEND_SPDWN_EN 0x0004 30855929a15Skevlo #define URE_PKT_AVAIL_SPDWN_EN 0x0100 3098a3a1b1fSkevlo #define URE_PLA_MCU_SPDWN_EN 0x4000 31042c54c93Sjmatthew 31155929a15Skevlo /* URE_PLA_MAC_PWR_CTRL4 */ 31242c54c93Sjmatthew #define URE_EEE_SPDWN_EN 0x0001 31355929a15Skevlo #define URE_TP1000_SPDWN_EN 0x0008 31455929a15Skevlo #define URE_TP500_SPDWN_EN 0x0010 31555929a15Skevlo #define URE_TP100_SPDWN_EN 0x0020 3163dd6ed5fSkevlo #define URE_IDLE_SPDWN_EN 0x0040 31755929a15Skevlo #define URE_TX10MIDLE_EN 0x0100 31855929a15Skevlo #define URE_RXDV_SPDWN_EN 0x0800 31955929a15Skevlo #define URE_PWRSAVE_SPDWN_EN 0x1000 32042c54c93Sjmatthew 32155929a15Skevlo /* URE_PLA_GPHY_INTR_IMR */ 32242c54c93Sjmatthew #define URE_GPHY_STS_MSK 0x0001 32342c54c93Sjmatthew #define URE_SPEED_DOWN_MSK 0x0002 32442c54c93Sjmatthew #define URE_SPDWN_RXDV_MSK 0x0004 32542c54c93Sjmatthew #define URE_SPDWN_LINKCHG_MSK 0x0008 32642c54c93Sjmatthew 32755929a15Skevlo /* URE_PLA_PHYAR */ 32842c54c93Sjmatthew #define URE_PHYAR_PHYDATA 0x0000ffff 32942c54c93Sjmatthew #define URE_PHYAR_BUSY 0x80000000 33042c54c93Sjmatthew 33155929a15Skevlo /* URE_PLA_EEE_CR */ 33242c54c93Sjmatthew #define URE_EEE_RX_EN 0x0001 33342c54c93Sjmatthew #define URE_EEE_TX_EN 0x0002 33442c54c93Sjmatthew 33555929a15Skevlo /* URE_PLA_BOOT_CTRL */ 33642c54c93Sjmatthew #define URE_AUTOLOAD_DONE 0x0002 33742c54c93Sjmatthew 3388a3a1b1fSkevlo /* URE_PLA_LWAKE_CTRL_REG */ 3398a3a1b1fSkevlo #define URE_LANWAKE_PIN 0x80 3408a3a1b1fSkevlo 34155929a15Skevlo /* URE_PLA_SUSPEND_FLAG */ 34255929a15Skevlo #define URE_LINK_CHG_EVENT 0x01 34355929a15Skevlo 34455929a15Skevlo /* URE_PLA_INDICATE_FALG */ 34555929a15Skevlo #define URE_UPCOMING_RUNTIME_D3 0x01 34655929a15Skevlo 34755929a15Skevlo /* URE_PLA_EXTRA_STATUS */ 3488a3a1b1fSkevlo #define URE_POLL_LINK_CHG 0x0001 34955929a15Skevlo #define URE_LINK_CHANGE_FLAG 0x0100 3508a3a1b1fSkevlo #define URE_CUR_LINK_OK 0x8000 3518a3a1b1fSkevlo 3528a3a1b1fSkevlo /* URE_PLA_GPHY_CTRL */ 3538a3a1b1fSkevlo #define URE_GPHY_FLASH 0x0002 3548a3a1b1fSkevlo 3558a3a1b1fSkevlo /* URE_PLA_POL_GPIO_CTRL */ 3568a3a1b1fSkevlo #define URE_DACK_DET_EN 0x8000 35755929a15Skevlo 358c096a1a3Skevlo /* URE_PLA_PHYSTATUS */ 359c096a1a3Skevlo #define URE_PHYSTATUS_FDX 0x0001 360c096a1a3Skevlo #define URE_PHYSTATUS_LINK 0x0002 361c096a1a3Skevlo #define URE_PHYSTATUS_10MBPS 0x0004 362c096a1a3Skevlo #define URE_PHYSTATUS_100MBPS 0x0008 363c096a1a3Skevlo #define URE_PHYSTATUS_1000MBPS 0x0010 364c096a1a3Skevlo #define URE_PHYSTATUS_2500MBPS 0x0400 365c096a1a3Skevlo 3668a3a1b1fSkevlo /* URE_PLA_CONFIG6 */ 3678a3a1b1fSkevlo #define URE_LANWAKE_CLR_EN 0x01 3688a3a1b1fSkevlo 36955929a15Skevlo /* URE_USB_USB2PHY */ 37042c54c93Sjmatthew #define URE_USB2PHY_SUSPEND 0x0001 37142c54c93Sjmatthew #define URE_USB2PHY_L1 0x0002 37242c54c93Sjmatthew 3738a3a1b1fSkevlo /* URE_USB_SSPHYLINK1 */ 3748a3a1b1fSkevlo #define URE_DELAY_PHY_PWR_CHG 0x0002 3758a3a1b1fSkevlo 37655929a15Skevlo /* URE_USB_SSPHYLINK2 */ 37742c54c93Sjmatthew #define URE_PWD_DN_SCALE_MASK 0x3ffe 37842c54c93Sjmatthew #define URE_PWD_DN_SCALE(x) ((x) << 1) 37942c54c93Sjmatthew 38055929a15Skevlo /* URE_USB_CSR_DUMMY1 */ 38142c54c93Sjmatthew #define URE_DYNAMIC_BURST 0x0001 38242c54c93Sjmatthew 38355929a15Skevlo /* URE_USB_CSR_DUMMY2 */ 38442c54c93Sjmatthew #define URE_EP4_FULL_FC 0x0001 38542c54c93Sjmatthew 38655929a15Skevlo /* URE_USB_DEV_STAT */ 38742c54c93Sjmatthew #define URE_STAT_SPEED_HIGH 0x0000 38842c54c93Sjmatthew #define URE_STAT_SPEED_FULL 0x0001 38955929a15Skevlo #define URE_STAT_SPEED_MASK 0x0006 39042c54c93Sjmatthew 39155929a15Skevlo /* URE_USB_LPM_CONFIG */ 39255929a15Skevlo #define LPM_U1U2_EN 0x0001 39355929a15Skevlo 3948a3a1b1fSkevlo /* URE_USB_MISC_2 */ 3958a3a1b1fSkevlo #define URE_UPS_FORCE_PWR_DOWN 0x01 3963dd6ed5fSkevlo #define URE_UPS_NO_UPS 0x80 3978a3a1b1fSkevlo 3988a3a1b1fSkevlo /* URE_USB_ECM_OPTION */ 3998a3a1b1fSkevlo #define URE_BYPASS_MAC_RESET 0x0020 4008a3a1b1fSkevlo 4018a3a1b1fSkevlo /* URE_USB_GPHY_CTRL */ 4028a3a1b1fSkevlo #define URE_GPHY_PATCH_DONE 0x0004 4038a3a1b1fSkevlo #define URE_BYPASS_FLASH 0x0020 4048a3a1b1fSkevlo 4058a3a1b1fSkevlo /* URE_USB_SPEED_OPTION */ 4068a3a1b1fSkevlo #define URE_RG_PWRDN_EN 0x0100 4078a3a1b1fSkevlo #define URE_ALL_SPEED_OFF 0x0200 4088a3a1b1fSkevlo 4098a3a1b1fSkevlo /* URE_USB_FW_CTRL */ 4108a3a1b1fSkevlo #define URE_FLOW_CTRL_PATCH_OPT 0x0002 4118a3a1b1fSkevlo #define URE_AUTO_SPEEDUP 0x0008 4128a3a1b1fSkevlo #define URE_FLOW_CTRL_PATCH_2 0x0100 4138a3a1b1fSkevlo 4148a3a1b1fSkevlo /* URE_URE_USB_FC_TIMER */ 4158a3a1b1fSkevlo #define URE_CTRL_TIMER_EN 0x8000 4168a3a1b1fSkevlo 4178a3a1b1fSkevlo /* URE_USB_USB_ECM_OP */ 4188a3a1b1fSkevlo #define URE_EN_ALL_SPEED 0x0001 4198a3a1b1fSkevlo 42055929a15Skevlo /* URE_USB_TX_AGG */ 42142c54c93Sjmatthew #define URE_TX_AGG_MAX_THRESHOLD 0x03 42242c54c93Sjmatthew 42355929a15Skevlo /* URE_USB_RX_BUF_TH */ 42442c54c93Sjmatthew #define URE_RX_THR_SUPER 0x0c350180 42542c54c93Sjmatthew #define URE_RX_THR_HIGH 0x7a120180 42642c54c93Sjmatthew #define URE_RX_THR_SLOW 0xffff0180 42755929a15Skevlo #define URE_RX_THR_B 0x00010001 42842c54c93Sjmatthew 42955929a15Skevlo /* URE_USB_TX_DMA */ 43042c54c93Sjmatthew #define URE_TEST_MODE_DISABLE 0x00000001 43142c54c93Sjmatthew #define URE_TX_SIZE_ADJUST1 0x00000100 43242c54c93Sjmatthew 43355929a15Skevlo /* URE_USB_UPT_RXDMA_OWN */ 43455929a15Skevlo #define URE_OWN_UPDATE 0x01 43555929a15Skevlo #define URE_OWN_CLEAR 0x02 43655929a15Skevlo 43755929a15Skevlo /* URE_USB_BMU_RESET */ 43855929a15Skevlo #define BMU_RESET_EP_IN 0x01 43955929a15Skevlo #define BMU_RESET_EP_OUT 0x02 44055929a15Skevlo 4418a3a1b1fSkevlo /* URE_USB_BMU_CONFIG */ 4428a3a1b1fSkevlo #define URE_ACT_ODMA 0x02 4438a3a1b1fSkevlo 4448a3a1b1fSkevlo /* URE_USB_FW_TASK */ 4458a3a1b1fSkevlo #define URE_FC_PATCH_TASK 0x0002 4468a3a1b1fSkevlo 4478a3a1b1fSkevlo /* URE_USB_RX_AGGR_NUM */ 4488a3a1b1fSkevlo #define URE_RX_AGGR_NUM_MASK 0x1ff 4498a3a1b1fSkevlo 45055929a15Skevlo /* URE_USB_UPS_CTRL */ 45142c54c93Sjmatthew #define URE_POWER_CUT 0x0100 45242c54c93Sjmatthew 45355929a15Skevlo /* URE_USB_PM_CTRL_STATUS */ 45442c54c93Sjmatthew #define URE_RESUME_INDICATE 0x0001 45542c54c93Sjmatthew 45655929a15Skevlo /* URE_USB_USB_CTRL */ 4578a3a1b1fSkevlo #define URE_CDC_ECM_EN 0x0008 45842c54c93Sjmatthew #define URE_RX_AGG_DISABLE 0x0010 45942c54c93Sjmatthew #define URE_RX_ZERO_EN 0x0080 46042c54c93Sjmatthew 46155929a15Skevlo /* URE_USB_U2P3_CTRL */ 46242c54c93Sjmatthew #define URE_U2P3_ENABLE 0x0001 4638a3a1b1fSkevlo #define URE_RX_DETECT8 0x0008 46442c54c93Sjmatthew 46555929a15Skevlo /* URE_USB_POWER_CUT */ 46642c54c93Sjmatthew #define URE_PWR_EN 0x0001 46742c54c93Sjmatthew #define URE_PHASE2_EN 0x0008 46855929a15Skevlo #define URE_UPS_EN 0x0010 46955929a15Skevlo #define URE_USP_PREWAKE 0x0020 47042c54c93Sjmatthew 47155929a15Skevlo /* URE_USB_MISC_0 */ 47242c54c93Sjmatthew #define URE_PCUT_STATUS 0x0001 47342c54c93Sjmatthew 47455929a15Skevlo /* URE_USB_RX_EARLY_AGG */ 47542c54c93Sjmatthew #define URE_COALESCE_SUPER 85000U 47642c54c93Sjmatthew #define URE_COALESCE_HIGH 250000U 47742c54c93Sjmatthew #define URE_COALESCE_SLOW 524280U 47842c54c93Sjmatthew 47955929a15Skevlo /* URE_USB_WDT11_CTRL */ 48042c54c93Sjmatthew #define URE_TIMER11_EN 0x0001 48142c54c93Sjmatthew 48255929a15Skevlo /* URE_USB_LPM_CTRL */ 48342c54c93Sjmatthew #define URE_FIFO_EMPTY_1FB 0x30 48442c54c93Sjmatthew #define URE_LPM_TIMER_MASK 0x0c 48542c54c93Sjmatthew #define URE_LPM_TIMER_500MS 0x04 48642c54c93Sjmatthew #define URE_LPM_TIMER_500US 0x0c 48742c54c93Sjmatthew #define URE_ROK_EXIT_LPM 0x02 48842c54c93Sjmatthew 48955929a15Skevlo /* URE_USB_AFE_CTRL2 */ 49042c54c93Sjmatthew #define URE_SEN_VAL_MASK 0xf800 49142c54c93Sjmatthew #define URE_SEN_VAL_NORMAL 0xa000 49242c54c93Sjmatthew #define URE_SEL_RXIDLE 0x0100 49342c54c93Sjmatthew 49455929a15Skevlo /* URE_USB_UPS_FLAGS */ 49555929a15Skevlo #define URE_UPS_FLAGS_EN_ALDPS 0x00000008 49655929a15Skevlo #define URE_UPS_FLAGS_MASK 0xffffffff 49755929a15Skevlo 49855929a15Skevlo /* URE_OCP_ALDPS_CONFIG */ 49942c54c93Sjmatthew #define URE_ENPWRSAVE 0x8000 50042c54c93Sjmatthew #define URE_ENPDNPS 0x0200 50142c54c93Sjmatthew #define URE_LINKENA 0x0100 50242c54c93Sjmatthew #define URE_DIS_SDSAVE 0x0010 50342c54c93Sjmatthew 50455929a15Skevlo /* URE_OCP_PHY_STATUS */ 50542c54c93Sjmatthew #define URE_PHY_STAT_MASK 0x0007 50655929a15Skevlo #define URE_PHY_STAT_EXT_INIT 2 50742c54c93Sjmatthew #define URE_PHY_STAT_LAN_ON 3 50842c54c93Sjmatthew #define URE_PHY_STAT_PWRDN 5 50942c54c93Sjmatthew 51055929a15Skevlo /* URE_OCP_POWER_CFG */ 51142c54c93Sjmatthew #define URE_EEE_CLKDIV_EN 0x8000 51242c54c93Sjmatthew #define URE_EN_ALDPS 0x0004 51342c54c93Sjmatthew #define URE_EN_10M_PLLOFF 0x0001 51442c54c93Sjmatthew 51555929a15Skevlo /* URE_OCP_EEE_CFG */ 51642c54c93Sjmatthew #define URE_CTAP_SHORT_EN 0x0040 51742c54c93Sjmatthew #define URE_EEE10_EN 0x0010 51842c54c93Sjmatthew 51955929a15Skevlo /* URE_OCP_DOWN_SPEED */ 52042c54c93Sjmatthew #define URE_EN_10M_BGOFF 0x0080 52142c54c93Sjmatthew 52255929a15Skevlo /* URE_OCP_PHY_STATE */ 52342c54c93Sjmatthew #define URE_TXDIS_STATE 0x01 52442c54c93Sjmatthew #define URE_ABD_STATE 0x02 52542c54c93Sjmatthew 52655929a15Skevlo /* URE_OCP_ADC_CFG */ 52742c54c93Sjmatthew #define URE_EN_EMI_L 0x0040 52855929a15Skevlo #define URE_ADC_EN 0x0080 52955929a15Skevlo #define URE_CKADSEL_L 0x0100 53042c54c93Sjmatthew 531c096a1a3Skevlo #define URE_ADV_2500TFDX 0x0080 532c096a1a3Skevlo 53342c54c93Sjmatthew #define URE_MCU_TYPE_PLA 0x0100 53442c54c93Sjmatthew #define URE_MCU_TYPE_USB 0x0000 53542c54c93Sjmatthew 53642c54c93Sjmatthew #define GET_MII(sc) uether_getmii(&(sc)->sc_ue) 53742c54c93Sjmatthew 53842c54c93Sjmatthew struct ure_intrpkt { 53942c54c93Sjmatthew uint8_t ure_tsr; 54042c54c93Sjmatthew uint8_t ure_rsr; 54142c54c93Sjmatthew uint8_t ure_gep_msr; 54242c54c93Sjmatthew uint8_t ure_waksr; 54342c54c93Sjmatthew uint8_t ure_txok_cnt; 54442c54c93Sjmatthew uint8_t ure_rxlost_cnt; 54542c54c93Sjmatthew uint8_t ure_crcerr_cnt; 54642c54c93Sjmatthew uint8_t ure_col_cnt; 54742c54c93Sjmatthew } __packed; 54842c54c93Sjmatthew 54942c54c93Sjmatthew struct ure_rxpkt { 55042c54c93Sjmatthew uint32_t ure_pktlen; 55142c54c93Sjmatthew #define URE_RXPKT_LEN_MASK 0x7fff 552c096a1a3Skevlo uint32_t ure_vlan; 553c096a1a3Skevlo #define URE_RXPKT_UDP (1 << 23) 554c096a1a3Skevlo #define URE_RXPKT_TCP (1 << 22) 555c096a1a3Skevlo #define URE_RXPKT_IPV6 (1 << 20) 556c096a1a3Skevlo #define URE_RXPKT_IPV4 (1 << 19) 557c096a1a3Skevlo #define URE_RXPKT_VLAN_TAG (1 << 16) 558c096a1a3Skevlo #define URE_RXPKT_VLAN_DATA 0xffff 559c096a1a3Skevlo uint32_t ure_csum; 560c096a1a3Skevlo #define URE_RXPKT_IPSUMBAD (1 << 23) 561c096a1a3Skevlo #define URE_RXPKT_UDPSUMBAD (1 << 22) 562c096a1a3Skevlo #define URE_RXPKT_TCPSUMBAD (1 << 21) 56342c54c93Sjmatthew uint32_t ure_rsvd2; 56442c54c93Sjmatthew uint32_t ure_rsvd3; 56542c54c93Sjmatthew uint32_t ure_rsvd4; 56642c54c93Sjmatthew } __packed; 56742c54c93Sjmatthew 56842c54c93Sjmatthew struct ure_txpkt { 56942c54c93Sjmatthew uint32_t ure_pktlen; 570*dcec61dcSmiod #define URE_TXPKT_TX_FS (1U << 31) 57142c54c93Sjmatthew #define URE_TXPKT_TX_LS (1 << 30) 57242c54c93Sjmatthew #define URE_TXPKT_LEN_MASK 0xffff 573c096a1a3Skevlo uint32_t ure_vlan; 574*dcec61dcSmiod #define URE_TXPKT_UDP (1U << 31) 575c096a1a3Skevlo #define URE_TXPKT_TCP (1 << 30) 576c096a1a3Skevlo #define URE_TXPKT_IPV4 (1 << 29) 577c096a1a3Skevlo #define URE_TXPKT_IPV6 (1 << 28) 578c096a1a3Skevlo #define URE_TXPKT_VLAN_TAG (1 << 16) 57942c54c93Sjmatthew } __packed; 58042c54c93Sjmatthew 58142c54c93Sjmatthew #define URE_ENDPT_RX 0 58242c54c93Sjmatthew #define URE_ENDPT_TX 1 58342c54c93Sjmatthew #define URE_ENDPT_MAX 2 58442c54c93Sjmatthew 585fd07ab7eSkevlo #define URE_TX_LIST_CNT 1 58642c54c93Sjmatthew #define URE_RX_LIST_CNT 1 587fd07ab7eSkevlo #define URE_TX_BUF_ALIGN 4 588fd07ab7eSkevlo #define URE_RX_BUF_ALIGN 8 58955929a15Skevlo 590fd07ab7eSkevlo #define URE_TX_BUFSZ 16384 591fd07ab7eSkevlo #define URE_8152_RX_BUFSZ 16384 592fd07ab7eSkevlo #define URE_8153_RX_BUFSZ 32768 59342c54c93Sjmatthew 59442c54c93Sjmatthew struct ure_chain { 59542c54c93Sjmatthew struct ure_softc *uc_sc; 59642c54c93Sjmatthew struct usbd_xfer *uc_xfer; 59742c54c93Sjmatthew char *uc_buf; 598fd07ab7eSkevlo uint32_t uc_cnt; 599fd07ab7eSkevlo uint32_t uc_buflen; 600fd07ab7eSkevlo uint32_t uc_bufmax; 601fd07ab7eSkevlo SLIST_ENTRY(ure_chain) uc_list; 602fd07ab7eSkevlo uint8_t uc_idx; 60342c54c93Sjmatthew }; 60442c54c93Sjmatthew 60542c54c93Sjmatthew struct ure_cdata { 606fd07ab7eSkevlo struct ure_chain ure_rx_chain[URE_RX_LIST_CNT]; 607fd07ab7eSkevlo struct ure_chain ure_tx_chain[URE_TX_LIST_CNT]; 608fd07ab7eSkevlo SLIST_HEAD(ure_list_head, ure_chain) ure_tx_free; 60942c54c93Sjmatthew }; 61042c54c93Sjmatthew 61142c54c93Sjmatthew struct ure_softc { 61242c54c93Sjmatthew struct device ure_dev; 61342c54c93Sjmatthew struct usbd_device *ure_udev; 61442c54c93Sjmatthew 61542c54c93Sjmatthew /* usb */ 61642c54c93Sjmatthew struct usbd_interface *ure_iface; 61742c54c93Sjmatthew struct usb_task ure_tick_task; 61842c54c93Sjmatthew int ure_ed[URE_ENDPT_MAX]; 61942c54c93Sjmatthew struct usbd_pipe *ure_ep[URE_ENDPT_MAX]; 62042c54c93Sjmatthew 62142c54c93Sjmatthew /* ethernet */ 62242c54c93Sjmatthew struct arpcom ure_ac; 62342c54c93Sjmatthew struct mii_data ure_mii; 624c096a1a3Skevlo struct ifmedia ure_ifmedia; 62542c54c93Sjmatthew struct rwlock ure_mii_lock; 62642c54c93Sjmatthew int ure_refcnt; 62742c54c93Sjmatthew 62842c54c93Sjmatthew struct ure_cdata ure_cdata; 62942c54c93Sjmatthew struct timeout ure_stat_ch; 63042c54c93Sjmatthew 63142c54c93Sjmatthew struct timeval ure_rx_notice; 632c096a1a3Skevlo int ure_rxbufsz; 633fd07ab7eSkevlo int ure_txbufsz; 63442c54c93Sjmatthew 63542c54c93Sjmatthew int ure_phyno; 63642c54c93Sjmatthew 63742c54c93Sjmatthew u_int ure_flags; 63842c54c93Sjmatthew #define URE_FLAG_LINK 0x0001 639794a317fSkettenis #define URE_FLAG_8152 0x1000 /* RTL8152 */ 64055929a15Skevlo #define URE_FLAG_8153B 0x2000 /* RTL8153B */ 641c096a1a3Skevlo #define URE_FLAG_8156 0x4000 /* RTL8156 */ 6428a3a1b1fSkevlo #define URE_FLAG_8156B 0x8000 /* RTL8156B */ 64342c54c93Sjmatthew 64442c54c93Sjmatthew u_int ure_chip; 64542c54c93Sjmatthew #define URE_CHIP_VER_4C00 0x01 64642c54c93Sjmatthew #define URE_CHIP_VER_4C10 0x02 647794a317fSkettenis #define URE_CHIP_VER_5C00 0x04 648794a317fSkettenis #define URE_CHIP_VER_5C10 0x08 649794a317fSkettenis #define URE_CHIP_VER_5C20 0x10 650794a317fSkettenis #define URE_CHIP_VER_5C30 0x20 6518a3a1b1fSkevlo #define URE_CHIP_VER_6010 0x40 6523dd6ed5fSkevlo #define URE_CHIP_VER_7420 0x80 65342c54c93Sjmatthew }; 654