| Message ID | f1af20c9-07ad-15f2-152c-e7145015de49@iopsys.eu |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBAABBQUB3GNAMGQEESJMMOQ@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 25CA344AEE for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 24 Oct 2022 09:37:39 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id y10-20020a056402358a00b0045d5cf18d4csf8751224edc.17 for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 24 Oct 2022 00:37:39 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1666597059; cv=pass; d=google.com; s=arc-20160816; b=V0CGnbmXrq1jhgBBElRgBwA9KNuVEEwtSxGt6qNl2to6cCL1+2A4L3++dS/migZ12h eBJYoVlVoEJYmO5U7S0jVeWlf6naXaXSbr0GAZ0ZKKbjmIyTzFu8yVYSVqaHuFOhcpK3 2PQQvOZHUijZRJIbaJ74Eh+PZD5ZK8OlHPnz0WTcjt813kblYAh3RGrIwpKah8cs0t3K hWscKWrGoVvWnFJIyJQvsQooBdIBYEV5JweFfAHtINRzu0zLCp7XY4FjN0RwKa9cpGp8 gOmiPT2cH8ifZ+6qgGsNEf/2VhGx47K56WPrNlDY7euXQUYK1P6trhaHHX2tqkuLPfwr wxNQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:reply-to:mime-version:subject:from:cc:to :content-language:user-agent:date:message-id:dkim-signature; bh=8AEL0x1Yjd3+oVCgWjtYfqMmcRK4BW+tLJzFPI+XAhQ=; b=caFyBTUpaZtj3IZDeDWJMe3VKa06El0y6iaUYRLjmd1mh0kL4dP4rIUzcla8Vtximz xwoF9YK8AgLV0j9Z8d+FlZ90Ux8IbsqZloWI0ryfnRUQuZqf4tx9Iu/yEBc3YLLkcze2 dHHzQb54K0+xKOoL64pYEw7vKvC46vbV3T2Wq4whCgR1LN0QQ3ZTW66M04H2z/uOXl6A b04cyU7xb46FDX55U9u+w44cYjF0RETjMDY74/phzub5H8flgQHnJ1ttCPFOJrYjBwDG 4BvmbIDF671g2KphYc+udsJydHEyKBWsxSKDoIG2S9Bq7B8+CDjiGMgk3PteZy3K+L/8 DplQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b="U+4/iGJA"; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.247.54 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:reply-to:x-original-authentication-results :x-original-sender:mime-version:subject:from:cc:to:content-language :user-agent:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=8AEL0x1Yjd3+oVCgWjtYfqMmcRK4BW+tLJzFPI+XAhQ=; b=H5vPQBPUpvUGuKY00GMkBOysHc+rkzqnTF5gVWTmYgERh23X/YcxHbN2OmEpf9nwVD 2XuwrSQxwl8hU8LAh/muU7aS7RUDhcme+xXl0oqMrmtiJm2mA3uPf3iqRqWX9fWnZ7Lq nPivAD87v4M/QRkLv1o1b3d3h6dDdB/VBxVEM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:mime-version :subject:from:cc:to:content-language:user-agent:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8AEL0x1Yjd3+oVCgWjtYfqMmcRK4BW+tLJzFPI+XAhQ=; b=fg24oACwEHxmyW94EvSPsSzPXsaQtwkXEjhJ/3CmwO/MLCqMGGXaq8O/wgov3kRzvr 3Lwx/oh3T7MaajBjI875tTo2FovSLRBwoo2P0zjCwbvCdjkilA3aX539xMEYcz0FONUf mTgRMAE3nTqVz1blqN5P17pSV6peGcCi9l04nkCl/lE+FCX/gNYVakGoudECRhMEld5Q d9UH8pkJpcCOngTybgDO+k1uo2RFTNWRFZ2t6mIBzgqfsLNgfoHS66AvBOA1aJv+KNiv pkDMJwcdM0MSHEVo3pwQkRhfbqdnpeyF9OtHtzmNZzGaYW+B/4mnVmHPPxkp2WKFXAkB nAHg== X-Gm-Message-State: ACrzQf1P+GW8IHW1DYFHwYWct98lMfgsjCnX4FHEOnpx0CwHhv7xNgGi +7W4WVR6j4vkIpMdp34yjD0qk6fm X-Google-Smtp-Source: AMsMyM6zKGUYfDhc7G+qTDK3KQSUX/48q4I+YPG+42ugUBW97szJEWPcBb4NugDOV/msfr330znzHQ== X-Received: by 2002:a17:907:7ba4:b0:78e:281d:91ef with SMTP id ne36-20020a1709077ba400b0078e281d91efmr26850440ejc.288.1666597058749; Mon, 24 Oct 2022 00:37:38 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:4f8e:b0:783:b20:46a0 with SMTP id o14-20020a1709064f8e00b007830b2046a0ls4030045eju.6.-pod-prod-gmail; Mon, 24 Oct 2022 00:37:38 -0700 (PDT) X-Received: by 2002:a17:906:ee81:b0:77e:829a:76e9 with SMTP id wt1-20020a170906ee8100b0077e829a76e9mr27535587ejb.207.1666597057796; Mon, 24 Oct 2022 00:37:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666597057; cv=pass; d=google.com; s=arc-20160816; b=0EY3+SJ5p3iMPccS2t+bo7dhk8ZJ+tlVN+ELBgZHoH2UNAlpNUU6Ax2QVwlfl8xbeL uBCb2MvQHSju5IWHnLxH4XwnoY7PR5adync/8peTBjQEGQnNDgXx/gdf3TB9JjQSIGZ5 3QKP8iflBpy0ncfLsWmb9TlF4uJkAX9EdrhtVSRWjKMgOTYY98EkngyIDoZSII3NglcT Cs0TmUuJ09l6jtjzJbvsCMniyenlewedFdXCqJ+9AQgSq9ys/LcXNMp5ln1CPvXljLLu bgi4IJXgCNwK5BYjEmu22nr4SniqzaG06JnFr9JwFj8rcu+aneogWTLecRHh5iM1vd7C ZPkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:subject:from:cc:to :content-language:user-agent:date:message-id:dkim-signature; bh=OfVldBLzcZW9fdPCLieM2GU9Q3IyOEv83yGaTa9I0sE=; b=LWmTMnRBcSLNu3hEwB3BQKKLHBujfg0tda+zmYKvArY/moz5NqBK1cadA/G1N6wnGC RT5gpXqQiG0ZrMcunbvxuzC0pDUvSU+gOUM3QaHG+NSzTffGVfcVAO57GXit+km/OzDo 4lHEyi/vW/aW4t+IeyYZs/fY+bMKY+EX5VHEkk3l7jPHOJecjfXqGF+n4NIwDbVjDsPi /eKVN/X+XCw8fl1MVBehH2F7WHKgZFdbXqJLmnanaqMkj0sITemGhyNToErRL50P3HpS R+FxD4IXNymRpiJcSirfDJhaB/xv9Et7MReD1u4niVFiRF9EFmKUA7f3Ma9560O8yk5/ 2ryA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b="U+4/iGJA"; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.247.54 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2054.outbound.protection.outlook.com. [40.107.247.54]) by mx.google.com with ESMTPS id wg7-20020a17090705c700b007a0b8eead9fsi5967893ejb.60.2022.10.24.00.37.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Oct 2022 00:37:37 -0700 (PDT) Received-SPF: pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.247.54 as permitted sender) client-ip=40.107.247.54; ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vz32MfZWqgXrgHYtHvtjsMJqpEIKc91CTgmCxETf61L93HcirEf5ZM1O9Gr8IQbyoXWClKLpbsKwqjlCHsTPfr1Hn9dXtH/UE1Bx2aoF9Xpwclyho/JqydlAEpdehq8PR0WPuD7MNl0ewfZ2IgwDoI57/7JiMwL0yAspmnDlnMj12soQRSgZNLhfDEhaSEQpOmsDq/6YCFeIziSZg0tNEoC/cFpmt/yy/qg1PiwUnotxkhqa6MnJnKfnbH6n/4q0p0/p/uNhQYBiIGqakitzW5llKbluxcN/JB+5vQcZr9RSlpw1goFpamFIZRGbTVgYIy1+/z/XsbS2uGm997kt/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OfVldBLzcZW9fdPCLieM2GU9Q3IyOEv83yGaTa9I0sE=; b=RhffUAnpLPXN35fCHRyuTUsm2ZaoEF+g94HaNU7b8LjYotTRgI/QA/ws6OnjQ0CTHEt5HxTthbYrrXQXynkc1Pt2wG1eMkxWel9ZGeYhUrwKkp9+NkVE1p1uLnLyCEy5BQk9g2hsCRhIs8tyIoJ6KAu+PfNNivMQErPeOzltGRYLbymsetu4pNFJgoVR1dRwtbxPvk7QvR6GzR7ClJpPLRfqJvdzIvizClmF1T0vjlz0qj9HxdzgSCXYD2tOB5XTNHS/aWAqWtfVx+5ebEDZw6H6YaEENzePJpaVKAWAPsoYOk2aUP84MNqwjRlFmkdKN3pxqsPcAh1GAoCLDS+H7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=iopsys.eu; dmarc=pass action=none header.from=iopsys.eu; dkim=pass header.d=iopsys.eu; arc=none Received: from PAXPR08MB6494.eurprd08.prod.outlook.com (2603:10a6:102:154::16) by AM8PR08MB5569.eurprd08.prod.outlook.com (2603:10a6:20b:1de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Mon, 24 Oct 2022 07:37:36 +0000 Received: from PAXPR08MB6494.eurprd08.prod.outlook.com ([fe80::4585:194e:af0f:4a46]) by PAXPR08MB6494.eurprd08.prod.outlook.com ([fe80::4585:194e:af0f:4a46%6]) with mapi id 15.20.5723.034; Mon, 24 Oct 2022 07:37:36 +0000 Message-ID: <f1af20c9-07ad-15f2-152c-e7145015de49@iopsys.eu> Date: Mon, 24 Oct 2022 10:37:34 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Content-Language: en-US, ru-RU To: u-boot@lists.denx.de Cc: Amarula patchwork <linux-amarula@amarulasolutions.com>, Tom Rini <trini@konsulko.com>, Jagan Teki <jagan@amarulasolutions.com>, Dario Binacchi <dario.binacchi@amarulasolutions.com>, Michael Trimarchi <michael@amarulasolutions.com>, mikhail.kshevetskiy@gmail.com From: "'Mikhail Kshevetskiy' via Amarula Linux" <linux-amarula@amarulasolutions.com> Subject: [PATCH v2] cmd: mtd: try to erase bad blocks only if scrub flag is provided Content-Type: text/plain; charset="UTF-8" X-ClientProxiedBy: FR0P281CA0002.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::7) To PAXPR08MB6494.eurprd08.prod.outlook.com (2603:10a6:102:154::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR08MB6494:EE_|AM8PR08MB5569:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a5d6e43-f05c-4734-f2ef-08dab5929f31 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: w+adxI7J8ct0RdhqX3h8YdUcoN0uF9//MXgynpCuPw6DAuA90xSka4/0+xagJx3runts+HR6JLn0UbNLL1TOIiQdG2pHBwUDktacFji8hhnS63P2X1/4IAbvAK8MpzryqLYq4tlosn9GqZyokEJO6GzFNQ2NYTmG+6Hs5OPpVJuAqozLqyVe+Li7tfkvYzD2cBxV1DsYfPoS4B7Dp/vf56RLUDzFXSkH+45AvbmMwVKFaZ6r7T5PCqMutxtQOi1F4RxpR6PEuKCUxzZD0zvoWgw/y6MfUsvSMbH77iJ9vSnPvp6sj2II08rsNcK1QklQKmS4mLk+uuf/4kHWPhOyZ/nh7K1nSmXdy9hPBfqF8Rt7ZWgLWTBm2PKJZuR6irbnBYQP8JMr7iusP2H15HB5Uni6IXfBUB8475yPXEDQoOI7u1naHwX0m+ctuvwBFvEbtGzUXo6FLbv0+g2oB7I5Z+0VOTl8cR1YuT3RTR2/LG0neMRbxxLADH+HPyZda18kxslyVBJefEnHidJLruACxiNTjKSvz2+nvHtbtkUh7Ofbs+h1k8IJOScx8yPSqw3brSAiIIMplW8l6brGo1Yt5T/gR4CliTKfSU2VJr3c3CHgzMr1pyVsI0O84jb+gm+uy/3nV9uWANFrv/WRurIFDnm7CjYWnye14lUZXyT43vaTCa06tZwU0dHujq/tXM2kphYhmuq/zRL7/YEBiDs1Ssq9VTjYKsHJWFYVLugXUFBIHJNvgVm7g22jixtWNl4fo3SBOmhp16Ie5/S4aiwQ78S5LzmvEbMIxwG9poqDVdE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR08MB6494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(366004)(396003)(376002)(346002)(39840400004)(451199015)(4326008)(5660300002)(54906003)(6916009)(66946007)(66556008)(66476007)(26005)(8936002)(8676002)(316002)(41300700001)(6512007)(6506007)(36756003)(186003)(38100700002)(2616005)(44832011)(2906002)(478600001)(31696002)(86362001)(83380400001)(6486002)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?cgw94LT0DbomW0NQ6/wyXPbRt?= =?utf-8?q?stBKP4eaYi6VUDWLnbZPhMbQDUuDtYJNbmauubB38OCacfJ5u/Nm8K/q?= =?utf-8?q?hFTvrT4xJiTQS4KXqXspbyrgpyUs+qdnyMxkJ87O42tPLynf1b10vS5S?= =?utf-8?q?yTwDQ0gvnX4cHgH7VKoHmaH8I2lDm5mRe7jl3wH4Y7j1jPy5msqCmAcO?= =?utf-8?q?51OUQOIL9JxmQ6PLuO0bny81DZ/jfWK/JleOT4IYy3e3FlhLCRva4nu4?= =?utf-8?q?XDhe9ltBt3HEvPXMKnMocVFCSXmBTvGsjxXcvsWQCAkaKURFHirXthR/?= =?utf-8?q?lUvl7VRH3TJwcyyzvndI+rQPGNWNiEkUJQtNUT9tP7pHF5t3Jvs3nJm0?= =?utf-8?q?K41kmYhz4YFKZpuC7PWUkgBCPT8djou7+guCJSt0aQBpefpi6fPg1fZR?= =?utf-8?q?EyVZzmwpbIwLFkhx2ekvlx7NHUSsvk/t29S25MUIJPOwDCKDfp53wWRo?= =?utf-8?q?N2TGVi7/iasWd+LAOnoaOYdqtb99bGX76Bha8hMfiZE1CwELJvkEMW/r?= =?utf-8?q?S7SwWc4FuAxaOgVkMIlvqXlxkAGCyVFOBnlmO4i7AlDqA5oF261HyoSc?= =?utf-8?q?cKN8Fd7SNkWRXrWZHM5PwYNFN5xgKcoa/K/wVbqZKdFLI1ctSyKI4J3B?= =?utf-8?q?70fToK5X4ACjHCkJB6NBCsC1pgZ8FXNSlQkVvn+o8hnrcGNAUQfmLkyT?= =?utf-8?q?Xe3b9420FEfqAoL95RAsuasF3EFGZBAn4cV7BCVJI6vwZRpS5RuY0a4I?= =?utf-8?q?T/F9AEaueJxIUq+tTcboGuYQVM6Zoj/cYw6clUI7wRNRGW48NReoB9r6?= =?utf-8?q?XOvp2mPblwf3n7Q73dIdPH8aDR3Jh4c6t4xgj9CB3Kr1vqjvHiiLPFD0?= =?utf-8?q?CeH7t5GHStC6c13jrmGORrV8eBs4ThO/inQoiLSJTLYWtbwXiP1pBF2L?= =?utf-8?q?+5aTFlAvu1sPRvjdS+cXgfoLNYuEDHvfwzHGPJGAFVsdP92Mv5Z2wS9z?= =?utf-8?q?CDqEF+4CmtNsw1S0MKiCqUcF7BaoIZ556aiN6S/GKMuvQBct6XM/9UaK?= =?utf-8?q?WV7bXZ2ODM3f/M3m6d2biezRyyDRpQiSCocKCpgW5aoVzvumP2O3tLYI?= =?utf-8?q?ABLzJ9s1QAr/KN8/CgawW0JhewpPk2oERDBCQcYGeYFbCgI04YjfVFyy?= =?utf-8?q?BuUQmMrPMLA/JuWkg+ouLVMbiNrO7m9ul5hBpF8QCGINqHULp3GNW2Zu?= =?utf-8?q?fToyZPA0zxbj8B8xk4TOeMaqgovbM/5vzzJyfGi7ULNXIMrL6oPUnVLE?= =?utf-8?q?ULzwqpoShB+KPjviZMszx+uqnEF9BoB8ZcEkASU1kPiTIs0phUS4KbtC?= =?utf-8?q?zgkMEXSc2aXCAeHhHsL4KR6LSmHaLfig/ZlmG601vtMQSdxCb4wNJ9WC?= =?utf-8?q?MHHCJ1LUaIQhJSeUIEd3tlY1QwD35umpGOgmju7zQDkxdBRjah65gkGO?= =?utf-8?q?TlbozWsfoNIb4gUK9FKkIWwj0nS54nL2sQeHK1wwrcG+S1d0F6gUe7+B?= =?utf-8?q?GQbiNhW2lshYQMHa/BVvnBlnzWqIQdqFaP60ZqXi8wAIOWVtYuz/xasF?= =?utf-8?q?tF+6XX6AqEPrzI8+DbceoGUDavuaoPAVADU7nyxrLGE/8QqayOyQyDEo?= =?utf-8?q?vEwPqnWs7SswYPiBgLZUwFAW2uXmA=3D=3D?= X-OriginatorOrg: iopsys.eu X-MS-Exchange-CrossTenant-Network-Message-Id: 2a5d6e43-f05c-4734-f2ef-08dab5929f31 X-MS-Exchange-CrossTenant-AuthSource: PAXPR08MB6494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 07:37:36.8143 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 7ff78d65-2de4-40f5-8675-0569e5c7a65d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KIXtsi2vvB/CItx7AgD0jIbSAQKyCcFpreAz2lHxwhWDjXajPs+sAY2VG01Q9fFm/ooQgVkToXZpKVBtVmEPNeab7k1n3RrKcYxgWAS4JMk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5569 X-Original-Sender: mikhail.kshevetskiy@iopsys.eu X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@iopsys.eu header.s=selector1 header.b="U+4/iGJA"; arc=pass (i=1 spf=pass spfdomain=iopsys.eu dkim=pass dkdomain=iopsys.eu dmarc=pass fromdomain=iopsys.eu); spf=pass (google.com: domain of mikhail.kshevetskiy@iopsys.eu designates 40.107.247.54 as permitted sender) smtp.mailfrom=mikhail.kshevetskiy@iopsys.eu; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iopsys.eu X-Original-From: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Reply-To: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
[v2] cmd: mtd: try to erase bad blocks only if scrub flag is provided
|
|
Commit Message
'Abel Vesa' via Amarula Linux
Oct. 24, 2022, 7:37 a.m. UTC
'mtd erase' command should not erase bad blocks. To force bad block erasing
there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases
bad blocks unconditionally. This is wrong.
Fix issue by adding bad block checks to do_mtd_erase() function in the case
srub flag is not provided. We can't simplify code by eliminating -EIO result
check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS.
Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
---
cmd/mtd.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Comments
Hi Mikhail On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> wrote: > > 'mtd erase' command should not erase bad blocks. To force bad block erasing > there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases > bad blocks unconditionally. This is wrong. > > Fix issue by adding bad block checks to do_mtd_erase() function in the case > srub flag is not provided. We can't simplify code by eliminating -EIO result > check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. > > Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch. > > Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> > --- > cmd/mtd.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/cmd/mtd.c b/cmd/mtd.c > index ad5cc9827d..a314745e95 100644 > --- a/cmd/mtd.c > +++ b/cmd/mtd.c > @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, > erase_op.mtd = mtd; > erase_op.addr = off; > erase_op.len = mtd->erasesize; > - erase_op.scrub = scrub; > > while (len) { > - ret = mtd_erase(mtd, &erase_op); > + if (!scrub) { > + ret = mtd_block_isbad(mtd, erase_op.addr); > + if (ret < 0) { > + printf("Failed to get bad block at 0x%08llx\n", > + erase_op.addr); > + ret = CMD_RET_FAILURE; > + goto out_put_mtd; > + } else if (ret > 0) { > + /* simulate bad block behavior */ > + ret = -EIO; > + goto skip_block_erasing; > + } > + } > > + ret = mtd_erase(mtd, &erase_op); > +skip_block_erasing: > if (ret) { > /* Abort if its not a bad block error */ > if (ret != -EIO) > -- > 2.35.1 > As I stated in a different email. Please re-post with the right sign-off Michael
On 24.10.2022 10:49, Michael Nazzareno Trimarchi wrote: > [External email] > > > > > > Hi Mikhail > > On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy > <mikhail.kshevetskiy@iopsys.eu> wrote: >> 'mtd erase' command should not erase bad blocks. To force bad block erasing >> there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases >> bad blocks unconditionally. This is wrong. >> >> Fix issue by adding bad block checks to do_mtd_erase() function in the case >> srub flag is not provided. We can't simplify code by eliminating -EIO result >> check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. >> >> Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch. >> >> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> >> --- >> cmd/mtd.c | 17 +++++++++++++++-- >> 1 file changed, 15 insertions(+), 2 deletions(-) >> >> diff --git a/cmd/mtd.c b/cmd/mtd.c >> index ad5cc9827d..a314745e95 100644 >> --- a/cmd/mtd.c >> +++ b/cmd/mtd.c >> @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, >> erase_op.mtd = mtd; >> erase_op.addr = off; >> erase_op.len = mtd->erasesize; >> - erase_op.scrub = scrub; >> >> while (len) { >> - ret = mtd_erase(mtd, &erase_op); >> + if (!scrub) { >> + ret = mtd_block_isbad(mtd, erase_op.addr); >> + if (ret < 0) { >> + printf("Failed to get bad block at 0x%08llx\n", >> + erase_op.addr); >> + ret = CMD_RET_FAILURE; >> + goto out_put_mtd; >> + } else if (ret > 0) { >> + /* simulate bad block behavior */ >> + ret = -EIO; >> + goto skip_block_erasing; >> + } >> + } >> >> + ret = mtd_erase(mtd, &erase_op); >> +skip_block_erasing: >> if (ret) { >> /* Abort if its not a bad block error */ >> if (ret != -EIO) >> -- >> 2.35.1 >> > As I stated in a different email. Please re-post with the right sign-off > > Michael There is an issue with Dario Binacchi patch. Please see my comments for his patch. I just suggest a fix. I am sorry if I do it wrong way. Mikhail > -- > Michael Nazzareno Trimarchi > Co-Founder & Chief Executive Officer > M. +39 347 913 2170 > michael@amarulasolutions.com > __________________________________ > > Amarula Solutions BV > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > T. +31 (0)85 111 9172 > info@amarulasolutions.com > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7Ca0041129e25a4456725708dab594462c%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021945688614410%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HASzL7T4QF8Kea8t6Dt7hQYnHGs1poC9gRPZ6N3SPEI%3D&reserved=0
Hi On Mon, Oct 24, 2022 at 10:20 AM Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> wrote: > > > On 24.10.2022 10:49, Michael Nazzareno Trimarchi wrote: > > [External email] > > > > > > > > > > > > Hi Mikhail > > > > On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy > > <mikhail.kshevetskiy@iopsys.eu> wrote: > >> 'mtd erase' command should not erase bad blocks. To force bad block erasing > >> there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases > >> bad blocks unconditionally. This is wrong. > >> > >> Fix issue by adding bad block checks to do_mtd_erase() function in the case > >> srub flag is not provided. We can't simplify code by eliminating -EIO result > >> check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. > >> > >> Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch. > >> > >> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> > >> --- > >> cmd/mtd.c | 17 +++++++++++++++-- > >> 1 file changed, 15 insertions(+), 2 deletions(-) > >> > >> diff --git a/cmd/mtd.c b/cmd/mtd.c > >> index ad5cc9827d..a314745e95 100644 > >> --- a/cmd/mtd.c > >> +++ b/cmd/mtd.c > >> @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, > >> erase_op.mtd = mtd; > >> erase_op.addr = off; > >> erase_op.len = mtd->erasesize; > >> - erase_op.scrub = scrub; > >> > >> while (len) { > >> - ret = mtd_erase(mtd, &erase_op); > >> + if (!scrub) { > >> + ret = mtd_block_isbad(mtd, erase_op.addr); > >> + if (ret < 0) { > >> + printf("Failed to get bad block at 0x%08llx\n", > >> + erase_op.addr); > >> + ret = CMD_RET_FAILURE; > >> + goto out_put_mtd; > >> + } else if (ret > 0) { > >> + /* simulate bad block behavior */ > >> + ret = -EIO; > >> + goto skip_block_erasing; > >> + } > >> + } > >> > >> + ret = mtd_erase(mtd, &erase_op); > >> +skip_block_erasing: > >> if (ret) { > >> /* Abort if its not a bad block error */ > >> if (ret != -EIO) > >> -- > >> 2.35.1 > >> > > As I stated in a different email. Please re-post with the right sign-off > > > > Michael > > There is an issue with Dario Binacchi patch. Please see my comments for > his patch. > > I just suggest a fix. I am sorry if I do it wrong way. > > Mikhail There are two ways I can see: Repost the v3 starting from Dario one and improve the commit message for him. You can add your signed off and tested by or wait Dario to resend with all the suggestion you have made We think that you rise a correct problem and you help us to understand. We just decided to fix on uboot level and not core level. Michael > > > -- > > Michael Nazzareno Trimarchi > > Co-Founder & Chief Executive Officer > > M. +39 347 913 2170 > > michael@amarulasolutions.com > > __________________________________ > > > > Amarula Solutions BV > > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > T. +31 (0)85 111 9172 > > info@amarulasolutions.com > > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7Ca0041129e25a4456725708dab594462c%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021945688614410%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HASzL7T4QF8Kea8t6Dt7hQYnHGs1poC9gRPZ6N3SPEI%3D&reserved=0
On 24.10.2022 11:27, Michael Nazzareno Trimarchi wrote: > [External email] > > > > > > Hi > > On Mon, Oct 24, 2022 at 10:20 AM Mikhail Kshevetskiy > <mikhail.kshevetskiy@iopsys.eu> wrote: >> >> On 24.10.2022 10:49, Michael Nazzareno Trimarchi wrote: >>> [External email] >>> >>> >>> >>> >>> >>> Hi Mikhail >>> >>> On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy >>> <mikhail.kshevetskiy@iopsys.eu> wrote: >>>> 'mtd erase' command should not erase bad blocks. To force bad block erasing >>>> there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases >>>> bad blocks unconditionally. This is wrong. >>>> >>>> Fix issue by adding bad block checks to do_mtd_erase() function in the case >>>> srub flag is not provided. We can't simplify code by eliminating -EIO result >>>> check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. >>>> >>>> Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch. >>>> >>>> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> >>>> --- >>>> cmd/mtd.c | 17 +++++++++++++++-- >>>> 1 file changed, 15 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/cmd/mtd.c b/cmd/mtd.c >>>> index ad5cc9827d..a314745e95 100644 >>>> --- a/cmd/mtd.c >>>> +++ b/cmd/mtd.c >>>> @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, >>>> erase_op.mtd = mtd; >>>> erase_op.addr = off; >>>> erase_op.len = mtd->erasesize; >>>> - erase_op.scrub = scrub; >>>> >>>> while (len) { >>>> - ret = mtd_erase(mtd, &erase_op); >>>> + if (!scrub) { >>>> + ret = mtd_block_isbad(mtd, erase_op.addr); >>>> + if (ret < 0) { >>>> + printf("Failed to get bad block at 0x%08llx\n", >>>> + erase_op.addr); >>>> + ret = CMD_RET_FAILURE; >>>> + goto out_put_mtd; >>>> + } else if (ret > 0) { >>>> + /* simulate bad block behavior */ >>>> + ret = -EIO; >>>> + goto skip_block_erasing; >>>> + } >>>> + } >>>> >>>> + ret = mtd_erase(mtd, &erase_op); >>>> +skip_block_erasing: >>>> if (ret) { >>>> /* Abort if its not a bad block error */ >>>> if (ret != -EIO) >>>> -- >>>> 2.35.1 >>>> >>> As I stated in a different email. Please re-post with the right sign-off >>> >>> Michael >> There is an issue with Dario Binacchi patch. Please see my comments for >> his patch. >> >> I just suggest a fix. I am sorry if I do it wrong way. >> >> Mikhail > There are two ways I can see: > Repost the v3 starting from Dario one and improve the commit message > for him. You can add your signed off and tested by or > wait Dario to resend with all the suggestion you have made > > We think that you rise a correct problem and you help us to > understand. We just decided to fix on uboot level and not core level. > > Michael Is there a good way to apply Dario patch? It was sent as HTML message. I can fix message body and apply it, but it will be better if Dario resend it as normal clear text. Mikhail PS: I send patch for a second time because first time it was sent in HTML format. > >>> -- >>> Michael Nazzareno Trimarchi >>> Co-Founder & Chief Executive Officer >>> M. +39 347 913 2170 >>> michael@amarulasolutions.com >>> __________________________________ >>> >>> Amarula Solutions BV >>> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL >>> T. +31 (0)85 111 9172 >>> info@amarulasolutions.com >>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C2c68f94e89c247e2886f08dab5999790%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021968536553670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GUYTrPb1VWhNN0EfEgV15jtuZxTldBB4qBpUsl%2Bd8H0%3D&reserved=0 > > > -- > Michael Nazzareno Trimarchi > Co-Founder & Chief Executive Officer > M. +39 347 913 2170 > michael@amarulasolutions.com > __________________________________ > > Amarula Solutions BV > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > T. +31 (0)85 111 9172 > info@amarulasolutions.com > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C2c68f94e89c247e2886f08dab5999790%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021968536553670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GUYTrPb1VWhNN0EfEgV15jtuZxTldBB4qBpUsl%2Bd8H0%3D&reserved=0
Hi Mikhail On Mon, Oct 24, 2022 at 10:34 AM Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> wrote: > > > On 24.10.2022 11:27, Michael Nazzareno Trimarchi wrote: > > [External email] > > > > > > > > > > > > Hi > > > > On Mon, Oct 24, 2022 at 10:20 AM Mikhail Kshevetskiy > > <mikhail.kshevetskiy@iopsys.eu> wrote: > >> > >> On 24.10.2022 10:49, Michael Nazzareno Trimarchi wrote: > >>> [External email] > >>> > >>> > >>> > >>> > >>> > >>> Hi Mikhail > >>> > >>> On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy > >>> <mikhail.kshevetskiy@iopsys.eu> wrote: > >>>> 'mtd erase' command should not erase bad blocks. To force bad block erasing > >>>> there is 'mtd erase.dontskipbad' command. Unfortunately nand layer erases > >>>> bad blocks unconditionally. This is wrong. > >>>> > >>>> Fix issue by adding bad block checks to do_mtd_erase() function in the case > >>>> srub flag is not provided. We can't simplify code by eliminating -EIO result > >>>> check of mtd_erase() as it will terminate erasing with CMD_RET_SUCCESS. > >>>> > >>>> Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for his patch. > >>>> > >>>> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> > >>>> --- > >>>> cmd/mtd.c | 17 +++++++++++++++-- > >>>> 1 file changed, 15 insertions(+), 2 deletions(-) > >>>> > >>>> diff --git a/cmd/mtd.c b/cmd/mtd.c > >>>> index ad5cc9827d..a314745e95 100644 > >>>> --- a/cmd/mtd.c > >>>> +++ b/cmd/mtd.c > >>>> @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, > >>>> erase_op.mtd = mtd; > >>>> erase_op.addr = off; > >>>> erase_op.len = mtd->erasesize; > >>>> - erase_op.scrub = scrub; > >>>> > >>>> while (len) { > >>>> - ret = mtd_erase(mtd, &erase_op); > >>>> + if (!scrub) { > >>>> + ret = mtd_block_isbad(mtd, erase_op.addr); > >>>> + if (ret < 0) { > >>>> + printf("Failed to get bad block at 0x%08llx\n", > >>>> + erase_op.addr); > >>>> + ret = CMD_RET_FAILURE; > >>>> + goto out_put_mtd; > >>>> + } else if (ret > 0) { > >>>> + /* simulate bad block behavior */ > >>>> + ret = -EIO; > >>>> + goto skip_block_erasing; > >>>> + } > >>>> + } > >>>> > >>>> + ret = mtd_erase(mtd, &erase_op); > >>>> +skip_block_erasing: > >>>> if (ret) { > >>>> /* Abort if its not a bad block error */ > >>>> if (ret != -EIO) > >>>> -- > >>>> 2.35.1 > >>>> > >>> As I stated in a different email. Please re-post with the right sign-off > >>> > >>> Michael > >> There is an issue with Dario Binacchi patch. Please see my comments for > >> his patch. > >> > >> I just suggest a fix. I am sorry if I do it wrong way. > >> > >> Mikhail > > There are two ways I can see: > > Repost the v3 starting from Dario one and improve the commit message > > for him. You can add your signed off and tested by or > > wait Dario to resend with all the suggestion you have made > > > > We think that you rise a correct problem and you help us to > > understand. We just decided to fix on uboot level and not core level. > > > > Michael > > Is there a good way to apply Dario patch? It was sent as HTML message. > > I can fix message body and apply it, but it will be better if Dario > resend it as normal clear text. We will respin with your fix on Dario patch, your tested-by and your signed off Michael > > > Mikhail > > PS: I send patch for a second time because first time it was sent in > HTML format. > > > > >>> -- > >>> Michael Nazzareno Trimarchi > >>> Co-Founder & Chief Executive Officer > >>> M. +39 347 913 2170 > >>> michael@amarulasolutions.com > >>> __________________________________ > >>> > >>> Amarula Solutions BV > >>> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > >>> T. +31 (0)85 111 9172 > >>> info@amarulasolutions.com > >>> https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C2c68f94e89c247e2886f08dab5999790%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021968536553670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GUYTrPb1VWhNN0EfEgV15jtuZxTldBB4qBpUsl%2Bd8H0%3D&reserved=0 > > > > > > -- > > Michael Nazzareno Trimarchi > > Co-Founder & Chief Executive Officer > > M. +39 347 913 2170 > > michael@amarulasolutions.com > > __________________________________ > > > > Amarula Solutions BV > > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > T. +31 (0)85 111 9172 > > info@amarulasolutions.com > > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7C2c68f94e89c247e2886f08dab5999790%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021968536553670%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GUYTrPb1VWhNN0EfEgV15jtuZxTldBB4qBpUsl%2Bd8H0%3D&reserved=0
Hi Mikhail, On Mon, Oct 24, 2022 at 10:27 AM Michael Nazzareno Trimarchi < michael@amarulasolutions.com> wrote: > Hi > > On Mon, Oct 24, 2022 at 10:20 AM Mikhail Kshevetskiy > <mikhail.kshevetskiy@iopsys.eu> wrote: > > > > > > On 24.10.2022 10:49, Michael Nazzareno Trimarchi wrote: > > > [External email] > > > > > > > > > > > > > > > > > > Hi Mikhail > > > > > > On Mon, Oct 24, 2022 at 9:37 AM Mikhail Kshevetskiy > > > <mikhail.kshevetskiy@iopsys.eu> wrote: > > >> 'mtd erase' command should not erase bad blocks. To force bad block > erasing > > >> there is 'mtd erase.dontskipbad' command. Unfortunately nand layer > erases > > >> bad blocks unconditionally. This is wrong. > > >> > > >> Fix issue by adding bad block checks to do_mtd_erase() function in > the case > > >> srub flag is not provided. We can't simplify code by eliminating -EIO > result > > >> check of mtd_erase() as it will terminate erasing with > CMD_RET_SUCCESS. > > >> > > >> Thanks to Dario Binacchi <dario.binacchi@amarulasolutions.com> for > his patch. > > >> > > >> Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu> > > >> --- > > >> cmd/mtd.c | 17 +++++++++++++++-- > > >> 1 file changed, 15 insertions(+), 2 deletions(-) > > >> > > >> diff --git a/cmd/mtd.c b/cmd/mtd.c > > >> index ad5cc9827d..a314745e95 100644 > > >> --- a/cmd/mtd.c > > >> +++ b/cmd/mtd.c > > >> @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, > int flag, int argc, > > >> erase_op.mtd = mtd; > > >> erase_op.addr = off; > > >> erase_op.len = mtd->erasesize; > > >> - erase_op.scrub = scrub; > > >> > > >> while (len) { > > >> - ret = mtd_erase(mtd, &erase_op); > > >> + if (!scrub) { > > >> + ret = mtd_block_isbad(mtd, erase_op.addr); > > >> + if (ret < 0) { > > >> + printf("Failed to get bad block at > 0x%08llx\n", > > >> + erase_op.addr); > > >> + ret = CMD_RET_FAILURE; > > >> + goto out_put_mtd; > > >> + } else if (ret > 0) { > > >> + /* simulate bad block behavior */ > > >> + ret = -EIO; > > >> + goto skip_block_erasing; > > >> + } > > >> + } > > >> > > >> + ret = mtd_erase(mtd, &erase_op); > > >> +skip_block_erasing: > > >> if (ret) { > > >> /* Abort if its not a bad block error */ > > >> if (ret != -EIO) > > >> -- > > >> 2.35.1 > > >> > > > As I stated in a different email. Please re-post with the right > sign-off > > > > > > Michael > > > > There is an issue with Dario Binacchi patch. Please see my comments for > > his patch. > > > > I just suggest a fix. I am sorry if I do it wrong way. > > > > Mikhail > > There are two ways I can see: > Repost the v3 starting from Dario one and improve the commit message > for him. You can add your signed off and tested by And please add these tags: Suggested-by: Michael Trimarchi <michael@amarulasolutions.com> Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com> Co-developed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Thanks and regards, Dario > or > wait Dario to resend with all the suggestion you have made > > We think that you rise a correct problem and you help us to > understand. We just decided to fix on uboot level and not core level. > > Michael > > > > > > > -- > > > Michael Nazzareno Trimarchi > > > Co-Founder & Chief Executive Officer > > > M. +39 347 913 2170 > > > michael@amarulasolutions.com > > > __________________________________ > > > > > > Amarula Solutions BV > > > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > > > T. +31 (0)85 111 9172 > > > info@amarulasolutions.com > > > > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.amarulasolutions.com%2F&data=05%7C01%7Cmikhail.kshevetskiy%40iopsys.eu%7Ca0041129e25a4456725708dab594462c%7C7ff78d652de440f586750569e5c7a65d%7C0%7C0%7C638021945688614410%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HASzL7T4QF8Kea8t6Dt7hQYnHGs1poC9gRPZ6N3SPEI%3D&reserved=0 > > > > -- > Michael Nazzareno Trimarchi > Co-Founder & Chief Executive Officer > M. +39 347 913 2170 > michael@amarulasolutions.com > __________________________________ > > Amarula Solutions BV > Joop Geesinkweg 125, 1114 AB, Amsterdam, NL > T. +31 (0)85 111 9172 > info@amarulasolutions.com > www.amarulasolutions.com >
diff --git a/cmd/mtd.c b/cmd/mtd.c index ad5cc9827d..a314745e95 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -434,11 +434,24 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.mtd = mtd; erase_op.addr = off; erase_op.len = mtd->erasesize; - erase_op.scrub = scrub; while (len) { - ret = mtd_erase(mtd, &erase_op); + if (!scrub) { + ret = mtd_block_isbad(mtd, erase_op.addr); + if (ret < 0) { + printf("Failed to get bad block at 0x%08llx\n", + erase_op.addr); + ret = CMD_RET_FAILURE; + goto out_put_mtd; + } else if (ret > 0) { + /* simulate bad block behavior */ + ret = -EIO; + goto skip_block_erasing; + } + } + ret = mtd_erase(mtd, &erase_op); +skip_block_erasing: if (ret) { /* Abort if its not a bad block error */ if (ret != -EIO)