summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2022-11-08 23:07:35 -0600
committerJoel Sherrill <joel@rtems.org>2022-11-10 08:06:31 -0600
commit02d383922be0bd2b161730a6a817beaf4795867d (patch)
treecb91b211246779c9ca3b3a5dd56c9a1f514c7497
parentfreebsd/cgem: Add device tree support (diff)
downloadrtems-libbsd-02d383922be0bd2b161730a6a817beaf4795867d.tar.bz2
freebsd/cgem: Add SGMII support
This adds support to the CGEM driver for selection of SGMII PHY interfaces specified via device tree parameters.
-rw-r--r--freebsd/sys/dev/cadence/if_cgem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/freebsd/sys/dev/cadence/if_cgem.c b/freebsd/sys/dev/cadence/if_cgem.c
index 047d9104..689c3611 100644
--- a/freebsd/sys/dev/cadence/if_cgem.c
+++ b/freebsd/sys/dev/cadence/if_cgem.c
@@ -134,6 +134,7 @@ struct cgem_softc {
#ifdef __rtems__
uint32_t net_cfg_shadow;
int neednullqs;
+ int phy_contype;
#endif /* __rtems__ */
int ref_clk_num;
#ifndef __rtems__
@@ -1296,6 +1297,14 @@ cgem_config(struct cgem_softc *sc)
CGEM_NET_CFG_FULL_DUPLEX |
CGEM_NET_CFG_SPEED100;
+#ifdef __rtems__
+ /* Check connection type, enable SGMII bits if necessary. */
+ if ( sc->phy_contype == MII_CONTYPE_SGMII ) {
+ net_cfg |= CGEM_NET_CFG_SGMII_EN;
+ net_cfg |= CGEM_NET_CFG_PCS_SEL;
+ }
+#endif
+
/* Enable receive checksum offloading? */
if ((if_getcapenable(ifp) & IFCAP_RXCSUM) != 0)
net_cfg |= CGEM_NET_CFG_RX_CHKSUM_OFFLD_EN;
@@ -2014,6 +2023,7 @@ cgem_attach(device_t dev)
/* Else for ref-clock-num OF_getprop */
else
sc->ref_clk_num = device_get_unit(dev);
+ sc->phy_contype = mii_fdt_get_contype(node);
} else {
sc->ref_clk_num = device_get_unit(dev);
sc->phy_contype = MII_CONTYPE_RGMII_ID;