[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1594896174-18826-3-git-send-email-yilun.xu@intel.com>
Date: Thu, 16 Jul 2020 18:42:53 +0800
From: Xu Yilun <yilun.xu@...el.com>
To: broonie@...nel.org, lee.jones@...aro.org,
linux-kernel@...r.kernel.org
Cc: trix@...hat.com, yilun.xu@...el.com,
matthew.gerlach@...ux.intel.com, russell.h.weight@...el.com,
lgoncalv@...hat.com, hao.wu@...el.com
Subject: [PATCH v2 2/3] regmap: spi-avmm: start with the last SOP on phy rx buffer parsing
From: Matthew Gerlach <matthew.gerlach@...ux.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@...ux.intel.com>
Signed-off-by: Xu Yilun <yilun.xu@...el.com>
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@...hat.com>
Signed-off-by: Tom Rix <trix@...hat.com>
---
v2: no change.
---
drivers/base/regmap/regmap-spi-avmm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/base/regmap/regmap-spi-avmm.c b/drivers/base/regmap/regmap-spi-avmm.c
index ab329d2..632e018 100644
--- a/drivers/base/regmap/regmap-spi-avmm.c
+++ b/drivers/base/regmap/regmap-spi-avmm.c
@@ -433,14 +433,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
Powered by blists - more mailing lists