Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1899263imm; Thu, 24 May 2018 02:34:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoV0+v917sRpPJAkU3rpGIP4saEDhFoZJaqTsoW8DuqxroxS8rLJfqCdF7rDtFd7pAkNFB8 X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr646381pgn.413.1527154464286; Thu, 24 May 2018 02:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527154464; cv=none; d=google.com; s=arc-20160816; b=G40lR8uDb1QQZ+UITJgMi8MkTvOk/pAO8pW7ou8J6yAgDI1771jhFtQgJPwEmmW/+d DtsmLMbSkNJT32DcqkxzzEb43Qdh+akKm0u4kjA+nyL9BG52cLKGBj0EcLh6OEyXylVz 3LDU1qtDQcMW4t0adA1BCzEm7q4RBgG+45gJ5HcG1EkVxcpLuEOPlxyqLCAOQf54BFdH aN/bNm8CWlF7zJKHlhgQg7mt9Wv8ytkUCU3+r7SObuKVyZyih2SuWxaJy16rIe3Np+cQ GaUCG+xRXBiZ7xYT58Po2bAjVjABb6UF53RUpeigZvrDyh9OxP4Ez+bpzqcKTuZLmBUM yvxA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=bQG0BLSrq/hnUSRWEtl5F6Dp+hFUBSVFwOLmkvboM3M=; b=eZ74YY+/Pwp6XHiYQ3QN5a6itw21nPAa4MeSnmmR1evgC9kM6j/Vf0964wqNNT1q7U Kem9Xs3QVfFvZmKMBJlu0gzpUbxwmsWLkLiZf378W/3GafIk1wxbFtj0M4ML8yJYhV+O yuzg1haxD1I+6Xh74n389o/T3v+Za1XFlzZuq42waU9vYXTgO1bvBKl04GsIeHuME8f5 QXVBN/tDf+LwvbVowVUv+RqUw7K80jqXiBO8eK8zIvX2wJaJU+zZuULSmCCOTWws55PS ZUBc1jU5//xyJ7KsqhQ/tTEsLjMAVJiy5FzUyOU0eoC9Bv1XzhsWB9GP5KpC4KAU1Yto kg1w== 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 e1-v6si925183pls.579.2018.05.24.02.34.09; Thu, 24 May 2018 02:34:24 -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 S965921AbeEXJcr (ORCPT + 99 others); Thu, 24 May 2018 05:32:47 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:25457 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965664AbeEXJcp (ORCPT ); Thu, 24 May 2018 05:32:45 -0400 X-IronPort-AV: E=Sophos;i="5.49,436,1520924400"; d="scan'208";a="14603529" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 May 2018 02:32:44 -0700 Received: from 192.168.0.100 (10.10.76.4) by chn-sv-exch04.mchp-main.com (10.10.76.105) with Microsoft SMTP Server id 14.3.352.0; Thu, 24 May 2018 02:32:43 -0700 Subject: Re: [RFC PATCH] mtd: spi-nor: add support to non-uniform SPI NOR flash memories To: Marek Vasut , , , , , CC: , , , References: <20180518093233.24241-1-tudor.ambarus@microchip.com> <89d45190-95b0-b780-b219-e6c6adcb6147@gmail.com> <4cd7d47a-fd56-6b54-3b38-262adf46a97f@microchip.com> <123e50da-e49e-f876-bdb4-2719f7f7640a@microchip.com> <66b2b859-72db-33cc-75ae-2493a4aad235@microchip.com> From: Tudor Ambarus Message-ID: Date: Thu, 24 May 2018 12:32:38 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Marek, On 05/23/2018 03:54 PM, Marek Vasut wrote: > On 05/23/2018 02:52 PM, Tudor Ambarus wrote: >> Hi, Marek, > > Hi, > >> On 05/23/2018 12:56 PM, Marek Vasut wrote: >> [...] >>>>> [...] >>>>> >>>>>>>> + while (len) { >>>>>>>> + cmd = spi_nor_find_best_erase_cmd(map, region, addr, len); >>>>>>>> + if (!cmd) >>>>>>>> + return -EINVAL; >>>>>>> What would happen if you realize mid-way that you cannot erase some >>>>>>> sector , do you end up with partial erase ? >>>>>> Is this possible? In non-overlaid regions, the address is aligned with >>>>>> at least one of the erase commands, else -EINVAL. For overlaid regions >>>>>> alignment doesn't matter. But yes, if this is possible, in this case, >>>>>> this proposal will do a partial erase. >>>>> Shouldn't we fail up front instead ? >>>> It will be great if we can do this without having performance penalties. >>>> Can we loose the conditions for the last erase command? If one wants to >>>> erase 80k chunk starting from offset 0 and only 32k and 64k erase type >>>> are supported, can we erase 96k? >>> No. But can you maybe build a list of erase commands to be executed once >>> you validate that the erase can be performed for example ? >> >> My second choice was an array witch saves u8 opcode and u32 erasesize. >> There are flashes of 256MB, in the worst case scenario with 4k erase >> type, we will end up with 64K entries. > > Some RLE encoding might help here ? Nice. > >> How about enforcing the length to be multiple of mtd->erasesize, like we >> do in uniform_erase? With this, the problem disappears. > > What is the erase size for the 4k-sector 256MiB flash ? S70FS01GS[1] is a 128 MByte flash with non-uniform erase support. It supports 4k and 256k erase types. I would have to enforce the address and the length to be multiple of 256k in order to vanish the issue. But the whole point of non-uniform erase will vanish too, I guess. I don't have any other good :) idea, so I'll implement your suggestion with the list of erase commands and RLE encoding. Thanks, ta [1] http://www.cypress.com/file/215911/download