* [PATCH v7 1/4] dt-bindings: i2c: qcom,i2c-geni: Document multi-owner controller support
2026-04-23 14:55 [PATCH v7 0/4] Enable multi-owner I2C support for QCOM GENI controllers Mukesh Kumar Savaliya
@ 2026-04-23 14:55 ` Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 2/4] dmaengine: qcom: gpi: Add lock/unlock TREs for multi-owner I2C transfers Mukesh Kumar Savaliya
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mukesh Kumar Savaliya @ 2026-04-23 14:55 UTC (permalink / raw)
To: viken.dadhaniya, andi.shyti, robh, krzk+dt, conor+dt, vkoul,
Frank.Li, andersson, konradybcio, dmitry.baryshkov, linmq006,
quic_jseerapu, agross, linux-arm-msm, linux-i2c, devicetree,
linux-kernel, dmaengine
Cc: krzysztof.kozlowski, bartosz.golaszewski, bjorn.andersson,
konrad.dybcio, Mukesh Kumar Savaliya
Document a DeviceTree property to describe QUP-based I2C controllers that
are shared with one or more other system processors.
On some Qualcomm platforms, a QUP-based I2C controller may be accessed by
multiple system processors (for example, APPS and DSP). In such
configurations, the operating system must not assume exclusive ownership
of the controller or its associated hardware resources.
The new qcom,qup-multi-owner property indicates that the controller is
externally shared and that the operating system must avoid operations
which rely on sole control of the hardware.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
---
.../devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml b/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
index 51534953a69c..9401dc2d5052 100644
--- a/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
+++ b/Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
@@ -60,6 +60,13 @@ properties:
power-domains:
maxItems: 1
+ qcom,qup-multi-owner:
+ type: boolean
+ description:
+ Indicates that the QUP-based controller is shared with one or more
+ other system processors and must not be assumed to have exclusive
+ ownership by the operating system.
+
reg:
maxItems: 1
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v7 2/4] dmaengine: qcom: gpi: Add lock/unlock TREs for multi-owner I2C transfers
2026-04-23 14:55 [PATCH v7 0/4] Enable multi-owner I2C support for QCOM GENI controllers Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 1/4] dt-bindings: i2c: qcom,i2c-geni: Document multi-owner controller support Mukesh Kumar Savaliya
@ 2026-04-23 14:55 ` Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 3/4] soc: qcom: geni-se: Keep pinctrl active for multi-owner controllers Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 4/4] i2c: qcom-geni: Support multi-owner controllers in GPI mode Mukesh Kumar Savaliya
3 siblings, 0 replies; 5+ messages in thread
From: Mukesh Kumar Savaliya @ 2026-04-23 14:55 UTC (permalink / raw)
To: viken.dadhaniya, andi.shyti, robh, krzk+dt, conor+dt, vkoul,
Frank.Li, andersson, konradybcio, dmitry.baryshkov, linmq006,
quic_jseerapu, agross, linux-arm-msm, linux-i2c, devicetree,
linux-kernel, dmaengine
Cc: krzysztof.kozlowski, bartosz.golaszewski, bjorn.andersson,
konrad.dybcio, Mukesh Kumar Savaliya
Some platforms use a QUP-based I2C controller in a configuration where the
controller is shared with another system processor (described in DT using
qcom,qup-multi-owner). In such setups, GPI hardware lock/unlock TREs can be
used to serialize access to the controller.
Add support to emit lock and unlock TREs around I2C transfers and increase
the maximum TRE count to account for the additional elements.
Also simplify the client interface by replacing multiple boolean fields
(shared flag and message position tracking) with a single lock_action
selector (acquire/release/none), as the GPI driver only needs to know
whether to emit lock/unlock TREs for a given transfer.
Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
---
drivers/dma/qcom/gpi.c | 44 +++++++++++++++++++++++++++++++-
include/linux/dma/qcom-gpi-dma.h | 18 +++++++++++++
2 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
index 6e30f3aa401e..a1f391dd1747 100644
--- a/drivers/dma/qcom/gpi.c
+++ b/drivers/dma/qcom/gpi.c
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2020, Linaro Limited
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#include <dt-bindings/dma/qcom-gpi.h>
@@ -67,6 +68,14 @@
#define TRE_DMA_LEN GENMASK(23, 0)
#define TRE_DMA_IMMEDIATE_LEN GENMASK(3, 0)
+/* Lock TRE */
+#define TRE_LOCK BIT(0)
+#define TRE_MINOR_TYPE GENMASK(19, 16)
+#define TRE_MAJOR_TYPE GENMASK(23, 20)
+
+/* Unlock TRE */
+#define TRE_UNLOCK BIT(8)
+
/* Register offsets from gpi-top */
#define GPII_n_CH_k_CNTXT_0_OFFS(n, k) (0x20000 + (0x4000 * (n)) + (0x80 * (k)))
#define GPII_n_CH_k_CNTXT_0_EL_SIZE GENMASK(31, 24)
@@ -518,7 +527,7 @@ struct gpii {
bool ieob_set;
};
-#define MAX_TRE 3
+#define MAX_TRE 5
struct gpi_desc {
struct virt_dma_desc vd;
@@ -1625,12 +1634,27 @@ static int gpi_create_i2c_tre(struct gchan *chan, struct gpi_desc *desc,
unsigned long flags)
{
struct gpi_i2c_config *i2c = chan->config;
+ enum gpi_lock_action lock_action = i2c->lock_action;
struct device *dev = chan->gpii->gpi_dev->dev;
unsigned int tre_idx = 0;
dma_addr_t address;
struct gpi_tre *tre;
unsigned int i;
+ /* Optional lock TRE before transfer */
+ if (lock_action == GPI_LOCK_ACQUIRE) {
+ tre = &desc->tre[tre_idx];
+ tre_idx++;
+
+ tre->dword[0] = 0;
+ tre->dword[1] = 0;
+ tre->dword[2] = 0;
+ tre->dword[3] = u32_encode_bits(1, TRE_LOCK);
+ tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_IEOB);
+ tre->dword[3] |= u32_encode_bits(0, TRE_MINOR_TYPE);
+ tre->dword[3] |= u32_encode_bits(3, TRE_MAJOR_TYPE);
+ }
+
/* first create config tre if applicable */
if (i2c->set_config) {
tre = &desc->tre[tre_idx];
@@ -1690,6 +1714,24 @@ static int gpi_create_i2c_tre(struct gchan *chan, struct gpi_desc *desc,
if (!(flags & DMA_PREP_INTERRUPT))
tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_BEI);
+
+ /* If multi-owner and this is the release boundary, chain it */
+ if (i2c->lock_action == GPI_LOCK_RELEASE)
+ tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_CHAIN);
+ }
+
+ /* Optional unlock TRE after transfer */
+ if (lock_action == GPI_LOCK_RELEASE && i2c->op != I2C_READ) {
+ tre = &desc->tre[tre_idx];
+ tre_idx++;
+
+ tre->dword[0] = 0;
+ tre->dword[1] = 0;
+ tre->dword[2] = 0;
+ tre->dword[3] = u32_encode_bits(1, TRE_UNLOCK);
+ tre->dword[3] |= u32_encode_bits(1, TRE_FLAGS_IEOB);
+ tre->dword[3] |= u32_encode_bits(1, TRE_MINOR_TYPE);
+ tre->dword[3] |= u32_encode_bits(3, TRE_MAJOR_TYPE);
}
for (i = 0; i < tre_idx; i++)
diff --git a/include/linux/dma/qcom-gpi-dma.h b/include/linux/dma/qcom-gpi-dma.h
index 6680dd1a43c6..36cbb85499b4 100644
--- a/include/linux/dma/qcom-gpi-dma.h
+++ b/include/linux/dma/qcom-gpi-dma.h
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020, Linaro Limited
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#ifndef QCOM_GPI_DMA_H
@@ -51,6 +52,21 @@ enum i2c_op {
I2C_READ,
};
+/**
+ * enum gpi_lock_action - request lock/unlock TRE sequencing
+ * @GPI_LOCK_NONE: No lock/unlock TRE requested for this transfer
+ * @GPI_LOCK_ACQUIRE: Emit a lock TRE before the transfer
+ * @GPI_LOCK_RELEASE: Emit an unlock TRE after the transfer
+ *
+ * Used by protocol drivers for multi-owner controller setups (e.g. when
+ * DeviceTree indicates the controller is shared via qcom,qup-multi-owner).
+ */
+enum gpi_lock_action {
+ GPI_LOCK_NONE = 0,
+ GPI_LOCK_ACQUIRE,
+ GPI_LOCK_RELEASE,
+};
+
/**
* struct gpi_i2c_config - i2c config for peripheral
*
@@ -65,6 +81,7 @@ enum i2c_op {
* @rx_len: receive length for buffer
* @op: i2c cmd
* @muli-msg: is part of multi i2c r-w msgs
+ * @lock_action: request lock/unlock TRE sequencing for this transfer
*/
struct gpi_i2c_config {
u8 set_config;
@@ -78,6 +95,7 @@ struct gpi_i2c_config {
u32 rx_len;
enum i2c_op op;
bool multi_msg;
+ enum gpi_lock_action lock_action;
};
#endif /* QCOM_GPI_DMA_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v7 3/4] soc: qcom: geni-se: Keep pinctrl active for multi-owner controllers
2026-04-23 14:55 [PATCH v7 0/4] Enable multi-owner I2C support for QCOM GENI controllers Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 1/4] dt-bindings: i2c: qcom,i2c-geni: Document multi-owner controller support Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 2/4] dmaengine: qcom: gpi: Add lock/unlock TREs for multi-owner I2C transfers Mukesh Kumar Savaliya
@ 2026-04-23 14:55 ` Mukesh Kumar Savaliya
2026-04-23 14:55 ` [PATCH v7 4/4] i2c: qcom-geni: Support multi-owner controllers in GPI mode Mukesh Kumar Savaliya
3 siblings, 0 replies; 5+ messages in thread
From: Mukesh Kumar Savaliya @ 2026-04-23 14:55 UTC (permalink / raw)
To: viken.dadhaniya, andi.shyti, robh, krzk+dt, conor+dt, vkoul,
Frank.Li, andersson, konradybcio, dmitry.baryshkov, linmq006,
quic_jseerapu, agross, linux-arm-msm, linux-i2c, devicetree,
linux-kernel, dmaengine
Cc: krzysztof.kozlowski, bartosz.golaszewski, bjorn.andersson,
konrad.dybcio, Mukesh Kumar Savaliya
On platforms where a GENI Serial Engine is shared with another system
processor, selecting the "sleep" pinctrl state can disrupt ongoing
transfers initiated by the other processor.
Teach geni_se_resources_off() to skip selecting the pinctrl sleep state
when the Serial Engine is marked as shared, while still allowing the
rest of the resource shutdown sequence to proceed.
This is required for multi-owner configurations (described via DeviceTree
with qcom,qup-multi-owner on the protocol controller node).
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
---
drivers/soc/qcom/qcom-geni-se.c | 15 +++++++++++----
include/linux/soc/qcom/geni-se.h | 2 ++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/soc/qcom/qcom-geni-se.c b/drivers/soc/qcom/qcom-geni-se.c
index cd1779b6a91a..1a60832ace16 100644
--- a/drivers/soc/qcom/qcom-geni-se.c
+++ b/drivers/soc/qcom/qcom-geni-se.c
@@ -597,10 +597,17 @@ int geni_se_resources_off(struct geni_se *se)
if (has_acpi_companion(se->dev))
return 0;
-
- ret = pinctrl_pm_select_sleep_state(se->dev);
- if (ret)
- return ret;
+ /*
+ * Select the "sleep" pinctrl state only when the serial engine is
+ * exclusively owned by this system processor. For shared controller
+ * configurations, another system processor may still be using the pins,
+ * and switching them to "sleep" can disrupt ongoing transfers.
+ */
+ if (!se->multi_owner) {
+ ret = pinctrl_pm_select_sleep_state(se->dev);
+ if (ret)
+ return ret;
+ }
geni_se_clks_off(se);
return 0;
diff --git a/include/linux/soc/qcom/geni-se.h b/include/linux/soc/qcom/geni-se.h
index 0a984e2579fe..46217cac73c3 100644
--- a/include/linux/soc/qcom/geni-se.h
+++ b/include/linux/soc/qcom/geni-se.h
@@ -63,6 +63,7 @@ struct geni_icc_path {
* @num_clk_levels: Number of valid clock levels in clk_perf_tbl
* @clk_perf_tbl: Table of clock frequency input to serial engine clock
* @icc_paths: Array of ICC paths for SE
+ * @multi_owner: True if SE is shared between multiple owners.
*/
struct geni_se {
void __iomem *base;
@@ -72,6 +73,7 @@ struct geni_se {
unsigned int num_clk_levels;
unsigned long *clk_perf_tbl;
struct geni_icc_path icc_paths[3];
+ bool multi_owner;
};
/* Common SE registers */
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v7 4/4] i2c: qcom-geni: Support multi-owner controllers in GPI mode
2026-04-23 14:55 [PATCH v7 0/4] Enable multi-owner I2C support for QCOM GENI controllers Mukesh Kumar Savaliya
` (2 preceding siblings ...)
2026-04-23 14:55 ` [PATCH v7 3/4] soc: qcom: geni-se: Keep pinctrl active for multi-owner controllers Mukesh Kumar Savaliya
@ 2026-04-23 14:55 ` Mukesh Kumar Savaliya
3 siblings, 0 replies; 5+ messages in thread
From: Mukesh Kumar Savaliya @ 2026-04-23 14:55 UTC (permalink / raw)
To: viken.dadhaniya, andi.shyti, robh, krzk+dt, conor+dt, vkoul,
Frank.Li, andersson, konradybcio, dmitry.baryshkov, linmq006,
quic_jseerapu, agross, linux-arm-msm, linux-i2c, devicetree,
linux-kernel, dmaengine
Cc: krzysztof.kozlowski, bartosz.golaszewski, bjorn.andersson,
konrad.dybcio, Mukesh Kumar Savaliya
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, request lock/unlock TRE sequencing from the GPI
driver by setting a single lock_action selector per message, emitting lock
before the first message and unlock after the last message (handling the
single-message case as well). This serializes access to the shared
controller without requiring message-position flags to be passed into the
DMA engine layer.
Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
---
drivers/i2c/busses/i2c-qcom-geni.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
index ae609bdd2ec4..a396ddc7d8f4 100644
--- a/drivers/i2c/busses/i2c-qcom-geni.c
+++ b/drivers/i2c/busses/i2c-qcom-geni.c
@@ -815,6 +815,14 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i
if (i < num - 1)
peripheral.stretch = 1;
+ peripheral.lock_action = GPI_LOCK_NONE;
+ if (gi2c->se.multi_owner) {
+ if (i == 0)
+ peripheral.lock_action = GPI_LOCK_ACQUIRE;
+ else if (i == num - 1)
+ peripheral.lock_action = GPI_LOCK_RELEASE;
+ }
+
peripheral.addr = msgs[i].addr;
if (i > 0 && (!(msgs[i].flags & I2C_M_RD)))
peripheral.multi_msg = false;
@@ -1014,6 +1022,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
gi2c->clk_freq_out = I2C_MAX_STANDARD_MODE_FREQ;
}
+ if (of_property_read_bool(pdev->dev.of_node, "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));
@@ -1089,7 +1102,9 @@ static int geni_i2c_probe(struct platform_device *pdev)
}
if (fifo_disable) {
- /* FIFO is disabled, so we can only use GPI DMA */
+ /* FIFO is disabled, so we can only use GPI DMA.
+ * SE can be shared in GSI mode between subsystems, each SS owns a GPII.
+ */
gi2c->gpi_mode = true;
ret = setup_gpi_dma(gi2c);
if (ret)
@@ -1098,6 +1113,11 @@ static int geni_i2c_probe(struct platform_device *pdev)
dev_dbg(dev, "Using GPI DMA mode for I2C\n");
} else {
gi2c->gpi_mode = false;
+
+ if (gi2c->se.multi_owner)
+ return dev_err_probe(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 */
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread