Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4299075imm; Mon, 18 Jun 2018 12:28:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKxAB6Ayl/kR1FPhTRtxHRdRh/nK4EDgH3a2wwurlSG8U5GygsbVWn6meGzTHZkRLrQCgcR X-Received: by 2002:a17:902:4301:: with SMTP id i1-v6mr15439522pld.280.1529350127806; Mon, 18 Jun 2018 12:28:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529350127; cv=none; d=google.com; s=arc-20160816; b=h1MIPLDnvJWBqsAImz5G3P2JWiT4TvyhMfK+z5caDH5dbwCVn+szZSDfo6F0HOlG9g 0UlusgGyI3xnbtcYvi7fvU6ll0uzUeXmD+edOrhegVRp/q9+UQbRnh3D4VExDdwdLamu MIBiIL17lFIoem1vFT6S/ySPTgmi4HZ2aRNA9nS7ZhJFTpmnYwOqIBSLVKjB9RCCdKGV gfotns9roX6KP4SOt5Oe0JUF8EHg6uNcyezyqPzIpzPbAURxVemt5bQv6wNPAdGxjL9X kwG+AuMg1acHPFRHWZegJi5anxrM3PobraYr8RK/19FvEufErDqifXTkRQaYQdabUM7Z sHdA== 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=49FYLFIhTLqeWnQipWTfM9sDmNubBQ0kRKp4fYfwkvM=; b=MKx7alip9k7qmbSNTu7pQ8Jp7IzAEqDO0ehAH3rPs+ipts99CLcFYysx1QcIn93lll ZP+OlFCcJ9X4fyfBtB+RwdETi2BeIWnku0d/JFAaVzP7nbYTQ78VAJMmIqhF3CIMe1OM PbcSXBsE7oxES3Foe+GVT/OwQzcFJKE1pGwvFleTV87lN83pUCppp7DE8XEe2wSP+9zP ZvIzdlNhcgHBvuxZEIeZ7AgLa7rZmFIAPMGQosrCe0e9FrGQyYZ/aaIpU4Sn9KYzR0XX qhJUqhogi5XgOMsjMdVmwTGz73oYA1fx6RML/Wb47gHSi7BGM35fZRIUwxItRL8hlwnD KmTA== 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 s184-v6si12765826pgb.172.2018.06.18.12.28.33; Mon, 18 Jun 2018 12:28:47 -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 S936349AbeFRT1z (ORCPT + 99 others); Mon, 18 Jun 2018 15:27:55 -0400 Received: from mail.bootlin.com ([62.4.15.54]:50581 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935859AbeFRT1w (ORCPT ); Mon, 18 Jun 2018 15:27:52 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 98172207C2; Mon, 18 Jun 2018 21:27:50 +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 (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.bootlin.com (Postfix) with ESMTPSA id 32CD920733; Mon, 18 Jun 2018 21:27:40 +0200 (CEST) Date: Mon, 18 Jun 2018 21:27:40 +0200 From: Boris Brezillon To: Frieder Schrempf Cc: linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, richard@nod.at, miquel.raynal@bootlin.com, broonie@kernel.org, david.wolfe@nxp.com, fabio.estevam@nxp.com, prabhakar.kushwaha@nxp.com, yogeshnarayan.gaur@nxp.com, han.xu@nxp.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/11] spi: Add a driver for the Freescale/NXP QuadSPI controller Message-ID: <20180618212740.6b25c089@bbrezillon> In-Reply-To: <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> References: <1527686082-15142-1-git-send-email-frieder.schrempf@exceet.de> <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> 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 Yogesh, On Wed, 30 May 2018 15:14:32 +0200 Frieder Schrempf wrote: > +static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi) > +{ > + unsigned long rate = spi->max_speed_hz; > + int ret, i; > + u32 map_addr; > + > + if (q->selected == spi->chip_select) > + return; > + > + /* > + * In HW there can be a maximum of four chips on two buses with > + * two chip selects on each bus. We use four chip selects in SW > + * to differentiate between the four chips. > + * We use the SFA1AD, SFA2AD, SFB1AD, SFB2AD registers to select > + * the chip we want to access. > + */ > + for (i = 0; i < 4; i++) { > + if (i < spi->chip_select) Can you try with: if (i <= spi->chip_select) and let me know if it fixes the problem you have when CS != 0? > + map_addr = q->memmap_phy; > + else > + map_addr = q->memmap_phy + > + 2 * q->devtype_data->ahb_buf_size; > + > + qspi_writel(q, map_addr, q->iobase + QUADSPI_SFA1AD + (i * 4)); > + } > + > + if (needs_4x_clock(q)) > + rate *= 4; > + > + fsl_qspi_clk_disable_unprep(q); > + > + ret = clk_set_rate(q->clk, rate); > + if (ret) > + return; > + > + ret = fsl_qspi_clk_prep_enable(q); > + if (ret) > + return; > + > + q->selected = spi->chip_select; > +}