Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4590179imm; Mon, 11 Jun 2018 15:18:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTv3gePcMlL2qkQhrOIcIUM7LKlN1/FNp9vU6tYByJQyedzjNVKT1NDhuRsIkmYgp9NY1A X-Received: by 2002:a63:6d0:: with SMTP id 199-v6mr818999pgg.338.1528755485824; Mon, 11 Jun 2018 15:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528755485; cv=none; d=google.com; s=arc-20160816; b=a5arkFGPXDYA1dpz6hF/+vX2puKnrwBhn0Y25ykvWnnvrz98DwrfM5/smn3nKzJtc5 mCjYLxmF3kW/mnpgNvkUMpTFEDijix2rmCosy6I1GPkGtz4LllzdvI9kcTj48tWBuQS4 OCOf7wqB7JIX5rm4TYeTNgepUIJg4VKzUA2tq3nva3KanCF/0IG9WshNSG5zVQvQgm8y NtA4stBWWA+gpYqxRBte3+JtjLqvWX9OQg8suxGEH7L7iX8+tl8BedyHf1vKi+51amry WHjnwdL49mA+t5y0WnJ3Qwk/auhhA3FKr+GRpB5za2NLrIxtWlMPTfoN2anEAZmG/r6F AFzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=e24B/kmKiLUwXLMld52WHCud3yzVsz3bfkzE5Pn3Kyo=; b=HVJZMtS7o4xXARUEY9zLlTh+45d8lGKR77VVyOUsl5ZV79sZADD598EgL64GV9cUZw 5y9hF3NIvkyvxVqIoHmzl1br/ZpOtN6JoxWf7c/dwrXF6nSKwTxaxyXyOmfNVzgEY1gJ CqRYDBGWcm4Gnm9fHEhowBc6E6ze5XLcyHIsI8x6vr9fBtYuE3na1nDx8YabWXgVYUl8 QfOfDbqjyJHTxZm11rbsBf3sU+pgAx1kRDRRfqwatqLnBmMH+cNEZn8OPVinOWreWyOx p0rGkRux/uXYMzXs4s6r4C5ArkUe9zbrIoEsrOolxgGXDJ3YcBGNHFpcJaAEo0VJwqA7 aMVg== 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 n9-v6si30644969pgp.558.2018.06.11.15.17.51; Mon, 11 Jun 2018 15:18:05 -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 S1753970AbeFKWF3 (ORCPT + 99 others); Mon, 11 Jun 2018 18:05:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:59156 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751148AbeFKWF2 (ORCPT ); Mon, 11 Jun 2018 18:05:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 137D4AE7A; Mon, 11 Jun 2018 22:05:27 +0000 (UTC) From: NeilBrown To: Boris Brezillon , Yogesh Gaur Date: Tue, 12 Jun 2018 08:05:13 +1000 Cc: 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 In-Reply-To: <20180611114916.351ed272@bbrezillon> References: <1528708694-19407-1-git-send-email-yogeshnarayan.gaur@nxp.com> <20180611114916.351ed272@bbrezillon> Message-ID: <87r2ldj7xi.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain 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. 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. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlse8hoACgkQOeye3VZi gbnSAQ/8DZgVN/kCJ8c8UYke3tZriVzT6F0rL2RBPB3InM7UTKKXpnbDe0V++Xc6 BVc535dvOY4cxIUK0uTqdsJUzGEA7OIjZbG9G5grv0DSNKqF3S9RmzOFEcR6hUjE 7gdrb23ehNsgW3gaWO3dNLqGXl7D+ryvAubrFh+GzFcaIiYIKiUCQhNnBUaduGQE daLVmOl8YxMFV85R2stN5+Z47wHYQOe/i+P7I4CQZnlDgzcMjsZk+WhBvc4CQ29k PIpMVPFIS4RCJvVuSgOGWmAn27FwkgBZf3bhKVMSOGnAJRVYPnjKqpIagzOqgt06 RnijPVaBUtbcPaTY7HmUtBS8ioPaeT/obgJnU1KxWiGoTexA0NG6pcPL9+0XidlG 9w2JX9kF2RHzidqKZqrdUha+zZ0U2I/J71+OMY61dtCvUxQiMWgZABlf8GiOnCQK hra46nTojuKK5LgI1iHDChzB8qU/ZM7PNv92FTDC0DIODTpe7M9oy++BUKlZOGIA prITcYkofPK0rT4bPwWG+RQTH6GtAehnOMtK30vb73F0Zqhl3n6QcR2upArPPbIz mMez52S6js95q9iwT7DzDuXfMOMZN6siy3ZgfUKtgr8Pd2NlOMe6CkbD1NGiKMzn EQz4SVTTQ9K1iq4iuOtnBneBKJWK4bkhFXDuiMF7rMGuiIZXpnI= =t90E -----END PGP SIGNATURE----- --=-=-=--