git: b109946d7564 - main - intelspi: Release LPSS reset on Sunrise Point controllers.

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Thu, 03 Aug 2023 16:12:02 UTC
The branch main has been updated by wulf:

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

commit b109946d7564afde6f3d3b3a78f428c8da14e17c
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-08-03 16:10:50 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2023-08-03 16:10:50 +0000

    intelspi: Release LPSS reset on Sunrise Point controllers.
    
    MacBookPro 14.1 SPI controller requires that to start functioning.
    
    MFC after:      1 week
    Reviewed by:    manu
    Differential Revision:  https://reviews.freebsd.org/D41245
---
 sys/dev/intel/spi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
index 42caed0c1c02..6dd063511e26 100644
--- a/sys/dev/intel/spi.c
+++ b/sys/dev/intel/spi.c
@@ -109,6 +109,10 @@
 #define	 SPI_CS_CTRL_HW_MODE			(1 << 0)
 #define	 SPI_CS_CTRL_CS_HIGH			(1 << 1)
 
+#define	INTELSPI_RESETS			0x204
+#define	 INTELSPI_RESET_HOST			(1 << 0) | (1 << 1)
+#define	 INTELSPI_RESET_DMA			(1 << 2)
+
 /* Same order as intelspi_vers */
 static const struct intelspi_info {
 	uint32_t reg_lpss_base;
@@ -477,6 +481,11 @@ intelspi_attach(device_t dev)
 		goto error;
 	}
 
+	/* Release LPSS reset */
+	if (sc->sc_vers == SPI_SUNRISEPOINT)
+		INTELSPI_WRITE(sc, INTELSPI_RESETS,
+		    (INTELSPI_RESET_HOST | INTELSPI_RESET_DMA));
+
 	sc->sc_irq_res = bus_alloc_resource_any(sc->sc_dev,
 	    SYS_RES_IRQ, &sc->sc_irq_rid, RF_ACTIVE | RF_SHAREABLE);
 	if (sc->sc_irq_res == NULL) {