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: 11956067 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 3C01AC4167B for ; Mon, 7 Dec 2020 14:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6BA6235DD for ; Mon, 7 Dec 2020 14:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726627AbgLGOBq (ORCPT ); Mon, 7 Dec 2020 09:01:46 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:12148 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbgLGOBq (ORCPT ); Mon, 7 Dec 2020 09:01:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349705; x=1638885705; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Nzjzi0BHIpaEs5LQPZKGd7A9lTZUVGUv43h4mqHMor4=; b=xhzn8UbHFnEdNlG6qULdWHIUWRQbRQuVe82eQnJl2X6g8bzEQfuWVfdN GrKE+lQUBxSM2hYypfvbP62ZjqaHXn1plhGfvmR9PcNrdE0hIh+u/tomp 7KJS+iuq0IkMvVyi/7oB2d/cy7KBCFoqb2GIWz6YrxprzD/6Fj4d3nNpw zd4YAnkjJzVRjHGq3hFfBcFTiPvjnYmGfPpAAULjIw+mWLuJIRm+Q7yOo uiS5YxQaOF37jrkaqLXUVgncFL8c3mQ7viwO9iUY1avQCLV+dYlFcw5Be 7WbzxZbPzjMDsPGGmfBeiJ5lqTae72d3LQ27lC6oIVXcWrCMmjO5ov4Vd 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: , CC: , , , , , , "Tudor Ambarus" , , Tom Burkart 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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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: 11956069 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 9FD28C1B087 for ; Mon, 7 Dec 2020 14:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5540A235DD for ; Mon, 7 Dec 2020 14:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727293AbgLGOBt (ORCPT ); Mon, 7 Dec 2020 09:01:49 -0500 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:12162 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbgLGOBs (ORCPT ); Mon, 7 Dec 2020 09:01:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349708; x=1638885708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gdsNLh0QMM1ZgYyE0TN1rD0dJrTxINGdj6nNAZ5seDs=; b=ss6/zTQXt1SDgrfEObB5Oxw35RmgHZDzwGkPArcGOj+/GTgPFbLgy2FT W/g8vLe80Q8mc5FjYvteY74rj02eoOJj6ITdwpFImm1d2t06zlQMH8GB2 yyExavEJLlciSgNHM/g6o0JPKn3vY+9KdQHUVnidVxlZjt4OwNpOfZX9T tWzQMBt0YfvQb1pcJZJOzDS7iRnRLxQL1kL+eLfYE0bWZvkIaPmvhEt7f GN0gqwvxsLpTtWC34b+FKTas2fIv40SQ4HHZpaZuu1RfROsP6ZRDGPFnE eFLeLa/pCqHJ6GmLMLMBMKrt6fPaOGyqazbxbRxPqDfOlpr3OiM+fbON8 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: , CC: , , , , , , "Tudor Ambarus" 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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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: 11956073 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 5233EC433FE for ; Mon, 7 Dec 2020 14:02:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1828423444 for ; Mon, 7 Dec 2020 14:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726359AbgLGOCX (ORCPT ); Mon, 7 Dec 2020 09:02:23 -0500 Received: from esa4.microchip.iphmx.com ([68.232.154.123]:64961 "EHLO esa4.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbgLGOCX (ORCPT ); Mon, 7 Dec 2020 09:02:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349743; x=1638885743; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EZu7eRgTCyJ0MdARgyamRkTg/cOik+X698PnPvls7qg=; b=kOBcuT79cXR4dy9jkN6wx/TFP2s2G0pb8gRMWL6g42+rI+Ih3LS+AvOh 5yNpgIo6nIDHUsYeQfZMFSSS1aCxdtqDaXO6zyhGg01QJnS1he/GNU184 D/0g1Ej/JXtLDkDjrZnI0486Zs3QQwj81ufA6EgJ/hNGPzF/njAkHodG9 dmBuOMnoVrKpfA02cEb+xqcxjtOL9WX2ZxEF2I4esu2jfAkdOCeHTPP6P HHdH6g+tANfEGfXbAAXt5tnMyvZsfE6P6IyY2koq0Xu/BRiTXiIMj7L/s vOONIJlKTGgS5HvO9PXA2ynTn5zfPsMGQdEc2MWQzRT7NR6RWDxs0cZ2I g==; 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: , CC: , , , , , , "Tudor Ambarus" 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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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: 11956071 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.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 74448C2BB3F for ; Mon, 7 Dec 2020 14:02:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53D7A235E4 for ; Mon, 7 Dec 2020 14:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727370AbgLGOBz (ORCPT ); Mon, 7 Dec 2020 09:01:55 -0500 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:4587 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726168AbgLGOBy (ORCPT ); Mon, 7 Dec 2020 09:01:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1607349714; x=1638885714; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eeY1Cu1aRr4raFHWenqciKug7r63tyMvIkoHojS1q4Y=; b=DR+iNgh3h6r0Jq4td2N8R+LqLZ81pJPcMtBpaAzXebgwArgqhdlH/qIs 01Vn8412vmXGDONczxIt6Nu1SuufXXQNQv/PoITVo+CL158vV+4q0VA1/ gH3GJHf+YwNIHytypca7vorrAoJkpfuwS7+IJkx+DG8xB648Wmn+SCYlF 8hkmP/vbZlDwqcwBtzY2Kil3+47vnpn8YRpmNY5ppTSqKJLOyxrup8M2b iaMfvjPHJrgRwgAOQyBCSY3ts2FIAhDrMgu+wT0LE6pLdCzLBWeXtsYdl asRuZhzuvGhMRQpP2ZlbauPwYnklAsEV5/eX/Tm00s8NabwGxzc2j4PjE A==; 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: , CC: , , , , , , "Tudor Ambarus" 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 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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; }