Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3941855imu; Mon, 12 Nov 2018 03:12:49 -0800 (PST) X-Google-Smtp-Source: AJdET5djCkadFN+G5cb+tE/tuv7BDuxpczXJ/rQEyPN7KcVZjw8701LSqhmF0B1fgMNCKkQqGY5X X-Received: by 2002:a17:902:846:: with SMTP id 64-v6mr514200plk.70.1542021169513; Mon, 12 Nov 2018 03:12:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542021169; cv=none; d=google.com; s=arc-20160816; b=Mt6DpFmC2KWnsoNykJFoeN2IiBfGbtkHahJsUo24A1rk47lNFK383PilIsVakPIL5v jThooDrsrBPKcVUc5dHindR7mjd3zihKH6mQJcJsHKeaarJyQdZHfPPThqaB40p8/ApA 4fNEMgnRzhcT7Lri+UkbZOF6jsDkfUwfgGCbKYEB3ZVESGeAskRXkHSobr4t4GOe5W0z w02uEHqQ4DkdXriJBRsBlvdT2aDG6dGxeMxQ3UbxVd/qeCxI81NnWIAZTWAx1VSWlhxj Vq/2DcCZ5yTUTJu6F560Z67WsEbBrjvOhCtkk8dShAUyzdbJAZCjYBBZ9o2gJp0zNznt /tjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=YNjvFA2A5lANKy+br/xS+a6qTL3cz5q8QLQnXB1PXKk=; b=WSITMclSUTE05K2LsCPSWCH4w9O1i91Ht/8nOsJbS6n6XaBWOoKTDPIzvYtoHzrPxN 7F61Kil3KlpniziWSIKLS/eRRlB2DHR4DNug98qM7auD+bmcEpgJVjMWgbNCjdRBu0X4 b9rvt2Kow9LF5UcUY0mErvXNmUF6T6APYStmAuJGyNETf1AkS6PO+2G6C2/rPV4fBurG 2V4XUNHymROonToiIGsncKX698gUqCbgTIibOzTBUvvnd2UAKjwmuGdLOh7OmT2Xr98f pqDLk6Nej8MeYe2BQGFAeqO488xtVQYazyBF0l/Bpyha/InsP/IT8jw1EpxwL2mKO10V nH5g== 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 t126-v6si18987130pfd.133.2018.11.12.03.12.33; Mon, 12 Nov 2018 03:12:49 -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 S1729201AbeKLVE7 (ORCPT + 99 others); Mon, 12 Nov 2018 16:04:59 -0500 Received: from martinlund.org ([173.255.130.145]:49530 "EHLO slmp-550-86.slc.westdc.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728302AbeKLVE7 (ORCPT ); Mon, 12 Nov 2018 16:04:59 -0500 X-Greylist: delayed 988 seconds by postgrey-1.27 at vger.kernel.org; Mon, 12 Nov 2018 16:04:59 EST Received: from mail-oi1-f174.google.com ([209.85.167.174]:39630) by slmp-550-86.slc.westdc.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1gM9sh-005Ttu-TH for linux-kernel@vger.kernel.org; Mon, 12 Nov 2018 03:55:47 -0700 Received: by mail-oi1-f174.google.com with SMTP id 192-v6so6795514oii.6 for ; Mon, 12 Nov 2018 02:55:47 -0800 (PST) X-Gm-Message-State: AGRZ1gJ1iIGsnOfokgO8pX7rzDHIAplpE+X69ippyQbdZtf8VDGHegkk oSoFbr2dA4sxJqATwdJgR3etgfJzC6ZlfBBHGgo= X-Received: by 2002:aca:654a:: with SMTP id j10-v6mr213773oiw.178.1542020147437; Mon, 12 Nov 2018 02:55:47 -0800 (PST) MIME-Version: 1.0 References: <1541739641-17789-1-git-send-email-naga.sureshkumar.relli@xilinx.com> <1541739641-17789-4-git-send-email-naga.sureshkumar.relli@xilinx.com> In-Reply-To: <1541739641-17789-4-git-send-email-naga.sureshkumar.relli@xilinx.com> From: Martin Lund Date: Mon, 12 Nov 2018 11:55:36 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [LINUX PATCH v12 3/3] mtd: rawnand: arasan: Add support for Arasan NAND Flash Controller To: naga.sureshkumar.relli@xilinx.com Cc: boris.brezillon@bootlin.com, miquel.raynal@bootlin.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, michals@xilinx.com, nagasuresh12@gmail.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, robh@kernel.org Content-Type: text/plain; charset="UTF-8" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - slmp-550-86.slc.westdc.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - keep-it-simple.com X-Get-Message-Sender-Via: slmp-550-86.slc.westdc.net: authenticated_id: martin.lund+keep-it-simple.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: slmp-550-86.slc.westdc.net: martin.lund@keep-it-simple.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Naga, Just a few review comments for the v12 version. On Fri, Nov 9, 2018 at 6:00 AM Naga Sureshkumar Relli wrote: > +#define PKT_OFST 0x00 > +#define PKT_CNT_SHIFT 12 > + > +#define MEM_ADDR1_OFST 0x04 > +#define MEM_ADDR2_OFST 0x08 For the sake of readability I think *_OFFSET is preferred, especially since the driver already includes short macro names. I think this is similar to the EVNT vs EVENT point. The majority of drivers in the Linux kernel do not shorten OFFSET -> OFST. > +static void anfc_rw_pio_op(struct mtd_info *mtd, u8 *buf, int len, > + bool do_read, int prog, int pktcount, int pktsize) > +{ > + struct nand_chip *chip = mtd_to_nand(mtd); > + struct anfc_nand_controller *nfc = to_anfc(chip->controller); > + struct anfc_nand_chip *achip = to_anfc_nand(chip); > + u32 *bufptr = (u32 *)buf; > + u32 cnt = 0, intr = 0; > + > + anfc_config_dma(nfc, 0); > + > + if (pktsize == 0) > + pktsize = len; > + > + anfc_setpktszcnt(nfc, pktsize, pktcount); > + > + if (!achip->strength) > + intr = MBIT_ERROR; > + > + if (do_read) > + intr |= READ_READY; > + else > + intr |= WRITE_READY; > + anfc_enable_intrs(nfc, intr); > + writel(prog, nfc->base + PROG_OFST); > + while (cnt < pktcount) { > + anfc_wait_for_event(nfc); > + cnt++; > + if (cnt == pktcount) > + anfc_enable_intrs(nfc, XFER_COMPLETE); > + if (do_read) > + ioread32_rep(nfc->base + DATA_PORT_OFST, bufptr, > + pktsize / 4); > + else > + iowrite32_rep(nfc->base + DATA_PORT_OFST, bufptr, > + pktsize / 4); > + bufptr += (pktsize / 4); > + if (cnt < pktcount) > + anfc_enable_intrs(nfc, intr); > + } > + anfc_wait_for_event(nfc); > +} Throughout the driver all calls to anfc_wait_for_event() ignores the timeout return value. It would be nice to see some error handling in case it times out - at minimum consider printing out an error message since timeout on NAND operations are fairly critical and should generally not occur. Perhaps even an argument can be made for returning -ETIMEDOUT in case of timeout. I'm putting a focus on this because I see the original non-upstream Arasan driver sometimes timeout on NAND operations when I stress test it via the UBI stress test. Not sure what the cause for the timeout is yet but either way an error message would have been helpful. Br, Martin