Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3532990imu; Mon, 10 Dec 2018 03:54:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UFfRFcC/oamJJ4xlivgRYpWxgVhCoyZMx8eGKQiieBJ233dA2uI7LvEQialH1rFo9DuFpU X-Received: by 2002:a17:902:925:: with SMTP id 34mr11419090plm.14.1544442899546; Mon, 10 Dec 2018 03:54:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544442899; cv=none; d=google.com; s=arc-20160816; b=qRY0MZiWIzjKOzY/LMvzp1cwqQqmkFZF6XEuKX9a1u0LtPMZ7bNnr83s2Z7b/Z/IJK AqnAcvu8EKm+uOb+Si0JqkTtF04/zDwyiFidLyj2ibB9KxKdejGCNhW0uvwxoa6mo8Y9 TOjXcUCCu1VOQpD88rBMo73Ng2A6DHS+E15RIxhPUaRoOYRZOlOvg5D0shuQRlhDo6SK iUAFn8mEEMvTtpmyV59vr9HGOoliO/YkdFm9WQPWZHLpT2LqDdYMhN+5vJSvrACBckij 8+Gzteld1wg7kuRk+mwyDQvve4HIGDc2zfyNWY9TNZa4j9DP8OS8gOLe7e8QgUBsh12Q +waQ== 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=wT5PfPad5DoaqRP2HRvCTDQ3Vb/fMT6OewbOXawbZ3A=; b=D1ElP2qtn1S2sFmEF/QymuLfqj+jLJNwQ+7sv+A8zqy+wZRr4OLEi+aKp1VhzpcV2g 6pBbv+N6VTR9tGaKS3h/1t0LVjGowY5EgFR+ml4+m/vzElWnJcH9JijBCx04o/uAvXMX kjrFM2kgBUMEkZzw9R3ykdS4UUvA0OIqntut9SSUjVvYgkqu3QuYK8E16t5RTv0XcJ7g NuK3hsQxkkf2dsYqYJSk5xEB6eyG6qtPfA0xXJ7pLJwDrmhsT6kD4yOkayJTusyX7Z2h SLMc5ba+ISEa+bj/XIhb2MIFwZvJb6Eb3t/YBt25Wyx7X6vzZPxnkqaT2rT+d0AjCQLT KGRQ== 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 v75si10354830pfd.157.2018.12.10.03.54.44; Mon, 10 Dec 2018 03:54:59 -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 S1727494AbeLJLiM (ORCPT + 99 others); Mon, 10 Dec 2018 06:38:12 -0500 Received: from mail.bootlin.com ([62.4.15.54]:58213 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726146AbeLJLiM (ORCPT ); Mon, 10 Dec 2018 06:38:12 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id C1E1D2079D; Mon, 10 Dec 2018 12:38:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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.2 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 420D02037D; Mon, 10 Dec 2018 12:38:09 +0100 (CET) Date: Mon, 10 Dec 2018 12:38:09 +0100 From: Boris Brezillon To: Liang Yang 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 , , , Subject: Re: [PATCH v7 2/2] mtd: rawnand: meson: add support for Amlogic NAND flash controller Message-ID: <20181210123809.5ade45c4@bbrezillon> In-Reply-To: <823825a3-86fb-9a20-ae29-85cc52d44093@amlogic.com> 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> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; 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 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? > 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.