From: briansune <briansune@gmail.com>
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, briansune <briansune@gmail.com>
Subject: [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies
Date: Sun, 14 Sep 2025 00:39:13 +0800 [thread overview]
Message-ID: <20250913163913.395-1-briansune@gmail.com> (raw)
This adds a new U-Boot command 'c5_pl330_dma' for Cyclone V SoCDK
boards. It provides access to the Reset Manager's Per2ModRst register
to release the reset for ARM PrimeCell PL330 DMA channels. This allows
software to initialize and use the PL330 DMA controller properly after
reset.
Signed-off-by: briansune <briansune@gmail.com>
---
cmd/4913 | 0
cmd/5036 | 0
cmd/Kconfig | 9 +++++++++
cmd/Makefile | 1 +
cmd/c5_pl330_dma.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 60 insertions(+)
create mode 100644 cmd/4913
create mode 100644 cmd/5036
create mode 100644 cmd/c5_pl330_dma.c
diff --git a/cmd/4913 b/cmd/4913
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/cmd/5036 b/cmd/5036
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 29de857ba7c..75c388d19da 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1791,6 +1791,15 @@ endmenu
menu "Shell scripting commands"
+if TARGET_SOCFPGA_CYCLONE5_SOCDK
+
+config CMD_C5_PL330_DMA
+ bool "Release Reset DMA Channels for PL330 Handshake"
+ help
+ Provides access to Reset Manager Per2ModRst. Enables DMA
+ channels for ARM PrimeCell PL330 via reset release.
+endif
+
config CMD_CAT
bool "cat"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 36e79cc3c28..d16e6fae20a 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -42,6 +42,7 @@ obj-$(CONFIG_CMD_BOOTI) += booti.o
obj-$(CONFIG_CMD_BTRFS) += btrfs.o
obj-$(CONFIG_CMD_BUTTON) += button.o
obj-$(CONFIG_CMD_CAT) += cat.o
+obj-$(CONFIG_CMD_C5_PL330_DMA) += c5_pl330_dma.o
obj-$(CONFIG_CMD_CACHE) += cache.o
obj-$(CONFIG_CMD_CBFS) += cbfs.o
obj-$(CONFIG_CMD_CEDIT) += cedit.o
diff --git a/cmd/c5_pl330_dma.c b/cmd/c5_pl330_dma.c
new file mode 100644
index 00000000000..5267ea2bd44
--- /dev/null
+++ b/cmd/c5_pl330_dma.c
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Brian Sune <briansune@gmail.com>
+ */
+
+#include <vsprintf.h>
+#include <command.h>
+#include <asm/io.h>
+
+#include <asm/arch/base_addr_ac5.h>
+
+#define RSTMGR_PERMODRST 0x18 /* PERMODRST register offset */
+
+static int do_dmareset(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ u8 val;
+ int i, ch;
+
+ if (argc < 2) {
+ printf("Usage: dmareset <channel 0-7> [<channel 0-7> ...]\n");
+ return CMD_RET_USAGE;
+ }
+
+ /* Read current register value */
+ val = readb(SOCFPGA_RSTMGR_ADDRESS + RSTMGR_PERMODRST);
+
+ /* Iterate over all channels given as arguments */
+ for (i = 1; i < argc; i++) {
+ ch = simple_strtoul(argv[i], NULL, 0);
+ if (ch < 0 || ch > 7) {
+ printf("Error: channel must be 0-7\n");
+ return CMD_RET_USAGE;
+ }
+ val &= ~(1 << ch);
+ printf("PL330 DMA channel %d reset released\n", ch);
+ }
+
+ /* Write back */
+ writeb(val, (SOCFPGA_RSTMGR_ADDRESS + RSTMGR_PERMODRST));
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ dmareset, 8, 0, do_dmareset,
+ "Release PL330 DMA channel reset(s) for SoCFPGA",
+ "dmareset <channel 0-7> [<channel 0-7> ...] - release reset for one or more DMA channels"
+);
+
--
2.47.1.windows.1
next reply other threads:[~2025-09-14 13:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-13 16:39 briansune [this message]
2025-09-23 11:47 ` [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies Quentin Schulz
2025-09-23 18:12 ` [PATCH v2] cmd/dma: implement dmareset command briansune
2025-10-08 4:22 ` Tom Rini
2025-10-08 11:09 ` Sune Brian
2025-10-08 15:34 ` Sune Brian
2025-10-08 16:06 ` Tom Rini
-- strict thread matches above, loose matches on Subject: below --
2025-09-13 8:04 [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies briansune
2025-09-13 15:55 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250913163913.395-1-briansune@gmail.com \
--to=briansune@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.