diff options
author | Luiz Otavio O Souza <luiz@netgate.com> | 2017-03-12 03:22:10 -0500 |
---|---|---|
committer | Luiz Souza <luiz@netgate.com> | 2017-07-20 21:31:03 -0500 |
commit | 9b9e72855f08214947644bc51b3316ca4cd63ec0 (patch) | |
tree | 98670345b745842b79e89a913509f9835e577378 /sys/arm/ti | |
parent | ba407fd699a0ab3abe46ba8b7072a87237f2824d (diff) | |
download | FreeBSD-src-9b9e72855f08214947644bc51b3316ca4cd63ec0.zip FreeBSD-src-9b9e72855f08214947644bc51b3316ca4cd63ec0.tar.gz |
Add read and write support for the PHY registers.
(cherry picked from commit 9a726e85185cf7cc2ed17cd59389dfa45421b61d)
Diffstat (limited to 'sys/arm/ti')
-rw-r--r-- | sys/arm/ti/cpsw/if_cpsw.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/sys/arm/ti/cpsw/if_cpsw.c b/sys/arm/ti/cpsw/if_cpsw.c index c385557..fd61cdf 100644 --- a/sys/arm/ti/cpsw/if_cpsw.c +++ b/sys/arm/ti/cpsw/if_cpsw.c @@ -2978,16 +2978,36 @@ cpsw_writereg(device_t dev, int addr, int value) static int cpsw_readphy(device_t dev, int phy, int reg) { + int i; + struct cpsw_softc *sc; - /* Not supported. */ - return (0); + sc = device_get_softc(dev); + if (!sc->dualemac) + return (0); + for (i = 0; i < CPSW_PORTS; i++) + if (sc->port[i].phy == phy) + break; + if (i >= CPSW_PORTS) + return (0); + + return (cpswp_miibus_readreg(sc->port[i].dev, phy, reg)); } static int cpsw_writephy(device_t dev, int phy, int reg, int data) { + int i; + struct cpsw_softc *sc; - /* Not supported. */ - return (0); + sc = device_get_softc(dev); + if (!sc->dualemac) + return (0); + for (i = 0; i < CPSW_PORTS; i++) + if (sc->port[i].phy == phy) + break; + if (i >= CPSW_PORTS) + return (0); + + return (cpswp_miibus_writereg(sc->port[i].dev, phy, reg, data)); } #endif |