From: Stephen Boyd <swboyd@chromium.org>
To: Mark Brown <broonie@kernel.org>
Cc: linux-kernel@vger.kernel.org, Alok Chauhan <alokc@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org,
Douglas Anderson <dianders@chromium.org>
Subject: [PATCH 7/5] spi: spi-geni-qcom: Don't set {tx,rx}_rem_bytes unnecessarily
Date: Thu, 18 Jun 2020 16:39:59 -0700 [thread overview]
Message-ID: <20200618233959.160032-2-swboyd@chromium.org> (raw)
In-Reply-To: <20200618150626.237027-1-dianders@chromium.org>
We only need to test for these counters being non-zero when we see the
end of a transfer. If we're doing a CS change then they will already be
zero. This implies that we don't need to set these to 0 if we're
cancelling an in flight transfer too, because we only care to test these
counters when the 'DONE' bit is set in the hardware and we've set them
to non-zero for a transfer.
This is a non-functional change, just cleanup to consolidate code.
Cc: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
drivers/spi/spi-geni-qcom.c | 42 ++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 670f83793aa4..828cfc988a3f 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -126,7 +126,6 @@ static void handle_fifo_timeout(struct spi_master *spi,
* came in while cancelling.
*/
mas->cur_xfer = NULL;
- mas->tx_rem_bytes = mas->rx_rem_bytes = 0;
geni_se_cancel_m_cmd(se);
spin_unlock_irq(&mas->lock);
@@ -517,29 +516,30 @@ static irqreturn_t geni_spi_isr(int irq, void *data)
if (mas->cur_xfer) {
spi_finalize_current_transfer(spi);
mas->cur_xfer = NULL;
+ /*
+ * If this happens, then a CMD_DONE came before all the
+ * Tx buffer bytes were sent out. This is unusual, log
+ * this condition and disable the WM interrupt to
+ * prevent the system from stalling due an interrupt
+ * storm.
+ *
+ * If this happens when all Rx bytes haven't been
+ * received, log the condition. The only known time
+ * this can happen is if bits_per_word != 8 and some
+ * registers that expect xfer lengths in num spi_words
+ * weren't written correctly.
+ */
+ if (mas->tx_rem_bytes) {
+ writel(0, se->base + SE_GENI_TX_WATERMARK_REG);
+ dev_err(mas->dev, "Premature done. tx_rem = %d bpw%d\n",
+ mas->tx_rem_bytes, mas->cur_bits_per_word);
+ }
+ if (mas->rx_rem_bytes)
+ dev_err(mas->dev, "Premature done. rx_rem = %d bpw%d\n",
+ mas->rx_rem_bytes, mas->cur_bits_per_word);
} else {
complete(&mas->cs_done);
}
-
- /*
- * If this happens, then a CMD_DONE came before all the Tx
- * buffer bytes were sent out. This is unusual, log this
- * condition and disable the WM interrupt to prevent the
- * system from stalling due an interrupt storm.
- * If this happens when all Rx bytes haven't been received, log
- * the condition.
- * The only known time this can happen is if bits_per_word != 8
- * and some registers that expect xfer lengths in num spi_words
- * weren't written correctly.
- */
- if (mas->tx_rem_bytes) {
- writel(0, se->base + SE_GENI_TX_WATERMARK_REG);
- dev_err(mas->dev, "Premature done. tx_rem = %d bpw%d\n",
- mas->tx_rem_bytes, mas->cur_bits_per_word);
- }
- if (mas->rx_rem_bytes)
- dev_err(mas->dev, "Premature done. rx_rem = %d bpw%d\n",
- mas->rx_rem_bytes, mas->cur_bits_per_word);
}
if (m_irq & M_CMD_CANCEL_EN)
--
Sent by a computer, using git, on the internet
next prev parent reply other threads:[~2020-06-18 23:40 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 15:06 [PATCH v4 0/5] spi: spi-geni-qcom: Fixes / perf improvements Douglas Anderson
2020-06-18 15:06 ` [PATCH v4 1/5] spi: spi-geni-qcom: No need for irqsave variant of spinlock calls Douglas Anderson
2020-06-18 15:15 ` Mark Brown
2020-06-18 15:06 ` [PATCH v4 2/5] spi: spi-geni-qcom: Mo' betta locking Douglas Anderson
2020-06-18 17:52 ` Stephen Boyd
2020-06-18 15:06 ` [PATCH v4 3/5] spi: spi-geni-qcom: Check for error IRQs Douglas Anderson
2020-06-18 15:06 ` [PATCH v4 4/5] spi: spi-geni-qcom: Actually use our FIFO Douglas Anderson
2020-06-18 15:06 ` [PATCH v4 5/5] spi: spi-geni-qcom: Don't keep a local state variable Douglas Anderson
2020-06-18 17:53 ` Stephen Boyd
2020-06-18 18:05 ` Stephen Boyd
2020-06-18 20:09 ` Doug Anderson
2020-06-18 21:52 ` Stephen Boyd
2020-06-18 22:00 ` Doug Anderson
2020-06-18 23:37 ` Stephen Boyd
2020-06-19 0:34 ` Doug Anderson
2020-06-18 23:39 ` [PATCH 6/5] spi: spi-geni-qcom: Simplify setup_fifo_xfer() Stephen Boyd
2020-06-19 0:40 ` Doug Anderson
2020-06-20 2:16 ` Stephen Boyd
2020-06-19 9:54 ` Mark Brown
2020-06-18 23:39 ` Stephen Boyd [this message]
2020-06-19 0:40 ` [PATCH 7/5] spi: spi-geni-qcom: Don't set {tx,rx}_rem_bytes unnecessarily Doug Anderson
2020-06-19 15:24 ` Mark Brown
2020-06-19 13:28 ` [PATCH v4 0/5] spi: spi-geni-qcom: Fixes / perf improvements Mark Brown
2020-06-22 14:59 ` Mark Brown
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=20200618233959.160032-2-swboyd@chromium.org \
--to=swboyd@chromium.org \
--cc=alokc@codeaurora.org \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.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