Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3407402rwa; Tue, 23 Aug 2022 04:23:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pOXKD45L3aTrHLb/KEjLoj3mal+4QnJ2PLJ74Ooi8Y64R7ujOYJgBP+fWgTs3ICltXK7S X-Received: by 2002:a05:6a00:bd9:b0:536:5c52:f408 with SMTP id x25-20020a056a000bd900b005365c52f408mr13732942pfu.31.1661253789407; Tue, 23 Aug 2022 04:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253789; cv=none; d=google.com; s=arc-20160816; b=XraV9dLqmnkTVW3XQ27ExVLUsez4yuIjqL+9N6t5J/9ti6Zlpe7qgYCn8gnEq6WgAN zVjplXm/ObawcIEgUm2SAKBPuzj6QEA8bpMJ14u6J/Nzaqyo8pKKp7C/vyURziLOVjS5 qh1R1fIYv5my5VAulJ1DlkkBcL6OeCq1DpzW6DWUOgR1smi5tN8gDueKdttGX6gzEYei QfSBBen0G4z033hYcixSOwknaxu6WYN4JVJKP1i7E03Vyj+OGwTNI+oCZYAPejtaOP8P dKFmNpD1VM8AMd0R7EvhgDNyubjAWOkfSgLtCWenCczaCsnjA4wiYwEaKz/nKvm92xoS fpuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JWRyquyNwYbYXf6YlIIS0jNYagt/CcSu6qDJTgEpt6g=; b=qSR40hnII50MvyX9f6Ax1NOvHwGT8R6p+mRRtOjwJFqOJ2roP+ybcw7qHf70y9glvb 9qte7WFD28dBesnPsNaCAkR+MHvHlWDBSmE0qZ+jszs8eX2xbo44oUdi3M2wjtQGYCv4 nikCXeYOVMitjo8syBQHIS2B7OgDFS9FiXNw8LBp56qBZ5ZHCX8yhGATT6CzuDo3LM8o o1u3dU6obv1ZnO1RY/UEJYV6rjoY1g9FttkJ5Cgc3zfiG2wHPuZFSxrfaNr5Oys8x2mS vxzM7qlBSCuc9MntRtDZx/hDW0DYxaRZ2LdWyfcTKRuMqeOvW5OhVD1HR+MnIXIQ7Ogh i/bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wXIW0YDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a655641000000b00428feddd582si15749761pgs.853.2022.08.23.04.22.57; Tue, 23 Aug 2022 04:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wXIW0YDM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352475AbiHWKHm (ORCPT + 99 others); Tue, 23 Aug 2022 06:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352445AbiHWKBz (ORCPT ); Tue, 23 Aug 2022 06:01:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9209B7C1CD; Tue, 23 Aug 2022 01:49:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BA296B81C50; Tue, 23 Aug 2022 08:33:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F4EBC433C1; Tue, 23 Aug 2022 08:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243623; bh=/EAzLTw2LDeTTq+gH0iIZMFAkA3J3B3MG6b3v5PKd8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXIW0YDMKyye69iUaMvGeD5I66tGKpPpxglAaYKQYrnp/Avt932a+4Sx+43FcCLiV ZUNXc/SuhRw1ASiefOXu34Le3kgWz9nnnhjCzVlzE8f9l8pfhCYoIJt6ZZIyvD3LyX JVQfsq3doNBQQq6SQXFqhxT/ZsWnTj7johk4ggRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Akhil R , Jon Hunter , Vinod Koul , Sasha Levin Subject: [PATCH 5.19 306/365] dmaengine: tegra: Add terminate() for Tegra234 Date: Tue, 23 Aug 2022 10:03:27 +0200 Message-Id: <20220823080130.997084605@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Akhil R [ Upstream commit 36834c67016794b8fa03d7672a5b7f2cc4529298 ] In certain cases where the DMA client bus gets corrupted or if the end device ceases to send/receive data, DMA can wait indefinitely for the data to be received/sent. Attempting to terminate the transfer will put the DMA in pause flush mode and it remains there. The channel is irrecoverable once this pause times out in Tegra194 and earlier chips. Whereas, from Tegra234, it can be recovered by disabling the channel and reprograming it. Hence add a new terminate() function that ignores the outcome of dma_pause() so that terminate_all() can proceed to disable the channel. Signed-off-by: Akhil R Reviewed-by: Jon Hunter Link: https://lore.kernel.org/r/20220720104045.16099-3-akhilrajeev@nvidia.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/tegra186-gpc-dma.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/dma/tegra186-gpc-dma.c b/drivers/dma/tegra186-gpc-dma.c index 05cd451f541d..fa9bda4a2bc6 100644 --- a/drivers/dma/tegra186-gpc-dma.c +++ b/drivers/dma/tegra186-gpc-dma.c @@ -157,8 +157,8 @@ * If any burst is in flight and DMA paused then this is the time to complete * on-flight burst and update DMA status register. */ -#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 20 -#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 100 +#define TEGRA_GPCDMA_BURST_COMPLETE_TIME 10 +#define TEGRA_GPCDMA_BURST_COMPLETION_TIMEOUT 5000 /* 5 msec */ /* Channel base address offset from GPCDMA base address */ #define TEGRA_GPCDMA_CHANNEL_BASE_ADD_OFFSET 0x20000 @@ -432,6 +432,17 @@ static int tegra_dma_device_resume(struct dma_chan *dc) return 0; } +static inline int tegra_dma_pause_noerr(struct tegra_dma_channel *tdc) +{ + /* Return 0 irrespective of PAUSE status. + * This is useful to recover channels that can exit out of flush + * state when the channel is disabled. + */ + + tegra_dma_pause(tdc); + return 0; +} + static void tegra_dma_disable(struct tegra_dma_channel *tdc) { u32 csr, status; @@ -1292,6 +1303,14 @@ static const struct tegra_dma_chip_data tegra194_dma_chip_data = { .terminate = tegra_dma_pause, }; +static const struct tegra_dma_chip_data tegra234_dma_chip_data = { + .nr_channels = 31, + .channel_reg_size = SZ_64K, + .max_dma_count = SZ_1G, + .hw_support_pause = true, + .terminate = tegra_dma_pause_noerr, +}; + static const struct of_device_id tegra_dma_of_match[] = { { .compatible = "nvidia,tegra186-gpcdma", @@ -1299,6 +1318,9 @@ static const struct of_device_id tegra_dma_of_match[] = { }, { .compatible = "nvidia,tegra194-gpcdma", .data = &tegra194_dma_chip_data, + }, { + .compatible = "nvidia,tegra234-gpcdma", + .data = &tegra234_dma_chip_data, }, { }, }; -- 2.35.1