if_dwc: Add flow control support
This commit is contained in:
parent
354cb625ee
commit
2b4a66ed17
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367887
@ -224,6 +224,10 @@ static void dwc_stop_dma(struct dwc_softc *sc);
|
||||
|
||||
static void dwc_tick(void *arg);
|
||||
|
||||
/* Pause time field in the transmitted control frame */
|
||||
static int dwc_pause_time = 0xffff;
|
||||
TUNABLE_INT("hw.dwc.pause_time", &dwc_pause_time);
|
||||
|
||||
/*
|
||||
* MIIBUS functions
|
||||
*/
|
||||
@ -334,6 +338,15 @@ dwc_miibus_statchg(device_t dev)
|
||||
reg &= ~(CONF_DM);
|
||||
WRITE4(sc, MAC_CONFIGURATION, reg);
|
||||
|
||||
reg = FLOW_CONTROL_UP;
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0)
|
||||
reg |= FLOW_CONTROL_TX;
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0)
|
||||
reg |= FLOW_CONTROL_RX;
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0)
|
||||
reg |= dwc_pause_time << FLOW_CONTROL_PT_SHIFT;
|
||||
WRITE4(sc, FLOW_CONTROL, reg);
|
||||
|
||||
IF_DWC_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active));
|
||||
|
||||
}
|
||||
|
@ -70,6 +70,10 @@
|
||||
#define GMII_ADDRESS_GB (1 << 0) /* Busy */
|
||||
#define GMII_DATA 0x14
|
||||
#define FLOW_CONTROL 0x18
|
||||
#define FLOW_CONTROL_PT_SHIFT 16
|
||||
#define FLOW_CONTROL_UP (1 << 3) /* Unicast pause enable */
|
||||
#define FLOW_CONTROL_RX (1 << 2) /* RX Flow control enable */
|
||||
#define FLOW_CONTROL_TX (1 << 1) /* TX Flow control enable */
|
||||
#define GMAC_VLAN_TAG 0x1C
|
||||
#define VERSION 0x20
|
||||
#define DEBUG 0x24
|
||||
|
Loading…
Reference in New Issue
Block a user