From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D74FC43381 for ; Wed, 27 Mar 2019 09:14:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 350AD206B7 for ; Wed, 27 Mar 2019 09:14:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MKfWY1vw"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="hOlH/pdQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 350AD206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Kcbx6bx71UTvj+t5+muCiAWrnAgibXqw/4O0IyWJbe4=; b=MKfWY1vwxLBm49 v+JowBmF46oDFhWafyZL1q/D1ty22afliLq6KvMw54fO6QnrAtOATETjlC/c8yvPNvR8tS6mZxppf WTYlQ0Czcs4Tc5RZyRjHGnPurtso0pw0HLQFNHlfSREpxxY2jWeU7jEPaynA4VU0Hnu+NymGvHmqd tdc760EMOdvbA/rFH5glMcsGvEuaXKMd2Kg0kp61lV4rs5+X3v04fVT6+xsEG+rI80umpDk775nM+ EImj0hbC3A3PspHsjiNKKbH4IHwd8B/BakvcLfmlpr/9t4UH2uVFQQOvG/m9Zlh1mrgR+K6XjOg6l MRspg36EGJo2JL8TSbEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h94dO-0005vj-1Q; Wed, 27 Mar 2019 09:14:10 +0000 Received: from mail-sn1nam01on062e.outbound.protection.outlook.com ([2a01:111:f400:fe40::62e] helo=NAM01-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h94dI-0005v1-Pw for linux-mtd@lists.infradead.org; Wed, 27 Mar 2019 09:14:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6v/Li4tHMR4YitLZRIOuqvurG1MKWbdo3ac6CPVzql8=; b=hOlH/pdQi24ZF0FzlkQcNj+5/M4aZfbiCNXNOrIYJ++HvjjGhzj2+k1q0XkExX3SCrh3JPvcnQ3EOU7y34BoKOXi/q5YxhrclF06ucZuDkUqUnK1spFr9jQzWhaUfyr8rG9fJQQpPPV/mOz6fNFBm1X+tM5yVv9DYEO5ip4Xg2A= Received: from MWHPR02MB2623.namprd02.prod.outlook.com (10.168.206.9) by MWHPR02MB2640.namprd02.prod.outlook.com (10.168.206.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1750.15; Wed, 27 Mar 2019 09:13:59 +0000 Received: from MWHPR02MB2623.namprd02.prod.outlook.com ([fe80::c89d:e485:cb5e:89cf]) by MWHPR02MB2623.namprd02.prod.outlook.com ([fe80::c89d:e485:cb5e:89cf%5]) with mapi id 15.20.1730.019; Wed, 27 Mar 2019 09:13:59 +0000 From: Naga Sureshkumar Relli To: Helmut Grohne Subject: RE: [LINUX PATCH v13] rawnand: pl353: Add basic driver for arm pl353 smc nand interface Thread-Topic: [LINUX PATCH v13] rawnand: pl353: Add basic driver for arm pl353 smc nand interface Thread-Index: AQHUwEH1zZQS3QRob0y10ZaiOKtLVqYeLsaAgAFJyIA= Date: Wed, 27 Mar 2019 09:13:59 +0000 Message-ID: References: <1549694247-24625-1-git-send-email-naga.sureshkumar.relli@xilinx.com> <20190326132721.52e7ktnptgwvzeor@laureti-dev> In-Reply-To: <20190326132721.52e7ktnptgwvzeor@laureti-dev> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=nagasure@xilinx.com; x-originating-ip: [149.199.50.133] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 004e94e2-4267-4adc-15da-08d6b2948c55 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:MWHPR02MB2640; x-ms-traffictypediagnostic: MWHPR02MB2640: x-microsoft-antispam-prvs: x-forefront-prvs: 0989A7979C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(136003)(346002)(396003)(39860400002)(366004)(13464003)(53234004)(189003)(199004)(53546011)(6916009)(76176011)(6436002)(6246003)(102836004)(8936002)(26005)(81166006)(81156014)(8676002)(25786009)(33656002)(4326008)(99286004)(68736007)(66066001)(478600001)(14454004)(9686003)(6506007)(55016002)(7696005)(71190400001)(71200400001)(6116002)(229853002)(3846002)(105586002)(7416002)(74316002)(54906003)(106356001)(86362001)(5660300002)(305945005)(7736002)(486006)(11346002)(14444005)(316002)(2906002)(97736004)(186003)(5024004)(256004)(52536014)(476003)(53936002)(446003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB2640; H:MWHPR02MB2623.namprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: xilinx.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: muzXueeW1Yg7fn/rpjmCWrpfvhABbTN6yme/+SbC5DJb4qK6RXqd2fBRpdFItGC1FfSFMrEM8/WLu8ArWRZAKRc5QT0R45aGS8CixKxikhS/RUzd4F49oeDHlKfCkj5PoXbAr5dg7W3klXXorP0iCqCVyxRh9YZukDQV7varfTOzJrVgvSZPfYvgG5aVg+70PsbbaWpHpF5hhDkT91jQXDRrziOXvAtMQXNxgC/r73HXbK1dJsPWafVllaeO/RrpD4qWAPlQuTMJvDScXAnBDXKkbeKz6fzdjW2dFt8fe89wxwDx2phC1WLDd2peiZH2v7yc27BDKmKswWFoRWXX7RuaTKms1mBwRGGdUov1lPN7a6apoqPEgCnEXY8ltC1JIGKMPgvkevIFgEst3nj6/4sCNzn2rHcvUPmKqUiEqZQ= MIME-Version: 1.0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-Network-Message-Id: 004e94e2-4267-4adc-15da-08d6b2948c55 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2019 09:13:59.7423 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2640 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190327_021404_899583_0498CEA3 X-CRM114-Status: GOOD ( 19.28 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "bbrezillon@kernel.org" , "richard@nod.at" , "linux-kernel@vger.kernel.org" , "marek.vasut@gmail.com" , "linux-mtd@lists.infradead.org" , "miquel.raynal@bootlin.com" , "nagasureshkumarrelli@gmail.com" , Michal Simek , "computersforpeace@gmail.com" , "dwmw2@infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org Hi Helmut, > -----Original Message----- > From: Helmut Grohne > Sent: Tuesday, March 26, 2019 6:57 PM > To: Naga Sureshkumar Relli > Cc: bbrezillon@kernel.org; miquel.raynal@bootlin.com; richard@nod.at; > dwmw2@infradead.org; computersforpeace@gmail.com; marek.vasut@gmail.com; linux- > mtd@lists.infradead.org; linux-kernel@vger.kernel.org; Michal Simek ; > nagasureshkumarrelli@gmail.com > Subject: Re: [LINUX PATCH v13] rawnand: pl353: Add basic driver for arm pl353 smc nand > interface > > 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. Will remove it. > > 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. Ok, will update > > > +/** > > + * 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. It's a on-die ECC capable device. Did u mentioned nand-ecc-mode = "on-die" in dts. The same part I tested by mentioning "on-die" property in dts and it worked for me. Please share the dts entries for NAND. Also if it is x8 bus then please mention nand-bus-width = <8>; If it is x16 mention nand-bus-width = <16>; > > | 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. Sure, I will put you in CC. On this v13 patch, got comments from Miquel to remove legacy hooks. I will update the driver and will send next version. Thanks, Naga Sureshkumar Relli > > Helmut ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/