From 2567d71370eda7dea7031f5eb074b86e133a039c Mon Sep 17 00:00:00 2001 From: Michael Zhilin Date: Tue, 15 Nov 2016 22:30:25 +0000 Subject: [PATCH] [etherswitch] enable phy4/mac4 of ip175c If MII1 interface is disabled, then enable phy4/mac4. Submitted by: Hiroki Mori Reviewed by: mizhka, adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D6832 --- sys/dev/etherswitch/ip17x/ip175c.c | 7 +++++++ sys/dev/etherswitch/ip17x/ip175c.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/sys/dev/etherswitch/ip17x/ip175c.c b/sys/dev/etherswitch/ip17x/ip175c.c index 30614a42417..c87543bc5b1 100644 --- a/sys/dev/etherswitch/ip17x/ip175c.c +++ b/sys/dev/etherswitch/ip17x/ip175c.c @@ -234,6 +234,13 @@ ip175c_get_vlan_mode(struct ip17x_softc *sc) void ip175c_attach(struct ip17x_softc *sc) { + uint32_t data; + + data = ip17x_readphy(sc->sc_dev, IP175C_MII_PHY, IP175C_MII_CTL_REG); + device_printf(sc->sc_dev, "MII: %x\n", data); + /* check mii1 interface if disabled then phy4 and mac4 hold on switch */ + if((data & (1 << IP175C_MII_MII1_RMII_EN)) == 0) + sc->phymask |= 0x10; sc->hal.ip17x_reset = ip175c_reset; sc->hal.ip17x_hw_setup = ip175c_hw_setup; diff --git a/sys/dev/etherswitch/ip17x/ip175c.h b/sys/dev/etherswitch/ip17x/ip175c.h index 8abb4b69619..2b9e05665d2 100644 --- a/sys/dev/etherswitch/ip17x/ip175c.h +++ b/sys/dev/etherswitch/ip17x/ip175c.h @@ -35,6 +35,9 @@ #define IP175C_MODE_REG 31 #define IP175C_RESET_PHY 30 #define IP175C_RESET_REG 0 +#define IP175C_MII_PHY 31 +#define IP175C_MII_CTL_REG 5 +#define IP175C_MII_MII1_RMII_EN 8 #define IP175C_LAST_VLAN 15 -- 2.45.2