Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4995470imm; Tue, 12 Jun 2018 00:23:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI/lSEybbxR5lo5nXRiniqJHLilnwJHs/Fm8w5zP0OQ2yc/X6FCahAyWf/EL2atvLKzLqvG X-Received: by 2002:a65:6343:: with SMTP id p3-v6mr2188782pgv.63.1528788210905; Tue, 12 Jun 2018 00:23:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528788210; cv=none; d=google.com; s=arc-20160816; b=z+q8ZWScGaYnRO7eMD9o97qvmQ4MxrkOjoEiTCBtOYiHzdUw+MYtf+ezV2mwd2miBZ UqB/e9aTcZnb7uQT7eNv8XYm0Pbesvqh9jpoPWA0gXKPz/Vi3NY7VdZ2edhYQdlITvik OMpdVo6jYHVV04LMdVCO4DP3JbGpF68NSWlSaVm7II3ZdsabgHaPdtriRlnxp8SqSzLx Pvge8oMUSuNjH6Thtxxx/y2vj48+6fOYG/5Bwc6WoDT93QkvAqdQSefgAMFmd8jNqGNz Oc1y/vVZCZGHBziWJuytYx4ODidc9AW29WNrsf+CTmoPnWGMCH2Q8B0zYkv42XxBC2xF yS2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=mPAR10cCzi6pEss6kpjYl5iJOOc2yCxlVnO3ZzAw+IA=; b=0Q0B4gDJk9YfxZsMPWJpqVyDlEmSNJLIxOVb14UbSj3tXlYFWdfcCpav0sx+MOCJkt 6MCs94SWPghtWiJ/BD2v4e6xAcfA1lwbKPY6mjkVillxCYzTYwHEPRc1mZxfTGvKGFzY kMVF8ByogeaAsevXwQhYodO5FEWMKALgIuDzoUygTqL9Q2tD0V3YY2UCjW25/sldVd3h CMWMHMokZHICs6P8hbsQ675GiS6755SmGp+z7n3PkG43W74W7j0G6xHm42++78ZiGKrU FVouQZGG18Y4xvH50UAj5zIAeBg5hWEdy3H10Jo1d3V4IUD/GllPGyg6oPP4fEJpbSL/ gPVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l30-v6si240615plg.420.2018.06.12.00.23.16; Tue, 12 Jun 2018 00:23:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933220AbeFLHWw (ORCPT + 99 others); Tue, 12 Jun 2018 03:22:52 -0400 Received: from mail.bootlin.com ([62.4.15.54]:37971 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932944AbeFLHWv (ORCPT ); Tue, 12 Jun 2018 03:22:51 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 691D520A20; Tue, 12 Jun 2018 09:22:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-37-30.w90-88.abo.wanadoo.fr [90.88.156.30]) by mail.bootlin.com (Postfix) with ESMTPSA id 129312073C; Tue, 12 Jun 2018 09:22:49 +0200 (CEST) Date: Tue, 12 Jun 2018 09:22:48 +0200 From: Boris Brezillon To: NeilBrown Cc: Yogesh Gaur , linux-mtd@lists.infradead.org, boris.brezillon@free-electrons.com, frieder.schrempf@exceet.de, computersforpeace@gmail.com, david.wolfe@nxp.com, han.xu@nxp.com, festevam@gmail.com, marek.vasut@gmail.com, prabhakar.kushwaha@nxp.com, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: spi-nor: honour max_data_size for spi-nor writes Message-ID: <20180612092248.4e6a3e92@bbrezillon> In-Reply-To: <87r2ldj7xi.fsf@notabene.neil.brown.name> References: <1528708694-19407-1-git-send-email-yogeshnarayan.gaur@nxp.com> <20180611114916.351ed272@bbrezillon> <87r2ldj7xi.fsf@notabene.neil.brown.name> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Neil, On Tue, 12 Jun 2018 08:05:13 +1000 NeilBrown wrote: > On Mon, Jun 11 2018, Boris Brezillon wrote: > > > > Also, I'd prefer to have this patch split in 2: > > 1/ one patch removing the check in spi_nor_write() > > 2/ and the second patch removing the while() loop in m25p80_write() > > > > How about the following commit messages for those 2 patches: > > > > 1: > > " > > mtd: spi-nor: Support controllers with limited TX FIFO size > > > > Some SPI controllers can't write nor->page_size bytes in a single step > > because their TX FIFO is too small. > > I no longer think this is good justification for changes to m25p80 or to > anything outside the low-level SPI driver. The size of the FIFO is not > related to the maximum message size. > > An SPI transaction involves: > - asserting chip-select > - sending/receiving a bunch of bits > - deasserting chip-select > > That middle part of sending/receiving bits can be done: > - one bit at a time by bit-banging GPIOs > - 32 bytes at a time by filling a buffer, running the SPI engine, then > reading results out of the buffer (assuming a 32-byte buffer) > - with one single DMA operation if the SPI engine can DMA to/from > main memory > > and there are probably other options. > > If your SPI engine only handles (say) 32 bytes at a time, then call it > repeatedly, while holding chip-select asserted the whole time. Except you're not necessarily in control of the CS signal, and that's most of the time the case with high-level (Q)SPI mem controllers like the NXP/FSL QSPI controller (see the datasheet here if you want to check [1]). > The SPI > clock is controlled by the host and in this case it will not have a > stable frequency for the whole transaction (occasionally pauses), but > that doesn't matter. The slave just watches for the clock transitions > and don't care when they come as long as they don't come too fast. > > I recently modified the mt7621 spi driver (in drivers/staging) to work > like this and got much better throughput when reading from spi-nor flash > memory. It handles writes of full pages (36 bytes at at time!) without > problems. Just because you managed to solve the problem in one driver does not mean the problem does not exist for others. I read this datasheet [1] several times and couldn't find a way to say 'I want to keep the CS asserted between 2 transactions', so I think we really need this patch. Regards, Boris [1]https://www.nxp.com/docs/en/reference-manual/VFXXXRM.pdf