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 */