From patchwork Sat Jul 15 01:04:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 120725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2836861vqm; Fri, 14 Jul 2023 19:48:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfyyiiIb/mJ+K89r6Tm74M6AWLU3wQ3xVdGRlfuAzOg72PcLbdiICARi5qA3pKmWox24aa X-Received: by 2002:a17:906:7482:b0:991:da66:e40b with SMTP id e2-20020a170906748200b00991da66e40bmr5850466ejl.13.1689389306451; Fri, 14 Jul 2023 19:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689389306; cv=none; d=google.com; s=arc-20160816; b=JiVvAS1Y+P1+Sxpp6emwLj3lFsIpuFGt0JwjrK+jUEdW4ify9dqxtS8P8PlcnNxdli uy7BirhUs+QPV8QzGtkSBzDu86yi0aEQ+fUbmeGshvc5gzg9Frhu+X46WiLxLJbXrJIv TY19bLvJwOKzGuEEKk+fk6ZuuuLydvacMXy+zIbQNVCSECwSkLzIol5LXAqUSK4h6gP4 BQq+54fBVHO9OqACDjj75tcgWie0ebyXhB0EIFtPZUflzUb+Ay94LibkTxhXDZEzBYdU RrV4cGHX6jaK6/vdWdI8N+h9ACJYxLCwiBe62hB+wYuoo4cF15f7+Y/lhovj51wufO5I jg3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QIrg7A20Rz1B8760wruwhlDpX5PdSOgkx1Yppzs/pcA=; fh=8SPOXdXcsbbrdLjCtKFrhdDDaSSTCLFzjvpt84tri9w=; b=oT2uAqHEjjS23Z4IOsMPxrSfrZLqabpI0TOrwDFHx5GEC8UCqPzX+38zudCdagGKN8 ZIVMgaZFZ1wvwMwtDfzaaQ3ZenJN4q8l3f/9AVhAGSkLnwJ14bkID05nf1X9r+F2fCTQ iwMqCZ3iOsfmkp8rkmXgc8TJ8fmNzDcUGvPI6XzMl5CiAlXhQdpWwx27VHyVUBjUVafd NCRZGrW5urUsQul1LunnI2lJVhX9kbNpr9kbZT7ry9LZAIvE2Yw7+TAL6pFaA5tRI4RA gv1y6CtDxL54CnAtUwFHmbOpt5X52eJUx76l5lmPEJS4Av1xdpHBaos9rk9lRKQYhi0/ rHtA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709061cc500b0099396546ffesi9226627ejh.768.2023.07.14.19.48.03; Fri, 14 Jul 2023 19:48:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229666AbjGOBE4 (ORCPT + 99 others); Fri, 14 Jul 2023 21:04:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjGOBEy (ORCPT ); Fri, 14 Jul 2023 21:04:54 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2D2B3AA6; Fri, 14 Jul 2023 18:04:37 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,206,1684767600"; d="scan'208";a="169014747" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 15 Jul 2023 10:04:36 +0900 Received: from mulinux.home (unknown [10.226.92.194]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id AFF4240C4DAF; Sat, 15 Jul 2023 10:04:33 +0900 (JST) From: Fabrizio Castro To: Mark Brown , Geert Uytterhoeven Cc: Fabrizio Castro , Andy Shevchenko , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Chris Paterson , Biju Das , Lad Prabhakar , linux-renesas-soc@vger.kernel.org Subject: [PATCH 06/10] spi: rzv2m-csi: Squash timing settings into one statement Date: Sat, 15 Jul 2023 02:04:03 +0100 Message-Id: <20230715010407.1751715-7-fabrizio.castro.jz@renesas.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230715010407.1751715-1-fabrizio.castro.jz@renesas.com> References: <20230715010407.1751715-1-fabrizio.castro.jz@renesas.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771453081496128306 X-GMAIL-MSGID: 1771453081496128306 Register CLKSEL hosts the configuration for both clock polarity and data phase, and both values can be set in one write operation. Squash the clock polarity and data phase register writes into one statement, for efficiency. Signed-off-by: Fabrizio Castro --- drivers/spi/spi-rzv2m-csi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-rzv2m-csi.c b/drivers/spi/spi-rzv2m-csi.c index 038f1486b7d7..faf5898bc3e0 100644 --- a/drivers/spi/spi-rzv2m-csi.c +++ b/drivers/spi/spi-rzv2m-csi.c @@ -38,6 +38,7 @@ /* CSI_CLKSEL */ #define CSI_CLKSEL_CKP BIT(17) #define CSI_CLKSEL_DAP BIT(16) +#define CSI_CLKSEL_MODE (CSI_CLKSEL_CKP|CSI_CLKSEL_DAP) #define CSI_CLKSEL_SLAVE BIT(15) #define CSI_CLKSEL_CKS GENMASK(14, 1) @@ -408,10 +409,8 @@ static int rzv2m_csi_setup(struct spi_device *spi) writel(CSI_MODE_SETUP, csi->base + CSI_MODE); /* Setup clock polarity and phase timing */ - rzv2m_csi_reg_write_bit(csi, CSI_CLKSEL, CSI_CLKSEL_CKP, - !(spi->mode & SPI_CPOL)); - rzv2m_csi_reg_write_bit(csi, CSI_CLKSEL, CSI_CLKSEL_DAP, - !(spi->mode & SPI_CPHA)); + rzv2m_csi_reg_write_bit(csi, CSI_CLKSEL, CSI_CLKSEL_MODE, + ~spi->mode & SPI_MODE_X_MASK); /* Setup serial data order */ rzv2m_csi_reg_write_bit(csi, CSI_MODE, CSI_MODE_DIR,