Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2023 00:53:27 GMT
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 5972ffde919a - main - ig4(4): Add an EMAG device type
Message-ID:  <202311160053.3AG0rRuv048675@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by gallatin:

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

commit 5972ffde919ab65ba29d4d51ccf735da18d52719
Author:     Andrew Gallatin <gallatin@FreeBSD.org>
AuthorDate: 2023-11-16 00:51:28 +0000
Commit:     Andrew Gallatin <gallatin@FreeBSD.org>
CommitDate: 2023-11-16 00:53:21 +0000

    ig4(4): Add an EMAG device type
    
    Sponsored by: Ampere Computing LLC, Netflix
    Submitted by: allanjude
    Differential Revision: https://reviews.freebsd.org/D28746
    Reviewed by: imp
---
 sys/dev/ichiic/ig4_acpi.c | 12 ++++++++++--
 sys/dev/ichiic/ig4_iic.c  |  3 +++
 sys/dev/ichiic/ig4_var.h  |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/sys/dev/ichiic/ig4_acpi.c b/sys/dev/ichiic/ig4_acpi.c
index f88cca6cf13d..3f370ae7abb9 100644
--- a/sys/dev/ichiic/ig4_acpi.c
+++ b/sys/dev/ichiic/ig4_acpi.c
@@ -83,13 +83,21 @@ static int
 ig4iic_acpi_attach(device_t dev)
 {
 	ig4iic_softc_t	*sc;
+	char *str;
 	int error;
 
 	sc = device_get_softc(dev);
 
 	sc->dev = dev;
-	/* All the HIDs matched are Atom SOCs. */
-	sc->version = IG4_ATOM;
+	error = ACPI_ID_PROBE(device_get_parent(dev), dev, ig4iic_ids, &str);
+	if (error > 0)
+		return (error);
+	if (strcmp(str, "APMC0D0F") == 0) {
+		sc->version = IG4_EMAG;
+	} else {
+		/* All the other HIDs matched are Atom SOCs. */
+		sc->version = IG4_ATOM;
+	}
 	sc->regs_rid = 0;
 	sc->regs_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
 					  &sc->regs_rid, RF_ACTIVE);
diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c
index 195bca62928a..3dc72c458b24 100644
--- a/sys/dev/ichiic/ig4_iic.c
+++ b/sys/dev/ichiic/ig4_iic.c
@@ -89,6 +89,9 @@
  * Ig4 hardware parameters except Haswell are taken from intel_lpss driver
  */
 static const struct ig4_hw ig4iic_hw[] = {
+	[IG4_EMAG] = {
+		.ic_clock_rate = 100,	/* MHz */
+	},
 	[IG4_HASWELL] = {
 		.ic_clock_rate = 100,	/* MHz */
 		.sda_hold_time = 90,	/* nsec */
diff --git a/sys/dev/ichiic/ig4_var.h b/sys/dev/ichiic/ig4_var.h
index 964a610e7408..989cf23779a2 100644
--- a/sys/dev/ichiic/ig4_var.h
+++ b/sys/dev/ichiic/ig4_var.h
@@ -42,6 +42,7 @@
 #include "iicbus_if.h"
 
 enum ig4_vers {
+	IG4_EMAG,
 	IG4_HASWELL,
 	IG4_ATOM,
 	IG4_SKYLAKE,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311160053.3AG0rRuv048675>