Received: by 2002:a17:90a:37e8:0:0:0:0 with SMTP id v95csp8820073pjb; Tue, 1 Oct 2019 04:44:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZSaH0v13fnpsG253MVv1urx2EDtdOP9xXPrXEYL88piWlkJ0fGEVF+upKUr3up684jslJ X-Received: by 2002:a17:906:32c2:: with SMTP id k2mr15820853ejk.140.1569930263445; Tue, 01 Oct 2019 04:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569930263; cv=none; d=google.com; s=arc-20160816; b=LG6FO+22ZcxNMSbMxlAjOQcHcvMxh4/f2oII6q3GubVQxPJ8GewVD0vCbUdgdBAQVc r1Q4mWZHec4OyrKF0CpYPuHcBJem/6ag0hvPtXJEAxx/Rce4DT5tDCA2fqhC3KUeZ0FV PIUGhRpl9bgG2ENWlqvfVkEmJ6uyBa2aeunCuJJUaQyOj7k5lDqreyDVwURR20ErGvLC TWe2+hlCUtAtnD7VCPeU7UL+86BdeNSMg2Idl5hUOIDNbq99flYfghh+Xh+7AQg9x7Pj DDzL/p3oD1r64G9ngJlzNTIs3X7NCv/rfrxOaayOXqV53zrLYQntLb1jc8fUN5JvGOC1 VZlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=frM2JsTVe3jb5WiWwu7ktf9Jc8bbbMxoSVuWP1vincI=; b=0kdkQTJJyYPeK3bI8tim3LMSyRtNcS8HOyolNPf2bL+sr7p9L5Pnqi4f0/5FkfrTNv Ip5BQOdn5EollIombB+4RumOLz4kj4GHRvnUhVnzHpOk2imaRntr2PH4mjZe1AKNUmw+ 4G9PBK4BkY9jd4KAbyxejx/V/J4+G14RmBTk3RT4wH7DI1PgwnEBXXm7qqS6lby9R1AF 0vmDNT9fMvR0my/SFrpx8jOCYW3/hrtxS+bNHaZASTKy8Qukk591+a9gH8v292Q88z9f QLrY4WkqTu0kxyk753nOjg+Ikv+cUYEq6dydW7MDKwVB/a0xMIWJncLRkqECrOOnxaSN WHDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=KFeL27be; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a41si9263770edc.180.2019.10.01.04.43.58; Tue, 01 Oct 2019 04:44:23 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=KFeL27be; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387632AbfJALlL (ORCPT + 99 others); Tue, 1 Oct 2019 07:41:11 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:41030 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387600AbfJALlK (ORCPT ); Tue, 1 Oct 2019 07:41:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=frM2JsTVe3jb5WiWwu7ktf9Jc8bbbMxoSVuWP1vincI=; b=KFeL27be0KdS RdCLZ7pZZHlD4j+kYZwXdDBRtEaVRKWnZbnuZ82Q4ZfMEluAu6Mt/GKBf9M7mEk8H3/brDw6SUxco frHPTwS03rVTQAMbkdlXfgSgW3iKOzkmu05xx66EjRJ49Nt/pMr2Cm0jjJjqIM3YzOfaHzdawridi A9qBI=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=ypsilon.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iFGWf-0004YV-V3; Tue, 01 Oct 2019 11:41:06 +0000 Received: by ypsilon.sirena.org.uk (Postfix, from userid 1000) id 7830D2742A10; Tue, 1 Oct 2019 12:41:05 +0100 (BST) From: Mark Brown To: Lukasz Majewski Cc: krzk@kernel.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, Mark Brown Subject: Applied "spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver" to the spi tree In-Reply-To: <20190924110547.14770-3-lukma@denx.de> X-Patchwork-Hint: ignore Message-Id: <20191001114105.7830D2742A10@ypsilon.sirena.org.uk> Date: Tue, 1 Oct 2019 12:41:05 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver has been applied to the spi tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.5 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From f4b323905d8b3e28b2a9cef9325dbec1b0f7f064 Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Tue, 24 Sep 2019 13:05:47 +0200 Subject: [PATCH] spi: Introduce dspi_slave_abort() function for NXP's dspi SPI driver This change provides the dspi_slave_abort() function, which is a callback for slave_abort() method of SPI controller generic driver. As in the SPI slave mode the transmission is driven by master, any distortion may cause the slave to enter undefined internal state. To avoid this problem the dspi_slave_abort() terminates all pending and ongoing DMA transactions (with sync) and clears internal FIFOs. Signed-off-by: Lukasz Majewski Link: https://lore.kernel.org/r/20190924110547.14770-3-lukma@denx.de Signed-off-by: Mark Brown --- drivers/spi/spi-fsl-dspi.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index bec758e978fb..2c0f211eed87 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1006,6 +1006,25 @@ static void dspi_init(struct fsl_dspi *dspi) SPI_CTARE_FMSZE(0) | SPI_CTARE_DTCP(1)); } +static int dspi_slave_abort(struct spi_master *master) +{ + struct fsl_dspi *dspi = spi_master_get_devdata(master); + + /* + * Terminate all pending DMA transactions for the SPI working + * in SLAVE mode. + */ + dmaengine_terminate_sync(dspi->dma->chan_rx); + dmaengine_terminate_sync(dspi->dma->chan_tx); + + /* Clear the internal DSPI RX and TX FIFO buffers */ + regmap_update_bits(dspi->regmap, SPI_MCR, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF, + SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); + + return 0; +} + static int dspi_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -1030,6 +1049,7 @@ static int dspi_probe(struct platform_device *pdev) ctlr->dev.of_node = pdev->dev.of_node; ctlr->cleanup = dspi_cleanup; + ctlr->slave_abort = dspi_slave_abort; ctlr->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST; pdata = dev_get_platdata(&pdev->dev); -- 2.20.1