Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5113038img; Wed, 27 Mar 2019 02:16:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7ud+1r2GdUtIFpLlfcGWpjkD58n571gABBpkAa2yXrbpzqEnPYQEMsZ+V2QXveoJnFXim X-Received: by 2002:aa7:8d01:: with SMTP id j1mr35108377pfe.122.1553678195094; Wed, 27 Mar 2019 02:16:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553678195; cv=none; d=google.com; s=arc-20160816; b=pwa8ia24Y4XKNRYr/VtvIHnTGYuaq1J07+5BinujeKxKpzf0NHpRTwaVjWOXp26/Hj T3qnJC2rTu/lf7eKu8oVJaUK7ozh1D/VvpW+2xgu68AJkIz0MdN/LiMucpDVr83rophC klKkurEpTEH1EJWbxnXVsdxcQceHYxGBy2k7XBT2BFaBDKcn3O5YV1yhMCsHparWWo6m Tp/5r/RWL3/zy1TsTy+ii6MjawYjbN6LLIQq9WA9Oa7UfgAU4O+HXr907J4j89jcA91q RSxhwLXMOXFEhwIC/3EK+TNS3C6QQWP3TfDe3qI8OFC5BWuqnX+WFTCONp4NGo9PPxRA ON8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=6v/Li4tHMR4YitLZRIOuqvurG1MKWbdo3ac6CPVzql8=; b=nGISjd1JbJNJ78CNSIozprpO6ONCmC3IvlgAAKYoTztyxIh32Dvid4lqFbHnE7gL6g 7wAlhZRLgnxHaTKwiS3/B3wzpo70MMhw5yQzeF7x4YU6AKOGftLk9uoHy9wGwb5ALeH5 VGhP+33hg6gTOVagFfjRXPBRIi+tM9NRzx3ICNR3UUGJAUbS4BGogsTgn9LXLnrD2FfZ oikLVcbJ3gwT91FY3k3K9t9EWH71koIzVrir26gU+Ukw9+6UtAWSnYfFN+K5L79KgBWB Duqv/wiBJKCNEdA2/ChmZqlG6Vc2MhVBy5/qwEuxdbf0EB1IRWHnaCPGaHxl+DSIXoPD JC3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b="hOlH/pdQ"; 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 d1si8055778pla.243.2019.03.27.02.16.19; Wed, 27 Mar 2019 02:16:35 -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=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b="hOlH/pdQ"; 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 S1731509AbfC0JPn (ORCPT + 99 others); Wed, 27 Mar 2019 05:15:43 -0400 Received: from mail-eopbgr820041.outbound.protection.outlook.com ([40.107.82.41]:30752 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726320AbfC0JPn (ORCPT ); Wed, 27 Mar 2019 05:15:43 -0400 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 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 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= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 p= l353 smc nand > interface >=20 > 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 =3D > > + container_of(chip, struct pl353_nand_controller, chip); >=20 > This `xnfc' variable is never used anywhere inside this function. >=20 > > +/** > > + * 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 =3D nand_to_mtd(chip); > > + const struct nand_op_instr *instr; > > + struct pl353_nfc_op nfc_op =3D {}; > > + struct pl353_nand_controller *xnfc =3D > > + container_of(chip, struct pl353_nand_controller, chip); > > + unsigned long cmd_phase_data =3D 0, end_cmd_valid =3D 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 =3D nfc_op.data_instr; > > + op_id =3D nfc_op.data_instr_idx; > > + > > + offset =3D nand_subop_get_data_start_off(subop, op_id); >=20 > This `offset' variable is never used anywhere inside this function. The c= all is unnecessary and > should be removed. Will remove it. >=20 > Beyond being useless, it also is harmful. When applying this patch on top= of a v5.1-rc2, this can > be found in dmesg: >=20 > | ------------[ 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 00= 000000 > | 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 ]--- >=20 > After removing the call (and the variable), this particular problem goes = away. Ok, will update >=20 > > +/** > > + * 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 hardwa= re. > > + * 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; >=20 > This `val' variable is never used anywhere inside this function. >=20 > Even after fixing these, I couldn't make this driver work on actual hardw= are. It's a on-die ECC capable device. Did u mentioned nand-ecc-mode =3D "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 =3D <8>; If it is x16 mention nand-bus-width =3D <16>; >=20 > | 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 >=20 > 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. >=20 > 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 >=20 > Helmut