Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp603193pxb; Tue, 15 Feb 2022 23:28:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwtYAToERD/VLZzgpoPGxwjFM60UcoNmcxFIj2P3T63A0n0Nxy2bAg3tqDNBvpoFSEJkLbf X-Received: by 2002:a17:90b:3ec2:b0:1b9:fbeb:942b with SMTP id rm2-20020a17090b3ec200b001b9fbeb942bmr283613pjb.55.1644996515365; Tue, 15 Feb 2022 23:28:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644996515; cv=none; d=google.com; s=arc-20160816; b=aOHenpdW09lfcB7haSCsw5NDx5qRrBmrv4GHYYpuqQ6LMIVnrw6Iure85PuJNdg6SH nyU63odL6j9bKTP7jvA2S3Hnu5JLQCkp/HqJ385RHH6j3BsAVO3MJHxfaRTp5Mv7tfhu L+H/KQDwv2Zzt4ESGHs75IyJjlf+BKX2qxcsbeBjYyVYE0ENgWbxklSsAsgERe0HvOKl +wRJlopCHCgIkgdQeztlD6BCtwc8UTkcLAacaukO2WgfBsuicAoXLA4SsYguKHYkil2+ QItd4c+euslAd1sJRy5J2IMX/SznV2Owu5QHvmLoBhyKBeXTl8v2A04A2PwEgxRgxFnX s+NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=VdS6zMHAAQamF0Y4eOJ/8BeUZufBjhGOiQmQri8QgCQ=; b=WtvXUVZdsO+GLnhtQjH8wQ2jrwgHMFkqX3I8dw9deeeXulFxue46EBCzb2HdJ7xZ2Z yoKhOqzbBYIwgmS3oEqkOWUD27180LwvvI4PhzGxaB/4/4Riw3jZYCCuJG8g/VFrkUj6 AmcaJ2B4KPRKxmQAnCjLh5I4WsGZ4GFp84m18ZtyCCFUhqqPjRqoeqYerl/7FMCkcF0e zcqizmIjKpHDiPa+gNu7VRxkdokHVQlDqYEvP2bose/NSe6MziHHfSP1vFaR3qHZtAiO i4/IJoI1FCQBsu27l7zeHKUtriD5iWI+iZrKmI/N9bIH3VnAGkL0T4/FGkK2Gn6kIUEu YO9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 139si4763080pga.793.2022.02.15.23.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Feb 2022 23:28:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=rock-chips.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CAE491954D5; Tue, 15 Feb 2022 22:56:17 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245667AbiBPBlK (ORCPT + 99 others); Tue, 15 Feb 2022 20:41:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245569AbiBPBkq (ORCPT ); Tue, 15 Feb 2022 20:40:46 -0500 Received: from mail-m17640.qiye.163.com (mail-m17640.qiye.163.com [59.111.176.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EACF237CA; Tue, 15 Feb 2022 17:40:36 -0800 (PST) Received: from localhost.localdomain (unknown [58.22.7.114]) by mail-m17640.qiye.163.com (Hmail) with ESMTPA id EA20B5401E7; Wed, 16 Feb 2022 09:40:33 +0800 (CST) From: Jon Lin To: broonie@kernel.org Cc: heiko@sntech.de, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jon Lin Subject: [PATCH v3 2/6] spi: rockchip: terminate dma transmission when slave abort Date: Wed, 16 Feb 2022 09:40:24 +0800 Message-Id: <20220216014028.8123-3-jon.lin@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220216014028.8123-1-jon.lin@rock-chips.com> References: <20220216014028.8123-1-jon.lin@rock-chips.com> X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZCBgUCR5ZQVlLVUtZV1 kWDxoPAgseWUFZKDYvK1lXWShZQUhPN1dZLVlBSVdZDwkaFQgSH1lBWUJPTBpWHU0aSUxNThpDSh 4fVRMBExYaEhckFA4PWVdZFhoPEhUdFFlBWVVLWQY+ X-HM-Sender-Digest: e1kMHhlZQR0aFwgeV1kSHx4VD1lBWUc6PSI6Azo*Cz5IPBYRUQ0IGQ04 DjQaFBdVSlVKTU9PQkxOTUhPTU5IVTMWGhIXVREUFVUXEhU7CRQYEFYYExILCFUYFBZFWVdZEgtZ QVlOQ1VJSVVMVUpKT1lXWQgBWUFJSklDNwY+ X-HM-Tid: 0a7f003036d7d995kuwsea20b5401e7 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SORBS_WEB, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 After slave abort, all DMA should be stopped, or it will affect the next transmission and maybe abort again. Signed-off-by: Jon Lin --- Changes in v3: None Changes in v2: - Fix patches should be at the start of the series - Delete useless messages Changes in v1: None 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.17.1