Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6129867imu; Wed, 30 Jan 2019 09:16:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN43Qbm8lmu0xBCU08rOjGWxoU7oD5z4msJeF3VLH8kQ0l/6X5AAISqahhQUsYVRuSdt1kNZ X-Received: by 2002:a17:902:2dc3:: with SMTP id p61mr30638007plb.166.1548868578144; Wed, 30 Jan 2019 09:16:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548868578; cv=none; d=google.com; s=arc-20160816; b=kPJ5eneNIRiToVg2VHeKjS+7rGbXOsbT8xlZ7swlBxgR+IdPZwl7yokG+r49k08E/l VYnw1ehy/47CywyxYLI4aNVGx8a/Onny+sVhlBy+JffdGZhvQzHyXDxY7rANZeGAscyn zBJOWApnmnMQuxPvvXQyCn1OpLkLi59R7MkOnMxvAxJYNOgIZ2aoui8R39v0GgpvIUfp YQ/LihyXAHbXlRJjPnNhGaIZ+goMvo13oP8uSj+Taof5DQbZsP/u6GgoFnDeszv6Kxcg jvMJ1HGFgfz/bTRAuzLCAyqNRYVkbmsGyllaLCsJQskZQJFSVazOHmpgO0lsjB5+BF3C y5Vw== 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 :dkim-signature; bh=WFXUR7pIS1QbuY3q/lEWdi2oq8ncQDQYXHKyVcuiEDQ=; b=BDcQnFBeP+jk5AxM+PoZ2xIFZ6VDiH/d8fbnjmQJeAYvKGlOQ75l2kNRinWEpmZGfT WGKtaiieOWD+thG1r7CM5w2hVvTPxsOn2BHbXBzDYva2B2a2keZUkzY/de9n0/0u5dOD hUK0yU+HXHjxE//UjYxLVpl9wi0fzgWfGkkIrIjC7skQZ9rA6ZIOnCT8lMJ5OHBZFPHh tEdpMTFcPJRxIIeCAMOXj6pCqHJJmkv6OhFDwXFNPgzB372zpqr9pxFckqWdLAF6JiA9 pzHtIiNAosbpcjqsw/LqBYi7tFqdM/0V9tHP2loJEH9ceY2XM/3miOrVvMyk4yiQ4T23 Vv0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YO2hnQZa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t65si1972160pfd.246.2019.01.30.09.15.56; Wed, 30 Jan 2019 09:16:18 -0800 (PST) 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=@kernel.org header.s=default header.b=YO2hnQZa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732313AbfA3RP0 (ORCPT + 99 others); Wed, 30 Jan 2019 12:15:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:49296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727680AbfA3RPZ (ORCPT ); Wed, 30 Jan 2019 12:15:25 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7A9502087F; Wed, 30 Jan 2019 17:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548868525; bh=rL8MOHGzlA9uP8ZVfBxcHv6afRZ6IvHg9FHRaOPcosk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YO2hnQZac79tNmomIgsJVI8OVsrSL2Qx3EndLyD28MP07Ics+sQpM5I9hBgLBYUZZ K9hT1fGkj+1ZQOHuJ11Ae1pH69bglZxftA/ej4r/u60uibd4BZ83hKrqUhu9plKZz4 z5dw4Av/dwlRfgAnpzErEbFw5xiMb+ev/WpIDOlU= Date: Wed, 30 Jan 2019 18:15:15 +0100 From: Boris Brezillon To: Cc: , , , , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org Subject: Re: [PATCH 1/9] spi: atmel-quadspi: optimize qspi init Message-ID: <20190130181505.4f495d3a@bbrezillon> In-Reply-To: <20190130150818.24902-2-tudor.ambarus@microchip.com> References: <20190130150818.24902-1-tudor.ambarus@microchip.com> <20190130150818.24902-2-tudor.ambarus@microchip.com> 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 Wed, 30 Jan 2019 15:08:29 +0000 wrote: > From: Tudor Ambarus > > Set the QSPI controller in Serial Memory Mode at init and not > at each exec_op() call. If you ever want to support regular SPI you'll have to put it back to atmel_qspi_exec_op(), so I'm not sure this is a good move. Another approach would be to cache the MR value to avoid doing a write access on the bus when the value hasn't changed. > > Signed-off-by: Tudor Ambarus > --- > drivers/spi/atmel-quadspi.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c > index ddc712410812..f79b17792a11 100644 > --- a/drivers/spi/atmel-quadspi.c > +++ b/drivers/spi/atmel-quadspi.c > @@ -238,8 +238,6 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) > icr = QSPI_ICR_INST(op->cmd.opcode); > ifr = QSPI_IFR_INSTEN; > > - qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); > - > mode = find_mode(op); > if (mode < 0) > return -ENOTSUPP; > @@ -381,6 +379,9 @@ static int atmel_qspi_init(struct atmel_qspi *aq) > /* Reset the QSPI controller */ > qspi_writel(aq, QSPI_CR, QSPI_CR_SWRST); > > + /* Set the QSPI controller in Serial Memory Mode */ > + qspi_writel(aq, QSPI_MR, QSPI_MR_SMM); > + > /* Enable the QSPI controller */ > qspi_writel(aq, QSPI_CR, QSPI_CR_QSPIEN); >