Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2906156imm; Fri, 19 Oct 2018 01:32:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV634V4N+f1eIv9yy8QtckZ+pna2tU7hh4EzhtafafhGnQJQP9E9xzT9EV9+Yu6e2Pe7dXTGc X-Received: by 2002:a62:2a15:: with SMTP id q21-v6mr17758614pfq.61.1539937979363; Fri, 19 Oct 2018 01:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539937979; cv=none; d=google.com; s=arc-20160816; b=gIEDj+5YhESDzV3P3B44svRCIceZ21vP8DnGojQjo1KpP10erbfS85Uc0zQr79TDED 3cHl/T16rhJ0eOoon+8Zgf9cX/8iE5c+qH1x42HS7nD+3cdglm9YOMFpKwVg4plngM+A j/nhX+oi7lMHMnBCZwjmMqFbmazeqz7spOQtWXo+/UQtT2DDqcTN1aV0p1s/l+3vgWTw rqXb0LJ2FozbU4QvR5ubyNWJDHfvieb5DQIsUmS5xFNfLfpivhqEEqYnHr1S/HfC1Rz2 tx0bz7jMn4Uqq2NJ8SO2Snj4I5ceVCaNmi/XRwOyO8bfkjxnUnFZgoyXAluz/Ae4dbsO 0YGg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=SHVupI2NkQwFvJeZD56v044YRkSGsGJCl5fLAweeMik=; b=KoatRuzhfuFXuv0rBwuQ1QS2tgWpzWV5B3NEN6aO4FfhI/+QPuHsR1xP76k8MoOuSZ AoLgWk+Fm77AcDox3IKZTXCyO6WWUM5Zs4L0z47HN1vJxvXcNL1/jzZs4CTydIpvvJyj tRnfBU3+IDylgWyA5LcAO+RJMeos/+BZJvPV9XxVrYjw8h54PnMOGXDM56boIlyiVVSi hpUE/m/VfIadn7u4PvvaGemGGf3ns0/xARISH8/O+BBizjapm09awK1Z1wrppBUAitLK xAT1vdGtS+SmPstAJlfSq5KwsV3vjE1aGICUN6pfeVAJNuH2t94sFv83GZhBf1s0ScOQ Y4jA== 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 a13-v6si23420583pgi.474.2018.10.19.01.32.43; Fri, 19 Oct 2018 01:32:59 -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 S1727205AbeJSQgA (ORCPT + 99 others); Fri, 19 Oct 2018 12:36:00 -0400 Received: from mail-sz2.amlogic.com ([211.162.65.114]:61982 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727118AbeJSQgA (ORCPT ); Fri, 19 Oct 2018 12:36:00 -0400 Received: from [10.28.18.51] (10.28.18.51) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 19 Oct 2018 16:30:48 +0800 Subject: Re: [PATCH v5 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Boris Brezillon 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 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> <20181019101033.0a160506@bbrezillon> From: Liang Yang Message-ID: <3e462d23-a100-6eb2-3740-abe2373a8e15@amlogic.com> Date: Fri, 19 Oct 2018 16:30:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181019101033.0a160506@bbrezillon> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.51] X-ClientProxiedBy: mail-sz2.amlogic.com (10.28.11.6) To mail-sz2.amlogic.com (10.28.11.6) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/10/19 16:10, Boris Brezillon wrote: > 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. > ok, i will fix it. > . >