From: Xu Yilun <yilun.xu@intel.com>
To: lee.jones@linaro.org, linux-kernel@vger.kernel.org
Cc: trix@redhat.com, yilun.xu@intel.com,
matthew.gerlach@linux.intel.com, russell.h.weight@intel.com,
lgoncalv@redhat.com
Subject: [PATCH 2/2] mfd: intel-m10-bmc: start with the last SOP on phy rx buffer parsing
Date: Mon, 13 Jul 2020 12:34:56 +0800 [thread overview]
Message-ID: <1594614896-16606-3-git-send-email-yilun.xu@intel.com> (raw)
In-Reply-To: <1594614896-16606-1-git-send-email-yilun.xu@intel.com>
From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
This patch works around a bug in the SPI Slave to Avalon Master bridge.
The SPI slave will send an unexpected extra SOP in the following case.
One in approximately one million read requests results in an apparant
stall on the avalon bus where the SPI slave inserts IDLE characters. When
the stall is over, the slave sends an extra SOP character instead of the
0x7c indicating channel. The other characters are correct.
To eliminate the impact of the bug, this patch changes to look for the
last SOP as the start point of the valid phy rx data.
Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/mfd/intel-spi-avmm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/intel-spi-avmm.c b/drivers/mfd/intel-spi-avmm.c
index 2604657..e4443b7 100644
--- a/drivers/mfd/intel-spi-avmm.c
+++ b/drivers/mfd/intel-spi-avmm.c
@@ -431,14 +431,14 @@ static int pkt_phy_rx_parse(struct device *dev,
{
char *b, *p;
- b = phy_buf;
p = trans_buf;
- /* Find the SOP */
- while (b < phy_buf + phy_len && *b != PKT_SOP)
- b++;
+ /* Find the last SOP */
+ b = (phy_buf + phy_len) - 1;
+ while (b >= phy_buf && *b != PKT_SOP)
+ b--;
- if (b >= phy_buf + phy_len) {
+ if (b < phy_buf) {
dev_err(dev, "%s no SOP\n", __func__);
return -EINVAL;
}
--
2.7.4
prev parent reply other threads:[~2020-07-13 4:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 4:34 [PATCH 0/2] add Intel Max10 BMC chip support Xu Yilun
2020-07-13 4:34 ` [PATCH 1/2] mfd: intel-m10-bmc: add Max10 BMC chip support for Intel FPGA PAC Xu Yilun
2020-07-13 9:17 ` Lee Jones
2020-07-14 6:05 ` Xu Yilun
2020-07-14 6:50 ` Lee Jones
2020-07-14 6:52 ` Xu Yilun
2020-07-13 4:34 ` Xu Yilun [this message]
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=1594614896-16606-3-git-send-email-yilun.xu@intel.com \
--to=yilun.xu@intel.com \
--cc=lee.jones@linaro.org \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.gerlach@linux.intel.com \
--cc=russell.h.weight@intel.com \
--cc=trix@redhat.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
all inboxes | Powered by JetHome®