Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2220990iof; Tue, 7 Jun 2022 23:38:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6Ms9GQQApJsUAnhK+F9fraFDKrLCmW0rfx64aQM0BcFVLvQUX6k94YMBIbJ1a52Z2gZ8/ X-Received: by 2002:a17:90b:4d05:b0:1e2:bf91:8af2 with SMTP id mw5-20020a17090b4d0500b001e2bf918af2mr35723456pjb.210.1654670280516; Tue, 07 Jun 2022 23:38:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654670280; cv=none; d=google.com; s=arc-20160816; b=tuWVoXZHtrFiaT+r8S57U5G89M8C1KGPI12+2qzIt4JOhyjgbWjqNMGhJfLQrjfAnU h3AaCeDRSGkU2MD43atvPY5QjFO4fdKfysuxbYZ5GkqcOBHs2i1apPC/esedUgImRHdp kPvOLK2HzcE/5bmMhVVbmsB+2YeOrNPF7ByisQL8KMC7P+fWbUwly03OB/+T8v8Ob0Rw LRjjtjIUlwAO2gYzMuKWaZYlXqO13LQ8B5dLyll/w4sgyl9E/ATnbjjfppkLR7nOf09p MsIDjSyeUQFs4zLPkq0sufa+nfXeCoDsxgoCvzJX23iKu8akbgPtXFlIr84+/nk1Qc8o 9nyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6ar1MDgtA0wB8Ds/6E+9yGeeWGB8hd9IIOZtnBP3qtQ=; b=F/L9JvIz415xBAMFN4dCxXoYF+8dEA9Ju/BIPIzRLECaSBp2YWSAyRymed9U6sdk8o yeRF+A+H7B/3aSbfPX7EIyJAqYjJY2b9F9POwbBdE3kgVel08Ke3YCWyW4/qo4uIAnbp akH9VSW56qhGRclwcx0f+oKKY2o5nK4/QI1Qf3zx+/TjNKysfa6pEGS1/oGZ3mx/MlkB O90Nbk7v1iYFw1z8lP5mabBqbvyY66GuPHkTD4Rgq/ZDIpt1Bnl0nX2vLvriQbJgt799 1afSFk2hGaz1CRNAluj9Wq8c6LVdtQnWnxglTWnkA5oDxGjQ8eUFG7JqFghgRdbDh6Za koPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IM1XkXyq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g6-20020a636b06000000b003fd8db87697si12588220pgc.441.2022.06.07.23.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:38:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IM1XkXyq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C253111803A; Tue, 7 Jun 2022 23:00:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1446484AbiFHCZN (ORCPT + 99 others); Tue, 7 Jun 2022 22:25:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445059AbiFHCLu (ORCPT ); Tue, 7 Jun 2022 22:11:50 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63608B58; Tue, 7 Jun 2022 17:11:33 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id m20so38216959ejj.10; Tue, 07 Jun 2022 17:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6ar1MDgtA0wB8Ds/6E+9yGeeWGB8hd9IIOZtnBP3qtQ=; b=IM1XkXyqw7gnD/Ee2HrDRknwqvnksbwocKVipuKtHHy7V9A7QvPfIZ0SdUBxhAsjiA 2BXgxrF+ABiZacrrEk7rf5Jmn6J56FT0/j2EH3nvI+LTdS5KOCGUAz+t5KinebT+0bBz wjF2JVvw1/fEjKL9G1z7s58dQZzhGIBq7uKK6v8uic/rNEmvW+vLPK6QfjJaxjLPhNh/ 7XSQzjJFcXkUepwkB0wQ0LJITyMSYPE8yNV6S2LPIK6U1Xs37gkKQe/mJfbL3vx5tafE LLoCPYhAw2FuN9cXol7v380sGD2OdKGqAE78H7J5dSxF6i0HzseJC77uHcDnuw/QkHv/ TnTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6ar1MDgtA0wB8Ds/6E+9yGeeWGB8hd9IIOZtnBP3qtQ=; b=Bj1ztGO2xLarav4m7mCsHXuAvrxZ0NkN4WEbu1sckPZfkG2VW3mmk1E4z/LmugDeNG lgvc0jaKkWFCvvpQzKETkP9UGAr+MbPsMRqAFp0cxbb97mEja2ktM5oDVzN813E86+7a rZFMHBh4Ud+Jx6vGmjuGRzdErnvDkvAWpksXotqSTL1ge6TiDRoGvVmE8xyWPwxYj2Uz 7mp0ZFeEVk6+vYIpxcwR8oPaYRq8TDtvT57W7DWj7x3I2HG9PJxfOmwilWA6z4OcA0gr r0yZJxwNOL1ghTpfeOa77ZSMJbPJSWHlDM3cmjGTlqOhnMcNK4URVAAYjApX5Bzo0kxH 0k5A== X-Gm-Message-State: AOAM53021JadDckoCBZbDtlPO/zadqLG8N6YmqOJNehwbQLKbpoerD6a SJ9eyncyFuNBoCdoOyAClEI= X-Received: by 2002:a17:906:449:b0:711:c975:cfb8 with SMTP id e9-20020a170906044900b00711c975cfb8mr14330370eja.58.1654647091688; Tue, 07 Jun 2022 17:11:31 -0700 (PDT) Received: from localhost.localdomain (93-42-70-190.ip85.fastwebnet.it. [93.42.70.190]) by smtp.googlemail.com with ESMTPSA id o19-20020a1709061b1300b006fed85c1a8fsm8434947ejg.202.2022.06.07.17.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 17:11:31 -0700 (PDT) From: Ansuel Smith To: Manivannan Sadhasivam , Andy Gross , Bjorn Andersson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Rob Herring , Krzysztof Kozlowski , linux-mtd@lists.infradead.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ansuel Smith Subject: [PATCH v5 0/3] Add support for unprotected spare data page Date: Wed, 8 Jun 2022 02:10:27 +0200 Message-Id: <20220608001030.18813-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some background about this. On original qsdk ipq8064 based firmware there was a big separation from boot partition and user partition. With boot partition we refer to partition used to init the router (bootloader, spm firmware and other internal stuff) With user partition we refer to linux partition and data partition not used to init the router. When someone had to write to these boot partition a special mode was needed, to switch the nand driver to this special configuration. Upstream version of the nandc driver totally dropped this and the result is that if someone try to read data from these partition a CRC warning is printed and if someone try to write that (if for example someone wants to replace the bootloader) result is a broken system as the data is badly written. This series comes to fix this. A user can declare offset and size of these special partition using the qcom,boot-pages binding. An initial implementation of this assumed that the boot-pages started from the start of the nand but we discover that some device have backup of these special partition and we can have situation where we have this partition scheme - APPSBL (require special mode) - APPSBLENV (doesn't require special mode) - ART - APPSBLBK (back of APPSBL require special mode) - APPSBLENVBK (back of APPSBLENV doesn't require special mode) With this configuration we need to declare sparse boot page and we can't assume boot-pages always starts from the start of the nand. A user can use this form to declare sparse boot pages qcom,boot-pages = <0x0 0x0c80000 0x0c80000 0x0500000>; The driver internally will parse this array, convert it to nand pages and check internally on every read/write if this special configuration should used for that page or the normal one. The reason for all of this is that qcom FOR SOME REASON, disable ECC for spare data only for these boot partition and we need to reflect this special configuration to mute these warning and to permit actually writing to these pages. v5: - Rename boot-pages to boot-partitions - Add additional check to parsing function - Rename unprotect_spare_data to codeword_fixup - Add additional info from Manivannan - Add patch to remove holes in qcom_nand_host struct v4: - Fix wrong compatible set for boot-pages (ipq8074 instead of ipq806x) v3: - Fix typo in Docmunetation commit desription - Add items description for uint32-matrix v2: - Add fixes from Krzysztof in Documentation Ansuel Smith (3): mtd: nand: raw: qcom_nandc: add support for unprotected spare data pages dt-bindings: mtd: qcom_nandc: document qcom,boot-partitions binding mtd: nand: raw: qcom_nandc: reorder qcom_nand_host struct .../devicetree/bindings/mtd/qcom,nandc.yaml | 26 +++ drivers/mtd/nand/raw/qcom_nandc.c | 179 +++++++++++++++++- 2 files changed, 198 insertions(+), 7 deletions(-) -- 2.36.1