[PATCH] cmd/dma: implement dmareset command

Tom Rini trini at konsulko.com
Fri Sep 12 22:35:11 CEST 2025


On Mon, Sep 01, 2025 at 06:25:01AM +0800, briansune wrote:

> Add dmareset command to release PL330 DMA channel resets.
> 
> Signed-off-by: briansune <briansune at gmail.com>
> ---
>  cmd/Kconfig  |  7 +++++++
>  cmd/Makefile |  1 +
>  cmd/dma.c    | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 60 insertions(+)
>  create mode 100644 cmd/dma.c
> 
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index e55a48a49af..720e3121018 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1149,6 +1149,13 @@ config CMD_DM
>  	  can be useful to see the state of driver model for debugging or
>  	  interest.
>  
> +config CMD_DMA
> +	bool "dma - Release Reset DMA Channels for PL330 Handshake"
> +	default y

New commands should not be "default y" and this likely doesn't build in
a whole lot of cases. If this is indeed PL330 specific, it should have a
less-generic name.

> +	help
> +	  Provides access to Reset Manager Per2ModRst. Enables DMA
> +	  channels for ARM PrimeCell PL330 via reset release.
> +
>  config CMD_FASTBOOT
>  	bool "fastboot - Android fastboot support"
>  	depends on FASTBOOT
> diff --git a/cmd/Makefile b/cmd/Makefile
> index 082470fa104..748c53767b8 100644
> --- a/cmd/Makefile
> +++ b/cmd/Makefile
> @@ -54,6 +54,7 @@ obj-$(CONFIG_CMD_CPU) += cpu.o
>  obj-$(CONFIG_CMD_DATE) += date.o
>  obj-$(CONFIG_CMD_DEMO) += demo.o
>  obj-$(CONFIG_CMD_DM) += dm.o
> +obj-$(CONFIG_CMD_DMA) += dma.o
>  obj-$(CONFIG_CMD_UFETCH) += ufetch.o
>  obj-$(CONFIG_CMD_SOUND) += sound.o
>  ifdef CONFIG_POST
> diff --git a/cmd/dma.c b/cmd/dma.c
> new file mode 100644
> index 00000000000..b35c2f32fcc
> --- /dev/null
> +++ b/cmd/dma.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Brian Sune <briansune at gmail.com>
> + */
> +
> +#include <vsprintf.h>
> +#include <command.h>
> +#include <asm/io.h>
> +
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +#include <asm/arch/base_addr_ac5.h>
> +#endif

If this can't be done generally for ARM then we shouldn't guard the
include, it needs to be part of the Kconfig dependencies.

> +#define RSTMGR_PERMODRST 0x18   /* PERMODRST register offset */
> +
> +static int do_dmareset(struct cmd_tbl *cmdtp, int flag, int argc,
> +	char * const argv[])

Incorrect spacing, please use checkpatch.pl to find and correct issues
like this. Thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250912/81ea71ba/attachment.sig>


More information about the U-Boot mailing list