diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2026-05-04 22:45:56 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2026-10-30 14:03:21 +0000 |
| commit | 83d0eed501060a733753c57c85da3abab4c973ad (patch) | |
| tree | a8f8ec98516dc0281b5057df03ccc650d902d24d | |
| parent | 9bd30915963157d975969649f8b3143408ecdf3c (diff) | |
lan867xphy: New driver for Microchip LAN8670/1/2 10BASE-T1S PHYs
10BASE-T1S is a Single Pair Ethernet (SPE) standard, intended for
automotive and industrial applications. It supports a multidrop "mixing
segment" of at least 25m with up to 8 nodes.
This driver currently does not support per-silicon-revision config or
PHY-Level Collision Avoidance (PLCA), but is sufficient for establishing
basic connectivity.
Device details are available in the "Microchip LAN8670/1/2 10BASE-T1S
Ethernet PHY Transceiver Datasheet".
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D60979
| -rw-r--r-- | sys/conf/files | 1 | ||||
| -rw-r--r-- | sys/dev/mii/lan867xphy.c | 110 | ||||
| -rw-r--r-- | sys/dev/mii/miidevs | 1 | ||||
| -rw-r--r-- | sys/modules/mii/Makefile | 4 |
4 files changed, 115 insertions, 1 deletions
diff --git a/sys/conf/files b/sys/conf/files index e83e27c54d4d..882070eddec2 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -2471,6 +2471,7 @@ dev/mii/gentbi.c optional miibus | gentbi 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 index 000000000000..6fe23959df86 --- /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 index 89d8e54a1843..c8c61c5f3b79 100644 --- a/sys/dev/mii/miidevs +++ b/sys/dev/mii/miidevs @@ -364,3 +364,4 @@ model xxXAQTI XMACII 0x0000 XaQti Corp. XMAC II gigabit interface /* 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 index 353d92a51167..9621212a1fbc 100644 --- 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 |
