Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2375230imm; Thu, 18 Oct 2018 13:36:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV629grWi81Or4Hy9EnnpqbKWQV6J9O3HcEI7ts11q2RWDm1qSvvBO6QV3TQftNaHegL6X+t5 X-Received: by 2002:a62:4799:: with SMTP id p25-v6mr31811936pfi.197.1539894966901; Thu, 18 Oct 2018 13:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539894966; cv=none; d=google.com; s=arc-20160816; b=cLNfpDkpPkIE4PlteD8HCWon+9LN4y8GMdwlpj5bSBzE456q3eoktJS0nuVt12zfy0 R7GJG/KBSosTn0Ey0T9XTUM4V5FzJY/wha1YqBzMVYRti8AR/I+NbMrRFTTY0gQD63gB qRtv8IoTXZS8P6cJzyNTIoNDbANKp3jnByYMfgAxE2iH09R1vi1xLAwAA5kY5nNw0Dr5 scwWqJ6nYrjSpxdjnHr2FHy0NfshMCFTO7Bv9a2WZQsD2l31k6GywhmD8SmSnqCdtAjp EbDkkZvTdlWooVV5npVV68Ovjc8Qjx83LoWCm5h8stQxHj0pHOxw+Ht1AinRwMFd3COy VwaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=FXGcDPrc08ODo0b6jnltChq7N7tmEdoTjbms6o11+Cg=; b=cZ4Ge9jTn0wY3r1ZYTYLJQbuJMThpGecZZhPlcNTHXeGUpFLMM976CfU/0YIQJDlxC iNP3y6kRhiNyheiBxubSJXU7vI06lW59giwJFysFE1B44T2i4BMCJkmerQKMo95mLg/2 vcfMyLB7lRE6+81q471eodCH/jYAbhUG/teD2YqPJdLEf4gK8jM+3CTzm6sJnl/GcP5u mPlI5R2knCIMsHLa2kEGzKrlQVvg9fQdPCS5T7E64n6y7yRuei0lxNQSbDtvMhNbD2zT FMkxNAMhCXhRWiu9ocdDgbBIu/1Yo+YIUbAfFZOEorEzMQ6nV2u+GGf09ztVkCDKW24R l6Zw== ARC-Authentication-Results: i=1; mx.google.com; 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 r17-v6si1948269pgh.56.2018.10.18.13.35.51; Thu, 18 Oct 2018 13:36:06 -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; 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 S1727308AbeJSEhM (ORCPT + 99 others); Fri, 19 Oct 2018 00:37:12 -0400 Received: from mail.bootlin.com ([62.4.15.54]:46366 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725738AbeJSEhM (ORCPT ); Fri, 19 Oct 2018 00:37:12 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id D0ACD207C4; Thu, 18 Oct 2018 22:34:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 58C202072C; Thu, 18 Oct 2018 22:34:27 +0200 (CEST) Date: Thu, 18 Oct 2018 22:34:26 +0200 From: Boris Brezillon To: Jianxin Pan Cc: , Liang Yang , Yixun Lan , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Jerome Brunet , Neil Armstrong , Martin Blumenstingl , Carlo Caione , Kevin Hilman , Rob Herring , Jian Hu , Hanjie Lin , Victor Wan , , , Subject: Re: [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller Message-ID: <20181018223426.5bfa23a1@bbrezillon> In-Reply-To: <1539839345-14021-3-git-send-email-jianxin.pan@amlogic.com> References: <1539839345-14021-1-git-send-email-jianxin.pan@amlogic.com> <1539839345-14021-3-git-send-email-jianxin.pan@amlogic.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 18 Oct 2018 13:09:05 +0800 Jianxin Pan wrote: > +static int meson_nand_bch_mode(struct nand_chip *nand) > +{ > + struct meson_nfc_nand_chip *meson_chip = to_meson_nand(nand); > + struct meson_nand_ecc meson_ecc[] = { > + MESON_ECC_DATA(NFC_ECC_BCH8_1K, 8), > + MESON_ECC_DATA(NFC_ECC_BCH24_1K, 24), > + MESON_ECC_DATA(NFC_ECC_BCH30_1K, 30), > + MESON_ECC_DATA(NFC_ECC_BCH40_1K, 40), > + MESON_ECC_DATA(NFC_ECC_BCH50_1K, 50), > + MESON_ECC_DATA(NFC_ECC_BCH60_1K, 60), > + }; > + int i, ret = 0; > + > + if (nand->ecc.strength > 60 || nand->ecc.strength < 8) > + return -EINVAL; > + > + for (i = 0; i < sizeof(meson_ecc); i++) { > + if (meson_ecc[i].strength == nand->ecc.strength) { > + meson_chip->bch_mode = meson_ecc[i].bch; > + break; return 0; > + } > + } > + > + return ret; return -EINVAL; > +}