LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Douglas Anderson <dianders@chromium.org>
To: Mark Brown <broonie@kernel.org>,
	Benson Leung <bleung@chromium.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: linux-rockchip@lists.infradead.org, drinkcat@chromium.org,
	Guenter Roeck <groeck@chromium.org>,
	briannorris@chromium.org, mka@chromium.org,
	Douglas Anderson <dianders@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v4 3/3] platform/chrome: cros_ec_spi: Request the SPI thread be realtime
Date: Wed, 15 May 2019 09:48:13 -0700	[thread overview]
Message-ID: <20190515164814.258898-4-dianders@chromium.org> (raw)
In-Reply-To: <20190515164814.258898-1-dianders@chromium.org>

All currently known ECs in the wild are very sensitive to timing.
Specifically the ECs are known to drop a transfer if more than 8 ms
passes from the assertion of the chip select until the transfer
finishes.

Let's use the new feature introduced in the patch (spi: Allow SPI
devices to request the pumping thread be realtime") to request the SPI
pumping thread be realtime.  This means that if we get shunted off to
the SPI thread for whatever reason we won't get downgraded to low
priority.

NOTES:
- We still need to keep ourselves as high priority since the SPI core
  doesn't guarantee that all transfers end up on the pumping thread
  (in fact, it tries pretty hard to do them in the calling context).
- If future Chrome OS ECs ever fix themselves to be less sensitive
  then we could consider adding a property (or compatible string) to
  not set this property.  For now we need it across the board.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
---

Changes in v4: None
Changes in v3:
- Updated description and variable name since we no longer force.

Changes in v2:
- Renamed variable to "force_rt_transfers".

 drivers/platform/chrome/cros_ec_spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/chrome/cros_ec_spi.c b/drivers/platform/chrome/cros_ec_spi.c
index 1e38a885c539..daf3119191c8 100644
--- a/drivers/platform/chrome/cros_ec_spi.c
+++ b/drivers/platform/chrome/cros_ec_spi.c
@@ -740,6 +740,7 @@ static int cros_ec_spi_probe(struct spi_device *spi)
 
 	spi->bits_per_word = 8;
 	spi->mode = SPI_MODE_0;
+	spi->rt = true;
 	err = spi_setup(spi);
 	if (err < 0)
 		return err;
-- 
2.21.0.1020.gf2820cf01a-goog


  parent reply	other threads:[~2019-05-15 16:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15 16:48 [PATCH v4 0/3] spi: A better solution for cros_ec_spi reliability Douglas Anderson
2019-05-15 16:48 ` [PATCH v4 1/3] platform/chrome: cros_ec_spi: Move to real time priority for transfers Douglas Anderson
2019-05-15 17:02   ` Guenter Roeck
2019-05-21  7:52     ` Enric Balletbo i Serra
2019-05-15 16:48 ` [PATCH v4 2/3] spi: Allow SPI devices to request the pumping thread be realtime Douglas Anderson
2019-05-21  7:49   ` Enric Balletbo i Serra
2019-05-23 13:46   ` Mark Brown
2019-05-23 13:49   ` Applied "spi: Allow SPI devices to request the pumping thread be realtime" to the spi tree Mark Brown
2019-05-15 16:48 ` Douglas Anderson [this message]
2019-05-21  7:50   ` [PATCH v4 3/3] platform/chrome: cros_ec_spi: Request the SPI thread be realtime Enric Balletbo i Serra
2019-05-24 10:26   ` Enric Balletbo i Serra

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=20190515164814.258898-4-dianders@chromium.org \
    --to=dianders@chromium.org \
    --cc=bleung@chromium.org \
    --cc=briannorris@chromium.org \
    --cc=broonie@kernel.org \
    --cc=drinkcat@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mka@chromium.org \
    --subject='Re: [PATCH v4 3/3] platform/chrome: cros_ec_spi: Request the SPI thread be realtime' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).