git: 11ba27a8a6a7 - main - ig4: Add an AMD generation with a 150 MHz clock

From: Olivier Cochard <olivier_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 23:36:36 UTC
The branch main has been updated by olivier:

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

commit 11ba27a8a6a7302453a561f32f28fb52f91d0108
Author:     Olivier Cochard <olivier@FreeBSD.org>
AuthorDate: 2026-11-22 15:15:29 +0000
Commit:     Olivier Cochard <olivier@FreeBSD.org>
CommitDate: 2026-11-23 23:30:50 +0000

    ig4: Add an AMD generation with a 150 MHz clock
    
    AMDI0010 controllers attached as Atom, whose timings assume a 100 MHz
    input clock, but they run from 150 MHz (Linux drivers/acpi/acpi_apd.c),
    so the bus runs above the 400 kHz of fast mode and the SDA hold time
    is a third short.  The median of 200 timed 1 KB reads on an HP ZBook
    Ultra G1a gives an effective 472 kHz before and 348 kHz after.
    
    Give them their own generation: the Atom timings with a 150 MHz clock,
    and of the Atom register handling only the DesignWare FIFO depth and
    component version checks, not the Intel LPSS private registers.  It
    sorts before IG4_SKYLAKE, so IG4_HAS_ADDREGS() stays false.
    
    Reviewed by:    wulf, imp
    Approved by:    wulf, imp
    MFC after:      1 week
    Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/114
---
 sys/dev/ichiic/ig4_acpi.c |  2 ++
 sys/dev/ichiic/ig4_iic.c  | 14 ++++++++++++--
 sys/dev/ichiic/ig4_var.h  |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/sys/dev/ichiic/ig4_acpi.c b/sys/dev/ichiic/ig4_acpi.c
index 10540d2bd889..7bbd48208657 100644
--- a/sys/dev/ichiic/ig4_acpi.c
+++ b/sys/dev/ichiic/ig4_acpi.c
@@ -99,6 +99,8 @@ ig4iic_acpi_attach(device_t dev)
 	    strcmp(str, "INT3432") == 0 || strcmp(str, "INT3433") == 0) {
 		/* Lynx Point-LP / Wildcat Point-LP LPSS in ACPI mode. */
 		sc->version = IG4_HASWELL;
+	} else if (strcmp(str, "AMDI0010") == 0) {
+		sc->version = IG4_AMD;
 	} else {
 		/* All the other HIDs matched are Atom SOCs. */
 		sc->version = IG4_ATOM;
diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c
index a326d487e1d9..c4dcaca4da00 100644
--- a/sys/dev/ichiic/ig4_iic.c
+++ b/sys/dev/ichiic/ig4_iic.c
@@ -106,6 +106,14 @@ static const struct ig4_hw ig4iic_hw[] = {
 		.txfifo_depth = 32,
 		.rxfifo_depth = 32,
 	},
+	[IG4_AMD] = {
+		.ic_clock_rate = 150,
+		.sda_fall_time = 280,
+		.scl_fall_time = 240,
+		.sda_hold_time = 60,
+		.txfifo_depth = 32,
+		.rxfifo_depth = 32,
+	},
 	[IG4_SKYLAKE] = {
 		.ic_clock_rate = 120,
 		.sda_hold_time = 230,
@@ -849,7 +857,8 @@ ig4iic_get_config(ig4iic_softc_t *sc)
 		sc->cfg.bus_speed = IG4_CTL_SPEED_FAST;
 
 	/* REG_COMP_PARAM1 is not documented in latest Intel specs */
-	if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) {
+	if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM ||
+	    sc->version == IG4_AMD) {
 		v = reg_read(sc, IG4_REG_COMP_PARAM1);
 		if (IG4_PARAM1_TXFIFO_DEPTH(v) != 0)
 			sc->cfg.txfifo_depth = IG4_PARAM1_TXFIFO_DEPTH(v);
@@ -995,7 +1004,8 @@ ig4iic_set_config(ig4iic_softc_t *sc, bool reset, bool force_restore)
 		v = reg_read(sc, IG4_REG_IDLE_LTR_VALUE);
 	}
 
-	if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM) {
+	if (sc->version == IG4_HASWELL || sc->version == IG4_ATOM ||
+	    sc->version == IG4_AMD) {
 		v = reg_read(sc, IG4_REG_COMP_VER);
 		if (v < IG4_COMP_MIN_VER)
 			return(ENXIO);
diff --git a/sys/dev/ichiic/ig4_var.h b/sys/dev/ichiic/ig4_var.h
index 0d000ab34c1d..91d467a11d83 100644
--- a/sys/dev/ichiic/ig4_var.h
+++ b/sys/dev/ichiic/ig4_var.h
@@ -45,6 +45,7 @@ enum ig4_vers {
 	IG4_EMAG,
 	IG4_HASWELL,
 	IG4_ATOM,
+	IG4_AMD,
 	IG4_SKYLAKE,
 	IG4_APL,
 	IG4_CANNONLAKE,