public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@nabladev.com>
To: cosmin-gabriel.tanislav.xa@renesas.com
Cc: cip-dev@lists.cip-project.org, pavel@nabladev.com,
	nobuhiro.iwamatsu.x90@mail.toshiba
Subject: Re: [cip-dev] [PATCH 6.12.y-cip v3 02/17] spi: Add driver for the RZ/V2H(P) RSPI IP
Date: Fri, 13 Mar 2026 11:17:48 +0100	[thread overview]
Message-ID: <abPkTIDQRgV0lxPA@duo.ucw.cz> (raw)
In-Reply-To: <20260309150619.761962-3-cosmin-gabriel.tanislav.xa@renesas.com>

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

Hi!

> From: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
> 
> commit 8b61c8919dff080d83415523cd68f2fef03ccfc7 upstream.
> 
> The Renesas RZ/V2H(P) RSPI IP supports 4-wire and 3-wire
> serial communications in both host role and target role.
> It can use a DMA, but the I/O can also be driven by the
> processor.

Normally we format this to 70 columns or so.

> @@ -885,6 +885,14 @@ config SPI_RSPI
>  	help
>  	  SPI driver for Renesas RSPI and QSPI blocks.
>  
> +config SPI_RZV2H_RSPI
> +	tristate "Renesas RZ/V2H RSPI controller"
> +	depends on ARCH_RENESAS || COMPILE_TEST
> +	help
> +	  RSPI driver for the Renesas RZ/V2H Serial Peripheral Interface (RSPI).
> +	  RSPI supports both SPI host and SPI target roles. This option only
> +	  enables the SPI host role.

"Module will be called xyz" is normally in the help text.

> +static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
> +{
> +	unsigned long tclk_rate;
> +	int spr;
> +	u8 brdv;
...
> +	tclk_rate = clk_get_rate(rspi->tclk);
> +	for (brdv = RSPI_SPCMD_BRDV_MIN; brdv <= RSPI_SPCMD_BRDV_MAX; brdv++) {
> +		spr = DIV_ROUND_UP(tclk_rate, hz * (1 << (brdv + 1)));
> +		spr--;
> +		if (spr >= RSPI_SPBR_SPR_MIN && spr <= RSPI_SPBR_SPR_MAX)
> +			goto clock_found;
> +	}
> +
> +	return 0;
> +
> +clock_found:
> +	rzv2h_rspi_reg_rmw(rspi, RSPI_SPCMD, RSPI_SPCMD_BRDV, brdv);
> +	writeb(spr, rspi->base + RSPI_SPBR);
> +
> +	return rzv2h_rspi_calc_bitrate(tclk_rate, spr, brdv);
> +}

I believe code would be better without the goto here.

Best regards,
								Pavel

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

  reply	other threads:[~2026-03-13 10:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 15:06 [PATCH 6.12.y-cip v3 00/17] Add RSPI support for RZ/T2H and RZ/N2H Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 01/17] spi: dt-bindings: Document the RZ/V2H(P) RSPI Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 02/17] spi: Add driver for the RZ/V2H(P) RSPI IP Cosmin Tanislav
2026-03-13 10:17   ` Pavel Machek [this message]
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 03/17] arm64: defconfig: Enable the RZ/V2H(P) RSPI driver Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 04/17] clk: renesas: r9a09g077: Add SPI module clocks Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 05/17] spi: rzv2h-rspi: make resets optional Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 06/17] spi: rzv2h-rspi: make FIFO size chip-specific Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 07/17] spi: rzv2h-rspi: make clocks chip-specific Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 08/17] spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock() Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 09/17] spi: rzv2h-rspi: avoid recomputing transfer frequency Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 10/17] spi: rzv2h-rspi: make transfer clock rate finding chip-specific Cosmin Tanislav
2026-03-13 10:25   ` Pavel Machek
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 11/17] spi: rzv2h-rspi: add support for using PCLK for transfer clock Cosmin Tanislav
2026-03-12  3:22   ` nobuhiro.iwamatsu.x90
2026-03-12  7:56     ` Cosmin-Gabriel Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 12/17] spi: rzv2h-rspi: add support for variable " Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 13/17] spi: rzv2h-rspi: add support for loopback mode Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 14/17] spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 15/17] spi: dt-bindings: renesas,rzv2h-rspi: document " Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 16/17] arm64: dts: renesas: r9a09g077: Add SPI nodes Cosmin Tanislav
2026-03-09 15:06 ` [PATCH 6.12.y-cip v3 17/17] arm64: dts: renesas: r9a09g087: " Cosmin Tanislav
2026-03-12  3:28 ` [PATCH 6.12.y-cip v3 00/17] Add RSPI support for RZ/T2H and RZ/N2H nobuhiro.iwamatsu.x90
2026-03-13 10:31 ` [cip-dev] " Pavel Machek
2026-03-18  5:31   ` nobuhiro.iwamatsu.x90

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=abPkTIDQRgV0lxPA@duo.ucw.cz \
    --to=pavel@nabladev.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=cosmin-gabriel.tanislav.xa@renesas.com \
    --cc=nobuhiro.iwamatsu.x90@mail.toshiba \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox