Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4280476img; Tue, 26 Mar 2019 06:36:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBm8CDtBcsnNXB4qfKunlpjCaveISFBafNWNazZMLmA0qmfedJ3czGTfcZ3Wes4aTR3hNL X-Received: by 2002:a63:e050:: with SMTP id n16mr28575396pgj.210.1553607362973; Tue, 26 Mar 2019 06:36:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553607362; cv=none; d=google.com; s=arc-20160816; b=mYRuBM6G5dQ5V5CCnZcGFYjnYtEbWr3ndnsqJnB/7qeF8YN3sB7J6YM2lgI4MZShDN l/XJy2YeKpazq4m+xuBs67Z6vtkCgD9O8UM8dLEu2lNr1uPkhv0B67oDorjdAx4EybTG PsSkN2ii2SwfmQl7d68K2Bnb5O5UtBhu9Ye1F6kt2kbm2+Wog2Fd8GNOn3Bz5CwTkLQ9 Uy4YXIO3xvtbbqjBJaJDjzHd7oD59hKB1EJwHlZ2pRZKL866fpYFaTsRbFvFCwimlpKE 1eM4JxKoZQhn94/suUjHqeqEmy+aI7kF6Ox8ETb3t386ob3z4SwwDEPBzZh4Lw0tKuUI 3bSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=E4LgTeAYS90v+QPMpYy6r78rOfJneZnRqnHkuTTGwkw=; b=ZM0StHVczZLCtzbWvQDd1Fz7/1EVmWv8ZZfyJjmaFAk9ko2+sguwwkQaDgy8jgl6yv Nl4Wnq1LCX++fHORuBCYrpl0qPtfLu8td7s0TVH7x0qczxwwBEI984Uhv+bWigv+51XA LpNELRyYEPZ6IawcGcrAQ+v5rjS/cJvEsdQAOzUqsST+uGhM5QEnuUQ1BcEO9tmIjI8j wMc4y9ghZU+pWx4mArMvsvmR0Tp11huAZWBw5YNisTykhFeCE8zridzk1DjPavkaoEVN 7E6+LCfji8LePemv0zyLIlcHGug9V5WiXHI/Uv0VzUiJtQl1oEwNnKceI7Iv+7qYdDI4 PMIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intenta.de header.s=dkim1 header.b=saf7D+xr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intenta.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10si12345711pfa.285.2019.03.26.06.35.47; Tue, 26 Mar 2019 06:36:02 -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; dkim=pass header.i=@intenta.de header.s=dkim1 header.b=saf7D+xr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intenta.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731599AbfCZNdF (ORCPT + 99 others); Tue, 26 Mar 2019 09:33:05 -0400 Received: from mail.intenta.de ([178.249.25.132]:38897 "EHLO mail.intenta.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfCZNdE (ORCPT ); Tue, 26 Mar 2019 09:33:04 -0400 X-Greylist: delayed 331 seconds by postgrey-1.27 at vger.kernel.org; Tue, 26 Mar 2019 09:33:04 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=intenta.de; s=dkim1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:CC:To:From:Date; bh=E4LgTeAYS90v+QPMpYy6r78rOfJneZnRqnHkuTTGwkw=; b=saf7D+xrGbY4t59dSisXEiCcWrJ0GsM7/KWEJ290QYx3aO2mpI4N5AscGg+XEYjXkG6en4BIuni4K/dRsMCKdARDxFg8eJ+lDBDX6zHbWJkMaW35R20tE7y7Lbs+RrEeQdk5PYVFxKXJUGR4333e1paNJm2UK7SI9Sw4x4y1+pwr6Y/6Lx8nzB9yXkFiSE5ap90dDXLjERMmPb0cq/Jor9bz8MgWv2zJdJJHgeIozl08vtKNN0uORXitxVqbPiCPUB1wel0nvP8f3+HX1iljhto7wDilj2fCRvWbB2IUXMDAVGDGzZ/TWW1AqmEgGOqWUdHWfm5WG6wG26OvbV7v4A==; X-CTCH-RefID: str=0001.0A0C0211.5C9A28BB.00B2,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 Date: Tue, 26 Mar 2019 14:27:23 +0100 From: Helmut Grohne To: Naga Sureshkumar Relli CC: , , , , , , , , , Subject: Re: [LINUX PATCH v13] rawnand: pl353: Add basic driver for arm pl353 smc nand interface Message-ID: <20190326132721.52e7ktnptgwvzeor@laureti-dev> References: <1549694247-24625-1-git-send-email-naga.sureshkumar.relli@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1549694247-24625-1-git-send-email-naga.sureshkumar.relli@xilinx.com> User-Agent: NeoMutt/20170113 (1.7.2) X-ClientProxiedBy: ICSMA002.intenta.de (10.10.16.48) To ICSMA002.intenta.de (10.10.16.48) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 09, 2019 at 12:07:27PM +0530, Naga Sureshkumar Relli wrote: > +static void pl353_nfc_force_byte_access(struct nand_chip *chip, > + bool force_8bit) > +{ > + struct pl353_nand_controller *xnfc = > + container_of(chip, struct pl353_nand_controller, chip); This `xnfc' variable is never used anywhere inside this function. > +/** > + * pl353_nand_exec_op_cmd - Send command to NAND device > + * @chip: Pointer to the NAND chip info structure > + * @subop: Pointer to array of instructions > + * Return: Always return zero > + */ > +static int pl353_nand_exec_op_cmd(struct nand_chip *chip, > + const struct nand_subop *subop) > +{ > + struct mtd_info *mtd = nand_to_mtd(chip); > + const struct nand_op_instr *instr; > + struct pl353_nfc_op nfc_op = {}; > + struct pl353_nand_controller *xnfc = > + container_of(chip, struct pl353_nand_controller, chip); > + unsigned long cmd_phase_data = 0, end_cmd_valid = 0; > + unsigned long cmd_phase_addr, data_phase_addr, end_cmd; > + unsigned int op_id, len, offset; > + bool reading; > + > + pl353_nfc_parse_instructions(chip, subop, &nfc_op); > + instr = nfc_op.data_instr; > + op_id = nfc_op.data_instr_idx; > + > + offset = nand_subop_get_data_start_off(subop, op_id); This `offset' variable is never used anywhere inside this function. The call is unnecessary and should be removed. Beyond being useless, it also is harmful. When applying this patch on top of a v5.1-rc2, this can be found in dmesg: | ------------[ cut here ]------------ | WARNING: CPU: 0 PID: 1 at .../linux/drivers/mtd/nand/raw/nand_base.c:2299 nand_subop_get_data_start_off+0x30/0x6c | CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.1.0-rc2-dirty #3 | Hardware name: Xilinx Zynq Platform | [] (unwind_backtrace) from [] (show_stack+0x18/0x1c) | [] (show_stack) from [] (dump_stack+0xa0/0xcc) | [] (dump_stack) from [] (__warn+0x10c/0x128) | [] (__warn) from [] (warn_slowpath_null+0x48/0x50) | [] (warn_slowpath_null) from [] (nand_subop_get_data_start_off+0x30/0x6c) | [] (nand_subop_get_data_start_off) from [] (pl353_nand_exec_op_cmd+0x94/0x2f0) | [] (pl353_nand_exec_op_cmd) from [] (nand_op_parser_exec_op+0x460/0x4cc) | [] (nand_op_parser_exec_op) from [] (nand_reset_op+0x134/0x1a0) | [] (nand_reset_op) from [] (nand_reset+0x60/0xbc) | [] (nand_reset) from [] (nand_scan_with_ids+0x288/0x1600) | [] (nand_scan_with_ids) from [] (pl353_nand_probe+0xf8/0x1a0) | [] (pl353_nand_probe) from [] (platform_drv_probe+0x3c/0x74) | [] (platform_drv_probe) from [] (really_probe+0x278/0x400) | [] (really_probe) from [] (bus_for_each_drv+0x68/0x9c) | [] (bus_for_each_drv) from [] (__device_attach+0xa8/0x11c) | [] (__device_attach) from [] (bus_probe_device+0x90/0x98) | [] (bus_probe_device) from [] (device_add+0x3b4/0x5f0) | [] (device_add) from [] (of_platform_device_create_pdata+0x98/0xc8) | [] (of_platform_device_create_pdata) from [] (pl353_smc_probe+0x194/0x234) | [] (pl353_smc_probe) from [] (amba_probe+0x60/0x74) | [] (amba_probe) from [] (really_probe+0x278/0x400) | [] (really_probe) from [] (device_driver_attach+0x60/0x68) | [] (device_driver_attach) from [] (__driver_attach+0x88/0x180) | [] (__driver_attach) from [] (bus_for_each_dev+0x60/0x9c) | [] (bus_for_each_dev) from [] (bus_add_driver+0x10c/0x208) | [] (bus_add_driver) from [] (driver_register+0x80/0x114) | [] (driver_register) from [] (do_one_initcall+0x164/0x374) | [] (do_one_initcall) from [] (kernel_init_freeable+0x394/0x474) | [] (kernel_init_freeable) from [] (kernel_init+0x14/0x100) | [] (kernel_init) from [] (ret_from_fork+0x14/0x28) | Exception stack(0xdd8c9fb0 to 0xdd8c9ff8) | 9fa0: 00000000 00000000 00000000 00000000 | 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 | irq event stamp: 414355 | hardirqs last enabled at (414361): [] console_unlock+0x4c4/0x690 | hardirqs last disabled at (414366): [] console_unlock+0xdc/0x690 | softirqs last enabled at (414350): [] __do_softirq+0x454/0x544 | softirqs last disabled at (414345): [] irq_exit+0x124/0x128 | ---[ end trace 3be9247df2f8dfb5 ]--- After removing the call (and the variable), this particular problem goes away. > +/** > + * pl353_nand_probe - Probe method for the NAND driver > + * @pdev: Pointer to the platform_device structure > + * > + * This function initializes the driver data structures and the hardware. > + * The NAND driver has dependency with the pl353_smc memory controller > + * driver for initializing the NAND timing parameters, bus width, ECC modes, > + * control and status information. > + * > + * Return: 0 on success or error value on failure > + */ > +static int pl353_nand_probe(struct platform_device *pdev) > +{ > + struct pl353_nand_controller *xnfc; > + struct mtd_info *mtd; > + struct nand_chip *chip; > + struct resource *res; > + struct device_node *np, *dn; > + u32 ret, val; This `val' variable is never used anywhere inside this function. Even after fixing these, I couldn't make this driver work on actual hardware. | nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xda | nand: Micron MT29F2G08ABAEAWP | nand: 256 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 | nand: WARNING: MT29F2G08ABAEAWP: the ECC used on your system is too weak compared to the one required by the NAND chip | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | Bad block table not found for chip 0 | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | pl353_nand_calculate_hwecc status failed | Bad block table not found for chip 0 The very same device works fine with an older version of the out-of-tree driver based on a v4.14 tree. Thus far I couldn't figure out why it fails like this. I'd appreciate if you could Cc me on future postings of this driver. Helmut