From: alokc@codeaurora.org
To: Stephen Boyd <swboyd@chromium.org>
Cc: broonie@kernel.org, dianders@chromium.org,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
mka@chromium.org, linux-arm-msm@vger.kernel.org,
Girish Mahadevan <girishm@codeaurora.org>,
Dilip Kota <dkota@codeaurora.org>
Subject: Re: [PATCH V5 3/3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP
Date: Thu, 11 Oct 2018 12:43:56 +0530 [thread overview]
Message-ID: <0cffce97ad9c25e397a450c43e31c397@codeaurora.org> (raw)
In-Reply-To: <153904219713.119890.7463642233895152532@swboyd.mtv.corp.google.com>
>> +static irqreturn_t geni_spi_isr(int irq, void *data)
>> +{
>> + struct spi_master *spi = data;
>> + struct spi_geni_master *mas = spi_master_get_devdata(spi);
>> + struct geni_se *se = &mas->se;
>> + u32 m_irq;
>> + unsigned long flags;
>> + irqreturn_t ret = IRQ_HANDLED;
>> +
>> + if (mas->cur_mcmd == CMD_NONE)
>> + return IRQ_NONE;
>> +
>> + spin_lock_irqsave(&mas->lock, flags);
>> + m_irq = readl(se->base + SE_GENI_M_IRQ_STATUS);
>> +
>> + if ((m_irq & M_RX_FIFO_WATERMARK_EN) || (m_irq &
>> M_RX_FIFO_LAST_EN))
>> + geni_spi_handle_rx(mas);
>> +
>> + if (m_irq & M_TX_FIFO_WATERMARK_EN)
>> + geni_spi_handle_tx(mas);
>> +
>> + if (m_irq & M_CMD_DONE_EN) {
>> + if (mas->cur_mcmd == CMD_XFER)
>> + spi_finalize_current_transfer(spi);
>> + else if (mas->cur_mcmd == CMD_CS)
>> + complete(&mas->xfer_done);
>> + mas->cur_mcmd = CMD_NONE;
>> + /*
>> + * 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) || (m_irq & M_CMD_ABORT_EN)) {
>> + mas->cur_mcmd = CMD_NONE;
>> + complete(&mas->xfer_done);
>> + }
>> +
>> + writel(m_irq, se->base + SE_GENI_M_IRQ_CLEAR);
>> + spin_unlock_irqrestore(&mas->lock, flags);
>> + return ret;
>
> Nitpick: Now this always returns IRQ_HANDLED, and we assign ret just to
> do that. Perhaps only return IRQ_HANDLED if one of the above if
> conditions is taken?
Not always. If ISR get triggered without setting proper cur_mcmd then it
will return IRQ_NONE.
prev parent reply other threads:[~2018-10-11 7:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 13:44 [PATCH V5 0/3] spi-geni-qcom: QUP SPI GENI driver and SPI device tree bindings Alok Chauhan
2018-10-03 13:44 ` [PATCH V5 1/3] dt-bindings: soc: qcom: Remove SPI controller maximum frequency binding Alok Chauhan
2018-10-03 13:44 ` [PATCH V5 2/3] dt-bindings: soc: qcom: GENI SE SPI controller device tree binding Alok Chauhan
2018-10-03 13:44 ` [PATCH V5 3/3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP Alok Chauhan
2018-10-03 17:46 ` Doug Anderson
2018-10-08 23:43 ` Stephen Boyd
2018-10-08 23:52 ` Doug Anderson
2018-10-09 16:12 ` Stephen Boyd
2018-10-09 17:48 ` Doug Anderson
2018-10-09 19:45 ` Stephen Boyd
2018-10-09 21:18 ` Doug Anderson
2018-10-10 1:22 ` Stephen Boyd
2018-10-11 7:13 ` alokc [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=0cffce97ad9c25e397a450c43e31c397@codeaurora.org \
--to=alokc@codeaurora.org \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=dkota@codeaurora.org \
--cc=girishm@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=mka@chromium.org \
--cc=swboyd@chromium.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;
as well as URLs for NNTP newsgroup(s).