From patchwork Wed Jan 17 16:15:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 10169789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3AFA2603ED for ; Wed, 17 Jan 2018 16:17:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B94E28590 for ; Wed, 17 Jan 2018 16:17:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FF55285D2; Wed, 17 Jan 2018 16:17:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A37C328590 for ; Wed, 17 Jan 2018 16:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eYRH0lZvuvtGP/x5iOpoTxzUdIqLNn1/FZgB61njxa4=; b=n0Lkm4t45sGhFKjEKubCauKm6R /Cu6QAJVkNt46OUhrJ1BQba2G2E3Ih7/Z4MXik5TMSzQBRpeX9QIO+vVe1g6dpYsYYQvP4BcIWuq6 jKiLPR62+8Ei5J5MZjp+0X6BtDNy7JddVibS07GxZXEa2EbzVARRPVtI9f3EJbtFDWBTpEnFsJzbA mM+hgPv1P9HR63Q7c+di6rg3eWkzRiKRZOSSXXmwwz/eRu+UkLC74Unu0+bIYxvWIjaWC6UKULH6a aJDhY8I3xYsAHuhOJnPR03dE5/Is9DRzj8E8VwR658UoB3NP56/qHl7ndv0X3l4OOP1hZTINC5wJv t09Nhx6w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ebqPG-0002Ns-Q8; Wed, 17 Jan 2018 16:17:43 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebqMB-0007PS-Ar for linux-arm-kernel@bombadil.infradead.org; Wed, 17 Jan 2018 16:14:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: 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:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=KlmZxzL5NN8hn1Lwox7F/3hioo821MfiTZXnyBGRdJk=; b=mjca5fmW2qdr7xdyqBqpGkuYr WdWyYUfb2Uk93QTnICCtoQybr/i8Tk0wGwEyfWgfj3Ww/3dM26dlz/ZKps1/VGiJgML+9lSWY3AsY dD8CJ3mY2Qq+KWdN1derFCvIOY7KMEXhTAzZK3+eVkehIbHdOx8tvu6pA+Y3B5xX4iW4AI1+kjzmK OEDALv3/skGDv6qyZLx/DTOJXx1iw1615RlpuuYFop71kKyUZLxZGsRm75M6A3QoE8J/kjfEyTBsz em7pENj6cy8FU4yaGzVzOLdbvFwuh+fwnMDL1H544MUDwKK479xR3jbywTnXbj14j6gUiqzEqckdv iPoylVgfQ==; Received: from idris.smile.fr ([91.216.209.19]) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebqM2-0006Aa-M7 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2018 16:14:29 +0000 Received: from localhost (localhost [127.0.0.1]) by idris.smile.fr (Postfix) with ESMTP id 871A31EE2BB0; Wed, 17 Jan 2018 17:14:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at smile.fr Received: from idris.smile.fr ([127.0.0.1]) by localhost (bluemind-mta.prod.vitry.intranet [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jeX3Y9Qtu4Xi; Wed, 17 Jan 2018 17:14:10 +0100 (CET) Received: from smile-e5570.sigfox.io (unknown [217.114.201.133]) by idris.smile.fr (Postfix) with ESMTPSA id 5170E1EE2BB1; Wed, 17 Jan 2018 17:14:10 +0100 (CET) From: Maxime Chevallier To: broonie@kernel.org Subject: [PATCH 3/4] spi: a3700: Allow to enable or disable FIFO mode Date: Wed, 17 Jan 2018 17:15:27 +0100 Message-Id: <1516205728-3256-4-git-send-email-maxime.chevallier@smile.fr> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1516205728-3256-1-git-send-email-maxime.chevallier@smile.fr> References: <1516205728-3256-1-git-send-email-maxime.chevallier@smile.fr> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180117_161422_767887_A97CFF34 X-CRM114-Status: UNSURE ( 8.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gregory.clement@free-electrons.com, Maxime Chevallier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The armada 3700 SPI controller allows to make transfers without using the 32 bytes RFIFO and WFIFO. This commit enable switching between FIFO and non-FIFO mode, which is necessary to implement full-duplex transfers. Signed-off-by: Maxime Chevallier --- drivers/spi/spi-armada-3700.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index 8048468..b387309 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c @@ -186,12 +186,15 @@ static int a3700_spi_pin_mode_set(struct a3700_spi *a3700_spi, return 0; } -static void a3700_spi_fifo_mode_set(struct a3700_spi *a3700_spi) +static void a3700_spi_fifo_mode_set(struct a3700_spi *a3700_spi, bool enable) { u32 val; val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG); - val |= A3700_SPI_FIFO_MODE; + if (enable) + val |= A3700_SPI_FIFO_MODE; + else + val &= ~A3700_SPI_FIFO_MODE; spireg_write(a3700_spi, A3700_SPI_IF_CFG_REG, val); } @@ -299,7 +302,7 @@ static int a3700_spi_init(struct a3700_spi *a3700_spi) a3700_spi_deactivate_cs(a3700_spi, i); /* Enable FIFO mode */ - a3700_spi_fifo_mode_set(a3700_spi); + a3700_spi_fifo_mode_set(a3700_spi, true); /* Set SPI mode */ a3700_spi_mode_set(a3700_spi, master->mode_bits);