From patchwork Mon Dec 7 13:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11956055 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7357C4361B for ; Mon, 7 Dec 2020 14:02:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A634235DD for ; Mon, 7 Dec 2020 14:02:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A634235DD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=P10lyQVbiKUaG/Uf3YhcEwEdppyCz1iN+6slL4IeIXc=; b=vgSSX0hJ0lmBiOTTGg83Csx6e 6pv2MY+aDYUq5enlkrI6mv14EJRSWuzzP5Th1DjM6OzSVPfzdO/fpkQffGur1klR/yYOsdyuLasft fU2nMNmQ3zNvnegM0o6dPbiVtBI8PFVb4v8T3UiQJ3Hh14J3HZ7arVq4Brvtxgx68mscTIWqxY1ej ML4psZxYI7t+kosQe/ycVKHwxSziGApNoLpKkrhRBcf38r2DbDh9vT5RiUR6ugokOattrF5zx2WNW Xf7wTtnhekIq9P/sWk/nYBkNkmCb/qiihkF9HmChuS+CCmvV2+Rmo56o22hepYE8SOqZcvLbjFJpx JU3avQMnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4M-0008OE-2n; Mon, 07 Dec 2020 14:00:50 +0000 Received: from esa1.microchip.iphmx.com ([68.232.147.91]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4E-0008LR-4c for linux-arm-kernel@lists.infradead.org; Mon, 07 Dec 2020 14:00:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349642; x=1638885642; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nzjzi0BHIpaEs5LQPZKGd7A9lTZUVGUv43h4mqHMor4=; b=OTQwT+pLRDG0lcTZC+oTuAmnnwWZULiyelM5M5rwwKsDDz00xirKMDdP B68m8Fsljvx2VQ5OXXi/Pgo6nbSKROQnQsvBrrhKjAgUl7x2ZBUpAOmcJ E3Ic4zP54Ofuj+D7w8d+PTzj8gjcZsFa+r965xM4JTJwzJHBx1jpWSFe9 LzMN5vtB8n5eKkM6npLZU+nCB2lWoNc46HbLLqZ5p7p2dDTigTgKRT90F 19RgjCw/JcEFZd8yFQ6Ie1fu/i6ViBaD+pNMhgP0I/dRoLY7Y9X+Uo09C FIbzuxC/UtWydj2+UvPhmNGgG7THK2PFexRygwJ5vIcoYJVOODSUMzDvL w==; IronPort-SDR: 5VFUzwtlK/hoT0qJ1iIRCWO42O3/d/CDb6e5rPBDt02KXJqe+RYM/UFYE0I1TPho5qv5inTLkg qQNMWDQJs6Pb8B8EWhppoTpDszFlAxA8FhH/4UZcrBiTgWJ+5vNoW3MQfqQaq/68suIvZnS1/Y I7DXUBZ5VIJv44Rrgwniz2kagNuOcW3ssxapUf8piEm+KV3wOa+J9eXvuykvHxT0PHvvaHYfRX bkAUfb3JCasBeWNT8T1q4YYKGB9K69xQ42aBJZsmSkQrqH0oAs/M8iAhMJV/V852eHuGBkHYCx sk0= X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="106511666" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Dec 2020 07:00:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 7 Dec 2020 07:00:39 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Mon, 7 Dec 2020 07:00:36 -0700 From: Tudor Ambarus To: , Subject: [PATCH 1/4] spi: atmel-quadspi: Fix AHB memory accesses Date: Mon, 7 Dec 2020 15:59:56 +0200 Message-ID: <20201207135959.154124-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207135959.154124-1-tudor.ambarus@microchip.com> References: <20201207135959.154124-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_090042_474297_A76D8C2A X-CRM114-Status: GOOD ( 13.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , Tom Burkart , linux-kernel@vger.kernel.org, stable@vger.kernel.org, ludovic.desroches@microchip.com, bugalski.piotr@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Following error was seen when mounting a 16MByte ubifs: UBIFS error (ubi0:0 pid 1893): check_lpt_type.constprop.6: invalid type (15) in LPT node type QSPI_IFR.TFRTYP was not set correctly. When data transfer is enabled and one wants to access the serial memory through AHB in order to: - read in the serial memory, but not a memory data, for example a JEDEC-ID, QSPI_IFR.TFRTYP must be written to '0' (both sama5d2 and sam9x60). - read in the serial memory, and particularly a memory data, TFRTYP must be written to '1' (both sama5d2 and sam9x60). - write in the serial memory, but not a memory data, for example writing the configuration or the QSPI_SR, TFRTYP must be written to '2' for sama5d2 and to '0' for sam9x60. - write in the serial memory in particular to program a memory data, TFRTYP must be written to '3' for sama5d2 and to '1' for sam9x60. Fix the setting of the QSPI_IFR.TFRTYP field. Fixes: 2d30ac5ed633 ("mtd: spi-nor: atmel-quadspi: Use spi-mem interface for atmel-quadspi driver") Cc: # v5.0+ Reported-by: Tom Burkart Signed-off-by: Tudor Ambarus --- drivers/spi/atmel-quadspi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index b44521d4a245..ad913212426e 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -365,10 +365,14 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, if (dummy_cycles) ifr |= QSPI_IFR_NBDUM(dummy_cycles); - /* Set data enable */ - if (op->data.nbytes) + /* Set data enable and data transfer type. */ + if (op->data.nbytes) { ifr |= QSPI_IFR_DATAEN; + if (op->addr.nbytes) + ifr |= QSPI_IFR_TFRTYP_MEM; + } + /* * If the QSPI controller is set in regular SPI mode, set it in * Serial Memory Mode (SMM). @@ -393,7 +397,7 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, atmel_qspi_write(icr, aq, QSPI_WICR); atmel_qspi_write(ifr, aq, QSPI_IFR); } else { - if (op->data.dir == SPI_MEM_DATA_OUT) + if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; /* Set QSPI Instruction Frame registers */ From patchwork Mon Dec 7 13:59:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11956057 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2386C4361B for ; Mon, 7 Dec 2020 14:02:13 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 62E3F23444 for ; Mon, 7 Dec 2020 14:02:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 62E3F23444 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=peMTq7txvKJ9wsan8sRLITGysNpINF1ODfzVj+hTFeo=; b=ueWavCC3RxHHVZOMiC/TyWS4R LCKV9GxNl7KdCQqzqb6Shyyi8vBx6ljzDZ4whO4x7tFoyPQadIWAzVZkLmYCfd8+PIOIO1p+1yRpW NF7ExFQIR2xmHRWV6hIX/B9V7gnmV6v1Pgx6BaViMXuU7kFPrY7apdqe81IARkgEBD+w/JiN3PDp4 k1W3ajaBSzHtE3Jb14StUbQzQFl4qPUjCCHL9UNqSMTGfiwlyCzintaCAU8Ij/Oe7MdYY8MV3QaNc 6y4DeeTg6oa17hVShTyYCo8drxMdHQW2n9LsXkix6gOCktsaXzJkoMJWWrHAl/DwdOep57xSxKrSG fPuYYa0FA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4U-0008Qo-BF; Mon, 07 Dec 2020 14:00:58 +0000 Received: from esa1.microchip.iphmx.com ([68.232.147.91]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4F-0008MP-IP for linux-arm-kernel@lists.infradead.org; Mon, 07 Dec 2020 14:00:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349643; x=1638885643; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gdsNLh0QMM1ZgYyE0TN1rD0dJrTxINGdj6nNAZ5seDs=; b=HrkEwLgkGFOBQpWjeVJ5gftSkTbqjyG/pqWbrNxJ/GUz8x9E3MFcRQgt FUpLA0d98wU4ZDy4vqKTFyTymjrQdApeZ2cPKkjOiAKSMRiGWYa1DNIhC WYYs3WxvOneNv+9f9eXYreFj0v89HORhpIKwl8sQeNvzZgZSAP2iQaLuu ggWSU2jO1nQE25gqvtMDQSdKQ8RZ5AiqK1A1+3xAj69sYfjXqJskMwA/X xpVl7awCrvNs5vidbfXwrOQuJg3Ir/rLetGZIwrZeZ0Yb7ujE90l0Q07Z kXDAEcc5jFit7tujeuLGQeq9fvJM/4d2RalkecL6ZTV0GR+nMrOdcRJl3 Q==; IronPort-SDR: T6AI5yvP6glTMvp/PxDsX+oQiD+0/tlne072VckwgZ5HAWroTHn6y7ZLZGl7tqlzpCt0Cj5OK4 a+dPab0Y7lxQmqKsmsUknS0cnPDGFAAPUapVMlES0bFtACPHDXGN9ydQbbLbJk6vvHKCxf7+lM hduSdI7Ojm6eDM5hHivuWbaFg1V4UwfUqM46DwJbtHtFxynRfKD/vJ8xuekihg65V4GEChy/5k aPcLGjqwmpmzhhX0aFBQQSuRk2KzwFUpBBmVfUPg0Hvxhh4hOt9W/S9DSEm4UB6Aa7dmPF1J8i aX0= X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="106511691" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Dec 2020 07:00:42 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 7 Dec 2020 07:00:42 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Mon, 7 Dec 2020 07:00:39 -0700 From: Tudor Ambarus To: , Subject: [PATCH 2/4] spi: atmel-quadspi: Drop superfluous set of QSPI_IFR_APBTFRTYP_READ Date: Mon, 7 Dec 2020 15:59:57 +0200 Message-ID: <20201207135959.154124-3-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207135959.154124-1-tudor.ambarus@microchip.com> References: <20201207135959.154124-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_090043_870115_613B57C1 X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, bugalski.piotr@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org That bit describes the APB transfer type. We are writing serial memory registers via AHB acesses, that bit does not make sense in the current context. Signed-off-by: Tudor Ambarus --- drivers/spi/atmel-quadspi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index ad913212426e..30533ab82c7b 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -386,9 +386,6 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, (void)atmel_qspi_read(aq, QSPI_SR); if (aq->caps->has_ricr) { - if (!op->addr.nbytes && op->data.dir == SPI_MEM_DATA_IN) - ifr |= QSPI_IFR_APBTFRTYP_READ; - /* Set QSPI Instruction Frame registers */ atmel_qspi_write(iar, aq, QSPI_IAR); if (op->data.dir == SPI_MEM_DATA_IN) From patchwork Mon Dec 7 13:59:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11956059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C6D7C433FE for ; Mon, 7 Dec 2020 14:02:14 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E65BC23444 for ; Mon, 7 Dec 2020 14:02:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E65BC23444 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=HL+tWMgqXIp18muG61G3sfy9y4KOaJjfurRXECgkIAk=; b=UaId9RbebnSpVTlA/DcsnXWaN MKDemcFAuCYxlppNARsl0/1SOw1GlNJAfYCPi5eDFZFA2/AQZkOTYnUDofK7XWCqWhewZYYspOrWL 6Cpl/8rhD18yvugTeC8oStRVO/5sSWOqV9tHQJkMmHEviy8dNlf0W48NG1ULUjVf97iYR+Q48S2DR daCuJQYiqT2N4skjnsRWUrl9yHA08PluphlGkKpO2RO8iKTjSs9eaC2x5SpmAR1UK6zteg52JuSC7 PUtHBLdt4MJ5zHDTxlmiyzLjaQa/2EG6q5F48kHlSwKUvlPZtvAeejKmF/QsHRGCZt+CIAmVNX0+1 t4UQ0HOlA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4Z-0008SF-VD; Mon, 07 Dec 2020 14:01:04 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4H-0008KT-U1 for linux-arm-kernel@lists.infradead.org; Mon, 07 Dec 2020 14:00:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349645; x=1638885645; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EZu7eRgTCyJ0MdARgyamRkTg/cOik+X698PnPvls7qg=; b=vmx0ofcQiHkDLoSCDkbFy8+oGMBeSM56IIQJzDfPM/uzC59e4m1FoRsZ Fzmm96jOyUnfASe93sICDbZOdsFNPYa0zGoDuZoL5CdCOPF0hDHhkfXpv iD3PYnJ+tdl4EKPKftcSw1mfcIeDseB0orqgfTamTNdM8bNJSrhdztM8z 0XKJiCsbyoHl2gqblBDfywBjFu2hRg/7cQ55QqrgZxmpMgOtVDsPwt2Bx UJJR6mB7SN6nrpMQ1VrWQf8CFwnRv2yuSoTiefiPZD0Qhuqs8lgZKu3/q 849CN2hFW4FRwT+JuuepXehnvJ5b8ro/vARORJsgyih/xKAVDULVX0kjJ A==; IronPort-SDR: zqbibeXiu4l+V1rijRuK1HqjUf38CHsMWsZW9xBt8VoPp5RjDUjAgZdQcrJZGvpULurKaBtSoR rxZ4eRIk4DJH806JFPdPTeBO32W477ncSLh/qy4x2ZgtwIgrq+A7edcdv2eJLhT32+RqtGGSA/ eMaoqguswWzrgBvBMZqUmbyQquRWtBBJ35+SlbUximFmoT8CCh7G0qAcaV4euQ4txQRjxX++1H LNYtZdjUf9paymw+GZCWQ/bOZVSmjfX5cNsixdH2Ep8ADJOlaRKF1x2naTwbUOXegHTC6J4nvG 9Vw= X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="96128975" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Dec 2020 07:00:45 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 7 Dec 2020 07:00:45 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Mon, 7 Dec 2020 07:00:42 -0700 From: Tudor Ambarus To: , Subject: [PATCH 3/4] spi: atmel-quadspi: Write QSPI_IAR only when needed Date: Mon, 7 Dec 2020 15:59:58 +0200 Message-ID: <20201207135959.154124-4-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207135959.154124-1-tudor.ambarus@microchip.com> References: <20201207135959.154124-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_090046_332266_5A1866DC X-CRM114-Status: UNSURE ( 9.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, bugalski.piotr@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The address must be written in QSPI_IAR only when we have a instruction frame with address but no data. Signed-off-by: Tudor Ambarus --- drivers/spi/atmel-quadspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 30533ab82c7b..5fd0dc70bd74 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -385,9 +385,11 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, /* Clear pending interrupts */ (void)atmel_qspi_read(aq, QSPI_SR); - if (aq->caps->has_ricr) { - /* Set QSPI Instruction Frame registers */ + /* Set QSPI Instruction Frame registers. */ + if (op->addr.nbytes && !op->data.nbytes) atmel_qspi_write(iar, aq, QSPI_IAR); + + if (aq->caps->has_ricr) { if (op->data.dir == SPI_MEM_DATA_IN) atmel_qspi_write(icr, aq, QSPI_RICR); else @@ -397,8 +399,6 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; - /* Set QSPI Instruction Frame registers */ - atmel_qspi_write(iar, aq, QSPI_IAR); atmel_qspi_write(icr, aq, QSPI_ICR); atmel_qspi_write(ifr, aq, QSPI_IFR); } From patchwork Mon Dec 7 13:59:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 11956061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79F86C4361B for ; Mon, 7 Dec 2020 14:02:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DB1823444 for ; Mon, 7 Dec 2020 14:02:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DB1823444 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=X733NkabxriaJfHJDP4MK7UkZ9agc54nc6J0IGqSvQ8=; b=2vnZ8L4SYTTc87yhJIB9m5Tel 2ctsE54zUIUEcC7FCQ9I5me2dhvqzyMMA4WHgxIf0NgTQrJBJMALEmCvfUQ7hiUn6Ou0xR5Na+rjv jHp9wtwkPJnKyFCANmGAyh+RnSGuVBl7ePp9YJz21Ru3WQpyrrRlWv0CEkiNI2ZungO+ZnQyb+cz4 fy+qq3y40yuHMNcmk3af6OGiL2oOnFylvelu78JBiU93rp/hDEiforfHUTREDVqnAZfHACa/lk3jM KhO0Qc+ESukDhzVbpDMujoexavgSNi1eGNE026GorpOP0qIrZkmCr3a+X6Zz7Con+sFetC3bCYEAC kp2r2/uMA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4c-0008T4-78; Mon, 07 Dec 2020 14:01:06 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmH4N-0008Od-7J for linux-arm-kernel@lists.infradead.org; Mon, 07 Dec 2020 14:00:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349651; x=1638885651; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eeY1Cu1aRr4raFHWenqciKug7r63tyMvIkoHojS1q4Y=; b=X/iUkQpY+r84pSYIPk2dZkva8YL+Yl9NVnr7Y/RPbcfPxFHSFue95/+C C3Ley1yUiEyGrPUIyWtxT9ULB7t1qcAgi2CofSjP2N4wNZFTftvSDxsIK hVELZcVxyrd2syAom1moHnFwoQYz9aQJexkgXOL7gl1bNofKTayAUGDCk HJanrpKdL3e5tAAD755vOAlGzNsjXRncBd96klcCa7vrZXg18DOs4nFsI +vfbEVQgjReV0GDeOuZI1kLaltgzvZJ0tuER3Uzb2l9wpsZ6XibjyE712 cnPDgWm+Ah9r7BHCAaua7kZVU1MyX37DCR7OvL+qW0BX5Jh/tn0II9WA5 g==; IronPort-SDR: 2farel37RSxeDW+4apm/Dd357J901m99jMAViQJ00OL9CRQXVWb2Lr5oghYV9q81a5oOW8x4Db pjXGhdfiJ03nM7Wu9QZ1CqQI3yCHeSL0kFzbxsOBuJIXnOKwilRN/MgIIZnC17vHi+9OoMpkMH uuH9oUnKZjw+oU7bruFVHkA5dRzJlEhH63gHEUEWtA4UEweUukiprqpAwkSrg9KRLDHtxNc76V gvra2bQ2cVYCKMaKU4AiZQT712ueMaFROCCm671piT9s504gHQdWn0LECWDzIM2wIpMnE7392U SBc= X-IronPort-AV: E=Sophos;i="5.78,399,1599548400"; d="scan'208";a="101740189" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Dec 2020 07:00:48 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Mon, 7 Dec 2020 07:00:47 -0700 Received: from atudor-ThinkPad-T470p.amer.actel.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Mon, 7 Dec 2020 07:00:45 -0700 From: Tudor Ambarus To: , Subject: [PATCH 4/4] spi: atmel-quadspi: Move common code outside of if else Date: Mon, 7 Dec 2020 15:59:59 +0200 Message-ID: <20201207135959.154124-5-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201207135959.154124-1-tudor.ambarus@microchip.com> References: <20201207135959.154124-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201207_090051_586333_CEED1791 X-CRM114-Status: GOOD ( 10.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, bugalski.piotr@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org QSPI_IFR is set as the last QSPI Instruction Frame register regardless of the sama5d2 or sam9x60 version of the IP. Move the writing of QSPI_IFR outside of the IP specific code. Signed-off-by: Tudor Ambarus --- drivers/spi/atmel-quadspi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 5fd0dc70bd74..f4f3d5c9ce50 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -394,15 +394,15 @@ static int atmel_qspi_set_cfg(struct atmel_qspi *aq, atmel_qspi_write(icr, aq, QSPI_RICR); else atmel_qspi_write(icr, aq, QSPI_WICR); - atmel_qspi_write(ifr, aq, QSPI_IFR); } else { if (op->data.nbytes && op->data.dir == SPI_MEM_DATA_OUT) ifr |= QSPI_IFR_SAMA5D2_WRITE_TRSFR; atmel_qspi_write(icr, aq, QSPI_ICR); - atmel_qspi_write(ifr, aq, QSPI_IFR); } + atmel_qspi_write(ifr, aq, QSPI_IFR); + return 0; }