From nobody Wed Mar 26 12:11:00 2025
X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZN5Gr5L8Xz5rr3T;
Wed, 26 Mar 2025 12:11:00 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
client-signature RSA-PSS (4096 bits) client-digest SHA256)
(Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK))
by mx1.freebsd.org (Postfix) with ESMTPS id 4ZN5Gr4PCTz3vS3;
Wed, 26 Mar 2025 12:11:00 +0000 (UTC)
(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1742991060;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=Fa5eKrh+twAY5RILu+9N/yHrcZxAiE5c5MKtNt40Fdo=;
b=sY2ZCIky6ozGn9onu/ypE+hz6+n6QEZtR96KCgi7gF242xDxasUehO1b/amwGBpLgLwHl5
9pQjrmpz+UEEeF6QfTXOvVfdL1224VCnL16f/woENW6YjpxREskRL42PTvpB5eSr2hMMlh
bVEcUxZVUydYhzhe5PgAwV3hcWc8p5Ay0KhAtfb4uQAUsVW+ksea49N5cDsR1r+Idg5xi5
LsR1DTJGsuurg7aTkPOiPMWsHnErJW8UNkOp7WCFuFbEPCU81UGW4f8Y+hDjq9tmik5UJ2
HfND5qLyyY1aP+5MQfuHpyoNtOSAEyxyvaCHE1Jxgr3AajHgBvIW9/qpcSKpag==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1742991060; a=rsa-sha256; cv=none;
b=KKhcFwowctVISvQhQ2Y3gbzQ20BfTeU0vOu8iDfsEano7hcVFPNE4QfDArZKPpBSNvOuTS
/HP8wN9WhRBnUZ9A7pOovSOthUyeXNqqrX1ULQISfa1p9VoUJoXVysvQ/VslnoR95yAfi6
6fbf7VZj3eVmLUqGGyZD/snztWNNvLasbd8id0WT7wkTrurHGcMVWBcUrJgjPDiK4VrW+6
8z0cVBiLzjvbZ+WGchM5X/QcjlLDsfwqUAJvH0DeObQ2bc+hdcRy4TxcEOOjBUxxDmpDHG
6ilARZpHnYZo3CVBYwQYnQx8w84WvARA024O/58ZKYzFIYpuVozLEHDx3KHiQQ==
ARC-Authentication-Results: i=1;
mx1.freebsd.org;
none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
s=dkim; t=1742991060;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding;
bh=Fa5eKrh+twAY5RILu+9N/yHrcZxAiE5c5MKtNt40Fdo=;
b=Ebceei1B0ZTEAWnTEwAF6aClKXjultyID6auKQD2lHUko2vGEJAIDwUTWS5N6rD2WS0w+D
UkHcK+XD3A1rcyE3WKZeNiQ11qvGx0dF37/k9VLLMuw20k7ssDn2UjveRT7el89KxoyfLf
GJWyaioHZPWFTPQLd0W6cN9dbykC3GFYnAdZ2X5LQh4FAB4vkbFYalLKENYMZH6FOgHYyU
dozpscOcDeMLCdFGTCzJMwZAJXznDM8D+sMat9DIRDiqX8L7lpa3PHA3M34xZeKXgYMHKU
JaxLv1rHYtfHUa4fPgtqDsjYt1OWsuXBt37sO6LKREAc68LaEAbLACs7BqMc9A==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
(Client did not present a certificate)
by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ZN5Gr40n7z1PMv;
Wed, 26 Mar 2025 12:11:00 +0000 (UTC)
(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 52QCB0QQ052507;
Wed, 26 Mar 2025 12:11:00 GMT
(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 52QCB0jk052504;
Wed, 26 Mar 2025 12:11:00 GMT
(envelope-from git)
Date: Wed, 26 Mar 2025 12:11:00 GMT
Message-Id: <202503261211.52QCB0jk052504@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin
Subject: git: c7ffe32b1b7d - main - xilinx quad spi: various fixes.
List-Id: Commit messages for the main branch of the src repository
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help:
List-Post:
List-Subscribe:
List-Unsubscribe:
X-BeenThere: dev-commits-src-main@freebsd.org
Sender: owner-dev-commits-src-main@FreeBSD.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: c7ffe32b1b7de9d72add1b44d5d3a3a14605a8f0
Auto-Submitted: auto-generated
The branch main has been updated by br:
URL: https://cgit.FreeBSD.org/src/commit/?id=c7ffe32b1b7de9d72add1b44d5d3a3a14605a8f0
commit c7ffe32b1b7de9d72add1b44d5d3a3a14605a8f0
Author: Ruslan Bukin
AuthorDate: 2025-03-26 11:53:24 +0000
Commit: Ruslan Bukin
CommitDate: 2025-03-26 12:08:27 +0000
xilinx quad spi: various fixes.
- add compat table and a string for an older IP
- name driver properly
- depend on ofw_spibus
- add missing ofw_bus_get_node() method
- connect to GENERIC (similar to other Xilinx IP)
Tested on Codasip A730.
---
sys/dev/xilinx/axi_quad_spi.c | 31 +++++++++++++++++++++++++------
sys/riscv/conf/GENERIC | 1 +
2 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/sys/dev/xilinx/axi_quad_spi.c b/sys/dev/xilinx/axi_quad_spi.c
index eba320731659..86b00473fc96 100644
--- a/sys/dev/xilinx/axi_quad_spi.c
+++ b/sys/dev/xilinx/axi_quad_spi.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2016 Ruslan Bukin
+ * Copyright (c) 2016-2025 Ruslan Bukin
* All rights reserved.
*
* Portions of this software were developed by SRI International and the
@@ -100,6 +100,12 @@ struct spi_softc {
void *ih;
};
+static struct ofw_compat_data compat_data[] = {
+ { "xlnx,xps-spi-3.2", 1 },
+ { "xlnx,xps-spi-2.00.a", 1 },
+ { NULL, 0 }
+};
+
static struct resource_spec spi_spec[] = {
{ SYS_RES_MEMORY, 0, RF_ACTIVE },
{ -1, 0 }
@@ -112,7 +118,7 @@ spi_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
- if (!ofw_bus_is_compatible(dev, "xlnx,xps-spi-3.2"))
+ if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
return (ENXIO);
device_set_desc(dev, "Xilinx Quad SPI");
@@ -148,7 +154,7 @@ spi_attach(device_t dev)
reg = (CR_MASTER | CR_MSS | CR_SPE);
WRITE4(sc, SPI_CR, reg);
- device_add_child(dev, "spibus", 0);
+ device_add_child(dev, "spibus", DEVICE_UNIT_ANY);
bus_attach_children(dev);
return (0);
}
@@ -212,20 +218,33 @@ spi_transfer(device_t dev, device_t child, struct spi_command *cmd)
return (0);
}
+static phandle_t
+axispi_get_node(device_t bus, device_t dev)
+{
+
+ return (ofw_bus_get_node(bus));
+}
+
static device_method_t spi_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, spi_probe),
DEVMETHOD(device_attach, spi_attach),
+ /* ofw_bus_if */
+ DEVMETHOD(ofw_bus_get_node, axispi_get_node),
+
/* SPI interface */
DEVMETHOD(spibus_transfer, spi_transfer),
DEVMETHOD_END
};
-static driver_t spi_driver = {
- "spi",
+static driver_t axispi_driver = {
+ "axispi",
spi_methods,
sizeof(struct spi_softc),
};
-DRIVER_MODULE(spi, simplebus, spi_driver, 0, 0);
+DRIVER_MODULE(axispi, simplebus, axispi_driver, 0, 0);
+DRIVER_MODULE(ofw_spibus, axispi, ofw_spibus_driver, 0, 0);
+MODULE_DEPEND(axispi, ofw_spibus, 1, 1, 1);
+SIMPLEBUS_PNP_INFO(compat_data);
diff --git a/sys/riscv/conf/GENERIC b/sys/riscv/conf/GENERIC
index 8dca3bdb3369..7d7d0ca6e79c 100644
--- a/sys/riscv/conf/GENERIC
+++ b/sys/riscv/conf/GENERIC
@@ -161,6 +161,7 @@ device fdt_pinctrl
# SPI
device spibus
device spigen
+device xilinx_spi # Xilinx AXI SPI Controller
# Debugging support. Always need this:
options KDB # Enable kernel debugger support.