The branch main has been updated by mw:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=dfcaa2c18bf9c69b94d531364f8913b23f19505f

commit dfcaa2c18bf9c69b94d531364f8913b23f19505f
Author:     Kornel Duleba <min...@semihalf.com>
AuthorDate: 2021-07-28 11:38:53 +0000
Commit:     Marcin Wojtas <m...@freebsd.org>
CommitDate: 2021-08-03 10:07:49 +0000

    enetc_mdio: Support building the driver as a loadable module.
    
    After recent arm64 GENERIC config cleanup the ENETC MDIO
    in NXP LS1028A SoC should support being loaded as a module.
    
    Obtained from: Semihalf
    Sponsored by: Alstom Group
---
 sys/conf/files.arm64              | 4 ++--
 sys/dev/enetc/enetc_mdio_pci.c    | 8 ++++----
 sys/dev/etherswitch/felix/felix.c | 2 ++
 sys/modules/Makefile              | 2 ++
 sys/modules/enetc_mdio/Makefile   | 8 ++++++++
 5 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index bfa03dade1db..5cd1fa396171 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -175,8 +175,8 @@ dev/cpufreq/cpufreq_dt.c                    optional 
cpufreq fdt
 dev/dwc/if_dwc.c                               optional fdt dwc_rk 
soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga 
soc_intel_stratix10
 dev/dwc/if_dwc_if.m                            optional fdt dwc_rk 
soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 | fdt dwc_socfpga 
soc_intel_stratix10
 
-dev/enetc/enetc_mdio.c                         optional enetc soc_nxp_ls
-dev/enetc/enetc_mdio_pci.c                     optional enetc pci soc_nxp_ls
+dev/enetc/enetc_mdio.c                         optional enetc soc_nxp_ls | 
enetc_mdio soc_nxp_ls
+dev/enetc/enetc_mdio_pci.c                     optional enetc_mdio pci 
soc_nxp_ls
 dev/enetc/if_enetc.c                           optional enetc iflib pci fdt 
soc_nxp_ls
 
 dev/etherswitch/felix/felix.c                  optional enetc etherswitch fdt 
felix pci soc_nxp_ls
diff --git a/sys/dev/enetc/enetc_mdio_pci.c b/sys/dev/enetc/enetc_mdio_pci.c
index 0fd540008e57..aac236d1c246 100644
--- a/sys/dev/enetc/enetc_mdio_pci.c
+++ b/sys/dev/enetc/enetc_mdio_pci.c
@@ -159,7 +159,7 @@ enetc_mdio_pci_detach(device_t dev)
 
        sc = device_get_softc(dev);
 
-       bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_regs);
+       bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(0), sc->sc_regs);
        mtx_destroy(&sc->sc_lock);
 
        return (0);
@@ -184,8 +184,8 @@ static driver_t     enetc_mdio_pci_driver = {
 
 static devclass_t enetc_mdio_pci_devclass;
 
-DRIVER_MODULE(enetc_mdio_pci, pci, enetc_mdio_pci_driver,
+DRIVER_MODULE(enetc_mdio, pci, enetc_mdio_pci_driver,
     enetc_mdio_pci_devclass, 0, 0);
-DRIVER_MODULE(miibus, enetc_mdio_pci, miibus_driver, miibus_devclass,
+DRIVER_MODULE(miibus, enetc_mdio, miibus_driver, miibus_devclass,
     0, 0);
-MODULE_VERSION(enetc_mdio_pci, 1);
+MODULE_VERSION(enetc_mdio, 1);
diff --git a/sys/dev/etherswitch/felix/felix.c 
b/sys/dev/etherswitch/felix/felix.c
index 140811807586..1cd1e0e29ca7 100644
--- a/sys/dev/etherswitch/felix/felix.c
+++ b/sys/dev/etherswitch/felix/felix.c
@@ -138,6 +138,8 @@ MODULE_VERSION(felix, 1);
 MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, felix,
     felix_pci_ids, nitems(felix_pci_ids) - 1);
 
+MODULE_DEPEND(felix, enetc_mdio, 1, 1, 1);
+
 static int
 felix_probe(device_t dev)
 {
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 0ba139977968..fdaea7fa4ec9 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -112,6 +112,7 @@ SUBDIR=     \
        ${_em} \
        ${_ena} \
        ${_enetc} \
+       ${_enetc_mdio} \
        esp \
        ${_et} \
        evdev \
@@ -614,6 +615,7 @@ _armv8crypto=       armv8crypto
 _dwwdt=                dwwdt
 _em=           em
 _enetc=                enetc
+_enetc_mdio=   enetc_mdio
 _felix=                felix
 _rockchip=     rockchip
 .endif
diff --git a/sys/modules/enetc_mdio/Makefile b/sys/modules/enetc_mdio/Makefile
new file mode 100644
index 000000000000..f448fc526705
--- /dev/null
+++ b/sys/modules/enetc_mdio/Makefile
@@ -0,0 +1,8 @@
+#$FreeBSD$
+
+.PATH: ${SRCTOP}/sys/dev/enetc
+
+KMOD   = enetc_mdio
+SRCS   = enetc_mdio_pci.c enetc_mdio.c
+
+.include <bsd.kmod.mk>
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to