Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp74010ybm; Mon, 20 May 2019 12:08:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzS1SwkEbiFPbWSrgP5qk4+UbnchgU2YCQ3GkoAXu7MXVRaGJBGLCZIwmKDTNOwxHetrDt4 X-Received: by 2002:a17:902:8a91:: with SMTP id p17mr13330686plo.60.1558379285680; Mon, 20 May 2019 12:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558379285; cv=none; d=google.com; s=arc-20160816; b=TxszVmS5P+s9+XoFe23x++VOjtli8Pt4A6vHTjheooK1jDUzP9LoYgqF+ntx7tKGmS BV/5vasPT4rJUkkYxzEB8RAA/B+p9ejDKR7W3mHRG3WcBfkHrYkfFZbZ9HvtOICHPaps Wcr6MRzdtFqT0Spb1MyJ3EFbBOqUYzMfyvASQXaad/sm+dOU1XcNnLaGCyzMj8LwSqaq e8k5TvcUT40emnRimAn1/YVkSGvs7ZzoPl5R6iVj6JYGInhG/u0XYn9yG3SAh6SgHVAd 0EuU40m1KTro8hJ3E03B1qHMEZPiOG0oi27Hw9n2xp4clZO3UHyjBERo055eTIgfJ99W 83aA== 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=Ha5skDnnLVo1GJdX/CM9NCe/isDa5RVzOLC2hACwN2I=; b=u9r7hLB/xwAIFjekVVW/DnNf2jB7O29c58jHLcHjcsjN1yGwH70Qk5j9ZXvC9PNwpz xMX+xMc41Z0dqREJtUb784yVpQc7sXL7LUhI8TZ4KPOJqSEIVPDOm/n5Ff5n2w7Gsras HNFrVgivWclGVUjm4w6Rd3cO66h3vzCaG/qBggFRhvxBw/TMmyxcoryfd6PxMXs1TKFF fpMBAkUTC/eioTjYkyuwV/iZAldEHxgO06qicSFHH3zd1cw5Ix8cK+wvqWfOto1kqshy m+iVZEAh6teXSSpjxg5Jxton9Sp0uqqmpzIvAHqqqEonz0dQp5mmB4LnWKtP12WsA/6k JonQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=axsFtOim; 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 v38si18194003plg.3.2019.05.20.12.07.50; Mon, 20 May 2019 12:08:05 -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=axsFtOim; 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 S1726491AbfETTGN (ORCPT + 99 others); Mon, 20 May 2019 15:06:13 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:42897 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725536AbfETTGM (ORCPT ); Mon, 20 May 2019 15:06:12 -0400 Received: by mail-ed1-f66.google.com with SMTP id l25so25387047eda.9 for ; Mon, 20 May 2019 12:06:11 -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=Ha5skDnnLVo1GJdX/CM9NCe/isDa5RVzOLC2hACwN2I=; b=axsFtOim/WJJUWbZJz8/i03Ph3xHSdnz2DNiFe2Q6ydh5h1ov4vVORzsbiXKu4xf3q T8qv/PEpxWr/0XCWg+dWz8Fbaqo589CjX1+CVNrsRQPm6vq6/RXK4BqJzc9BhtvujQrZ demB+VLNkgwH1e0xE3eug2/mCTuZFgVuDohU1BXXR1t0EH3Y4i/vbvv0uxYEIFLqOCEC TPGQYB4l2GEP/AQW0Gok9TgGpg3Cw1wI6/Ut7kpZeQzBoL8bJ232hzUu8gdtfCfJfWHN EjgU7pK/15Z32ja3bM/p+QKiSiu6Yy0oYnjSC4CtNuX0geMW+vdVUWmEhToZq0HwBiug 6bBA== 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=Ha5skDnnLVo1GJdX/CM9NCe/isDa5RVzOLC2hACwN2I=; b=nTnIKglAJFzLXqj0WnioMvvjbXPAkt4BsG0OAM+TB5PiYXAyHF/7WBgPQvNBpmWPkZ fHYTsULzfamu0IOZb+FYux3Nety1c/XwPnIWlFpIr09jocJwsTm1ot43wrUyKXLEVkZT OILw7mQNRN9vcrRixnQuMyDLAMVZtSvmU4dN1GasaL9jvwEJQSEpGysE1mkRiRdj8yp/ TmGblMm9ab454glE3XnvHI5WG6Qr45BCa8NcSlxwkeHOwFpXctnPwpEdLRZRrmljtxeQ TH6WsIBLmJKSLNTnvplMwSg2Ze8gl/T6VCY1y/8hE0JSO4ttOyh7yfQc2TpKxVMRNHSD DH1w== X-Gm-Message-State: APjAAAWKhwD0lwBd6h+27X6TG0qCb3kPbqFUJlE+ynoZf2C2uJYZ+rBq bbfYe4ErcLRx83kz85TROTA= X-Received: by 2002:a17:906:1303:: with SMTP id w3mr8731735ejb.196.1558379171104; Mon, 20 May 2019 12:06:11 -0700 (PDT) Received: from mail.broadcom.com ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id 11sm3201967ejv.64.2019.05.20.12.06.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 12:06:10 -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 v2 2/2] mtd: nand: raw: brcmnand: fallback to detected ecc-strength, ecc-step-size Date: Mon, 20 May 2019 15:05:12 -0400 Message-Id: <1558379144-28283-2-git-send-email-kdasu.kdev@gmail.com> X-Mailer: git-send-email 1.9.0.138.g2de3478 In-Reply-To: <1558379144-28283-1-git-send-email-kdasu.kdev@gmail.com> References: <1558379144-28283-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..a4d2057 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; + pr_info("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