Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3590472imu; Mon, 10 Dec 2018 04:53:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/UPHjQ5xg7c5ZWFLYQ0PaTIcN1AJvsJ8oBkWrCoGnGXfvQQ4bEvLY1Cd3lDvF293j2eTHKX X-Received: by 2002:a65:63d3:: with SMTP id n19mr10919124pgv.179.1544446386847; Mon, 10 Dec 2018 04:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544446386; cv=none; d=google.com; s=arc-20160816; b=zxFNw3enR5PyceOCMN/th7s4vD+G7bevyFvsnsPeQcdLKlauiTQPQyeIRwDWQr0QsX PAoc0QvCrqTznq8u/+ePw/EG1YSzoOCe6znVIuvwdMDlKiwddAOY7csiA/BWCdqirFlz VfLXLJprYNtnDFO6WqCrjURJ4QyHDAvYdsUNdK1dPwY5TH9ctWfOcVyDfRPg3dHxbcil 4BcFB29CRdBCJPk0l/xV/widCYlkLdN41OCSA5pPnmkadB6tdjaH9nR64v2PhZjMuEXn ZkUD1cT5TxX7ibyvK3aWqeOZgjQGvqVV692/8v1Pl+OMowubV466hwzdw0AG0nuaWQpb VDjA== 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=kc1xee3tflrz+JxpIvX9GndFkpiOkk7GKT+YQTXDKaQ=; b=DuG5uqhJj+KOd5EZ81DSw1Lt8tZugaj86+GVRsRC4oAKM4UOdtiH08Bakg7GN1veqI V3fq4FR0Q1SXxjIlMrpT1FA0XtJTA0mqvI7I8StSIzTD33shjjzw+U1iJtwm7/IROHLm UMUxi4tP+4d/M3VrcV6jAFctjjyqT4Xii+BLvsi9l52xBxZTJk+YeETo0FCJEQoB6mB8 JlyBt9Lkr76hFyOPknFf9Tg8wNBv5pufEuTD1aNb3nUQOTWLlqWmNDoJuxUK5wCe8cbQ c6gZRJWopxlAvnfaeGWxQbRr0DHp91VAxXi/piDsMgWp1wCRt1CKyHTDPluRAK8QW5se HLcw== 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 69si9666564pla.75.2018.12.10.04.52.51; Mon, 10 Dec 2018 04:53:06 -0800 (PST) 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 S1727495AbeLJMMV (ORCPT + 99 others); Mon, 10 Dec 2018 07:12:21 -0500 Received: from mail-sz2.amlogic.com ([211.162.65.114]:40892 "EHLO mail-sz2.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727172AbeLJMMV (ORCPT ); Mon, 10 Dec 2018 07:12:21 -0500 Received: from [10.28.18.115] (10.28.18.115) by mail-sz2.amlogic.com (10.28.11.6) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 10 Dec 2018 20:12:39 +0800 Subject: Re: [PATCH v7 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller To: Boris Brezillon CC: Miquel Raynal , Jianxin Pan , , 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 , , , References: <1542386439-30166-1-git-send-email-jianxin.pan@amlogic.com> <1542386439-30166-3-git-send-email-jianxin.pan@amlogic.com> <20181207102456.1dc67e07@xps13> <823825a3-86fb-9a20-ae29-85cc52d44093@amlogic.com> <20181210123809.5ade45c4@bbrezillon> From: Liang Yang Message-ID: <79a797c2-f37f-7f7c-e907-2d3c2283ec2d@amlogic.com> Date: Mon, 10 Dec 2018 20:12:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181210123809.5ade45c4@bbrezillon> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.28.18.115] 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/12/10 19:38, Boris Brezillon wrote: > On Mon, 10 Dec 2018 19:23:46 +0800 > Liang Yang wrote: > >>>> + mtd->ecc_stats.failed++; >>>> + continue; >>>> + } >>>> + mtd->ecc_stats.corrected += ECC_ERR_CNT(*info); >>>> + bitflips = max_t(u32, bitflips, ECC_ERR_CNT(*info)); >>>> + } >>> >>> Are you sure you handle correctly empty pages with bf? >>> >> if scramble is enable, i would say yes here. >> when scramble is disabled, i am considering how to use the helper >> nand_check_erased_ecc_chunk, but it seems that i can't get the ecc >> bytes which is caculated by ecc engine.by the way, nfc dma doesn't send >> out the ecc parity bytes. > > Even if the ECC engine is disabled? > No. When ECC engine is disabled, it can read the ecc parity bytes ; but there is another problem that i need to consider how code struct looks better when reading error with ecc opened and then try to raw read. Is there a good idea? >> so i would suggest using scramble. >> > > No, please don't force people to use the scrambler. > >>>> + >>>> +const void * >>>> +meson_nand_op_get_dma_safe_output_buf(const struct nand_op_instr *instr) >>>> +{ >>>> + if (WARN_ON(instr->type != NAND_OP_DATA_OUT_INSTR)) >>>> + return NULL; >>>> + >>>> + if (virt_addr_valid(instr->ctx.data.buf.out) && >>>> + !object_is_on_stack(instr->ctx.data.buf.out)) >>> >>> Can you please create helpers for that? I guess it will help removing >>> these checks once the core will have a DMA-safe approach. >>> >> I will use below definition: >> #define BUFFER_IS_DMA_SAFE(x) \ >> (virt_addr_valid((x)) && (!object_is_on_stack((x)))) >> >> Is it ok? > > Please define a function, not a macro. > ok > . >