From nobody Sat Feb 7 16:26:55 2026 Received: from mail-dy1-f178.google.com (mail-dy1-f178.google.com [74.125.82.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21A09246778 for ; Tue, 20 Jan 2026 01:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768873048; cv=none; b=ZSvmKeyKcDKuOe2QPu7i4GC95ltBZPECY1XtQIcZSv7IZl94xzJkOiZLdO3wOWD6AxsE/d/8QCoz8vtwsOQDVbxl6LpMzhA59Bd0iLy0i/TbTcbgTzNYkzBNx4wlzpuEZBgECfpnWSHFlQLCne6w4KR+Id6UQO7OfVwVjGmNyXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768873048; c=relaxed/simple; bh=m30+RpDNnkg8xHt7cNwbdu7n3SlrHrGfQYim0hkdS3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BD+1i6PXa8qGk1kCNDcyC39csks5bACKJn72uc5n6vU1az6qxQfZJgS249ansjPVVV7uqXmMTxTZo5uqqpAccja3RVdSgCbh8W0j7HvLguI03ohBRgv9QpASZrVZ2RQRse5jRyPboWb3ufVgDnMqSgmHbARxUjKZaJ0NuKNQHwg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZSsIpIOY; arc=none smtp.client-ip=74.125.82.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZSsIpIOY" Received: by mail-dy1-f178.google.com with SMTP id 5a478bee46e88-2ae287a8444so2284081eec.0 for ; Mon, 19 Jan 2026 17:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768873044; x=1769477844; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gH82B8wM8CiGczLPrX3tBjZxmPDBBF0WQaYSUsGab4s=; b=ZSsIpIOYFTJsLe+qFjI0W5cIkmHH6YAQipC8Mep+ZL4uB3CpU6pGLNwPsyGSxJeCCg 9nMD3JHKDYiEjNGZhH6KuD/JZMCtC+M0T0KCW+l2TEj8CjgROwt02rlckpBcNsDQVmFx g28oJhS7C+ddRk7YsmyKx1Rf2drF4zXOwCHEU/cDoFKofk39vNVXGRpoxM+eNSZigffp 1+LHS/ew7I4NcVtmmSwBuKjy4gArRak/v8HU9braJjr+6zurCspuJTA3hhRsDmpasjUQ 3DsOdQCCE877XLnjmJ+ajmT6MGNtkkBbmCFa08t1OTYquZtWBuk8GGSi8zCwpo2Rl5t+ JrMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768873044; x=1769477844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=gH82B8wM8CiGczLPrX3tBjZxmPDBBF0WQaYSUsGab4s=; b=bP60fgZLLl3erIvkjQZYnOQThNqw88a7vFiTkRPPzia8nKvwVF+hEqVVEgdwl45/AT venOIqlQurrgPhY+sz22oKo5zb48LwC4NYooDqhVXzKRaHX2wo/dH1LDCX1xK6OSz5ge oKLq8F8u0p6AElQckPhM9bF3pwu0HXuknDYBuDPOYbHbY4VtNBa/09ixEqKHeQTd/hdN IkQemXiNQLB5uT9RnSJqCJ1Ewq22hnkGkbzdUbbKt1l/SlCZ5cnI8iIj8yAOAGoRrP8Z XBwB6prSNwsIdwliGL/0uFHxA+aOHYp8MfQF+JdjWVAX91VbE14Bxp4uDupcP9LDd9uk Ri8Q== X-Forwarded-Encrypted: i=1; AJvYcCVF+blmnGwTUTCeRL8Gg0FVpWsYAM6ePZ7X4sb5wWlkrNNQyCK3Nnyh+xCgOAvSfL0NvtP9uc58RdWQj/A=@vger.kernel.org X-Gm-Message-State: AOJu0Yyks/lljahgewbEuhEgSsJswsLlGir9w/NtsArWaDcMcDJLQzHy FT7BDEZDD6mqqKpXGBfSE9287F8V5eoUv3UEwRSK6wK2cBFVcU3NQBde X-Gm-Gg: AZuq6aIM+vZ7WKXHZ2Mn2OU1/0Hzd0837heDs/4Rm8SMjlf9jDxzuEB7Ht0HAUew5gI X+0lw1vLXq8EDFSKzExPj6xJmHw/QBbtzBwT5tyip8zlE6vsz6VbjKslfFqXQB7P7K3C2tvB+h4 v95VN7yewY6nub9y0QHxRpT9d2MiwioPtKLN/X2OspDEpixgs8LkbRZHJku7yXw4AIsxg/kbrKs 86ZmlsxCPC7Nnc1f2oMxp8A6h6zSJ/gfNn3XbdaepzkdLSsNA1E7zfOezU5csrOfdNPfXrtNLQ3 wbzLemfD8Lkzq2tbdZ1ud/Sfjb8W7eGPqYUMSKFK89FxAxqbMl/gWDBaOOqgXUZxdNiXwfvfSrt 9FAUpfbPzY2ROMqQKXAxHSibqd1LRSvc6JP3ciDQ3O4bFdg/oJAO2EnSbhJdj6MwhNQjKpyYuLx +ZEBrOw9NZeQ== X-Received: by 2002:a05:693c:6097:b0:2b6:b9c2:7b48 with SMTP id 5a478bee46e88-2b6b9c27beemr9582735eec.20.1768873042756; Mon, 19 Jan 2026 17:37:22 -0800 (PST) Received: from localhost ([2001:19f0:ac00:4eb8:5400:5ff:fe30:7df3]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b6b3502d22sm15297558eec.10.2026.01.19.17.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jan 2026 17:37:22 -0800 (PST) From: Inochi Amaoto To: Eugeniy Paltsev , Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen Wang , Inochi Amaoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Alexander Sverdlin , Longbin Li , Ze Huang Cc: dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, sophgo@lists.linux.dev, linux-riscv@lists.infradead.org, Yixun Lan Subject: [PATCH v3 2/3] dmaengine: dw-axi-dmac: Add support for CV1800B DMA Date: Tue, 20 Jan 2026 09:37:04 +0800 Message-ID: <20260120013706.436742-3-inochiama@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260120013706.436742-1-inochiama@gmail.com> References: <20260120013706.436742-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As the DMA controller on Sophgo CV1800 series SoC only has 8 channels, the SoC provides a dma multiplexer to reuse the DMA channel. However, the dma multiplexer also controls the DMA interrupt multiplexer, which means that the dma multiplexer needs to know the channel number. Allow the driver to use DMA phandle args as the channel number, so the DMA multiplexer can route the DMA interrupt correctly. Signed-off-by: Inochi Amaoto Reviewed-by: Frank Li --- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 25 ++++++++++++++++--- drivers/dma/dw-axi-dmac/dw-axi-dmac.h | 1 + 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/d= w-axi-dmac/dw-axi-dmac-platform.c index b23536645ff7..89ded0207832 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -50,6 +50,7 @@ #define AXI_DMA_FLAG_HAS_APB_REGS BIT(0) #define AXI_DMA_FLAG_HAS_RESETS BIT(1) #define AXI_DMA_FLAG_USE_CFG2 BIT(2) +#define AXI_DMA_FLAG_ARG0_AS_CHAN BIT(3) =20 static inline void axi_dma_iowrite32(struct axi_dma_chip *chip, u32 reg, u32 val) @@ -1360,16 +1361,27 @@ static int __maybe_unused axi_dma_runtime_resume(st= ruct device *dev) static struct dma_chan *dw_axi_dma_of_xlate(struct of_phandle_args *dma_sp= ec, struct of_dma *ofdma) { + unsigned int handshake =3D dma_spec->args[0]; struct dw_axi_dma *dw =3D ofdma->of_dma_data; - struct axi_dma_chan *chan; + struct axi_dma_chan *chan =3D NULL; struct dma_chan *dchan; =20 - dchan =3D dma_get_any_slave_channel(&dw->dma); + if (dw->hdata->use_handshake_as_channel_number) { + if (handshake >=3D dw->hdata->nr_channels) + return NULL; + + chan =3D &dw->chan[handshake]; + dchan =3D dma_get_slave_channel(&chan->vc.chan); + } else { + dchan =3D dma_get_any_slave_channel(&dw->dma); + } + if (!dchan) return NULL; =20 - chan =3D dchan_to_axi_dma_chan(dchan); - chan->hw_handshake_num =3D dma_spec->args[0]; + if (!chan) + chan =3D dchan_to_axi_dma_chan(dchan); + chan->hw_handshake_num =3D handshake; return dchan; } =20 @@ -1508,6 +1520,8 @@ static int dw_probe(struct platform_device *pdev) return ret; } =20 + chip->dw->hdata->use_handshake_as_channel_number =3D !!(flags & AXI_DMA_F= LAG_ARG0_AS_CHAN); + chip->dw->hdata->use_cfg2 =3D !!(flags & AXI_DMA_FLAG_USE_CFG2); =20 chip->core_clk =3D devm_clk_get(chip->dev, "core-clk"); @@ -1663,6 +1677,9 @@ static const struct of_device_id dw_dma_of_id_table[]= =3D { }, { .compatible =3D "intel,kmb-axi-dma", .data =3D (void *)AXI_DMA_FLAG_HAS_APB_REGS, + }, { + .compatible =3D "sophgo,cv1800b-axi-dma", + .data =3D (void *)AXI_DMA_FLAG_ARG0_AS_CHAN, }, { .compatible =3D "starfive,jh7110-axi-dma", .data =3D (void *)(AXI_DMA_FLAG_HAS_RESETS | AXI_DMA_FLAG_USE_CFG2), diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h b/drivers/dma/dw-axi-dma= c/dw-axi-dmac.h index b842e6a8d90d..67cc199e24d1 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac.h +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac.h @@ -34,6 +34,7 @@ struct dw_axi_dma_hcfg { bool reg_map_8_channels; bool restrict_axi_burst_len; bool use_cfg2; + bool use_handshake_as_channel_number; }; =20 struct axi_dma_chan { --=20 2.52.0