Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2890371imm; Fri, 19 Oct 2018 01:12:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV62nDYLb+WJ4gSCwOm8RDrFh2gVBHyI4fgpP9SQWuiaXgD1k3t0mSIhe6N92s2vwQ23AVfFJ X-Received: by 2002:a17:902:16a4:: with SMTP id h33-v6mr32474822plh.3.1539936765572; Fri, 19 Oct 2018 01:12:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539936765; cv=none; d=google.com; s=arc-20160816; b=c1QqLWVsuhAJ8Zb7FolMAhUIoqPMBJpDEdryn116Bp2cLfs3I2arEAWM635KnlFUai HgyatfgCbP8CgN61JrFrfRcRoJ1xgSvuX395P3rI+Vi+pO7q6rFhrEkqJxD1du3kqx+H TOLNcf6Ge8twG84TjF1BwWNHqTeld0y+fNGb65lbRiJ63diSrK4UpUcqJ3IhiEu0yWhp O56zlAateGfieQcm2rJKMBfDhKruTBi+abjR0PeRKcBWoLvaMzTxwnQ90ivegQ56ltfx cppPiH+Re0I7FOerrDZBi6z/M0N9ovd2k99OxZYHCgJkUF9NuA/ZssART9oY2monGg2o b3lA== 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=A1pPTmT+0WvR8ZljHj9g0yGTQtDIpyOQauI8QKs5Tp4=; b=hVebj24jBYERDaTSnYB1JQknP0zyiZv9pbu6155LJa+Ch8AbgfxBL1B4idAv27itU1 7bdrz8Zq8nxnaxQtVO0JEMwRXhvJQ5ZgeckGdurV1ZHY88ffGBneaAhkoVvdgoB+XVP0 vVNj+VJjg96gfujF/pZf0vWQK/1ogCUEwScLT95dwx1GI4W4tcPv6OLXkSOKbhJpG4pM kaz1qcAWdQB+OG4HC13zuyerx7yF50lPLIF9nyBghgXYtCpL5VDL0JA/hf6esyN6J9Pa QcvO65iKI3Pi7UbJnPpOqF71VaRwPQTP93V74u57JIuizYYW1gCCXQEn5sxKjB14+Lh6 AuRA== 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 d185-v6si18324482pfd.260.2018.10.19.01.12.30; Fri, 19 Oct 2018 01:12:45 -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 S1727261AbeJSQPp (ORCPT + 99 others); Fri, 19 Oct 2018 12:15:45 -0400 Received: from mail.bootlin.com ([62.4.15.54]:55276 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbeJSQPp (ORCPT ); Fri, 19 Oct 2018 12:15:45 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 159BD207A3; Fri, 19 Oct 2018 10:10:44 +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, URIBL_BLOCKED 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 8AE2220618; Fri, 19 Oct 2018 10:10:33 +0200 (CEST) Date: Fri, 19 Oct 2018 10:10:33 +0200 From: Boris Brezillon To: Liang Yang Cc: Jianxin Pan , , Rob Herring , Hanjie Lin , Victor Wan , Neil Armstrong , Martin Blumenstingl , Richard Weinberger , Yixun Lan , , Marek Vasut , Jian Hu , Kevin Hilman , Carlo Caione , , Brian Norris , David Woodhouse , , Jerome Brunet Subject: Re: [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller Message-ID: <20181019101033.0a160506@bbrezillon> In-Reply-To: <09f76f17-05c4-d9e0-0167-f68e224f00c4@amlogic.com> References: <1539839345-14021-1-git-send-email-jianxin.pan@amlogic.com> <1539839345-14021-3-git-send-email-jianxin.pan@amlogic.com> <20181018213308.3f8a5279@bbrezillon> <09f76f17-05c4-d9e0-0167-f68e224f00c4@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 Fri, 19 Oct 2018 15:29:05 +0800 Liang Yang wrote: > > How about defining that the HW returns an array of __le64 instead and then > > define the following macros which you can use after converting in the > > CPU endianness > > > > #define ECC_GET_PROTECTED_OOB_BYTE(x, y) (((x) >> (8 * (1 + y)) & GENMASK(7, 0)) > > #define ECC_COMPLETE BIT(31) > > #define ECC_ERR_CNT(x) (((x) >> 24) & GENMASK(5, 0)) > > > > (I'm not entirely sure the field positions are correct, but I'll let you > > check that). > > > ok. i think it should be: > > #define ECC_GET_PROTECTED_OOB_BYTE(x, y) (((x) >> (8 * y) & > GENMASK(7, 0)) > > if x represents the u64 and y represents the index of the u64. Absolutely. > > > > >> + > >> +#define PER_INFO_BYTE (sizeof(struct meson_nfc_info_format)) > >> + > >> +struct meson_nfc_nand_chip { > >> + struct list_head node; > >> + struct nand_chip nand; > >> + bool is_scramble; > > > > I think I already mentioned the NAND_NEED_SCRAMBLING flag []. Please > > drop this field and test (chip->flags & NAND_NEED_SCRAMBLING) instead. > > > em, i use NAND_NEED_SCRAMBLING and is_scramble is set: > static int meson_nand_attach_chip(struct nand_chip *nand) > { > ...... > meson_chip->is_scramble = > (nand->options & NAND_NEED_SCRAMBLING) ? 1 : 0; > ...... > } Why do you need to add a new field then? Just test nand->options & NAND_NEED_SCRAMBLING directly or provide a helper function that does that.