Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9096807pxu; Mon, 28 Dec 2020 06:33:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJz2ZnH2rcLLu8B89nDpBO+cW4eOAeaF5Kt2N0vNThWlCZkcRVEkuvhEamRVnZoGB+u+/qx9 X-Received: by 2002:a17:906:34ca:: with SMTP id h10mr42435832ejb.417.1609166017839; Mon, 28 Dec 2020 06:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166017; cv=none; d=google.com; s=arc-20160816; b=odu+ae8V+ZOLxHVMJDWryxLfg7p0JMkQc87HQw+2cWr2s+Ngl1mcY4kSLE278jlytV 8kTBb8acMmsg14NJxht7QYgy1U7e7Ub0IABq5hPJ8YLVOQEZTwYGGhEJxciQTW1uavW4 ap8JINYNl3flz/uVdDa52RHM9w44O715PejJzMkNYNbOqhbV7MQx3GqTprGSUGgTq2U5 RAgkGLJbF77ftgZ5abDP+KfOoOP6mGnDWSlGZFx8sDt1KPWmf+d0IP4oLg0OqiZP408k +TYqlsS92UhmmLoOrEjb4GZrx7GOssKNk1hrJjIVp+gv32qFoHBDUVoquq64wPLgryRN 8uOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=C2tIee9LU14LfPGlBKW93bl9TNuFX6fGogJRXOgujyc=; b=RgH0d2B9aq8/+B6nLNDmSPiBxdz+iRTjHndHdOSqwcDA8xMl/B5PbiZUQcIJZ+92Yd DoQ1z/X5mriy8p5h+DGRfmPuFPl78o1GVox88eVN0WEMij642IeLEanD2ql9RvpT+Frj 4IPFRQWjQEu8CzjMtyWkE04/xyqiV5a3zOteWB3PIPqREDN1p4Gq+X+Fn6BholrQgQI1 xW9AjVquKV50N0fueBZnOtI80KD7jovkb/ymgbaqzF1SToeADms8R7CV4PI1hRI+g5Pu Dr58Od1WNpdMGr3nWyR1em0eMiOyvvCF7o3cVRiRiZcab1UUKo2KMPTd5uREcgFTlbUi vDkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VrXpRLIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l13si18242771ejr.754.2020.12.28.06.33.15; Mon, 28 Dec 2020 06:33:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VrXpRLIM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503912AbgL1Oa4 (ORCPT + 99 others); Mon, 28 Dec 2020 09:30:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:38964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504058AbgL1Oav (ORCPT ); Mon, 28 Dec 2020 09:30:51 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E148207B2; Mon, 28 Dec 2020 14:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165810; bh=z3Rn+HRS8wfvkY/wVJ7Yjsw5fdpfNmkkCJF+q3y3wtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VrXpRLIMFmjOBJQmApfEkODRfzEun9uSwlENScGd3JmoM/Gnu0eit1NQjxdRuyg+F f5f8+Ki+JC7UpiYph6Ma9tYAZilf8dFKPYtd8hNJ9wAIrBuPhB+OYvH8+Mpzg4cgkI iw+YL0+EmVOciqnyCq8V8+uoRcZCsBsf+E2Lj0hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Burkart , Tudor Ambarus , Mark Brown Subject: [PATCH 5.10 662/717] spi: atmel-quadspi: Fix AHB memory accesses Date: Mon, 28 Dec 2020 13:51:00 +0100 Message-Id: <20201228125052.686496870@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tudor Ambarus commit cac8c821059639b015586abf61623c62cc549a13 upstream. 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 Link: https://lore.kernel.org/r/20201207135959.154124-2-tudor.ambarus@microchip.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/atmel-quadspi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -365,10 +365,14 @@ static int atmel_qspi_set_cfg(struct atm 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 atm 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 */