Message ID | 20211005135606.2246-1-kabel@kernel.org |
---|---|
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=sH6HDoFo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HNzdm2dFLz9sPB for <incoming@patchwork.ozlabs.org>; Wed, 6 Oct 2021 00:56:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CD10782DA1; Tue, 5 Oct 2021 15:56:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="sH6HDoFo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 22C8782C30; Tue, 5 Oct 2021 15:56:18 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6E9D280FBE for <u-boot@lists.denx.de>; Tue, 5 Oct 2021 15:56:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 6F9C4615E3; Tue, 5 Oct 2021 13:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633442172; bh=F8fJi4PDJnmxq2mBDfj75sU565r6mWk7zZUFVqLfGnw=; h=From:To:Cc:Subject:Date:From; b=sH6HDoFo1t9zSZUkEOqGfZXc3KHxF67SJbesBeFN2eupHXzYhP0w7Q4BFHOwoYWyw +xsLiLdkHdSsWS0zpfdB3MdZPOfvn9YZBk5VxH+Z4KlLBkgbBuVjwfpiVV0oycZ8ms 4xHonNUP7XI0C2EiSe3iU98CbNUnnVj+gT+pOXxPAMxedY7k8QKE+tktPgVcho3n7s wvJ9Cl0q32qpf1kga4LSMMp2wVQ1gPmKo3g9wRVAyOcssN1deSD19Bw4RAAXGzFFTv eO8XsDawR2hP6dRXDm4Wpnnf1l0mHu7lZgVjgQTe86zgvkPmhosPlZub7NXcB4x4er vAnWnEA4no8FQ== From: =?utf-8?q?Marek_Beh=C3=BAn?= <kabel@kernel.org> To: Jagan Teki <jagan@amarulasolutions.com>, Tom Rini <trini@konsulko.com> Cc: u-boot@lists.denx.de, Patrick Delaunay <patrick.delaunay@st.com>, =?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>, Patrice Chotard <patrice.chotard@foss.st.com>, Marek Vasut <marex@denx.de>, Pratyush Yadav <p.yadav@ti.com>, =?utf-8?q?Marek_Beh=C3=BAn?= <marek.behun@nic.cz> Subject: [PATCH u-boot-spi v3 00/10] Fix `mtd erase` when used with mtdpart Date: Tue, 5 Oct 2021 15:55:56 +0200 Message-Id: <20211005135606.2246-1-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean |
Series |
Fix `mtd erase` when used with mtdpart
|
expand
|
From: Marek Behún <marek.behun@nic.cz> The original cover letter said: this patch series fixes the `mtd erase` command when used with mtdpart with a partition of non-zero offset. Currently when the `mtd erase` command is used for such a partition, it does not erase all blocks. Instead after a block is erased, the next block address not current block address + block size, but current block address + block size + partition offset, due to spi_nor_erase() not calling mtd_erase_callback(): => mtd erase "Rescue system".. Erasing 0x00000000 ... 0x006fffff (1792 eraseblock(s)) jedec_spi_nor spi-nor@0: at 0x100000, len 4096 jedec_spi_nor spi-nor@0: at 0x201000, len 4096 jedec_spi_nor spi-nor@0: at 0x302000, len 4096 jedec_spi_nor spi-nor@0: at 0x403000, len 4096 jedec_spi_nor spi-nor@0: at 0x504000, len 4096 jedec_spi_nor spi-nor@0: at 0x605000, len 4096 jedec_spi_nor spi-nor@0: at 0x706000, len 4096 This series adds some fixes to spi_nor_erase() function, then adds calling of mtd_erase_callback() to fix this bug. The series also contains an improvement - adding the posibility to interrupt spi_nor_erase() with Ctrl+C; and another one - making mtdpart's _erase() method more sane so that the above mentioned bug will not occur even if underlying driver does not call mtd_erase_callback(). Finally the last patch removes mtd_erase_callback() entirely, since: - all provided callbacks across U-Boot are no-ops - mtd_erase_callback() is abused for completely different purpose than the original one (as explained in last commit message) Marek Changes since v2: - added patch (5) adding check for zero length into legacy spi_flash_*() functions - changes patch (6, previously 5) to remove check for zero length also from spi_nor_write() Changes since v1: - fixed CI bugs (by removing mtd_erase_callback() entirely) Marek Behún (10): mtd: spi-nor-core: Try cleaning up in case writing BAR failed mtd: spi-nor-core: Check return value of write_enable() in spi_nor_erase() mtd: spi-nor-core: Don't overwrite return value if it is non-zero mtd: spi-nor-core: Check return value of write_disable() in spi_nor_erase() mtd: spi-flash: Check for zero length in legacy spi_flash_*() mtd: spi-nor-core: Don't check for zero length in spi_nor_write() / spi_nor_erase() mtd: spi-nor-core: Call mtd_erase_callback() from spi_nor_erase() mtd: spi-nor-core: Check for ctrlc() in spi_nor_erase() mtd: mtdpart: Make mtdpart's _erase method sane mtd: Remove mtd_erase_callback() entirely cmd/onenand.c | 9 ++---- drivers/mtd/altera_qspi.c | 3 -- drivers/mtd/cfi_mtd.c | 1 - drivers/mtd/mtdconcat.c | 11 ------- drivers/mtd/mtdcore.c | 8 ------ drivers/mtd/mtdpart.c | 23 ++++----------- drivers/mtd/nand/raw/nand_base.c | 4 --- drivers/mtd/onenand/onenand_base.c | 3 -- drivers/mtd/spi/sf_mtd.c | 1 - drivers/mtd/spi/spi-nor-core.c | 46 +++++++++++++++++++++--------- drivers/mtd/ubi/io.c | 13 --------- env/onenand.c | 4 +-- fs/yaffs2/yaffs_mtdif.c | 1 - include/linux/mtd/mtd.h | 11 ------- include/nand.h | 1 - include/spi_flash.h | 9 ++++++ 16 files changed, 51 insertions(+), 97 deletions(-)