Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp826096imm; Fri, 15 Jun 2018 06:56:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJiEXXXsJBV0dZ9AgiCJvNriZp5JohdIhM0Ln5QC4adWCNxz4F/iANvuTOSn6eJgKjuvHLX X-Received: by 2002:aa7:820e:: with SMTP id k14-v6mr2074716pfi.97.1529070996738; Fri, 15 Jun 2018 06:56:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529070996; cv=none; d=google.com; s=arc-20160816; b=Gx211JNJVtkq3lMbR4UFXt55Et1SL+4Gcnbf2uKvDdRWWIjqtpRdIWjNfO8t7QrHe0 huqznL5g8uD4CFZ6GP5nQR/ikJzCeQ0o26PO2SO+AHLQzYzf+5uTzWcesE+GXnQk56tV vqqvUyuq6j6Q7Woi8zxcaqqUGCOtO4qsumCBOZxF7odtrHh9uNA1BUT/L7Q+JcOCFLHK mDld94ysrB710Y2pqD2Cx0qaK9s65f1gjF5fcDFDo+v/SweVUoYdJpLenwdq6MBpQG4f UzrB+z2GCgE1xiBpeVdP+lSxKjWLZcVKLVpQlo/JKnPo+3l3vTZzv8cm26g2IZ7bSWWC mWyg== 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 :arc-authentication-results; bh=grssA8YVrHITnEyvrtdQzxXATO4aNOJs3KM9o530EpQ=; b=Kj34dwyKrGaPRNY6Wp1loIRC2LJIsNzHtAMOrHeOIXCTcoKCcBBrXqBL7xtfR6ec4F uzrvhgdZdrPD3TN+57K16pP5QViHA8Q52OvjLOAu1OHC5cilvon48K+ygkUBLGbx5TAW BNoxqamQuw+eV4Z8InQw/r6U60xSU7MCDOyog9v/2MQcHg+FTSb9YHBUfQaxOu9HY/ge Qi5qVviTOPUl6VO0oHqNSMCB0JUKngrFxtj0B+Ou4k1Q2hfCojIjv9OrIjxyuNzkYd7V 9lQ3XsFciPYpLfFBSevBf/uMDKNtrASKypsVA0rMakkNJdBhLRYsohpHyQc6grdC8KIw ls5g== 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 p6-v6si8289083pfl.279.2018.06.15.06.56.21; Fri, 15 Jun 2018 06:56:36 -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 S1756180AbeFONzz (ORCPT + 99 others); Fri, 15 Jun 2018 09:55:55 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50175 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755925AbeFONzx (ORCPT ); Fri, 15 Jun 2018 09:55:53 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id C2A0A20717; Fri, 15 Jun 2018 15:55:51 +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-37-30.w90-88.abo.wanadoo.fr [90.88.156.30]) by mail.bootlin.com (Postfix) with ESMTPSA id 594AA206A0; Fri, 15 Jun 2018 15:55:41 +0200 (CEST) Date: Fri, 15 Jun 2018 15:55:41 +0200 From: Boris Brezillon To: Yogesh Narayan Gaur , Fabio Estevam , David Wolfe , "dwmw2@infradead.org" Cc: "richard@nod.at" , Prabhakar Kushwaha , Han Xu , "linux-kernel@vger.kernel.org" , "linux-spi@vger.kernel.org" , "marek.vasut@gmail.com" , Frieder Schrempf , "broonie@kernel.org" , "linux-mtd@lists.infradead.org" , "miquel.raynal@bootlin.com" , "computersforpeace@gmail.com" Subject: Re: [PATCH 03/11] spi: Add a driver for the Freescale/NXP QuadSPI controller Message-ID: <20180615155541.4f43e9bb@bbrezillon> In-Reply-To: References: <1527686082-15142-1-git-send-email-frieder.schrempf@exceet.de> <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> <20180608145130.09f979f9@bbrezillon> <20180611094616.5c8f82cf@bbrezillon> <20180611121618.40f4b609@bbrezillon> <20180612091328.67734adb@bbrezillon> <20180615145019.734f23a9@bbrezillon> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; 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 Fri, 15 Jun 2018 13:42:12 +0000 Yogesh Narayan Gaur wrote: > Hi Boris, > > I am still debugging the issue. > With some analysis, able to check that proper values are not being written for QUADSPI_SFA2AD/ QUADSPI_SFB1AD/ QUADSPI_SFB2AD register. > > In current code, value of map_addr are being assigned to these register. > map_addr = q->memmap_phy + > 2 * q->devtype_data->ahb_buf_size; > > qspi_writel(q, map_addr, q->iobase + QUADSPI_SFA1AD + (i * 4)); > > But instead of "q->devtype_data->ahb_buf_size" it should be flash size. No, because we're only using 2 * ->ahb_buf_size in the direct mapping for each device, and we're modifying the mapping dynamically based on the selected device. Maybe we got the logic wrong though. > For my case flash size is 0x4000000 and with this hard coded value I am able to perform Write and Erase operation. > One more change, I have to do is adding the flash_size when writing the base_address in SFAR register for case when "mem->spi->chip_select == 1" > qspi_writel(q, q->memmap_phy + 0x4000000, base + QUADSPI_SFAR); I don't want to expose the full device in the direct mapping yet (that's part of the direct-mapping API I posted here [1]). What this version of the driver does is, map only 2 time the ahb_size so that we can bypass the internal cache of the QSPI engine. > > Thus, there should be mechanism or the entry in structure where we can have the information of the size of the connected slave device. Because that's exactly the kind of thing I'd like to avoid. What if the device is bigger than the reserved memory region? What if the sum of all devices does not fit in there? Here I tried to support all cases by just mapping the portion of memory we need.