From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: tianye@sugon.com
Cc: jarkko.nikula@linux.intel.com, mika.westerberg@linux.intel.com,
jsd@semihalf.com, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: designware: slave should do WRITE_RECEIVED before SLAVE_STOP
Date: Mon, 10 Oct 2022 09:58:06 +0300 [thread overview]
Message-ID: <Y0PCfkobAoWQ3vmG@smile.fi.intel.com> (raw)
In-Reply-To: <20221010034015.7526-1-tianye@sugon.com>
On Mon, Oct 10, 2022 at 11:40:15AM +0800, tianye@sugon.com wrote:
> From: Tian Ye <tianye@sugon.com>
>
> Sometimes when designware slave receive 3byte in high speed mode:
DesignWare
3 bytes
> 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x514 : INTR_STAT=0x4
> I2C_SLAVE_WRITE_REQUESTED
> I2C_SLAVE_WRITE_RECEIVED
> 0x1 STATUS SLAVE_ACTIVITY=0 : RAW_INTR_STAT=0x714 : INTR_STAT=0x204
> I2C_SLAVE_WRITE_RECEIVED
> I2C_SLAVE_STOP
> 0x1 STATUS SLAVE_ACTIVITY=0x1 : RAW_INTR_STAT=0x514 : INTR_STAT=0x4
> I2C_SLAVE_WRITE_REQUESTED
> I2C_SLAVE_WRITE_RECEIVED
>
> When second slave interrupt occus:slave rx fifo receive two bytes and
occurs: slave Rx FIFO receives 2 bytes
> stop interrupt occus at the same time.
occurs
...
Please, do a spell check / proof reading of the commit messages.
...
> + u32 rx_valid;
> + regmap_read(dev, DW_IC_RXFLR, &rx_valid);
If regmap_read() fails, rx_valid will contain garbage...
> + for (; rx_valid > 0; rx_valid--) {
...and this will go far beyond the expected boundaries.
> + regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
> + val = tmp;
> + if (!i2c_slave_event(dev->slave, I2C_SLAVE_WRITE_RECEIVED,
> + &val))
> + dev_vdbg(dev->dev, "Byte %X acked!", val);
Why do you need this? regmap has it's own trace event mechanism, isn't it
enough?
> + }
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-10-10 6:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 3:40 [PATCH] i2c: designware: slave should do WRITE_RECEIVED before SLAVE_STOP tianye
2022-10-10 6:58 ` Andy Shevchenko [this message]
2022-10-10 8:13 ` kernel test robot
2022-10-10 12:02 ` kernel test robot
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=Y0PCfkobAoWQ3vmG@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=tianye@sugon.com \
/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