From: Aniket RANDIVE <aniket.randive@oss.qualcomm.com>
To: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>,
Jyothi Kumar Seerapu <jyothi.seerapu@oss.qualcomm.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
Andi Shyti <andi.shyti@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v1 3/3] i2c: qcom-geni: Add bus recovery support for GPI DMA mode
Date: Tue, 13 Oct 2026 10:57:24 +0530 [thread overview]
Message-ID: <903bec3e-14a0-447a-8652-f57efa58cb68@oss.qualcomm.com> (raw)
In-Reply-To: <bcf5b148-d4d0-434d-a020-deca2381f5a3@oss.qualcomm.com>
On 9/7/2026 12:16 PM, Mukesh Savaliya wrote:
>
>
> On 9/3/2026 9:44 PM, Jyothi Kumar Seerapu wrote:
> [...]
>
>>> +static int geni_i2c_gpi_bus_cmd(struct geni_i2c_dev *gi2c, enum
>>> i2c_op cmd)
>>> +{
>>> + const struct geni_i2c_clk_fld *itr = gi2c->clk_fld;
>>> + struct dma_async_tx_descriptor *desc;
>>> + struct gpi_i2c_config peripheral = {};
>>> + struct dma_slave_config config = {};
>>> + unsigned long time_left;
>>> + unsigned long flags;
>>> + dma_cookie_t cookie;
>>> +
>>> + config.peripheral_config = &peripheral;
>>> + config.peripheral_size = sizeof(peripheral);
>>> +
>>> + peripheral.set_config = 1;
>>> + peripheral.pack_enable = I2C_PACK_TX | I2C_PACK_RX;
>>> + peripheral.cycle_count = itr->t_cycle_cnt;
>>> + peripheral.high_count = itr->t_high_cnt;
>>> + peripheral.low_count = itr->t_low_cnt;
>>> + peripheral.clk_div = itr->clk_div;
>>> + peripheral.op = cmd;
>>> +
>>> + if (dmaengine_slave_config(gi2c->tx_c, &config)) {
> should capture the return value and print, as it returns specific error
> code.>> + dev_err(gi2c->se.dev, "dma config error for bus cmd
> %u\n", cmd);
Yes we can capture it. I will update it in v2 patch.
>>> + return -EIO;
>>> + }
>>> +
>
> [...]
>
>>> @@ -1066,14 +1136,18 @@ static int geni_i2c_xfer(struct i2c_adapter
>>> *adap,
>>> else
>>> ret = geni_i2c_fifo_xfer(gi2c, msgs, num);
>>> - if (!gi2c->gpi_mode &&
>>> - (ret == -EPROTO || ret == -ETIMEDOUT || ret == -EAGAIN)) {
>>> + if (ret == -EPROTO || ret == -ETIMEDOUT || ret == -EAGAIN ||
>>> + (gi2c->gpi_mode && ret == -EIO)) {
>>> /*
>>> * Only attempt recovery if SDA is stuck low. -EPROTO and
>>> * -ETIMEDOUT indicate bus errors where the target may be
>>> * holding SDA low. ARB_LOST (-EAGAIN) on a single-controller
>>> * bus indicates a stuck target, not a real arbitration loss.
>>> - * GPI DMA mode extends this trigger separately.
>>> + * In GPI DMA mode the completion callback reports NACK,
>>> + * BUS_PROTO and ARB_LOST alike as -EIO, so the SE_GENI_IOS
>>> + * RX_DATA_IN check below is what distinguishes a genuinely
>>> + * stuck bus from a benign NACK: a NACK leaves SDA released
>>> + * (high) after the STOP, so recovery is skipped.
> after the STOP, indicating i2c bus is in idle state, so.....>>
Sure. Will update the comment.
> */
>>> if (!(readl_relaxed(gi2c->se.base + SE_GENI_IOS) &
>>> RX_DATA_IN)) {
>>> int recovery_ret = i2c_recover_bus(adap);
>> This does not appear to handle scenarios such as an I2C multi-message
>> transfer where the stretch bit is set during the first message, but an
>> error occurs while preparing the second message (for example, during
>> memory allocation or DMA descriptor preparation). In such cases, the
>> SCL line may remain asserted low and impact subsequent transfers.
>> > @@ -1292,10 +1366,8 @@ static int geni_i2c_probe(struct
>> platform_device *pdev)
>>> if (ret < 0)
>>> return ret;
>>> - if (!gi2c->gpi_mode) {
>>> - gi2c->rinfo.recover_bus = geni_i2c_recover_bus;
>>> - gi2c->adap.bus_recovery_info = &gi2c->rinfo;
>>> - }
>>> + gi2c->rinfo.recover_bus = geni_i2c_recover_bus;
>>> + gi2c->adap.bus_recovery_info = &gi2c->rinfo;
>>> ret = i2c_add_adapter(&gi2c->adap);
>>> if (ret)
>>>
>>
>
next prev parent reply other threads:[~2026-10-13 5:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 9:51 [PATCH 0/3] i2c: qcom-geni: Add I2C bus recovery support Aniket Randive
2026-08-26 9:51 ` [PATCH v1 1/3] dmaengine: qcom: gpi: Add I2C bus recovery opcode support Aniket Randive
2026-09-07 5:14 ` Mukesh Savaliya
2026-10-09 5:35 ` Aniket RANDIVE
2026-08-26 9:51 ` [PATCH v1 2/3] i2c: qcom-geni: Add bus recovery support for FIFO mode Aniket Randive
2026-09-03 16:17 ` Jyothi Kumar Seerapu
2026-09-07 6:05 ` Mukesh Savaliya
2026-09-07 6:10 ` Mukesh Savaliya
2026-10-09 6:58 ` Aniket RANDIVE
2026-08-26 9:51 ` [PATCH v1 3/3] i2c: qcom-geni: Add bus recovery support for GPI DMA mode Aniket Randive
2026-09-03 16:14 ` Jyothi Kumar Seerapu
2026-09-07 6:46 ` Mukesh Savaliya
2026-10-13 5:27 ` Aniket RANDIVE [this message]
2026-10-09 11:29 ` Aniket RANDIVE
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=903bec3e-14a0-447a-8652-f57efa58cb68@oss.qualcomm.com \
--to=aniket.randive@oss.qualcomm.com \
--cc=Frank.Li@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=jyothi.seerapu@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=viken.dadhaniya@oss.qualcomm.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®