[PATCH v9 4/4] i2c: qcom-geni: Support multi-owner controllers in GPI mode
Mukesh Kumar Savaliya <[email protected]> Thu, 13 Aug 2026 19:30:43 +0530
| Newsgroups | org.kernel.vger.linux-i2c,org.kernel.vger.dmaengine,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Some platforms use a QUP-based I2C controller in a configuration where the controller is shared with another system processor. In this setup the operating system must not assume exclusive ownership of the controller or its associated pins. Add support for enabling multi-owner operation when DeviceTree specifies qcom,qup-multi-owner. When enabled, mark the underlying serial engine as shared so the common GENI resource handling avoids selecting the "sleep" pinctrl state, which could disrupt transfers initiated by the other processor. For GPI mode transfers, indicate multi-owner mode to the GPI driver by setting the multi_owner field in the initial dmaengine_slave_config call. The GPI driver then autonomously inserts lock and unlock TREs around the transfer sequence without any per-message guidance from the I2C driver. This keeps the locking mechanism as an internal GPI implementation detail; the I2C driver does not need to track transfer boundaries or message positions for lock/unlock purposes. Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Mukesh Kumar Savaliya <[email protected]> --- drivers/i2c/busses/i2c-qcom-geni.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 658636c1ee0e..850fb0516a87 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -829,6 +829,7 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i peripheral.clk_div = itr->clk_div; peripheral.set_config = 1; peripheral.multi_msg = false; + peripheral.multi_owner = gi2c->se.multi_owner; trace_geni_i2c_bus_setup(gi2c->se.dev, gi2c->clk_freq_out, itr->clk_div, itr->t_high_cnt, @@ -1066,7 +1067,11 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c) } if (fifo_disable) { - /* FIFO is disabled, so we can only use GPI DMA */ + /* + * FIFO is disabled, so only GPI DMA can be used. + * In multi-owner configurations, the SE may be shared between subsystems, + * with each subsystem owning a separate GPII. + */ gi2c->gpi_mode = true; ret = setup_gpi_dma(gi2c); if (ret) @@ -1075,6 +1080,11 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c) dev_dbg(gi2c->se.dev, "Using GPI DMA mode for I2C\n"); } else { gi2c->gpi_mode = false; + + if (gi2c->se.multi_owner) + return dev_err_probe(gi2c->se.dev, -EINVAL, + "I2C sharing not supported in non-GSI mode\n"); + tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se); /* I2C Master Hub Serial Elements doesn't have the HW_PARAM_0 register */ @@ -1145,6 +1155,11 @@ static int geni_i2c_probe(struct platform_device *pdev) gi2c->clk_freq_out = I2C_MAX_STANDARD_MODE_FREQ; } + if (device_property_present(&pdev->dev, "qcom,qup-multi-owner")) { + gi2c->se.multi_owner = true; + dev_dbg(&pdev->dev, "I2C controller is shared with another system processor\n"); + } + if (has_acpi_companion(dev)) ACPI_COMPANION_SET(&gi2c->adap.dev, ACPI_COMPANION(dev)); -- 2.43.0