From patchwork Fri Jan 24 09:29:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 233192 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0D4CC32771 for ; Fri, 24 Jan 2020 09:55:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D51921556 for ; Fri, 24 Jan 2020 09:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859735; bh=gISvfdF3rq83FvdFZr/q1r1oTwT69/DCEI7zMbw+coc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2lIc1KZEe/IMsXoetkvsblDmA587Gs7VcTw4lRgqJ2L3msFJ+DXcdXZD0VTvyPxui A6DwHGPHqCI6c4SOddhcy9Ud0VKyfclRptxBvPuibVVYmf2N+QqGUnpcuw1ihvpC5w mNeiYKmdVvMlSo2j1zJPXP/8FvE68n5CT5YpFMMk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388223AbgAXJzb (ORCPT ); Fri, 24 Jan 2020 04:55:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:58742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731598AbgAXJza (ORCPT ); Fri, 24 Jan 2020 04:55:30 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B4EF20709; Fri, 24 Jan 2020 09:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859730; bh=gISvfdF3rq83FvdFZr/q1r1oTwT69/DCEI7zMbw+coc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vysag40pjsStckJ1sbeW9XlxBd89DrirXxsfMNJ41ZhaklXqBERdUyYk5SVu4tZvC cPrl21ZI7FAsX6utYQZ9i9cUVjETvrwVSo9oo7Ekg4S1sHVYoRELUGUnlowNoZWp8t 2/CDDygeLJXsUssTijHCGUPK2d9Yxa5aHyknSo9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sowjanya Komatineni , Mark Brown , Sasha Levin Subject: [PATCH 4.14 158/343] spi: tegra114: terminate dma and reset on transfer timeout Date: Fri, 24 Jan 2020 10:29:36 +0100 Message-Id: <20200124092940.748210843@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Sowjanya Komatineni [ Upstream commit 32bd1a9551cae34e6889afa235c7afdfede9aeac ] Fixes: terminate DMA and perform controller reset on transfer timeout to clear the FIFO's and errors. Signed-off-by: Sowjanya Komatineni Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra114.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index c6674b01e0fd6..4878d5e00c669 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -869,7 +869,16 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, if (WARN_ON(ret == 0)) { dev_err(tspi->dev, "spi transfer timeout, err %d\n", ret); + if (tspi->is_curr_dma_xfer && + (tspi->cur_direction & DATA_DIR_TX)) + dmaengine_terminate_all(tspi->tx_dma_chan); + if (tspi->is_curr_dma_xfer && + (tspi->cur_direction & DATA_DIR_RX)) + dmaengine_terminate_all(tspi->rx_dma_chan); ret = -EIO; + reset_control_assert(tspi->rst); + udelay(2); + reset_control_deassert(tspi->rst); goto complete_xfer; }