Re: [PATCH 5/7] spi: qcom-geni: Use geni_se_set_rate() for setting source clock frequency
From: Mukesh Savaliya
Date: Mon Aug 24 2026 - 07:52:39 EST
On 8/5/2026 1:27 AM, Praveen Talari wrote:
On the SA8255P platform there is no Linux clock handler for the SE
source clock, so the driver has no way to look up the source clock
index and divider needed to fill the GSI CONFIG0 TRE for a requested
transfer frequency. To work around this, firmware instead exposes the
SE HW supported source clock frequencies as OPPs on the perf domain
device.
geni_se_domain_attach() now populates se->clk_perf_tbl from this OPP
table at attach time, mirroring clk_perf_tbl on the Linux-clock-managed
path. This lets get_spi_clk_cfg() call geni_se_clk_freq_match() to pick
the closest supported source clock frequency and divider on SA8255P
exactly as it already does when a Linux clock is present, and fill in
the GSI CONFIG0 TRE accordingly.
Switch get_spi_clk_cfg() and spi_geni_runtime_resume() from calling
dev_pm_opp_set_rate() directly to the new geni_se_set_rate() helper, so
the matched frequency is applied to the correct device (the perf
domain device on the firmware managed path, or se->dev otherwise)
without the SPI driver needing to know which resources_init variant is
in use.
let me suggest little compressed commit message removing some duplication.
geni_se_domain_attach() now populates clk_perf_tbl from
the performance-domain OPP table, allowing firmware-managed
platforms to use geni_se_clk_freq_match().
Use geni_se_set_rate() instead of dev_pm_opp_set_rate()
so clock programming is handled centrally by the GENI core,
independent of the underlying clock-control mechanism.
Signed-off-by: Praveen Talari <praveen.talari@xxxxxxxxxxxxxxxx>
---
drivers/spi/spi-geni-qcom.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
[...]
@@ -150,9 +148,9 @@ static int get_spi_clk_cfg(unsigned int speed_hz,little verbose - "Failed to set source clock rate %d"> else
dev_dbg(mas->dev, "req %u=>%u sclk %lu, idx %d, div %d\n", speed_hz,
actual_hz, sclk_freq, *clk_idx, *clk_div);
- ret = dev_pm_opp_set_rate(mas->dev, sclk_freq);
+ ret = geni_se_set_rate(&mas->se, sclk_freq);
if (ret)
- dev_err(mas->dev, "dev_pm_opp_set_rate failed %d\n", ret);
+ dev_err(mas->dev, "geni_se_set_rate failed %d\n", ret);
mas->cur_sclk_hz = sclk_freq;
@@ -847,7 +845,7 @@ static int setup_se_xfer(struct spi_transfer *xfer,
}
[...]