[PATCH v5 0/4] Enable shared SE support over I2C

From: Mukesh Kumar Savaliya
Date: Fri Nov 29 2024 - 09:44:28 EST


QUP based I2C GENI controller driver doesn't support controller sharing
between two processors (E.g. APPS and DSP) running same or different OS.

For example, two I2C clients (one from ADSP and another from APPS) want to
communicate with EEPROM connected over I2C without any bus level disturbance
during transfer.

This Series adds support to share QUP (Qualcomm Unified peripheral) based
I2C SE (Serial Engine) controller between two or more processors (Apps/ADSP
etc). Each system processor is having its own dedicated GPII(General
Purpose Interface Instance) acting as pipe between SE and GSI(Generic SW-
Interface) DMA HW engine. Hence the sharing of I2C is possible only in GPI
mode, not with FIFO/CPU DMA mode.

Each Processor subsystem must acquire Lock over the controller so that it
gets uninterrupted control till it unlocks the SE. Generally, GPIOs are
being unconfigured during It also makes sure the commonly shared TLMM GPIOs
are not touched which can impact other subsystem or cause any interruption.
suspend time. Transfer from each processor gets serialized by lock TRE +
Transfers + Unlock TRE at HW level.

GSI DMA engine is capable to perform requested transfer operations from any
of the I2C client in a seamless way and its transparent to the subsystems.
Make sure to enable “qcom,is-shared” flag only while enabling this feature.
I2C client should add in its respective parent node.

Signed-off-by: Mukesh Kumar Savaliya <quic_msavaliy@xxxxxxxxxxx>
----
Link to V4 : https://lore.kernel.org/lkml/20241113161413.3821858-1-quic_msavaliy@xxxxxxxxxxx/

Changes in V5:
- Corrected name as qcom,shared-se instead of qcom,is-shared.
- Added description for the SE acronyms into yaml file and commit log.
- Renamed TRE_I2C_UNLOCK to TRE_UNLOCK being generic.
- Log an error and return if non GPI mode goes into shared usecase.

---
Link to V3: https://lore.kernel.org/lkml/20240927063108.2773304-4-quic_msavaliy@xxxxxxxxxxx/T/

Changes in V4:
- Fixed Typo to dt-bindings in subject line of PATCH 1.
- Replaced SS (subsystem) as multiprocessor as per Bryan's suggestions.
- Replied to Krzysztof's comments and replaced SS with Multiprocessor system.
- Removed Abbreviations and also bullet point list from PATCH 1.
- Changed feature flag name from qcom,shared-se to qcom,is-shared.
- Removed bullet points from example of usecase and explained in paragraph.
- Changed title suffix to dmaengine from dma for Patch 2.
- Rename TRE_I2C_LOCK to TRE_LOCK in PATCH 2.
- Enhanced comments about not modifying the pin states on shared SE for PATCH 3.
- Enhanced shared_geni_se struct member explanation as per Bjorn's comment in PATCH 3.
- Moved GPIO unconfiguration description from patch 4 to patch 3 as pointed by Bjorn.
- Removed debug log which was unrelated to this feature change.
- Added usecase exmaple of shared SE in commit log.

---
Link to V2: https://lore.kernel.org/lkml/a88a16ff-3537-4396-b2ea-4ba02b4850e9@xxxxxxxxxxx/T/

Changes in V3:
- Added missing maintainers which i forgot to add.
- Add cover letter with description of SS and EE for dt-bindings patch.
- Added acronyms expansion to commit log.
- [PATCH v2 3/4] : Removed exported symbol geni_se_clks_off().
Instead added changes to bypass pinctrl sleep configuration from
geni_se_resources_off() function.
- Changed title name of [PATCH v2 3/4] to reflect the suggested changes.
- [PATCH v2 4/4] kept geni_i2c_runtime_suspend() as is and removed
explicit call to geni_se_clks_off().
- Removed is_shared variable from i2c driver and instead used common
shared_geni_se variable from qcom-geni-se.h so that other protocols
can also extend for similar feature.
- I2C driver log changed from dev_err() to dev_dbg() for timeout.
- set gpi_mode = true if shared_geni_se is set for this usecase. Enhanced
comments around code and commit log.
---

Link to V1: https://lore.kernel.org/lkml/cb7613d0-586e-4089-a1b6-2405f4dc4883@xxxxxxxxxxx/T/

Changes in V2:
- Enhanced commit log grammatically for PATCH v1 3/4 as suggested by Bryan.
- Updated Cover letter along with acronyms expansion.
- Added maintainers list from other subsystems for review, which was missing.
Thanks to Krzysztof for pointing out.
- Added cover letter with an example of Serial Engine sharing.
- Addressed review comments for all the patches.
---

Mukesh Kumar Savaliya (4):
dt-bindindgs: i2c: qcom,i2c-geni: Document shared flag
dmaengine: gpi: Add Lock and Unlock TRE support to access I2C
exclusively
soc: qcom: geni-se: Do not keep GPIOs to sleep state for shared SE
usecase
i2c: i2c-qcom-geni: Enable i2c controller sharing between two
subsystems

.../bindings/i2c/qcom,i2c-geni-qcom.yaml | 8 ++++
drivers/dma/qcom/gpi.c | 37 ++++++++++++++++++-
drivers/i2c/busses/i2c-qcom-geni.c | 22 +++++++++--
drivers/soc/qcom/qcom-geni-se.c | 13 +++++--
include/linux/dma/qcom-gpi-dma.h | 6 +++
include/linux/soc/qcom/geni-se.h | 3 ++
6 files changed, 81 insertions(+), 8 deletions(-)

--
2.25.1