Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp961781pxp; Wed, 16 Mar 2022 22:44:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyooBy6MFgL/6uy0PP5AKQD79vvqjQ2cgrsYxoAWgwSFobmIYomJ/OspeX4i+zrybBIRGCU X-Received: by 2002:a65:4081:0:b0:381:6ff8:f4ba with SMTP id t1-20020a654081000000b003816ff8f4bamr2333859pgp.457.1647495890330; Wed, 16 Mar 2022 22:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647495890; cv=none; d=google.com; s=arc-20160816; b=I0GZqSsa03Lknmkh/dW4C8+Ol6Quhs7D+LsQSxAuODojYM8RJ+vO7s6mF3MTEGczK0 ZeZrlGwMXV5wI1btoCskX0HmWExoRleE9T7ywZ7ZBkQVIlS/fZU5k31h2rof3rJENeJz Yist7UGUpokFBZzX9j0DmxLj7mztrGVk89ibQD4YfHo9JX975CVYzJ6tIJh3zzzGPpbx YfGsbKfZNsRP7YHyMSiTQGSOhQxqHgyfIBHbcxb5FGOnPOXzSkkumw4KBL1rlqbpiVo9 L2yFRioAvJ5UCtt0TMYU9OSESsUY5OfNEnpeV7jeOZiRSax6SCm8V57nQTmc/pVJLGwT ZVyg== 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=T4GJRKm5NE4GFmdgAMZuARgRxAhbcQ5Fvc1N+oTWOLw=; b=wkgOneLp9kjxgtLQ0aWla635s8VgDqmAIgqY6OxAUYM8E59/WkPf5kIV0GpIC03MhW xRhODLQtvdwABa8clOgDLLdblhV3vcNtpG5oGpishIGWlKGiH8uP7BoByp81pRAM1T4s ogDBMn/FLwLj5gi39ng4M1WaEnxVPa4y3NKzD4BtoRTFvEBSfrcSc7VNZKQfvry+skGG 9qPabzGeC1LIR2gxdvPGIn0pd8unrqHkRlNTWrktrAMwG2qUu8ZWnc8QVuU8HWCaSN1E 85o447hZk5ep7pAcT5Ogq97nHvSXF5CxAxKR4+MemPPiqcaJguVTI/lUHpufUizICoqk Dp4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tr6w9XO1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p5-20020a056a0026c500b004f6e1253f4asi3498321pfw.79.2022.03.16.22.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 22:44:50 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tr6w9XO1; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 00FDF2359CD; Wed, 16 Mar 2022 21:39:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242871AbiCNMaU (ORCPT + 99 others); Mon, 14 Mar 2022 08:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243908AbiCNMVX (ORCPT ); Mon, 14 Mar 2022 08:21:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 640CBDFC7; Mon, 14 Mar 2022 05:17:58 -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 dfw.source.kernel.org (Postfix) with ESMTPS id F231860C6D; Mon, 14 Mar 2022 12:17:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB273C340EC; Mon, 14 Mar 2022 12:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260277; bh=4Fma61kxyBtoEpmgucDXrTf9L5hhilvU5ts6daQFQuc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tr6w9XO1oy3OJ1lq0R83gU4YZVuRmQ0iStTZNh3OcppNRl/6duuVT3MO4jmgFpwH7 DwNkyVPYJsZUJz7AMadUBa9NbW8f8/HePsxq2+nIzkgHKl3Z2ZdqHbpv1jazEEClSb xH6BLIGXrWBmHzQzQBhFTSAoLU940TZJ7m/CTOh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.16 067/121] spi: rockchip: terminate dma transmission when slave abort Date: Mon, 14 Mar 2022 12:54:10 +0100 Message-Id: <20220314112745.994984753@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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: Jon Lin [ Upstream commit 80808768e41324d2e23de89972b5406c1020e6e4 ] After slave abort, all DMA should be stopped, or it will affect the next transmission and maybe abort again. Signed-off-by: Jon Lin Link: https://lore.kernel.org/r/20220216014028.8123-3-jon.lin@rock-chips.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-rockchip.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index 4f65ba3dd19c..c6a1bb09be05 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c @@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr) { struct rockchip_spi *rs = spi_controller_get_devdata(ctlr); + if (atomic_read(&rs->state) & RXDMA) + dmaengine_terminate_sync(ctlr->dma_rx); + if (atomic_read(&rs->state) & TXDMA) + dmaengine_terminate_sync(ctlr->dma_tx); + atomic_set(&rs->state, 0); + spi_enable_chip(rs, false); rs->slave_abort = true; spi_finalize_current_transfer(ctlr); -- 2.34.1