Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp708915lqc; Fri, 8 Mar 2024 09:22:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVvgimmB89wMFJaOGIdIK4AYOCok/NSx7MsLAjf5lLKd+9yfsTNjE2naczuvbYmb9wqGchrWkKFdndbUddW0kettS0O/6MTPQ+FC/wg6g== X-Google-Smtp-Source: AGHT+IEjCUcIWg+TGHmWuohNxb7OXg+LGGwTyQfChlo4DDCjlJD+LoUp1TAtgp+O0XQHj3XGcQui X-Received: by 2002:a17:90b:19c8:b0:29b:b854:db with SMTP id nm8-20020a17090b19c800b0029bb85400dbmr623400pjb.27.1709918539829; Fri, 08 Mar 2024 09:22:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709918539; cv=pass; d=google.com; s=arc-20160816; b=d8uxy8Md8giLRMnJUgOUZgQJ59fFi2w6nZES81fYttxrNyn2ITSCwvsiNzpCZACEoA UsDcvwTHoYD5Agc+7kDvdrChwgi2ATSdSHcCxB/sQNsmWXmKmZfjreqnR9+wxKobv52E ZEPSGZgMWpMfz+7UciiRfRioHsWC6blUfoR73ESTYHBKHX2IpUrwm+IDf9ZkMWtzzc3v rXOJB9Wa7RYvKfuOTBZvSfwlwJG+VCo36FJPrBd9Q/vwJjaqv3vv8ZSHB+o9R2zI98Nm A+DYJ5aJGceuZ2Ru23mwRyQ9ApNlIH8FhnZbb4O97q2wyEMpE6NH9ZDas/GM5q7wfeeA 7kcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=wU600EcnHX7eTl5hRWQKY3CNjHvFq+CeJaAfPTEOFUc=; fh=IFZx66juwxwjgBVbjzEtAtqYWBzPzwE1Kpx7PM9KIjE=; b=tt9yXZG7uREyLJuRF/gXQogAacyeKDT7tMFt0Y/5kC7KUJuQfeO82EhTR+fEc8fTEq UYR+mjtDeXffvvUfUzbwGDFWPnCeR+M/gHhOB+odD+6J9qNnqfZ+D64bpE7yP66VALbu U5QfqJse7bJHYfOAwFgNyHOu9U6qLFgw/OmgocV2ehXfvbOhvd/1VmgDw2PM/5rC4PH8 dt8Znc297qMd8pS6UjWfknwnoGvrEbXgFHiAOZJnSLZiSwzOaq4bGuJniOrf+djTcY5E na5rxzEceP6anFTlFa+FOwiak7gxhhbVEvL5onIEKTy0dVE3NTzqQcc+FYzwDCDEak2c iPww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EP25NqWk; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-97371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l196-20020a633ecd000000b005d795f96f31si16571274pga.152.2024.03.08.09.22.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:22:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=EP25NqWk; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-97371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 59BA9B213EB for ; Fri, 8 Mar 2024 17:20:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 459FE5C917; Fri, 8 Mar 2024 17:18:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="EP25NqWk" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 944C53BBF9; Fri, 8 Mar 2024 17:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918310; cv=none; b=WbnBv/uJkjyLiM766nc+Zk8IMQo1qb7oebyE1IIpdoJZZmIPkvNgga45o0DhfqVFcaARCsOY0bo8d1HqqXzAVVnOpkjvN7iQUDCEnIjAzEF8i8ozOPtoLIZMkOxp7FBVHXXsbMIO7NoAdRjbkAE5zTormEqivyU1F8kj3GbjOUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709918310; c=relaxed/simple; bh=YXqqaMLJ6VjihU/yGeXa28hiwOZ8Xv4a3RM0++ZGF0o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VM5dtrt3vsT4HLSaruKk8DxFw+aH2GcCNDHvdU+I2trWSR6fFJKCHsuhtwx2p4iQTlOfEsGpJVrNC0g1PwfuaDyIUp3dQLPRVHmAkKvjLeUpBCXLQ9DMpML6usw7PgGbqYIVE77Y+NX4hPEuxDNdaHJKaXvHrjsGr+t8DOBSRSc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=EP25NqWk; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 0B513C000A; Fri, 8 Mar 2024 17:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709918301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wU600EcnHX7eTl5hRWQKY3CNjHvFq+CeJaAfPTEOFUc=; b=EP25NqWk261JTUwPQQ+pVqeH6Dt0/r21G0RH4ltvXsAu/MAIcSZuNSF0/Ba0Mdb9PSe0kZ 6MCPmZj/a8EE4ReQdaoylpl8Egk6uXTdam9BRxQMKVJI8mRuJECpZ2ZM1EAmLzQGgIpOsN Oxy9gZ14vXmKCNpW/31AkDA0staM3HGH/sqdVFQ8Pqvmv2agyBJSk3pf9OPDUiHA+mxvMD P5ZAHgWLyk72mcLZAHZnaNFkPkJy1rR24TAfyTQzJ2bT6wUUsnanZ7+pFUns/eU771VzXV VyvHdtGRb64AJFXeFqDK0+gE/Guw1vRdaLRN4zvR+aTa/w8ga9yCzNe5xRPCvw== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Fri, 08 Mar 2024 18:18:21 +0100 Subject: [PATCH 06/11] spi: cadence-qspi: minimise register accesses on each op if !DTR Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240308-cdns-qspi-mbly-v1-6-a503856dd205@bootlin.com> References: <20240308-cdns-qspi-mbly-v1-0-a503856dd205@bootlin.com> In-Reply-To: <20240308-cdns-qspi-mbly-v1-0-a503856dd205@bootlin.com> To: Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vaishnav Achath , Thomas Bogendoerfer Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Vladimir Kondratiev , Gregory CLEMENT , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.13.0 X-GND-Sasl: theo.lebrun@bootlin.com cqspi_enable_dtr() is called for each operation, commands or not, reads or writes. It writes CQSPI_REG_CONFIG then waits for idle (three successful reads). Skip that in the no-DTR case if DTR is already disabled. It cannot be skipped in the DTR case as cqspi_setup_opcode_ext() writes to a register and we must wait for idle state. According to ftrace, the average cqspi_exec_mem_op() call goes from 85.4µs to 83.6µs when reading 235M over UBIFS on an octal flash. Signed-off-by: Théo Lebrun --- drivers/spi/spi-cadence-quadspi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index d178148788f0..0fc452bab0ee 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -492,8 +492,11 @@ static int cqspi_enable_dtr(struct cqspi_flash_pdata *f_pdata, if (ret) return ret; } else { - reg &= ~CQSPI_REG_CONFIG_DTR_PROTO; - reg &= ~CQSPI_REG_CONFIG_DUAL_OPCODE; + unsigned int mask = CQSPI_REG_CONFIG_DTR_PROTO | CQSPI_REG_CONFIG_DUAL_OPCODE; + /* Shortcut if DTR is already disabled. */ + if ((reg & mask) == 0) + return 0; + reg &= ~mask; } writel(reg, reg_base + CQSPI_REG_CONFIG); -- 2.44.0