All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies
@ 2025-09-13  8:04 briansune
  2025-09-13 15:55 ` Tom Rini
  0 siblings, 1 reply; 4+ messages in thread
From: briansune @ 2025-09-13  8:04 UTC (permalink / raw)
  To: u-boot; +Cc: trini, briansune

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.

Tested-by: Sune Brian <briansune@gmail.com>
Tested on: Cyclone V SoCDK

Signed-off-by: briansune <briansune@gmail.com>
---
 cmd/Kconfig        |  9 +++++++++
 cmd/Makefile       |  1 +
 cmd/c5_pl330_dma.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)
 create mode 100644 cmd/c5_pl330_dma.c

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..53bd7a44b7e
--- /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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies
  2025-09-13  8:04 [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies briansune
@ 2025-09-13 15:55 ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2025-09-13 15:55 UTC (permalink / raw)
  To: briansune; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

On Sat, Sep 13, 2025 at 04:04:14PM +0800, briansune wrote:

> 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.
> 
> Tested-by: Sune Brian <briansune@gmail.com>
> Tested on: Cyclone V SoCDK
> 
> Signed-off-by: briansune <briansune@gmail.com>

This is better, yes. The subject should be fixed, your real name used in
the Signed-off-by (and you don't give yourself a Tested-by for what you
wrote). Also:

> ---
>  cmd/Kconfig        |  9 +++++++++
>  cmd/Makefile       |  1 +
>  cmd/c5_pl330_dma.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+)
>  create mode 100644 cmd/c5_pl330_dma.c
> 
> 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

This should just be "depends on TARGET_SOCFPGA_CYCLONE5_SOCDK" if it's
that specific and not slightly more usable on other SOCFPGA chipsets.

[snip]
> +static int do_dmareset(struct cmd_tbl *cmdtp, int flag, int argc,
> +	char * const argv[])

This spacing is still wrong and what checkpatch.pl notes. Thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies
@ 2025-09-13 16:39 briansune
  2025-09-23 11:47 ` Quentin Schulz
  0 siblings, 1 reply; 4+ messages in thread
From: briansune @ 2025-09-13 16:39 UTC (permalink / raw)
  To: u-boot; +Cc: trini, briansune

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies
  2025-09-13 16:39 briansune
@ 2025-09-23 11:47 ` Quentin Schulz
  0 siblings, 0 replies; 4+ messages in thread
From: Quentin Schulz @ 2025-09-23 11:47 UTC (permalink / raw)
  To: briansune, u-boot; +Cc: trini

Hi Brian,


The git commit title doesn't seem related to the actual content of the 
patch?

On 9/13/25 6:39 PM, briansune wrote:
> [You don't often get email from briansune@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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.

Isn't this something that should be done by boards directly (i.e. 
somewhere in board/ directory) or at the SoC/arch level (i.e. arch/arm 
or arch/arm/mach-socfpga) or handle that in a DMA driver (I assume 
there's none now looking at drivers/dma/)? Essentially the question is 
"why do we need this as a command?".

> 
> Signed-off-by: briansune <briansune@gmail.com>

Needs to be Brian Sune here (same for the commit author which you can 
change with git commit --amend --author="Brian Sune 
<briansune@gmail.com>" if I remember correctly).

> ---
>   cmd/4913           |  0
>   cmd/5036           |  0

We don't need those files I assume?

Cheers,
Quentin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-23 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13  8:04 [PATCH] cmd/dma: fix generic naming, spacing, and Dependencies briansune
2025-09-13 15:55 ` Tom Rini
  -- strict thread matches above, loose matches on Subject: below --
2025-09-13 16:39 briansune
2025-09-23 11:47 ` Quentin Schulz

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.