Date: Tue, 3 Aug 2021 10:08:03 GMT From: Marcin Wojtas <mw@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 5ad6d28cbe6b - main - enetc: Support building the driver as a loadable module. Message-ID: <202108031008.173A83HA096670@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df commit 5ad6d28cbe6b3ff85e49607a7e04cb68db3ed6df Author: Kornel Duleba <mindal@semihalf.com> AuthorDate: 2021-07-28 09:23:23 +0000 Commit: Marcin Wojtas <mw@FreeBSD.org> CommitDate: 2021-08-03 10:07:49 +0000 enetc: Support building the driver as a loadable module. Function level reset has to be done in attach in order to put the hardware in a known state before configuring it. The order of DRIVER_MODULEs was changed to ensure that the miibus driver is loaded when mii_attach is called. Obtained from: Semihalf Sponsored by: Alstom Group --- sys/dev/enetc/if_enetc.c | 6 +++++- sys/modules/Makefile | 2 ++ sys/modules/enetc/Makefile | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/enetc/if_enetc.c b/sys/dev/enetc/if_enetc.c index 54cdc6ea9ad4..46327eb419bf 100644 --- a/sys/dev/enetc/if_enetc.c +++ b/sys/dev/enetc/if_enetc.c @@ -158,8 +158,8 @@ static driver_t enetc_driver = { }; static devclass_t enetc_devclass; -DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); DRIVER_MODULE(miibus, enetc, miibus_driver, miibus_devclass, NULL, NULL); +DRIVER_MODULE(enetc, pci, enetc_driver, enetc_devclass, NULL, NULL); MODULE_VERSION(enetc, 1); IFLIB_PNP_INFO(pci, enetc, enetc_vendor_info_array); @@ -366,6 +366,10 @@ enetc_attach_pre(if_ctx_t ctx) sc->shared = scctx; ifp = iflib_get_ifp(ctx); + pci_save_state(sc->dev); + pcie_flr(sc->dev, 1000, false); + pci_restore_state(sc->dev); + rid = PCIR_BAR(ENETC_BAR_REGS); sc->regs = bus_alloc_resource_any(sc->dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->regs == NULL) { diff --git a/sys/modules/Makefile b/sys/modules/Makefile index e6e683ecd65e..0ba139977968 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -111,6 +111,7 @@ SUBDIR= \ ${_efirt} \ ${_em} \ ${_ena} \ + ${_enetc} \ esp \ ${_et} \ evdev \ @@ -612,6 +613,7 @@ _allwinner= allwinner _armv8crypto= armv8crypto _dwwdt= dwwdt _em= em +_enetc= enetc _felix= felix _rockchip= rockchip .endif diff --git a/sys/modules/enetc/Makefile b/sys/modules/enetc/Makefile new file mode 100644 index 000000000000..694ec2043f37 --- /dev/null +++ b/sys/modules/enetc/Makefile @@ -0,0 +1,8 @@ +#$FreeBSD$ + +.PATH: ${SRCTOP}/sys/dev/enetc + +KMOD = if_enetc +SRCS = if_enetc.c enetc_mdio.c + +.include <bsd.kmod.mk>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108031008.173A83HA096670>