[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260204162854.1206323-2-praveen.talari@oss.qualcomm.com>
Date: Wed, 4 Feb 2026 21:58:51 +0530
From: Praveen Talari <praveen.talari@....qualcomm.com>
To: Mark Brown <broonie@...nel.org>, linux-arm-msm@...r.kernel.org,
linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
bjorn.andersson@....qualcomm.com, dmitry.baryshkov@....qualcomm.com,
konrad.dybcio@....qualcomm.com
Cc: prasad.sodagudi@....qualcomm.com, mukesh.savaliya@....qualcomm.com,
quic_vtanuku@...cinc.com, aniket.randive@....qualcomm.com,
chandana.chiluveru@....qualcomm.com, jyothi.seerapu@....qualcomm.com,
Praveen Talari <praveen.talari@....qualcomm.com>
Subject: [PATCH v2 1/4] spi: geni-qcom: Improve target mode allocation by using proper allocation functions
The current implementation always allocates a host controller and sets the
target flag later when the "spi-slave" device tree property is present.
This approach is suboptimal as it doesn't utilize the dedicated allocation
functions designed for target mode.
Use devm_spi_alloc_target() when "spi-slave" device tree property is
present, otherwise use devm_spi_alloc_host(). This replaces the previous
approach of always allocating a host controller and setting target flag
later.
Signed-off-by: Praveen Talari <praveen.talari@....qualcomm.com>
---
v1->v2
konrad
- Placed changes where host is allocated.
---
drivers/spi/spi-geni-qcom.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 0e5fd9df1a8f..f886a9ba56e6 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -1033,7 +1033,11 @@ static int spi_geni_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return PTR_ERR(clk);
- spi = devm_spi_alloc_host(dev, sizeof(*mas));
+ if (device_property_read_bool(dev, "spi-slave"))
+ spi = devm_spi_alloc_target(dev, sizeof(*mas));
+ else
+ spi = devm_spi_alloc_host(dev, sizeof(*mas));
+
if (!spi)
return -ENOMEM;
@@ -1087,9 +1091,6 @@ static int spi_geni_probe(struct platform_device *pdev)
if (ret)
return ret;
- if (device_property_read_bool(&pdev->dev, "spi-slave"))
- spi->target = true;
-
/* Set the bus quota to a reasonable value for register access */
mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ);
mas->se.icc_paths[CPU_TO_GENI].avg_bw = GENI_DEFAULT_BW;
--
2.34.1
Powered by blists - more mailing lists