Page MenuHomeFreeBSD

D60979.1793472184.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D60979.1793472184.diff

diff --git a/sys/conf/files b/sys/conf/files
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2471,6 +2471,7 @@
dev/mii/icsphy.c optional miibus | icsphy
dev/mii/ip1000phy.c optional miibus | ip1000phy
dev/mii/jmphy.c optional miibus | jmphy
+dev/mii/lan867xphy.c optional miibus | lan867xphy
dev/mii/lxtphy.c optional miibus | lxtphy
dev/mii/mcommphy.c optional miibus | mcommphy
dev/mii/micphy.c optional miibus fdt | micphy fdt
diff --git a/sys/dev/mii/lan867xphy.c b/sys/dev/mii/lan867xphy.c
new file mode 100644
--- /dev/null
+++ b/sys/dev/mii/lan867xphy.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2026 Ed Maste
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+/*
+ * Microchip LAN8670/1/2 10BASE-T1S Single Pair Ethernet (SPE) PHY Driver.
+ *
+ * This driver is sufficient for basic connectivity with CSMA/CD.
+ *
+ * TODO:
+ * - Revision-specific configuration for C2 and D0 silicon
+ * - PHY-Level Collision Avoidance (PLCA) configuration
+ * - Sleep mode (C2, D0 and later)
+ * - Topology discovry (D0 and later)
+ * - Signal Quality Indicator (SQI) (C2, D0 and later)
+ * - Cable fault diagnostics (C2 and later)
+ * - Harness Defect Detection (D0 and later)
+ * - Link status (D0 and later)
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/module.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+
+#include <dev/mii/miivar.h>
+#include "miidevs.h"
+#include "miibus_if.h"
+
+static int lan867x_probe(device_t);
+static int lan867x_attach(device_t);
+
+static int lan867xphy_service(struct mii_softc *, struct mii_data *, int);
+static void lan867xphy_status(struct mii_softc *);
+
+
+static const struct mii_phydesc lan867xphys[] = {
+ MII_PHY_DESC(SMSC, LAN867X),
+ MII_PHY_END
+};
+
+static const struct mii_phy_funcs lan867xphy_funcs = {
+ lan867xphy_service,
+ lan867xphy_status,
+ mii_phy_reset,
+};
+
+static int
+lan867xphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
+{
+ PHY_STATUS(sc);
+ mii_phy_update(sc, cmd);
+ return (0);
+}
+
+static void
+lan867xphy_status(struct mii_softc *sc)
+{
+ struct mii_data *mii = sc->mii_pdata;
+
+ mii->mii_media_status = IFM_AVALID | IFM_ACTIVE;
+ mii->mii_media_active = IFM_ETHER | IFM_10_T1S | IFM_HDX;
+}
+
+static int
+lan867x_probe(device_t dev)
+{
+ return (mii_phy_dev_probe(dev, lan867xphys, BUS_PROBE_DEFAULT));
+}
+
+static int
+lan867x_attach(device_t dev)
+{
+ struct mii_softc *sc = device_get_softc(dev);
+ int media;
+
+ mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
+ &lan867xphy_funcs, 0);
+
+ PHY_RESET(sc);
+
+ /* PHY supports 10BASE-T1S only, no negotiation. */
+ media = IFM_MAKEWORD(IFM_ETHER, IFM_10_T1S, IFM_HDX, sc->mii_inst);
+ ifmedia_add(&sc->mii_pdata->mii_media, media, 0, NULL);
+ ifmedia_set(&sc->mii_pdata->mii_media, media);
+
+ return (0);
+}
+
+static device_method_t lan867x_methods[] = {
+ DEVMETHOD(device_probe, lan867x_probe),
+ DEVMETHOD(device_attach, lan867x_attach),
+ DEVMETHOD(device_detach, mii_phy_detach),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ DEVMETHOD_END
+};
+
+static driver_t lan867x_driver = {
+ "lan867xphy",
+ lan867x_methods,
+ sizeof(struct mii_softc)
+};
+
+DRIVER_MODULE(lan867xphy, miibus, lan867x_driver, 0, 0);
diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs
--- a/sys/dev/mii/miidevs
+++ b/sys/dev/mii/miidevs
@@ -364,3 +364,4 @@
/* Microchip (formerly SMSC) */
model SMSC LAN8710A 0x000F Microchip LAN8710A 10/100 interface
model SMSC LAN8700 0x000C Microchip LAN8700 10/100 interface
+model SMSC LAN867X 0x0016 Microchip LAN8670/1/2 10BASE-T1S PHY
diff --git a/sys/modules/mii/Makefile b/sys/modules/mii/Makefile
--- a/sys/modules/mii/Makefile
+++ b/sys/modules/mii/Makefile
@@ -3,7 +3,9 @@
KMOD= miibus
SRCS= acphy.c amphy.c atphy.c axphy.c bmtphy.c brgphy.c
SRCS+= ciphy.c dp83822phy.c dp83867phy.c
-SRCS+= e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c lxtphy.c
+SRCS+= e1000phy.c gentbi.c icsphy.c ip1000phy.c jmphy.c
+SRCS+= lan867xphy.c
+SRCS+= lxtphy.c
SRCS+= miibus_if.c mii.c mii_bitbang.c mii_physubr.c
SRCS+= nsgphy.c nsphy.c nsphyter.c pnaphy.c qsphy.c
SRCS+= rdcphy.c rgephy.c rlphy.c smcphy.c

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 31, 6:43 PM (16 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41268398
Default Alt Text
D60979.1793472184.diff (4 KB)

Event Timeline