Received: by 10.192.165.156 with SMTP id m28csp1758204imm; Thu, 12 Apr 2018 03:03:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Zh+YN4Hwvk3qtBsckLAm3P2gYs7fd5CziTcfmYyQT7m66qlP4pdxxezZtMG9WrZmMVDVW X-Received: by 10.98.35.202 with SMTP id q71mr7133866pfj.9.1523527418828; Thu, 12 Apr 2018 03:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523527418; cv=none; d=google.com; s=arc-20160816; b=p3a6vaNijOrvpcp6lZ9sncO+IJi0dP67HK4Lh/spaPLUU+wCh/1SrIAfhRxHiNDpy9 s8SxFOpyyszGLl2ubCMprylB36pVGOifoEMcJIQ6z3kyi/J8yAeJyScX3vdhK5sc7VRw TDr4vuxer6Xh+NBub7B+/AdY9XIWV8tMmA73WgvEMK1+Pi5saG08HbNo3/0uLMfjdwxv gGDeV8ecTZDoCqpidOvh2ZucnEJjguu42i1ohx56tJcVqUJAx73uCGkPCTGr0LWzdEZr 0zdjmHWBERZfLm8vSy/idTL6C8ZNzgRik3ag6xOIVHXWiDcjYcYGkkQ5oi5DAad8PxeT MoqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=l8/0HiXUOG2/FhopimPF1kzPPR16X508/cejNJVwZTU=; b=COIJDMftdo1mK6mozoLjHNZ/Iy6hh+ZfLG+vjLfwatscyJKl6Jx6i/XadDxMtrcWLQ kCNBnKDAOfWklFmXJnu5ZykZi+zf3K9bfvnW8YpAc36cti+QT+bC3O7OMcjVon99Aibm ukaxhEZXFCIIycopXvnYPpKLuhjdiekw62qXBY1a6JxE5NTy2RYsF9JoXNBGVFTFe33E TSv5GBBBUo5Rzr+w7UvG3QUCj7V8J2vm2SlHWxchfrb2dXq2LcslQ5YhRsif9zcED4/m 8zCb62ImJtvVUYO7kt4B5s0xD1ql5lzbDN703h7kJyO6P4EE0wyGTJI9ESzClzrBtBzM dKEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Js7ncpiT; dkim=pass header.i=@codeaurora.org header.s=default header.b=TsgXTtX0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k63si1982290pgc.290.2018.04.12.03.03.01; Thu, 12 Apr 2018 03:03:38 -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=@codeaurora.org header.s=default header.b=Js7ncpiT; dkim=pass header.i=@codeaurora.org header.s=default header.b=TsgXTtX0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752437AbeDLJ7w (ORCPT + 99 others); Thu, 12 Apr 2018 05:59:52 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:55322 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751848AbeDLJ7u (ORCPT ); Thu, 12 Apr 2018 05:59:50 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 2B76660F8F; Thu, 12 Apr 2018 09:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523527190; bh=avzRo2hDry/PyPyJOoW9Hx9mC2Bq/QdkmYpzah/GYHA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Js7ncpiTVB1A4Fm6gwkUTeqWkrPfP4m8B7rkoOuWc7YJgzpWNkwrFjTUCstAWar8C x2IijsElASntr/eXRn91A5l37sV8qPP5eUdur0dDJbFIANbfCm9DyMzxYCn5Vtiu0O YOcT81U6ZiK6xsP88W8kvYlWU0FSzVmNPjTBYdo8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 852556030D; Thu, 12 Apr 2018 09:59:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523527188; bh=avzRo2hDry/PyPyJOoW9Hx9mC2Bq/QdkmYpzah/GYHA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=TsgXTtX0uubHAMNJ6QmB4XacqEjvoeON/d4yfCHkHHHD5OxyLwOd+bgqPCyo+/ELW HHVBq3suBOeyaGM/CJ97vM+Q09PrC3BoaXYyO/uviDDIiJhwlWyIclM25Jt6ESZ1dr 8nrisoK/uTpa0YWRQAc2EmZgF5jZiTS9LEy2E9nE= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 12 Apr 2018 15:29:48 +0530 From: Abhishek Sahu To: Boris Brezillon Cc: Miquel Raynal , Boris Brezillon , Archit Taneja , Richard Weinberger , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Marek Vasut , linux-mtd@lists.infradead.org, Cyrille Pitchen , Andy Gross , Brian Norris , David Woodhouse Subject: Re: [PATCH 1/9] mtd: nand: qcom: use the ecc strength from device parameter In-Reply-To: <20180410100745.625d66f8@bbrezillon> References: <1522845745-6624-1-git-send-email-absahu@codeaurora.org> <1522845745-6624-2-git-send-email-absahu@codeaurora.org> <20180406143133.67f33d33@xps13> <23c8330d00d4d9b62c4c1ab597cbb22b@codeaurora.org> <20180410094657.63ac7ec9@xps13> <20180410095558.34c4d91f@xps13> <20180410100745.625d66f8@bbrezillon> Message-ID: X-Sender: absahu@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-10 13:37, Boris Brezillon wrote: > On Tue, 10 Apr 2018 09:55:58 +0200 > Miquel Raynal wrote: > >> > Hi Abhishek, >> > >> > On Tue, 10 Apr 2018 11:39:35 +0530, Abhishek Sahu >> > wrote: >> > >> > > On 2018-04-06 18:01, Miquel Raynal wrote: >> > > > Hi Abhishek, >> > > > >> > > > On Wed, 4 Apr 2018 18:12:17 +0530, Abhishek Sahu >> > > > wrote: >> > > > >> > > >> Currently the driver uses the ECC strength specified in >> > > >> device tree. The ONFI or JEDEC device parameter page >> > > >> contains the ‘ECC correctability’ field which indicates the >> > > >> number of bits that the host should be able to correct per >> > > >> 512 bytes of data. >> > > > >> > > > This is misleading. This field is not about the controller but rather >> > > > the chip requirements in terms of minimal strength for nominal use. >> > > > >> > > >> > > Thanks Miquel. >> > > >> > > Yes. Its NAND chip requirement. I have used the description for >> > > NAND ONFI param page >> > > >> > > 5.6.1.24. Byte 112: Number of bits ECC correctability >> > > This field indicates the number of bits that the host should be >> > > able to correct per 512 bytes of data. >> > > >> > > >> The ecc correctability is assigned in >> > > >> chip parameter during device probe time. QPIC/EBI2 NAND >> > > >> supports 4/8-bit ecc correction. The Same kind of board >> > > >> can have different NAND parts so use the ecc strength >> > > >> from device parameter (if its non zero) instead of >> > > >> device tree. >> > > > >> > > > That is not what you do. >> > > > >> > > > What you do is forcing the strength to be 8-bit per ECC chunk if the >> > > > NAND chip requires at least 8-bit/chunk strength. >> > > > >> > > > The DT property is here to force a strength. Otherwise, Linux will >> > > > propose to the NAND controller to use the minimum strength required by >> > > > the chip (from either the ONFI/JEDEC parameter page or from a static >> > > > table). >> > > > >> > > >> > > The main problem is that the same kind of boards can have different >> > > NAND parts. >> > > >> > > Lets assume, we have following 2 cases. >> > > >> > > 1. Non ONFI/JEDEC device for which chip->ecc_strength_ds >> > > will be zero. In this case, the ecc->strength from DT >> > > will be used >> > >> > No, the strength from DT will always be used if the property is >> > present, no matter the type of chip. >> > >> > > 2. ONFI/JEDEC device for which chip->ecc_strength_ds > 8. >> > > Since QCOM nand controller can not support >> > > ECC correction greater than 8 bits so we can use 8 bit ECC >> > > itself instead of failing NAND boot completely. >> > >> > I understand that. But this is still not what you do. >> > >> > > >> > > > IMHO, you have two solutions: >> > > > 1/ Remove these properties from the board DT (breaks DT backward >> > > > compatibility though); >> > > >> > > - nand-ecc-strength: This is optional property in nand.txt and >> > > Required property in qcom_nandc.txt. >> > >> > Well, this property is not controller specific but chip specific. The >> > controller driver does not rely on it, so this property should not be >> > required. >> > >> > > We can't remove since >> > > if the device is Non ONFI/JEDEC, then ecc strength will come >> > > from DT only. >> > >> > We can remove it and let the core handle this (as this is generic to >> > all raw NANDs and not specific to this controller driver). Try it out! Thanks Boris and Miquel for your inputs. Just want to confirm if already its implemented in core layer or shall I explore regrading this option. I checked by removing this property alone from dtsi and it was failing with "Driver must set ecc.strength when using hardware ECC" I checked the code in nand_base.c also but couldn't get anything related with this. Thanks, Abhishek >> > >> > However if the defaults value do not match your expectations, I think >> > you can add your non-ONFI/JEDEC chip in 'nand_ids.c', this should fill >> > your strength_ds field and let you avoid using these properties. >> >> Actually nand_ids.c should not be filled anymore, instead you can >> implement this detection thanks to the part full name in the vendor >> code nand_samsung.c, nand_micron.c, nand_macronix.c, nand_hynix.c, >> etc. > > Usually you don't have to go that far, and the ECC requirements are > encoded somewhere in the ID (after byte 2). When that's not the > case, you may have to check the full ID. > >> Depending on what part you are using, it might already work. > > Yep.