Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1040643ybm; Tue, 21 May 2019 07:47:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqcZTeZhbhY4qOVGX6svO1UX2f96Hb5gE+dPbqd7Ai2C9jaDwUJ+xqzVuzBEjvYIqQJBGt X-Received: by 2002:a17:902:9f85:: with SMTP id g5mr77997755plq.29.1558450038721; Tue, 21 May 2019 07:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558450038; cv=none; d=google.com; s=arc-20160816; b=dN4FWkXeBXA7KtRPpYS/chU8vCN2Lp4OZ5KYj8L8FR7PTX2eSM4LLyY9NFlGcGGLHM liosTf1E2iYlxmFQyQc6F2X7ypdoOBzmKak1wdPt7fxLTG4xcALeikfq82bfnAxZKNYK ni713zqiW18BJDQvnQT9uoynFahdPczJBdd0jEkylzvY4P/ZhOTnnmQFxVBOxQOriDWB De4rIOSvuenVZ1B3alJKLISatuwW5Lql/IOjLHE62I4ygULP1M6+MJMEmGVYL1nCZkoB xgRHlWGeiU2IZOGW12bpxRc4EYgFH5iwyPcht/BE1HRe6L+m509+xU16VbCy9acLBpFB l+NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=+YjYseCZQLoFuFy6wB+/po9n3RrWPo0OCVJ23Hjgjzo=; b=b0C12SrSBll9rVNA63wm1hgWShHX5R87iM7xoTkxrqJWaED56TmfdVxMKPyyE0x4sU kidm832T5gl1UqYdPNM7WgE5YhwBGeC22C4EduFzCKbK+UQxDhJnlXHR3/JuBiXIquAV z3KiGiGyQANZY3nr+nm+8ONJVdMaUdnWzUWjrDENWDqnxTlvCg6bQC8DG2bOHDFHU+To ytN4f9HFMvUJxF+JKKn4REaKuSDlUmE8PYzpsiOuMpWYe3COuPBGORlLnArKu4l5lKVT jmQO6s1+xLBw/pHdyirtGkMSKx+U2YL0xFM4nLWIpDpYeKXqdc0JB8Rqnsw/yOpJbkh3 eVSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N6m0bG+u; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h4si21121368pgq.456.2019.05.21.07.47.02; Tue, 21 May 2019 07:47:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N6m0bG+u; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728677AbfEUOou (ORCPT + 99 others); Tue, 21 May 2019 10:44:50 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:33797 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728510AbfEUOot (ORCPT ); Tue, 21 May 2019 10:44:49 -0400 Received: by mail-pl1-f195.google.com with SMTP id w7so8575023plz.1 for ; Tue, 21 May 2019 07:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+YjYseCZQLoFuFy6wB+/po9n3RrWPo0OCVJ23Hjgjzo=; b=N6m0bG+uzJyuf+DqjNJb+TpKxpL8saEuXMtNVMAixVRdWPgVWnBoBFB7DwGf9okZiV WRgwu0rORwzAJV2dJpMizvWiHbdB41xYe/NhwVp9xt2c8g99kmJn200iR1u0cFu20XxB GcwSlvogROTc7LhP5sKxeE2aSz2Mm3hVynpdoo6GKB0sl2Y5Ydtdo+3pcWh8qwiFzOQe mjqp+Nxj/BS3fy90oYbWqkX+wBLUsmLLutQSjodabbSB/SyQotvIJsi64hz8AWByWo/q 9ZahZpO9zY/2dd4dkgGHoJvI1tbjbIYBxQ/LiylAu96Zy9W+6Ke8oib2Q390RvuXCjbR 2LwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+YjYseCZQLoFuFy6wB+/po9n3RrWPo0OCVJ23Hjgjzo=; b=Tfkht7nCSsAw3yvAkMLgNXt2DNw5OgLiAGuD6/k0aoYI+Wt3tKb4dhl+yZsi7UA3D1 F0WpHKkCS4yBcr+awwm5TRcdil3m1FgDI+HdW0MaV+QlzWWaint1X7hwkilcl7w8QU8n W4lxdkYtse+fgKXyWjNAcBWB3arI2i49umtLrR7dEdZbsb3GTje40EqzU0aANIK/OlAo P/O6cpOTVbqa+y3tmV7fczbezlY8uKbc6VMuj2n0X5KA5VZjLMjQ9BUmQVs7JEbxVx/7 SrRSStjW65paY3hs/LRHCtu7Va0DfGCEJiadPEd1DI3Qo0/KRe2sqC5/Czk0f83JHXmg 9+6A== X-Gm-Message-State: APjAAAW6WPLhWts4x/x/rgWWrErHIWNHOAfCHLiOc/gFKFngKhLFmW4J 6oQXjV/bzTDUmfKO4JVoMUw= X-Received: by 2002:a17:902:3103:: with SMTP id w3mr7998295plb.329.1558449888952; Tue, 21 May 2019 07:44:48 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id g17sm13227945pfb.56.2019.05.21.07.44.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 May 2019 07:44:48 -0700 (PDT) From: Kamal Dasu To: linux-mtd@lists.infradead.org Cc: bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, Kamal Dasu , Brian Norris , Miquel Raynal , Richard Weinberger , David Woodhouse , Marek Vasut , Vignesh Raghavendra Subject: [PATCH v3 2/2] mtd: nand: raw: brcmnand: fallback to detected ecc-strength, ecc-step-size Date: Tue, 21 May 2019 10:44:22 -0400 Message-Id: <1558449865-36852-2-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1558449865-36852-1-git-send-email-kdasu.kdev@gmail.com> References: <1558449865-36852-1-git-send-email-kdasu.kdev@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This change supports nand-ecc-step-size and nand-ecc-strength fields in brcmnand DT node to be optional. see: Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt If both nand-ecc-strength and nand-ecc-step-size are not specified in device tree node for NAND, raw NAND layer does detect ECC information by reading ONFI extended parameter page for parts using ONFI >= 2.1. In case of non-ONFI NAND parts there could be a nand_id table entry with ECC information. If there is valid device tree entry for nand-ecc-strength and nand-ecc-step-size fields it still shall override the detected values. Signed-off-by: Kamal Dasu --- drivers/mtd/nand/raw/brcmnand/brcmnand.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index ce0b8ff..1bdd490 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -2144,6 +2144,17 @@ static int brcmnand_setup_dev(struct brcmnand_host *host) return -EINVAL; } + if (chip->ecc.mode != NAND_ECC_NONE && + (!chip->ecc.size || !chip->ecc.strength)) { + if (chip->base.eccreq.step_size && chip->base.eccreq.strength) { + /* use detected ECC parameters */ + chip->ecc.size = chip->base.eccreq.step_size; + chip->ecc.strength = chip->base.eccreq.strength; + dev_info(ctrl->dev, "Using ECC step-size %d, strength %d\n", + chip->ecc.size, chip->ecc.strength); + } + } + switch (chip->ecc.size) { case 512: if (chip->ecc.algo == NAND_ECC_HAMMING) -- 1.9.0.138.g2de3478