Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3031714ybd; Fri, 28 Jun 2019 01:33:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJwxaRDwQKYqPrVDSEuwXTkKdh+KN1jmf97daQN5A92465R7W+UfxSoAwLWVAF/5rBIH77 X-Received: by 2002:a63:6a49:: with SMTP id f70mr7947961pgc.55.1561710783781; Fri, 28 Jun 2019 01:33:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561710783; cv=none; d=google.com; s=arc-20160816; b=aMNvgZOFaacG77P/U7X1kFzzuXkOUjaYe5gM34ZjnLHyTv5W9FiWvMtIV+Hed067wE mOBBbWl7j0oYE2Xl1grspqAdw+02lbJmevlFeO1FeIUtV9F+spIj8Bq6J2rvKZSU+i5w EINZHP4xudSME22G04pXAPFbURHJlwTRFuy2vUra7RbKuaJOMTmFwZKj/b4LCJxETTXj ZxAyX+uUL/P1SBRnZBWE6Vt/n1IIYFZSu3Ajz5BKonpGkZtUJbJ/lfhRO7YZMhTFb1HO n/5orQ06gXATAOU9lkOykCqk2lwz29q/2mU72LAXxSuuYTena+ir7wCtY9yhypt15fhf 59VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:from:message-id:mime-version:subject :cc:to:references:in-reply-to; bh=v28nU5ffNwpcEOPdCAAbQ2s+2fqgDDOSbpV3Tomx1fU=; b=V9g/Z7gsIPxE2JLPIIBwIDbXNzgFLLmaAxssV+yb3Y15Hm6xRwcppC4ZP5l3Wts6Uk vzPpNUpC4hAaZUCiTAI5D+7j+3dKFeuEnv6eFct3PmVtFr5PRBUraBlvd4Gt/3oSgGzJ L32u8lIAgJDNSRceRsH2pjfF1Xmy3ZrEEZy3gNvaRdKwO0H31MlBg9s2C5Lz61T+x/tk fPq2M2o5YWHMPPkPhcKPbVqnT9x0hPC47lb555kPjrZgBT8IbHPLOnxPpDYKZkRB6bRL slXkLDNGQGCPaVPcv/lt2aKJTCWMjd70ciKKoHtj34UUZIduoXB+84pHUcJLvhvI6pDt Pyig== 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 j14si1811283pfe.183.2019.06.28.01.32.47; Fri, 28 Jun 2019 01:33:03 -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 S1726673AbfF1Ici (ORCPT + 99 others); Fri, 28 Jun 2019 04:32:38 -0400 Received: from twhmllg4.macronix.com ([211.75.127.132]:51313 "EHLO TWHMLLG4.macronix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfF1Ici (ORCPT ); Fri, 28 Jun 2019 04:32:38 -0400 Received: from twhfmnt1.mxic.com.tw (twhfm1p2.macronix.com [172.17.20.92]) by TWHMLLG4.macronix.com with ESMTP id x5S8VFLX077566; Fri, 28 Jun 2019 16:31:15 +0800 (GMT-8) (envelope-from masonccyang@mxic.com.tw) Received: from MXML06C.mxic.com.tw (mxml06c.macronix.com [172.17.14.55]) by Forcepoint Email with ESMTP id AE28135DC1DE6750D845; Fri, 28 Jun 2019 16:31:15 +0800 (CST) In-Reply-To: <20190628091836.3148d450@xps13> References: <1561443056-13766-1-git-send-email-masonccyang@mxic.com.tw> <1561443056-13766-2-git-send-email-masonccyang@mxic.com.tw> <20190627193635.29abff43@xps13> <20190628091836.3148d450@xps13> To: "Miquel Raynal" Cc: anders.roxell@linaro.org, bbrezillon@kernel.org, broonie@kernel.org, christophe.kerello@st.com, computersforpeace@gmail.com, devicetree@vger.kernel.org, dwmw2@infradead.org, jianxin.pan@amlogic.com, juliensu@mxic.com.tw, lee.jones@linaro.org, liang.yang@amlogic.com, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, marek.vasut@gmail.com, paul@crapouillou.net, paul.burton@mips.com, richard@nod.at, stefan@agner.ch, vigneshr@ti.com Subject: Re: [PATCH v4 1/2] mtd: rawnand: Add Macronix Raw NAND controller MIME-Version: 1.0 X-KeepSent: 2EDB7089:FAD92F61-48258427:002D122A; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.5.3FP4 SHF90 June 10, 2013 Message-ID: From: masonccyang@mxic.com.tw Date: Fri, 28 Jun 2019 16:31:16 +0800 X-MIMETrack: Serialize by Router on MXML06C/TAIWAN/MXIC(Release 9.0.1FP10 HF265|July 25, 2018) at 2019/06/28 PM 04:31:15, Serialize complete at 2019/06/28 PM 04:31:15 Content-Type: text/plain; charset="US-ASCII" X-MAIL: TWHMLLG4.macronix.com x5S8VFLX077566 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miquel, > > > > > > Add a driver for Macronix raw NAND controller. > > > > > > Could you pass userspace major MTD tests and can you attach/mount/edit > > > a UBI/UBIFS storage? > > > > mtd_debug passed and using dd utility to read and write > > with md5sum checking passed. > > Please don't use dd, use nanddump/nandwrite/flasherase/nandbiterrs and > run the other tests from the mtd-utils test suite (available in > Buildroot for instance). > Got it. But may I know why 'dd' utility is not preferences ? I generate a random data file and write to Flash by using dd with bs=page size and read data back from Flash. Checking data by md5sum. The write and read testing data size is easily adjustable. > > > > > > +static int mxic_nfc_clk_enable(struct mxic_nand_ctlr *nfc) > > > > +{ > > > > + int ret; > > > > + > > > > + ret = clk_prepare_enable(nfc->send_clk); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + ret = clk_prepare_enable(nfc->send_dly_clk); > > > > + if (ret) > > > > + goto err_send_dly_clk; > > > > > > I'm not sure why you only enable 2 out of 3 clocks and also why ou > > > handle two of them here (which is great, I prefer having a separate > > > helper for that) and the other one elsewhere? > > > > > > > send_clk and send_dly_clk are device domain clocks. > > > > send_clk is clock without phase delay to ps_clk, used for sending device > > signals except for SIO[7:0]. > > send_dly_clk is clock with phase delay to ps_clk, used for sending > > SIO[7:0] > > > > ps_clk is system domain clock and it's a source clock of send_clk and > > send_dly_clk. > > And why is that explaining the fact that you configure them in > different places? You can explain this with a nice comment at the top > of the function, but I would rather prefer that you handle all three > clocks in one go if possible. > okay, will patch it. > > > > +static int mxic_nfc_data_xfer(struct mxic_nand_ctlr *nfc, const void > > *txbuf, > > > > + void *rxbuf, unsigned int len) > > > > +{ > > > > + unsigned int pos = 0; > > > > + > > > > + while (pos < len) { > > > > + unsigned int nbytes = len - pos; > > > > + u32 data = 0xffffffff; > > > > + u32 sts; > > > > + int ret; > > > > + > > > > + if (nbytes > 4) > > > > + nbytes = 4; > > > > + > > > > + if (txbuf) > > > > + memcpy(&data, txbuf + pos, nbytes); > > > > + > > > > + ret = readl_poll_timeout(nfc->regs + INT_STS, sts, > > > > + sts & INT_TX_EMPTY, 0, USEC_PER_SEC); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + writel(data, nfc->regs + TXD(nbytes % 4)); > > > > + > > > > + if (rxbuf) { > > > > + ret = readl_poll_timeout(nfc->regs + INT_STS, sts, > > > > + sts & INT_TX_EMPTY, 0, > > > > + USEC_PER_SEC); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + ret = readl_poll_timeout(nfc->regs + INT_STS, sts, > > > > + sts & INT_RX_NOT_EMPTY, 0, > > > > + USEC_PER_SEC); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + data = readl(nfc->regs + RXD); > > > > + data >>= (8 * (4 - nbytes)); > > > > + memcpy(rxbuf + pos, &data, nbytes); > > > > + WARN_ON(readl(nfc->regs + INT_STS) & INT_RX_NOT_EMPTY); > > > > + } else { > > > > + readl(nfc->regs + RXD); > > > > + } > > > > + WARN_ON(readl(nfc->regs + INT_STS) & INT_RX_NOT_EMPTY); > > > > > > WARN_ON() is maybe a bit overkill here? > > > > should I remove it ? > > I would stick to regular dev_warn. Got it, will patch it. thanks & best regards, Mason CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. ===================================================================== ============================================================================ CONFIDENTIALITY NOTE: This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation. Macronix International Co., Ltd. =====================================================================