Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1851137imm; Thu, 11 Oct 2018 00:27:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV63CCAwoF1cd4LxiCgauXiNHEiNgYfw6hBy0L/izmCtBdPNaje2olJMhftRbiT73ots5WLCH X-Received: by 2002:a65:66c9:: with SMTP id c9-v6mr393558pgw.55.1539242824000; Thu, 11 Oct 2018 00:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539242823; cv=none; d=google.com; s=arc-20160816; b=nb4AvhBkC9T4hPMx9BJp5wwakLtn/L4bZkDjupsY34QX296ogc4uh7yc+OvKnphawo ZAp0M1P8Cq2uq//YryyjpRAoxDyYvXE66jnRDmGBmEL36himAngsnCGLvrDxp+0kSNHK qt0wqD88efRx6LB0Yx8aiqmHgPJVUx9ni+Efnx7Mrd0teGPzwnPFut1o/WCxpJbKhgEM /eqGyeJUtt4JIDaqRJ1uMh6YKZfokRpDvdHhsTDlRc7WH0QleNam1/BxqUeB/cCw2TxL M1dyN+k2XHhiZ700LYUIVuM1TTA2uUe/cjOkoYNtPHJgIwxW12nWwR/6J4S73/pr16bO urfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=ctUuz2XnB9G8j3KHvUDyaOFgXVjmkieo+UilSz18+6s=; b=xcqkwAidn58bJ+ig1dYO95ADFKoFEMDGsSZ/IiqvYL+2wUI71g9Z3r53T4leSQV5RW cV1O6sf/e0bGZKG9adDDaJgbB+5zBQZcyOc2ZeFhb1peJp+poGam47/a9gQwMAEVUCzv IpYBftiX42WhiIXyeSYJBlSa/MHXCsqwlF+hQ+mOc+YLZydlPH5BXS1dxW58oTh+9Y5/ upVtuLpKT6F/5qtOj/K0sziUpTxv8tRjQHBgRlXr8R48Qgkkvziq7hNyydyYi40dSef7 HpS6VkeFQ3KY8PsrEdPl7JEQyOBPvtK+xieBduahDjn55eJ295pLlFFk1WQD4943zSOG YWBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=BvMAHvr1; dkim=pass header.i=@codeaurora.org header.s=default header.b=T4eYNzAJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q16-v6si3566800pgb.266.2018.10.11.00.26.48; Thu, 11 Oct 2018 00:27:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=BvMAHvr1; dkim=pass header.i=@codeaurora.org header.s=default header.b=T4eYNzAJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbeJKOjy (ORCPT + 99 others); Thu, 11 Oct 2018 10:39:54 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57994 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbeJKOjy (ORCPT ); Thu, 11 Oct 2018 10:39:54 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 445EE6063F; Thu, 11 Oct 2018 07:13:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539242037; bh=Nq6kym1pl8Kgr6ofuLIGbmm0n3GNiqcfAK0u40QadkM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BvMAHvr1FdpWwuITK3uzaDUsmpYHOndnd1mX1hCplYCDS3roLzIZwRhjdRQ0HbxIm SCZ9GdHz7H+VnVNSbPg8angR/muz13nWn7fIYGxLkiu1GaeYDXJIEGSMbPp3M3+Dix xgYYzGKSTh6kIRpBNG1/O4qj5judQMuUX+Uqh9es= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 9CA1B60B0D; Thu, 11 Oct 2018 07:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539242036; bh=Nq6kym1pl8Kgr6ofuLIGbmm0n3GNiqcfAK0u40QadkM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=T4eYNzAJTMwIylukMMqMqbMFxbtqkYobWIegteZDkyFFtaEL5pzkgOK9t+Y4p3buD PhqQwZ6nZZIY6+RL2Lg0N1aQ1rWEDUjJIKY98OKSa1YzTkRaJATiXkjjqAP0lFLkZ9 xi8dbQPqI2wquCqx+Y8kF0jyYgKzUy1oyoiRawps= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 11 Oct 2018 12:43:56 +0530 From: alokc@codeaurora.org To: Stephen Boyd 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 , Dilip Kota Subject: Re: [PATCH V5 3/3] spi: spi-geni-qcom: Add SPI driver support for GENI based QUP In-Reply-To: <153904219713.119890.7463642233895152532@swboyd.mtv.corp.google.com> References: <1538574265-30235-1-git-send-email-alokc@codeaurora.org> <1538574265-30235-4-git-send-email-alokc@codeaurora.org> <153904219713.119890.7463642233895152532@swboyd.mtv.corp.google.com> Message-ID: <0cffce97ad9c25e397a450c43e31c397@codeaurora.org> X-Sender: alokc@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> +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.