git: 99443830fa7c - main - iicoc: support building as a module

From: Philip Paeps <philip_at_FreeBSD.org>
Date: Mon, 01 Nov 2021 05:09:26 UTC
The branch main has been updated by philip:

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

commit 99443830fa7c121af42a6af5971357f9ab52deff
Author:     Thomas Skibo <thomas-bsd@skibo.net>
AuthorDate: 2021-11-01 04:31:49 +0000
Commit:     Philip Paeps <philip@FreeBSD.org>
CommitDate: 2021-11-01 04:33:39 +0000

    iicoc: support building as a module
    
    Only build on RISC-V for now, since we're not aware of any other cores
    with this IP supported by FreeBSD.
    
    Reviewed by:    jrtc27, philip
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D32737
---
 sys/dev/iicbus/iicoc_fdt.c                 | 1 +
 sys/modules/i2c/controllers/Makefile       | 3 +++
 sys/modules/i2c/controllers/iicoc/Makefile | 7 +++++++
 3 files changed, 11 insertions(+)

diff --git a/sys/dev/iicbus/iicoc_fdt.c b/sys/dev/iicbus/iicoc_fdt.c
index 052174a91134..0bc25044a293 100644
--- a/sys/dev/iicbus/iicoc_fdt.c
+++ b/sys/dev/iicbus/iicoc_fdt.c
@@ -185,6 +185,7 @@ static driver_t iicoc_driver = {
 	sizeof(struct iicoc_softc),
 };
 
+SIMPLEBUS_PNP_INFO(compat_data);
 DRIVER_MODULE(iicoc, simplebus, iicoc_driver, iicoc_devclass, 0, 0);
 DRIVER_MODULE(ofw_iicbus, iicoc, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0);
 MODULE_DEPEND(iicoc, iicbus, 1, 1, 1);
diff --git a/sys/modules/i2c/controllers/Makefile b/sys/modules/i2c/controllers/Makefile
index 8773bc09c030..3bae39c3b439 100644
--- a/sys/modules/i2c/controllers/Makefile
+++ b/sys/modules/i2c/controllers/Makefile
@@ -5,5 +5,8 @@ SUBDIR = alpm amdpm amdsmb ichiic ichsmb intpm ismt nfsmb viapm lpbb pcf
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
 SUBDIR += imcsmb
 .endif
+.if ${MACHINE_CPUARCH} == "riscv"
+SUBDIR += iicoc
+.endif
 
 .include <bsd.subdir.mk>
diff --git a/sys/modules/i2c/controllers/iicoc/Makefile b/sys/modules/i2c/controllers/iicoc/Makefile
new file mode 100644
index 000000000000..f6902f1f864a
--- /dev/null
+++ b/sys/modules/i2c/controllers/iicoc/Makefile
@@ -0,0 +1,7 @@
+.PATH:		${SRCTOP}/sys/dev/iicbus
+
+KMOD		= iicoc
+SRCS		= device_if.h bus_if.h iicbus_if.h \
+		  iicoc.c iicoc_fdt.c iicoc_pci.c
+
+.include <bsd.kmod.mk>