[6-freebsd-12 PATCH 2/2] bsp/motorola_powerpc: Add dc and ukphy support

chrisj at rtems.org chrisj at rtems.org
Tue Feb 16 02:02:29 UTC 2021


From: Chris Johns <chrisj at rtems.org>

- Add the dc net dev to the BSP

- Add the ukphy support

Closes # 4246
---
 freebsd/sys/dev/dc/if_dc.c                    | 10 ++++--
 freebsd/sys/dev/dc/if_dcreg.h                 |  7 ++++
 rtemsbsd/include/bsp/nexus-devices.h          |  4 +++
 .../include/machine/rtems-bsd-nexus-bus.h     | 32 +++++++++++++++++++
 4 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/freebsd/sys/dev/dc/if_dc.c b/freebsd/sys/dev/dc/if_dc.c
index 7fc0ef54..4cb61fa5 100644
--- a/freebsd/sys/dev/dc/if_dc.c
+++ b/freebsd/sys/dev/dc/if_dc.c
@@ -156,6 +156,10 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1);
  * Various supported device vendors/types and their names.
  */
 static const struct dc_type dc_devs[] = {
+#ifdef __rtems__
+	{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A), 0,
+		"Intel 21140A 10/100BaseTX" },
+#endif /* __rtems__ */
 	{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0,
 		"Intel 21143 10/100BaseTX" },
 	{ DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0,
@@ -2076,6 +2080,9 @@ dc_attach(device_t dev)
 		dc_eeprom_width(sc);
 
 	switch (sc->dc_info->dc_devid) {
+#ifdef __rtems__
+	case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A):
+#endif /* __rtems__ */
 	case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143):
 		sc->dc_type = DC_TYPE_21143;
 		sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
@@ -2449,7 +2456,6 @@ dc_attach(device_t dev)
 
 	error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd,
 	    dc_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
-
 	if (error && DC_IS_INTEL(sc)) {
 		sc->dc_pmode = tmp;
 		if (sc->dc_pmode != DC_PMODE_SIA)
@@ -2503,7 +2509,6 @@ dc_attach(device_t dev)
 	/* Hook interrupt last to avoid having to lock softc */
 	error = bus_setup_intr(dev, sc->dc_irq, INTR_TYPE_NET | INTR_MPSAFE,
 	    NULL, dc_intr, sc, &sc->dc_intrhand);
-
 	if (error) {
 		device_printf(dev, "couldn't set up irq\n");
 		ether_ifdetach(ifp);
@@ -2602,7 +2607,6 @@ dc_list_tx_init(struct dc_softc *sc)
 		ld->dc_tx_list[i].dc_next = htole32(DC_TXDESC(sc, nexti));
 		cd->dc_tx_chain[i] = NULL;
 	}
-
 	cd->dc_tx_prod = cd->dc_tx_cons = cd->dc_tx_cnt = 0;
 	cd->dc_tx_pkts = 0;
 	bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap,
diff --git a/freebsd/sys/dev/dc/if_dcreg.h b/freebsd/sys/dev/dc/if_dcreg.h
index 9ae26cc6..836e70f8 100644
--- a/freebsd/sys/dev/dc/if_dcreg.h
+++ b/freebsd/sys/dev/dc/if_dcreg.h
@@ -824,6 +824,13 @@ struct dc_softc {
  */
 #define	DC_VENDORID_DEC		0x1011
 
+#ifdef __rtems__
+/*
+ * DEC/Intel 21140 PCI device ID
+ */
+#define	DC_DEVICEID_21140A	0x0009
+#endif /* __rtems__ */
+
 /*
  * DEC/Intel 21143 PCI device ID
  */
diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
index c3c43dc9..d813addd 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -199,6 +199,8 @@ RTEMS_BSD_DRIVER_PCI_IGB;
 RTEMS_BSD_DRIVER_PCI_EM;
 RTEMS_BSD_DRIVER_PCI_RE;
 RTEMS_BSD_DRIVER_REPHY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_DCPHY;
 
 #elif defined(LIBBSP_POWERPC_QORIQ_BSP_H)
 
@@ -240,6 +242,8 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 #elif defined(LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H)
 
 RTEMS_BSD_DRIVER_PC_LEGACY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_UKPHY;
 
 #endif /* LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H */
 
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index 5c95d2c3..752bc559 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -486,10 +486,26 @@ extern "C" {
     SYSINIT_DRIVER_REFERENCE(re, pci);
 #endif /* RTEMS_BSD_DRIVER_PCI_RE */
 
+/*
+ * DEC Tulip Driver
+ */
+#if !defined(RTEMS_BSD_DRIVER_PCI_DC)
+  #define RTEMS_BSD_DRIVER_PCI_DC                 \
+    SYSINIT_DRIVER_REFERENCE(dc, pci);
+#endif /* RTEMS_BSD_DRIVER_PCI_DC */
+
 /**
  ** MMI Physical Layer Support.
  **/
 
+/*
+ * UK PHY (for unknown PHY devices)
+ */
+#if !defined(RTEMS_BSD_DRIVER_UKPHY)
+  #define RTEMS_BSD_DRIVER_UKPHY               \
+    SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_UKPHY */
+
 /*
  * E1000 PHY
  */
@@ -522,6 +538,22 @@ extern "C" {
     SYSINIT_DRIVER_REFERENCE(micphy, miibus);
 #endif /* RTEMS_BSD_DRIVER_PHY_MIC */
 
+/*
+ * DC PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_DCPHY)
+  #define RTEMS_BSD_DRIVER_DCPHY                  \
+    SYSINIT_DRIVER_REFERENCE(dcphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_DCPHY */
+
+/*
+ * PN PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_PNPHY)
+  #define RTEMS_BSD_DRIVER_PNPHY                  \
+    SYSINIT_DRIVER_REFERENCE(pnphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_PNPHY */
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-- 
2.24.1



More information about the devel mailing list