From nobody Mon Dec 1 21:31:54 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