Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3197034ima; Tue, 23 Oct 2018 01:49:19 -0700 (PDT) X-Google-Smtp-Source: ACcGV63OH9nx5Nn+FCmdWdOtDY8nx+EtEtm54Frug01UxNuL43cpHwXE/2mN6MaIxmmC+fgIDAi7 X-Received: by 2002:a63:e07:: with SMTP id d7-v6mr21059866pgl.272.1540284559919; Tue, 23 Oct 2018 01:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540284559; cv=none; d=google.com; s=arc-20160816; b=krpYzDaHpgF+1BKm3dHWSU4wBhK9J7oE8nA0V2lBrHLX/QdREdUPt6OsLH+/OfPZ3O pt3vh6g2ogG4vqu77QHEd2vT3qftCkHI5sjGm00rPJsfW4WFn4Monc9+LhZ6pLsh3BmT PaeSO9IclODdBcKrfd0dnHSRgh3Ew6s3kYhTti6ZQQjAaTnBNFrWMt11TRk/5IXThXLW 2WOQpoIl0Wvja6m9qL2a9SdYxvBfTky8KcJgpxcRWkLn7mKwsJcZkGb3rdQGT8Otha5m 9XVVb8zeaD24Z4pl3H9TRwV6fe+NMavjNmm4gc41wLIo2TLKIGFGuBcOAuwxE0qBxMDT E7wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=DxVYpa+/fsiNimeb9zwchVXiwHNgW9r9fvd+CHzaY3Q=; b=AqGL3VKyO6SrSk5c3OT4ME3cZL+uOCrfBKQ550FOt2rjFPk0i5lsl+qa7m3qCTGDM9 DNgmnIbpofWGyny45QjYxUXUwBYV3ZPcufKb6SRG3pxd4CWz3gBww9vSgknEh9aF/F8P 4ixpWcOOc5DFhBY9miovlF3DOmDy3KDFmBpnme0Ky3dvZSLK9r+UMdPocdNyMREfhdz/ rSYH6uT1f08PGc6ua1CTBn/YrPuMBNpZk/pDIXHx816BQoiKFcTzY9bOcuGuE30XhdW3 k+fGp8qtmp/XRGhkkc7NWcj1i3yJpH2JL10bGc8g0834P5jpr+xG9iZDq6Z6ehJiB73j nVCQ== 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 s13-v6si629517pgp.382.2018.10.23.01.49.04; Tue, 23 Oct 2018 01:49:19 -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 S1727978AbeJWRKz (ORCPT + 99 others); Tue, 23 Oct 2018 13:10:55 -0400 Received: from mail.bootlin.com ([62.4.15.54]:40019 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727709AbeJWRKz (ORCPT ); Tue, 23 Oct 2018 13:10:55 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 198B3208AF; Tue, 23 Oct 2018 10:48:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (aaubervilliers-681-1-25-52.w90-88.abo.wanadoo.fr [90.88.145.52]) by mail.bootlin.com (Postfix) with ESMTPSA id AB46D20736; Tue, 23 Oct 2018 10:48:28 +0200 (CEST) Date: Tue, 23 Oct 2018 10:48:27 +0200 From: Boris Brezillon To: Yogesh Narayan Gaur Cc: "Cristian.Birsan@microchip.com" , Tudor Ambarus , "richard@nod.at" , Mark Brown , "linux-kernel@vger.kernel.org" , "nicolas.ferre@microchip.com" , "marek.vasut@gmail.com" , "cyrille.pitchen@microchip.com" , "linux-mtd@lists.infradead.org" , Cyrille Pitchen , "computersforpeace@gmail.com" , "dwmw2@infradead.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v3 1/2] mtd: spi-nor: add support to non-uniform SFDP SPI NOR flash memories Message-ID: <20181023104827.77e7775b@bbrezillon> In-Reply-To: References: <20180911154007.17195-1-tudor.ambarus@microchip.com> <20181017115237.07310b74@bbrezillon> <20181022111543.2a607efc@bbrezillon> <20181022122659.0675942e@bbrezillon> <20181022124627.2c6c3b93@bbrezillon> <20181022125259.42df83ea@bbrezillon> <20181022134324.2c1bd248@bbrezillon> <20181022135211.1978c25d@bbrezillon> <20181023073946.138b287e@bbrezillon> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Oct 2018 08:18:35 +0000 Yogesh Narayan Gaur wrote: > > I have added the prints in m25p80_read() and in flexspi controller prepare_lut and read_rxfifo() func. > In these have added prints for data variable of struct op and data which being read by the controller from the flash. > > [ 2.091467] smpt[0]=[addr_width:00000003, read_dumy:00000008, read_opcode:00000065, data_mask:00000008] > [ 2.099113] m25p80_read, nor[op:00000065 addr_width:00000003, dummy:00000008, len:00000001 > [ 2.107367] m25p80_read, cmd[opcode:65 bwidth:1] aadr[val:4, nbytes:3, bwidth:1] > [ 2.114753] m25p80_read, dummy[nbytes:1 bwidth:1] data[bwidth:1, nbytes:1] > [ 2.121706] nxp_fspi_prepare_lut cmd[opcode:65 bwidth:1] aadr[val:4, nbytes:3, bwidth:1] > [ 2.129786] dummy[nbytes:1 bwidth:1] data[dir:0 bwidth:1, nbytes:1] > [ 2.136132] nxp-fspi 20c0000.flexspi: CMD[65] lutval[0:8180465 1:24003008 2:0 3:0] > [ 2.144223] nxp_fspi_read_rxfifo, ReadData op.buf[0x00] > [ 2.151004] smpt_read[1] addr[00000004], data_byte[00000000] err:00000000 > > > [ 2.157782] smpt[2]=[addr_width:00000003, read_dumy:00000008, read_opcode:00000065, data_mask:00000004] > [ 2.165429] m25p80_read, nor[op:00000065 addr_width:00000003, dummy:00000008, len:00000001 > [ 2.173683] m25p80_read, cmd[opcode:65 bwidth:1] aadr[val:2, nbytes:3, bwidth:1] > [ 2.181068] m25p80_read, dummy[nbytes:1 bwidth:1] data[bwidth:1, nbytes:1] > [ 2.188021] nxp_fspi_prepare_lut cmd[opcode:65 bwidth:1] aadr[val:2, nbytes:3, bwidth:1] > [ 2.196101] dummy[nbytes:1 bwidth:1] data[dir:0 bwidth:1, nbytes:1] > [ 2.202447] nxp-fspi 20c0000.flexspi: CMD[65] lutval[0:8180465 1:24003008 2:0 3:0] > [ 2.210539] nxp_fspi_read_rxfifo, ReadData op.buf[0x02] > [ 2.217319] smpt_read[3] addr[00000002], data_byte[00000002] err:00000000 > > > [ 2.224098] smpt[4]=[addr_width:00000003, read_dumy:00000008, read_opcode:00000065, data_mask:00000002] > [ 2.231744] m25p80_read, nor[op:00000065 addr_width:00000003, dummy:00000008, len:00000001 > [ 2.239998] m25p80_read, cmd[opcode:65 bwidth:1] aadr[val:4, nbytes:3, bwidth:1] > [ 2.247383] m25p80_read, dummy[nbytes:1 bwidth:1] data[bwidth:1, nbytes:1] > [ 2.254336] nxp_fspi_prepare_lut cmd[opcode:65 bwidth:1] aadr[val:4, nbytes:3, bwidth:1] > [ 2.262416] dummy[nbytes:1 bwidth:1] data[dir:0 bwidth:1, nbytes:1] > [ 2.268762] nxp-fspi 20c0000.flexspi: CMD[65] lutval[0:8180465 1:24003008 2:0 3:0] > [ 2.276854] nxp_fspi_read_rxfifo, ReadData op.buf[0x00] > [ 2.283634] smpt_read[5] addr[00000004], data_byte[00000000] err:00000000 > > > [ 2.290412] spi_nor_get_map_in_use:2915 map_id=0 smpt_len:16 i=:6 > [ 2.296496] End [addr_width:00000003, read_dumy:00000008, read_opcode:00000065] ReturnVal:00000000 > [ 2.305444] spi_nor_parse_smpt:3065 > [ 2.308924] m25p80 spi0.0: failed to parse SMPT (err = -22) > > > > > > Next thing you can do is read the CR2NV reg (using the RDAR command) and > > check the RL (Read Latency) and AL (Address Length) values. > > Please let me know how to read CR2NV register. Actually, RDAR is already what you use to read the map_id, and we need to use it to read the register that contains the number of dummy cycles and the number of address bytes to use for RDAR operations. Looks like we have a chicken and egg situation here :-). Let's try something else: 1/ create an u8 array of 16 entries named data_bytes for each loop iteration (the first for loop): 2/ set ->addr_width to 3 and ->read_dummy to 0 3/ call spi_nor_read_raw(nor, addr, ARRAY_SIZE(data_bytes), data_bytes) 4/ dump the data_bytes buf 5/ set ->addr_width to 4 6/ call spi_nor_read_raw(nor, addr, ARRAY_SIZE(data_bytes), data_bytes) 7/ dump the data_bytes buf If the SPI driver is working correctly, we should be able to figure out the right value for ->addr_width and ->read_dummy. Thanks, Boris