From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AD353148D6; Mon, 1 Dec 2025 13:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596605; cv=none; b=CO2Vi9GVJrwEBsC51aTTPOp70Miyg1HfhsEg9lm1wijEt8H3ZfsgX5AIyLbd1jvZDoSgK//A1n3/uZ+2Tn2D1GNCBDfwTnU7V5PzFwHJRFSKFdcXvnlzowbdMv8EFw8ia+l6m9yjVcTqnsj5ODJ7XPpzjVO7a4tkmkrXYRpWz3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596605; c=relaxed/simple; bh=Fib4tjZyVTB7PnpP79JySpsl6fr2rviiZtpD1YJeTpg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FfjRxj/YjUxNqgJFkinQT6cBXr64CIi80fWSGzqTNi56BIMcTnM0Si+rGeAtw4MJYWjMi8YNoFhrwMNamHPz2wDytK/VoTf84/Tr/GFxVTiy1GJoEjHK5Te5PkHnoryDd90m3KvlaF0lwd6beclVWxyDPk2hIfPT2GZ9BPLqBBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: kI/GulQJTuiQStPNoI1fAQ== X-CSE-MsgGUID: sQGvT46lS4G3QuNm8Wvpnw== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:23 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 28D594215A4E; Mon, 1 Dec 2025 22:43:18 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 01/13] spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation Date: Mon, 1 Dec 2025 15:42:17 +0200 Message-ID: <20251201134229.600817-2-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" Add the missing space to align to open pararenthesis. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 1db7e4e5d64e..8cffc9cb6b6b 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -225,8 +225,8 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv *r= spi, void *rxbuf, } =20 static int rzv2h_rspi_transfer_one(struct spi_controller *controller, - struct spi_device *spi, - struct spi_transfer *transfer) + struct spi_device *spi, + struct spi_transfer *transfer) { struct rzv2h_rspi_priv *rspi =3D spi_controller_get_devdata(controller); unsigned int words_to_transfer, i; --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD491313534; Mon, 1 Dec 2025 13:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596611; cv=none; b=bP3N8S41pceeDcoX4P8QJOibiixS89G9r3D8UVmhOAeOshHwxYCgOGAGhO4fIHduviXzRLKrhhsSnYteG48OQGwwnddUYiw/F4hKF0GcONUuLQzeE4aNxk6gTJ00BHXJI6HqcAEoI9RwKGcaKxnW4kJqQKLNNfLLFx+O0pR63GA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596611; c=relaxed/simple; bh=Wy33NiifHsGZ2jBbQSNKzWdZMQQXU0K2+FtJ2agEbVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cX/y6cCnmjRCx2GcM2PmboAOjE0B53uHz2pfts3t+q9GdjdCxxhN6jsJnteA8VbK7W2h921SalcT/dL4QhJGbfgVGrY+UCzf9ZoGEuZm9r52NvzICnqpbh/mLK4vm+F/RmzDBJyx6K386ssI/dEKIH4dA1tWN97WQJzX/LgcPV4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: rKpREmTeQ92SHgn3gB4ayQ== X-CSE-MsgGUID: KZM1urBQR/KJH1t374WmMg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:28 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 61F654215A52; Mon, 1 Dec 2025 22:43:24 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 02/13] spi: rzv2h-rspi: remove call to spi_finalize_current_transfer() Date: Mon, 1 Dec 2025 15:42:18 +0200 Message-ID: <20251201134229.600817-3-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" A call to spi_finalize_current_transfer() is only needed when the SPI transfer is completed outside of the current context, when the .transfer_one() implementation returns > 0. Since the SPI transfer is completed in the current context, and we return 0 from .transfer_one(), the SPI core assumes that the transfer has completed and it does not wait for the completion variable that would be set by a call to spi_finalize_current_transfer(). Remove the call to spi_finalize_current_transfer(). Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 8cffc9cb6b6b..beea4fb83d10 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -250,8 +250,6 @@ static int rzv2h_rspi_transfer_one(struct spi_controlle= r *controller, if (ret) transfer->error =3D SPI_TRANS_FAIL_IO; =20 - spi_finalize_current_transfer(controller); - return ret; } =20 --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 008FF2ECD28; Mon, 1 Dec 2025 13:43:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596616; cv=none; b=nk2phOLxP0xBEt6f3Ov3Z3AT0iqcvJ5/7Gu9lGmFreJr0CuqewkOzjx1CIrL7IyNqr/DgXFNAeZRerGqo7FVT4VGQHD01CU6uKB7x/Re4GbJ+BtF5OnpH2QRxnENPQvdMhC9IQG/Rb2yb+NsJndsw32xno4VT8tYUvPT27t0QS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596616; c=relaxed/simple; bh=U1O5hkd2zV2cbV4QTachtVEfCAhSsumnJrjriXdmGtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iB09vNb+KKLhLFskGN+2EARs0bvc6XUSiB3Sqgx6F9ORTlqxH3kh9Q+VLS1cYGbaHwAG5GM27nZAomBrABDi1HiXGBrXCn2+h0FACKVRP0UKSW+ibXSC+K7X6I28rWBox3K0sH1S1Y6oSaY5QUzEClEUAb8iXI4o3JVdRy50iXg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: 2j4og05HRkW8PcMsrBPFEw== X-CSE-MsgGUID: /3qBSxqTQ5OlOEWtvZIgJw== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:33 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8432D4215A4E; Mon, 1 Dec 2025 22:43:29 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 03/13] spi: rzv2h-rspi: do not set SPI_TRANS_FAIL_IO Date: Mon, 1 Dec 2025 15:42:19 +0200 Message-ID: <20251201134229.600817-4-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" Setting SPI_TRANS_FAIL_IO has no effect if the transfer completes in the current context, as it is only handled when .transfer_one() returns > 0, when the SPI core must wait for the SPI transfer to complete. Do not set SPI_TRANS_FAIL_IO as we either return an error or 0, since we do our own waiting. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index beea4fb83d10..02424d4e722a 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -247,9 +247,6 @@ static int rzv2h_rspi_transfer_one(struct spi_controlle= r *controller, =20 rzv2h_rspi_clear_all_irqs(rspi); =20 - if (ret) - transfer->error =3D SPI_TRANS_FAIL_IO; - return ret; } =20 --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CD98314A6E; Mon, 1 Dec 2025 13:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596625; cv=none; b=iqr12z9lDfphmF8PnO3C0oQN4Kzgh7+7YWPqQivasNnwYEUAy60s2zwFUmX8OWXzV1zo7lYwwJJTKnUoAKL0YSMIcxG6Lb2H6Qmspa356Bd9cwTsURenq+tGY9JoOXsWnAPxKrmRlc38kzY+YeJgADjALmyub/cY/Z7NO4Rm7VY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596625; c=relaxed/simple; bh=29H8bdk1J/fakW8c7X2KWoLqSSTdQ/hUZGjKsn7jzPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tcx7j3PNNP5q/uRidYymtCsZtL2FeaYjw5QX3duPbYziRvBVmX8gQx+QDLolAAdP4w8t7XhhzepVlcKNoSJWlqRer6n5/Zy+Hoi6r+F8MYl6VPuDsUTLoXkfBtgrAJWZy8qAgvtqOyPxCNXqsYe/qYkFfhTcQaM8YqtEYFb40jY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: /BUEYugWTsCEydQ0TlQ1tQ== X-CSE-MsgGUID: Aoc6ZfOwQ0WqR7fskW1y+A== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:38 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 884E34215A52; Mon, 1 Dec 2025 22:43:34 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 04/13] spi: rzv2h-rspi: use device-managed APIs Date: Mon, 1 Dec 2025 15:42:20 +0200 Message-ID: <20251201134229.600817-5-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" Non-device-managed APIs were initially used here to avoid the buggy interaction between PM domains and device-managed actions. Commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()") fixed the interaction between PM domains and device-managed actions. Simplify the code by using device-managed actions to unregister the SPI controller and to assert and release the resets. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 58 ++++++++++++------------------------ 1 file changed, 19 insertions(+), 39 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 02424d4e722a..6163ada3ccbb 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -93,7 +93,6 @@ struct rzv2h_rspi_info { }; =20 struct rzv2h_rspi_priv { - struct reset_control_bulk_data resets[RSPI_RESET_NUM]; struct spi_controller *controller; const struct rzv2h_rspi_info *info; void __iomem *base; @@ -533,6 +532,7 @@ static int rzv2h_rspi_probe(struct platform_device *pde= v) struct spi_controller *controller; struct device *dev =3D &pdev->dev; struct rzv2h_rspi_priv *rspi; + struct reset_control *reset; struct clk_bulk_data *clks; int irq_rx, ret, i; long tclk_rate; @@ -568,28 +568,29 @@ static int rzv2h_rspi_probe(struct platform_device *p= dev) if (!rspi->tclk) return dev_err_probe(dev, -EINVAL, "Failed to get tclk\n"); =20 - rspi->resets[0].id =3D "presetn"; - rspi->resets[1].id =3D "tresetn"; - ret =3D devm_reset_control_bulk_get_optional_exclusive(dev, RSPI_RESET_NU= M, - rspi->resets); - if (ret) - return dev_err_probe(dev, ret, "cannot get resets\n"); + reset =3D devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, + "presetn"); + if (IS_ERR(reset)) + return dev_err_probe(&pdev->dev, PTR_ERR(reset), + "cannot get presetn reset\n"); + + reset =3D devm_reset_control_get_optional_exclusive_deasserted(&pdev->dev, + "tresetn"); + if (IS_ERR(reset)) + return dev_err_probe(&pdev->dev, PTR_ERR(reset), + "cannot get tresetn reset\n"); =20 irq_rx =3D platform_get_irq_byname(pdev, "rx"); if (irq_rx < 0) return dev_err_probe(dev, irq_rx, "cannot get IRQ 'rx'\n"); =20 - ret =3D reset_control_bulk_deassert(RSPI_RESET_NUM, rspi->resets); - if (ret) - return dev_err_probe(dev, ret, "failed to deassert resets\n"); - init_waitqueue_head(&rspi->wait); =20 ret =3D devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0, dev_name(dev), rspi); if (ret) { dev_err(dev, "cannot request `rx` IRQ\n"); - goto quit_resets; + return ret; } =20 controller->mode_bits =3D SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | @@ -601,20 +602,16 @@ static int rzv2h_rspi_probe(struct platform_device *p= dev) controller->transfer_one =3D rzv2h_rspi_transfer_one; =20 tclk_rate =3D clk_round_rate(rspi->tclk, 0); - if (tclk_rate < 0) { - ret =3D tclk_rate; - goto quit_resets; - } + if (tclk_rate < 0) + return tclk_rate; =20 controller->min_speed_hz =3D rzv2h_rspi_calc_bitrate(tclk_rate, RSPI_SPBR_SPR_MAX, RSPI_SPCMD_BRDV_MAX); =20 tclk_rate =3D clk_round_rate(rspi->tclk, ULONG_MAX); - if (tclk_rate < 0) { - ret =3D tclk_rate; - goto quit_resets; - } + if (tclk_rate < 0) + return tclk_rate; =20 controller->max_speed_hz =3D rzv2h_rspi_calc_bitrate(tclk_rate, RSPI_SPBR_SPR_MIN, @@ -622,29 +619,13 @@ static int rzv2h_rspi_probe(struct platform_device *p= dev) =20 device_set_node(&controller->dev, dev_fwnode(dev)); =20 - ret =3D spi_register_controller(controller); - if (ret) { + ret =3D devm_spi_register_controller(dev, controller); + if (ret) dev_err(dev, "register controller failed\n"); - goto quit_resets; - } - - return 0; - -quit_resets: - reset_control_bulk_assert(RSPI_RESET_NUM, rspi->resets); =20 return ret; } =20 -static void rzv2h_rspi_remove(struct platform_device *pdev) -{ - struct rzv2h_rspi_priv *rspi =3D platform_get_drvdata(pdev); - - spi_unregister_controller(rspi->controller); - - reset_control_bulk_assert(RSPI_RESET_NUM, rspi->resets); -} - static const struct rzv2h_rspi_info rzv2h_info =3D { .find_tclk_rate =3D rzv2h_rspi_find_rate_fixed, .tclk_name =3D "tclk", @@ -669,7 +650,6 @@ MODULE_DEVICE_TABLE(of, rzv2h_rspi_match); =20 static struct platform_driver rzv2h_rspi_drv =3D { .probe =3D rzv2h_rspi_probe, - .remove =3D rzv2h_rspi_remove, .driver =3D { .name =3D "rzv2h_rspi", .of_match_table =3D rzv2h_rspi_match, --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9511230DEA2; Mon, 1 Dec 2025 13:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596629; cv=none; b=ufCrZHcShyvPLzB0Ld2iNaNAzVrOtmMuxaquaiSrrkYiSdnUBzl2jJhMTD2ctzMc+Qc02/rb2jJPBYPzEZnfdBofjC1Z8VAb8cltoyZPMO5ywGQcUQZKg1CTO+JOoBxXLb2lZklLeD6DZbZrenEGrE1W1PcFCpE9ZN5BK0pTB/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596629; c=relaxed/simple; bh=HjyliHx7RRVHCDwLyI4GM+IRbi/UU7/RayCPv4NHBtU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jj3x+WAYiqfvW6wXMwni6yeBhmlE5JBsNqSBwTeybMpejLkxPnzhc0DINGbAeqSN5k9/Ka1QD3XxqCS21Um6no5jehhRPeNAplKvW2mMjv4WpVagQX/55OwlO+7jfNHT7tZ+FKmPtbGj9/khTXi4DRWa1fZ+drOGOdLxNwScjuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: k+wmOS5LTui3CTrKODrU/g== X-CSE-MsgGUID: h7mK7av0Trud7Mzf3aDdDA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:44 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 51D9E4215A52; Mon, 1 Dec 2025 22:43:40 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 05/13] spi: rzv2h-rspi: store RX interrupt in state Date: Mon, 1 Dec 2025 15:42:21 +0200 Message-ID: <20251201134229.600817-6-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" In preparation for implementing DMA support, store the RX interrupt number in the private state, to allow disabling it during DMA. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 6163ada3ccbb..50fd7ddef58d 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -100,6 +100,7 @@ struct rzv2h_rspi_priv { struct clk *pclk; wait_queue_head_t wait; unsigned int bytes_per_word; + int irq_rx; u32 last_speed_hz; u32 freq; u16 status; @@ -534,8 +535,8 @@ static int rzv2h_rspi_probe(struct platform_device *pde= v) struct rzv2h_rspi_priv *rspi; struct reset_control *reset; struct clk_bulk_data *clks; - int irq_rx, ret, i; long tclk_rate; + int ret, i; =20 controller =3D devm_spi_alloc_host(dev, sizeof(*rspi)); if (!controller) @@ -580,13 +581,13 @@ static int rzv2h_rspi_probe(struct platform_device *p= dev) return dev_err_probe(&pdev->dev, PTR_ERR(reset), "cannot get tresetn reset\n"); =20 - irq_rx =3D platform_get_irq_byname(pdev, "rx"); - if (irq_rx < 0) - return dev_err_probe(dev, irq_rx, "cannot get IRQ 'rx'\n"); + rspi->irq_rx =3D platform_get_irq_byname(pdev, "rx"); + if (rspi->irq_rx < 0) + return dev_err_probe(dev, rspi->irq_rx, "cannot get IRQ 'rx'\n"); =20 init_waitqueue_head(&rspi->wait); =20 - ret =3D devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0, + ret =3D devm_request_irq(dev, rspi->irq_rx, rzv2h_rx_irq_handler, 0, dev_name(dev), rspi); if (ret) { dev_err(dev, "cannot request `rx` IRQ\n"); --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 388883191A2; Mon, 1 Dec 2025 13:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596634; cv=none; b=vAlmqPH8fqnckzSAxi3i0fANMp87+Q22oGDDAjNS1Rm3ztwjSbuT4TFvkUeYt8izL5fyHIsThm/w6eWH9zMQR+B5vyoSOqqpNSTNOZ4Bf3I32beCL8xIY/MV/EG/f9sScKYbgW5uIra5YUbtL6UshX7yvXqbCX3vFB7z0rOdZhc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596634; c=relaxed/simple; bh=GeAaz+Wi1uM8FERJPGZGCHtKTCzPfUBafULTCaDC5Ik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G21e8CbMw27vx3a+PqmxwBQ1P9Yet6Hp0BzTJ/HQXXz0F++I70KkC2OzFqKW8QOokZQfys40TKAWp+jL0yWdlz4EfMbMJY90CSkgY1BR+UNPMhVYbB/nRcQC7fB3fVRN/PP7dCmkxg7UgSPcNO2095seM9krwzU8K3jI/1fNFT4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: cWu70kYfQVitmQYuxk/ehg== X-CSE-MsgGUID: Alw3zvHxQhu8irJEZIgwTA== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:49 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D1F504215A4E; Mon, 1 Dec 2025 22:43:45 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 06/13] spi: rzv2h-rspi: set MUST_RX/MUST_TX Date: Mon, 1 Dec 2025 15:42:22 +0200 Message-ID: <20251201134229.600817-7-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" In preparation for implementing DMA support, set MUST_RX and MUST_TX flags on the controller so that we always receive non-NULL buffers. The PIO mode already handles this manually by checking if rx_buf/tx_buf are set on the transfer, and doing a dummy read/write if not. DMA will not be able to implement this special handling, and although the SPI controller advertises support for transmit-only or receive-only transfers via SPCR's register TXMD bitfield, it does not seem to work. Remove the special handling for PIO and let the SPI controller core handle it. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 50fd7ddef58d..f0bbbd21c763 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -113,11 +113,7 @@ struct rzv2h_rspi_priv { static inline void rzv2h_rspi_tx_##type(struct rzv2h_rspi_priv *rspi, \ const void *txbuf, \ unsigned int index) { \ - type buf =3D 0; \ - \ - if (txbuf) \ - buf =3D ((type *)txbuf)[index]; \ - \ + type buf =3D ((type *)txbuf)[index]; \ func(buf, rspi->base + RSPI_SPDR); \ } =20 @@ -126,9 +122,7 @@ static inline void rzv2h_rspi_rx_##type(struct rzv2h_rs= pi_priv *rspi, \ void *rxbuf, \ unsigned int index) { \ type buf =3D func(rspi->base + RSPI_SPDR); \ - \ - if (rxbuf) \ - ((type *)rxbuf)[index] =3D buf; \ + ((type *)rxbuf)[index] =3D buf; \ } =20 RZV2H_RSPI_TX(writel, u32) @@ -596,6 +590,7 @@ static int rzv2h_rspi_probe(struct platform_device *pde= v) =20 controller->mode_bits =3D SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | SPI_LSB_FIRST | SPI_LOOP; + controller->flags =3D SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX; controller->bits_per_word_mask =3D SPI_BPW_RANGE_MASK(4, 32); controller->prepare_message =3D rzv2h_rspi_prepare_message; controller->unprepare_message =3D rzv2h_rspi_unprepare_message; --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53A71314A90; Mon, 1 Dec 2025 13:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596637; cv=none; b=XQ75SenBH/04ngAt+LfGi4xGzbKTzJcvtJ7bEhmc62cPGqMI7TcQzXUpourSD+32vl7CY+iXDrMjt8pbCK9WeqPKNidN265c02FRAd2TQdEg4NpW4GqIlErmKI0AuTMqldESkzbtpkNIXaD6YflXOAEf6Rx3aWCf9Dq5eWBWwec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596637; c=relaxed/simple; bh=BPL2TwvTpcjQX7A4CSXa87cu0XO0kjfn8C+hfo327q4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lv1xnCXdxVjTbuoh0D+x0IPtXHLin+xIc17QeeLefuC/x+WBfVj+zbb61bwLjaK5DUaUpGafgQZvyQ/ufdHWzgNkNPlnQ7M1644vLxXfyHFzYz0I+9lJO3LoH49uWlTbLzSK33BWfHhexhzH/TxRpvggH1PRccNwovsyiBXY6T0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: lCt8/OgPQW67O0ya4J74rw== X-CSE-MsgGUID: ZHYEJHJtQ4edFFgQke9A4g== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:43:55 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 087574215A52; Mon, 1 Dec 2025 22:43:50 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 07/13] spi: rzv2h-rspi: set TX FIFO threshold to 0 Date: Mon, 1 Dec 2025 15:42:23 +0200 Message-ID: <20251201134229.600817-8-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" In PIO mode we send data word-by-word, and wait for the received data to be available after each sent word, making no use of the TX interrupt. In DMA mode, we need to set the RX and TX FIFO thresholds to 0, as described in the User Manual. In preparation for implementing DMA support, set TX FIFO threshold to 0, as RX FIFO threshold is already 0. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index f0bbbd21c763..83bb0b7400b2 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -501,7 +501,7 @@ static int rzv2h_rspi_prepare_message(struct spi_contro= ller *ctlr, writeb(0, rspi->base + RSPI_SSLP); =20 /* Setup FIFO thresholds */ - conf16 =3D FIELD_PREP(RSPI_SPDCR2_TTRG, rspi->info->fifo_size - 1); + conf16 =3D FIELD_PREP(RSPI_SPDCR2_TTRG, 0); conf16 |=3D FIELD_PREP(RSPI_SPDCR2_RTRG, 0); writew(conf16, rspi->base + RSPI_SPDCR2); =20 --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C0F431A077; Mon, 1 Dec 2025 13:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596642; cv=none; b=VbsaEZuJYXwiawqiPUDLQzgfat5QTAqy3QtarJ6vlyGonrNKTKg7ke4bxi9YbaECJelp7dev2wmXePGc24jdTlTU2ZLGXASU009Ogs9VI1uT5IWnrBUiv/mIAYUBRow3PLI6KP/881UfBgalAeuZkorTvmxWJ0V6hO3ju3LT9SA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596642; c=relaxed/simple; bh=Sj0hWpswDywnL3Az5mRQyDqd9ixhPFWzW4b3OJTHQJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LNqI3xRLGGnlBsnJ7+EZQye4iIVcCa/23krYqARFhXTQenYu+ctM3+iS8tCxzUJFLX0zS83Ica53YKQisHFvuKsfyFobzURDvFvlWRIj6uTVU+MRs4EC0w+jhOWGCXiTc1/zwFwcx8+h0RbjNUZT5ekOg77Ejkbm9wqLmQoDReM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: uE+g0GGWQBm01kstQpZWVQ== X-CSE-MsgGUID: sVr1CqDfT8um6MqpkAzqgQ== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:00 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 191194215A52; Mon, 1 Dec 2025 22:43:55 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 08/13] spi: rzv2h-rspi: enable TX buffer empty interrupt Date: Mon, 1 Dec 2025 15:42:24 +0200 Message-ID: <20251201134229.600817-9-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" In preparation for implementing DMA support, enable the transmit buffer empty interrupt, which is necessary for DMA to write more data to the FIFO. This does not affect the PIO mode as we do not even request the TX interrupt line. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 83bb0b7400b2..b31ef2f31f1b 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -37,6 +37,7 @@ /* Register SPCR */ #define RSPI_SPCR_BPEN BIT(31) #define RSPI_SPCR_MSTR BIT(30) +#define RSPI_SPCR_SPTIE BIT(20) #define RSPI_SPCR_SPRIE BIT(17) #define RSPI_SPCR_SCKASE BIT(12) #define RSPI_SPCR_SPE BIT(0) @@ -474,6 +475,9 @@ static int rzv2h_rspi_prepare_message(struct spi_contro= ller *ctlr, /* SPI receive buffer full interrupt enable */ conf32 |=3D RSPI_SPCR_SPRIE; =20 + /* SPI transmit buffer empty interrupt enable */ + conf32 |=3D RSPI_SPCR_SPTIE; + /* Bypass synchronization circuit */ conf32 |=3D FIELD_PREP(RSPI_SPCR_BPEN, rspi->use_pclk); =20 --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7274A315772; Mon, 1 Dec 2025 13:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596651; cv=none; b=VGCjeCQA48GsaeEDS+W3VQzd7HekIqhVUBorvQPK/NQcalokr7l1S1pUjaA7ZzQlwtBdwyXq35IF9SqVnsv44Ciw2henZfvV/SLnGROZz3Z3iQK/XFdC+IEDOiA6l0zdp6u1eMFr9ImnCuD1zGKBVEcMA5J/P2KYZdA0wwmIpi8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596651; c=relaxed/simple; bh=u27xUl0kkOLy0u6f2Vq6bB/XgClSoN0MGg3XY8/l5kY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RnmtAwWCn778u++zHie7nnFxS4yEvt6J0mIFYs2wm7srT7WVhk3uiYnOhpkuuIC23to9xXQWDoifRUn6bJqs9yjQXkaYoCCLfmEaxtd+WSOTO8Lqjvp1yDmWSso+XnHoHDQpn9hUmDduHM7o1AGhu9iWGaOtJ5DePm/w+Im5NI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: gKuZGwdUTpy7cQ1SKd0kqw== X-CSE-MsgGUID: mVBLJdHOSoSQDgDnPr5N8w== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:05 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 6BAE84215A4E; Mon, 1 Dec 2025 22:44:01 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 09/13] spi: rzv2h-rspi: split out PIO transfer Date: Mon, 1 Dec 2025 15:42:25 +0200 Message-ID: <20251201134229.600817-10-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" In preparation for implementing DMA support, split out the PIO transfer code into its own function. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index b31ef2f31f1b..9f5bc047b485 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -219,17 +219,14 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv = *rspi, void *rxbuf, return 0; } =20 -static int rzv2h_rspi_transfer_one(struct spi_controller *controller, +static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi_priv *rspi, struct spi_device *spi, - struct spi_transfer *transfer) + struct spi_transfer *transfer, + unsigned int words_to_transfer) { - struct rzv2h_rspi_priv *rspi =3D spi_controller_get_devdata(controller); - unsigned int words_to_transfer, i; + unsigned int i; int ret =3D 0; =20 - transfer->effective_speed_hz =3D rspi->freq; - words_to_transfer =3D transfer->len / rspi->bytes_per_word; - for (i =3D 0; i < words_to_transfer; i++) { rzv2h_rspi_clear_all_irqs(rspi); =20 @@ -240,6 +237,22 @@ static int rzv2h_rspi_transfer_one(struct spi_controll= er *controller, break; } =20 + return ret; +} + +static int rzv2h_rspi_transfer_one(struct spi_controller *controller, + struct spi_device *spi, + struct spi_transfer *transfer) +{ + struct rzv2h_rspi_priv *rspi =3D spi_controller_get_devdata(controller); + unsigned int words_to_transfer; + int ret; + + transfer->effective_speed_hz =3D rspi->freq; + words_to_transfer =3D transfer->len / rspi->bytes_per_word; + + ret =3D rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer); + rzv2h_rspi_clear_all_irqs(rspi); =20 return ret; --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC59D3148C1; Mon, 1 Dec 2025 13:44:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596654; cv=none; b=fb7xeE95WLt77AiwNZj9cI2esxQY/1m8ARiWh7QyrRQ/zTtaAxLOzs/zHJ1lTR0x7OcaIwKKFKOL/3MRmXugtFrqfEkH9pwAsBRAAnj46yQPBtUZW+Bpf1D6EffSWHBS43p+63ktT1YY88zOVaV4PwK0h8+ZjXgnSrKoH3nn1FY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596654; c=relaxed/simple; bh=RT642P3T6QJLHh/S5u6G+FvY6/THA58lYQNMLhF30/k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=If9z2lR/G807qhqNRGeELAD4sVvHHbBay9cMto4ZTfP7Qay0VPKoPtYN9RaLqcwtc236/M6eSeOwQo74MWdtJDdFhxLmBsFksgypVDtBVX8Rghnjerb88do8u0xzZoEzX/qjbi0E3hmST7LRYhZu4mx99vRWRuWtT6i91UQwW2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: rPLdHsXoR3eVDngQlXKihg== X-CSE-MsgGUID: n41JDCjoST6UapzbjU/m1A== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:10 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8C9944215A4E; Mon, 1 Dec 2025 22:44:06 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 10/13] dt-bindings: spi: renesas,rzv2h-rspi: document optional support for DMA Date: Mon, 1 Dec 2025 15:42:26 +0200 Message-ID: <20251201134229.600817-11-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" The IP supports using DMA for reading and writing data from the FIFO, document it. Signed-off-by: Cosmin Tanislav --- .../devicetree/bindings/spi/renesas,rzv2h-rspi.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml = b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml index 069557a587b5..a588b112e11e 100644 --- a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +++ b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml @@ -57,6 +57,14 @@ properties: - const: presetn - const: tresetn =20 + dmas: + maxItems: 2 + + dma-names: + items: + - const: rx + - const: tx + power-domains: maxItems: 1 =20 --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C13263164A8; Mon, 1 Dec 2025 13:44:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596665; cv=none; b=Zu8NkZ7il3H75LMzVvst47LQWkPPaoLDpDQ1lgDXeSuHeGEm36zOIJpsLJBAB+hzJS1j9pr1ZOwieO6zSYLV095KCrcVXFbGvMMuSEG+cPJEJqhLhxdaIRgjMjDakf7uUJEg00DaiJXlPYksyIbZZQ1hU6y1nc6vsUxex8PXO80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596665; c=relaxed/simple; bh=gfZE5pDNxjjD/cfrOYBJmPe45UkIw4FE6AEb2aCh7fM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GAh6i7RVlhVRQtiwUH791vBZxWZ+uaJP0+lqTWsweDA0n8sdVsQKyjdKbp+fU0x8ow4JDgj4fySfU4qebt4V7uGcKoEs2d0GhgnR5zUhD3iIDlhbUV/dZZKzr5+NPL5L30NDuMpXhCj+wCzkP0ddLjJg4vi/SFDal2WJZpRGhMA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: aBdb9Ha7ROSDbYGSYFRvtA== X-CSE-MsgGUID: dX5G5KoqR2mPVxB0Q2aokg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:18 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id E9AA44215A4E; Mon, 1 Dec 2025 22:44:13 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 11/13] spi: rzv2h-rspi: add support for DMA mode Date: Mon, 1 Dec 2025 15:42:27 +0200 Message-ID: <20251201134229.600817-12-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" The DMA controller can be used to transfer data to and from the SPI controller without involving the CPU for each word of a SPI transfer. Add support for DMA mode. Signed-off-by: Cosmin Tanislav --- drivers/spi/spi-rzv2h-rspi.c | 169 ++++++++++++++++++++++++++++++++++- 1 file changed, 168 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c index 9f5bc047b485..aae916882915 100644 --- a/drivers/spi/spi-rzv2h-rspi.c +++ b/drivers/spi/spi-rzv2h-rspi.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,8 @@ #include #include =20 +#include "internals.h" + /* Registers */ #define RSPI_SPDR 0x00 #define RSPI_SPCR 0x08 @@ -96,6 +99,7 @@ struct rzv2h_rspi_info { struct rzv2h_rspi_priv { struct spi_controller *controller; const struct rzv2h_rspi_info *info; + struct platform_device *pdev; void __iomem *base; struct clk *tclk; struct clk *pclk; @@ -108,6 +112,7 @@ struct rzv2h_rspi_priv { u8 spr; u8 brdv; bool use_pclk; + bool dma_callbacked; }; =20 #define RZV2H_RSPI_TX(func, type) \ @@ -219,6 +224,20 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv *= rspi, void *rxbuf, return 0; } =20 +static bool rzv2h_rspi_can_dma(struct spi_controller *ctlr, struct spi_dev= ice *spi, + struct spi_transfer *xfer) +{ + struct rzv2h_rspi_priv *rspi =3D spi_controller_get_devdata(ctlr); + + if (ctlr->fallback) + return false; + + if (!ctlr->dma_tx || !ctlr->dma_rx) + return false; + + return xfer->len > rspi->info->fifo_size; +} + static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi_priv *rspi, struct spi_device *spi, struct spi_transfer *transfer, @@ -240,21 +259,149 @@ static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi= _priv *rspi, return ret; } =20 +static void rzv2h_rspi_dma_complete(void *arg) +{ + struct rzv2h_rspi_priv *rspi =3D arg; + + rspi->dma_callbacked =3D 1; + wake_up_interruptible(&rspi->wait); +} + +static struct dma_async_tx_descriptor * +rzv2h_rspi_setup_dma_channel(struct rzv2h_rspi_priv *rspi, + struct dma_chan *chan, struct sg_table *sg, + enum dma_slave_buswidth width, + enum dma_transfer_direction direction) +{ + struct dma_slave_config config =3D { + .dst_addr =3D rspi->pdev->resource->start + RSPI_SPDR, + .src_addr =3D rspi->pdev->resource->start + RSPI_SPDR, + .dst_addr_width =3D width, + .src_addr_width =3D width, + .direction =3D direction, + }; + struct dma_async_tx_descriptor *desc; + int ret; + + ret =3D dmaengine_slave_config(chan, &config); + if (ret) + return ERR_PTR(ret); + + desc =3D dmaengine_prep_slave_sg(chan, sg->sgl, sg->nents, direction, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + if (!desc) + return ERR_PTR(-EAGAIN); + + if (direction =3D=3D DMA_DEV_TO_MEM) { + desc->callback =3D rzv2h_rspi_dma_complete; + desc->callback_param =3D rspi; + } + + return desc; +} + +static enum dma_slave_buswidth +rzv2h_rspi_dma_width(struct rzv2h_rspi_priv *rspi) +{ + switch (rspi->bytes_per_word) { + case 4: + return DMA_SLAVE_BUSWIDTH_4_BYTES; + case 2: + return DMA_SLAVE_BUSWIDTH_2_BYTES; + case 1: + return DMA_SLAVE_BUSWIDTH_1_BYTE; + default: + return DMA_SLAVE_BUSWIDTH_UNDEFINED; + } +} + +static int rzv2h_rspi_transfer_dma(struct rzv2h_rspi_priv *rspi, + struct spi_device *spi, + struct spi_transfer *transfer, + unsigned int words_to_transfer) +{ + struct dma_async_tx_descriptor *tx_desc =3D NULL, *rx_desc =3D NULL; + enum dma_slave_buswidth width; + dma_cookie_t cookie; + int ret; + + width =3D rzv2h_rspi_dma_width(rspi); + if (width =3D=3D DMA_SLAVE_BUSWIDTH_UNDEFINED) + return -EINVAL; + + rx_desc =3D rzv2h_rspi_setup_dma_channel(rspi, rspi->controller->dma_rx, + &transfer->rx_sg, width, + DMA_DEV_TO_MEM); + if (IS_ERR(rx_desc)) + return PTR_ERR(rx_desc); + + tx_desc =3D rzv2h_rspi_setup_dma_channel(rspi, rspi->controller->dma_tx, + &transfer->tx_sg, width, + DMA_MEM_TO_DEV); + if (IS_ERR(tx_desc)) + return PTR_ERR(tx_desc); + + cookie =3D dmaengine_submit(rx_desc); + if (dma_submit_error(cookie)) + return cookie; + + cookie =3D dmaengine_submit(tx_desc); + if (dma_submit_error(cookie)) { + dmaengine_terminate_sync(rspi->controller->dma_rx); + return cookie; + } + + /* + * DMA transfer does not need IRQs to be enabled. + * For PIO, we only use RX IRQ, so disable that. + */ + disable_irq(rspi->irq_rx); + + rspi->dma_callbacked =3D 0; + + dma_async_issue_pending(rspi->controller->dma_rx); + dma_async_issue_pending(rspi->controller->dma_tx); + rzv2h_rspi_clear_all_irqs(rspi); + + ret =3D wait_event_interruptible_timeout(rspi->wait, rspi->dma_callbacked= , HZ); + if (ret) { + dmaengine_synchronize(rspi->controller->dma_tx); + dmaengine_synchronize(rspi->controller->dma_rx); + ret =3D 0; + } else { + dmaengine_terminate_sync(rspi->controller->dma_tx); + dmaengine_terminate_sync(rspi->controller->dma_rx); + ret =3D -ETIMEDOUT; + } + + enable_irq(rspi->irq_rx); + + return ret; +} + static int rzv2h_rspi_transfer_one(struct spi_controller *controller, struct spi_device *spi, struct spi_transfer *transfer) { struct rzv2h_rspi_priv *rspi =3D spi_controller_get_devdata(controller); + bool is_dma =3D spi_xfer_is_dma_mapped(controller, spi, transfer); unsigned int words_to_transfer; int ret; =20 transfer->effective_speed_hz =3D rspi->freq; words_to_transfer =3D transfer->len / rspi->bytes_per_word; =20 - ret =3D rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer); + if (is_dma) + ret =3D rzv2h_rspi_transfer_dma(rspi, spi, transfer, words_to_transfer); + else + ret =3D rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer); =20 rzv2h_rspi_clear_all_irqs(rspi); =20 + if (is_dma && ret =3D=3D -EAGAIN) + /* Retry with PIO */ + transfer->error =3D SPI_TRANS_FAIL_NO_START; + return ret; } =20 @@ -557,6 +704,7 @@ static int rzv2h_rspi_probe(struct platform_device *pde= v) platform_set_drvdata(pdev, rspi); =20 rspi->controller =3D controller; + rspi->pdev =3D pdev; =20 rspi->info =3D device_get_match_data(dev); =20 @@ -613,6 +761,7 @@ static int rzv2h_rspi_probe(struct platform_device *pde= v) controller->unprepare_message =3D rzv2h_rspi_unprepare_message; controller->num_chipselect =3D 4; controller->transfer_one =3D rzv2h_rspi_transfer_one; + controller->can_dma =3D rzv2h_rspi_can_dma; =20 tclk_rate =3D clk_round_rate(rspi->tclk, 0); if (tclk_rate < 0) @@ -630,6 +779,24 @@ static int rzv2h_rspi_probe(struct platform_device *pd= ev) RSPI_SPBR_SPR_MIN, RSPI_SPCMD_BRDV_MIN); =20 + controller->dma_tx =3D devm_dma_request_chan(dev, "tx"); + if (IS_ERR(controller->dma_tx)) { + ret =3D dev_warn_probe(dev, PTR_ERR(controller->dma_tx), + "failed to request TX DMA channel\n"); + if (ret =3D=3D -EPROBE_DEFER) + return ret; + controller->dma_tx =3D NULL; + } + + controller->dma_rx =3D devm_dma_request_chan(dev, "rx"); + if (IS_ERR(controller->dma_rx)) { + ret =3D dev_warn_probe(dev, PTR_ERR(controller->dma_rx), + "failed to request RX DMA channel\n"); + if (ret =3D=3D -EPROBE_DEFER) + return ret; + controller->dma_rx =3D NULL; + } + device_set_node(&controller->dev, dev_fwnode(dev)); =20 ret =3D devm_spi_register_controller(dev, controller); --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 402D73148A0; Mon, 1 Dec 2025 13:44:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596668; cv=none; b=TIHU3MsLZ8NyK/OLplstxBQ/o/BnhamGhc1F4vw0dt2N/CJ2RY8OLDmTVK7AjXUTT2hPUbQmRKxXkx2RmGLY3tQ75CoDIe9ijdYShi9sVpUvEjENKBCwi9/fiClHsEkRXVOyBlUzprmu7n+yqZDzlJbZDXajQ1oJz7PL8r1uf5M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596668; c=relaxed/simple; bh=964hwEdCFr/GEQ6EzREk+fNU7494aZepv8A03AsYutk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LaXwYiKyblfVLTVwpNf1gpiE61O3o69fdjKbU2qHvcoCkXVpeqNI3TwMavh3w9WI4SELfxlic75kU74FI6aOvMHLSwDTS700/wGzN8BgTAx39r1YtSKQcjdWZdtQwhvJRtounudCvNv4b8itHQMDtpAHxOFVyzC0x3zFUNWBqO4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: K73JxEYxSTiKIOeiyRbcQw== X-CSE-MsgGUID: 4A8qX2/oRGmW2ax0ORGO5Q== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:23 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 815CE4215A4E; Mon, 1 Dec 2025 22:44:19 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 12/13] arm64: dts: renesas: r9a09g077: wire up DMA support for SPI Date: Mon, 1 Dec 2025 15:42:28 +0200 Message-ID: <20251201134229.600817-13-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" RZ/T2H (R9A09G077) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU. Wire up the DMA channels for the SPI peripherals. Signed-off-by: Cosmin Tanislav --- arch/arm64/boot/dts/renesas/r9a09g077.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a09g077.dtsi b/arch/arm64/boot/d= ts/renesas/r9a09g077.dtsi index ee11efb68638..34f5a4d26f29 100644 --- a/arch/arm64/boot/dts/renesas/r9a09g077.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a09g077.dtsi @@ -200,6 +200,8 @@ rspi0: spi@80007000 { clocks =3D <&cpg CPG_CORE R9A09G077_CLK_PCLKM>, <&cpg CPG_MOD 104>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x267a>, <&dmac0 0x267b>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -218,6 +220,8 @@ rspi1: spi@80007400 { clocks =3D <&cpg CPG_CORE R9A09G077_CLK_PCLKM>, <&cpg CPG_MOD 105>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x267f>, <&dmac0 0x2680>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -236,6 +240,8 @@ rspi2: spi@80007800 { clocks =3D <&cpg CPG_CORE R9A09G077_CLK_PCLKM>, <&cpg CPG_MOD 106>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x2684>, <&dmac0 0x2685>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -254,6 +260,8 @@ rspi3: spi@81007000 { clocks =3D <&cpg CPG_CORE R9A09G077_CLK_PCLKM>, <&cpg CPG_MOD 602>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x2689>, <&dmac0 0x268a>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.52.0 From nobody Mon Dec 1 20:57:27 2025 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AA7C31CA7F; Mon, 1 Dec 2025 13:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596671; cv=none; b=QqRAzT8q/vGrb4kH+q6ngvflg5fXY1YkXmsytqPmaHVITwc3onPlvtq7+wpihh1CaLXxONcl+zny5ojlEPIBJZnxK1PmcXyoPUIWP2V3nvFsPcKA0pKuY2hTu6i7Y6Yb1AuDLnlkfSK1XnKwbUF8Vwz5EmjXf14IbUj2M77bqtc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764596671; c=relaxed/simple; bh=K+8Imq08PBFg0FzfxwvlVR/iIDNvODdGNxCaD6X3rLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j8k3Xwhdo2WLs5/POXAJdRV6GyZDKBWDH0948Q6m6d/Ps4bPzx618IISUG8KDVid/wbm+HBCoukJVOFaHSef0Br5wRnHzk+XdcZxSe2AmMIgJQt+POQyXVAKU6uMvHPkAqt3EFx5Jyg3qxirEavqlDe4xiFY7aa2u8gpEDmdXTI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com X-CSE-ConnectionGUID: P8X0AJUbSj6a33fC+MQIuw== X-CSE-MsgGUID: iMQSsI9HS7ij2WRf2z0UOw== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Dec 2025 22:44:28 +0900 Received: from demon-pc.localdomain (unknown [10.226.93.83]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id A71544215A56; Mon, 1 Dec 2025 22:44:24 +0900 (JST) From: Cosmin Tanislav To: Fabrizio Castro , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Philipp Zabel Cc: linux-spi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 13/13] arm64: dts: renesas: r9a09g087: wire up DMA support for SPI Date: Mon, 1 Dec 2025 15:42:29 +0200 Message-ID: <20251201134229.600817-14-cosmin-gabriel.tanislav.xa@renesas.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.com> References: <20251201134229.600817-1-cosmin-gabriel.tanislav.xa@renesas.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" RZ/N2H (R9A09G087) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU. Wire up the DMA channels for the SPI peripherals. Signed-off-by: Cosmin Tanislav --- arch/arm64/boot/dts/renesas/r9a09g087.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi b/arch/arm64/boot/d= ts/renesas/r9a09g087.dtsi index 7b1f2c1c9e85..61c1b3713b43 100644 --- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi +++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi @@ -200,6 +200,8 @@ rspi0: spi@80007000 { clocks =3D <&cpg CPG_CORE R9A09G087_CLK_PCLKM>, <&cpg CPG_MOD 104>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x267a>, <&dmac0 0x267b>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -218,6 +220,8 @@ rspi1: spi@80007400 { clocks =3D <&cpg CPG_CORE R9A09G087_CLK_PCLKM>, <&cpg CPG_MOD 105>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x267f>, <&dmac0 0x2680>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -236,6 +240,8 @@ rspi2: spi@80007800 { clocks =3D <&cpg CPG_CORE R9A09G087_CLK_PCLKM>, <&cpg CPG_MOD 106>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x2684>, <&dmac0 0x2685>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; @@ -254,6 +260,8 @@ rspi3: spi@81007000 { clocks =3D <&cpg CPG_CORE R9A09G087_CLK_PCLKM>, <&cpg CPG_MOD 602>; clock-names =3D "pclk", "pclkspi"; + dmas =3D <&dmac0 0x2689>, <&dmac0 0x268a>; + dma-names =3D "rx", "tx"; power-domains =3D <&cpg>; #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.52.0