diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-03-28 09:03:49 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-03-28 09:03:49 +0000 |
commit | eefc54392c940ade21b07948fb804ed35ecaa62a (patch) | |
tree | b747b96b6589037b5874fd834a8a95567e6e5a09 /sys/dev/fdt | |
parent | 34a7254bface02196c0297db29012861fee44ff6 (diff) |
Configure tx and rx chain delay based on device tree properties.
ok mlarkin@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r-- | sys/dev/fdt/if_dwxe.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/fdt/if_dwxe.c b/sys/dev/fdt/if_dwxe.c index c38599814ad..020de824664 100644 --- a/sys/dev/fdt/if_dwxe.c +++ b/sys/dev/fdt/if_dwxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_dwxe.c,v 1.6 2017/12/13 10:38:06 kettenis Exp $ */ +/* $OpenBSD: if_dwxe.c,v 1.7 2018/03/28 09:03:48 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis * Copyright (c) 2017 Patrick Wildt <patrick@blueri.se> @@ -448,6 +448,7 @@ dwxe_phy_setup(struct dwxe_softc *sc) { struct regmap *rm; uint32_t syscon; + uint32_t tx_delay, rx_delay; char *phy_mode; int len; @@ -457,6 +458,7 @@ dwxe_phy_setup(struct dwxe_softc *sc) syscon = regmap_read_4(rm, SYSCON); syscon &= ~(SYSCON_ETCS_MASK|SYSCON_EPIT|SYSCON_RMII_EN); + syscon &= ~(SYSCON_ETXDC_MASK | SYSCON_ERXDC_MASK); syscon &= ~SYSCON_H3_EPHY_SELECT; if ((len = OF_getproplen(sc->sc_node, "phy-mode")) <= 0) @@ -480,6 +482,11 @@ dwxe_phy_setup(struct dwxe_softc *sc) } free(phy_mode, M_TEMP, len); + tx_delay = OF_getpropint(sc->sc_node, "allwinner,tx-delay-ps", 0); + rx_delay = OF_getpropint(sc->sc_node, "allwinner,rx-delay-ps", 0); + syscon |= ((tx_delay / 100) << SYSCON_ETXDC_SHIFT) & SYSCON_ETXDC_MASK; + syscon |= ((rx_delay / 100) << SYSCON_ERXDC_SHIFT) & SYSCON_ERXDC_MASK; + regmap_write_4(rm, SYSCON, syscon); dwxe_reset(sc); } |