From patchwork Sat Jul 15 01:04:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabrizio Castro X-Patchwork-Id: 120724 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2836813vqm; Fri, 14 Jul 2023 19:48:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdnR5nGa7t/Ms86YeIZGdyFBwpQBFyCCSb4a7DWPHhMLTcjjao00A+V31eML3hm2v3Zisw X-Received: by 2002:a17:906:28a:b0:993:a37a:cb4c with SMTP id 10-20020a170906028a00b00993a37acb4cmr5787227ejf.9.1689389297096; Fri, 14 Jul 2023 19:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689389297; cv=none; d=google.com; s=arc-20160816; b=sY+UVcwPxw6jptXs5HpA9lNp9VbOiYyy0wJ2A40ELEcZF6cuoqfON2LPZQN+h0myDX 7nNcOcC68/siISDiqSddp8YWaXzoyOLWKLOGsy0yOFK/IlwAXvLnvRQ31K8jHLCH83sa KKXhS339oBIpVzHJcjQSst7cOBOVpEMAoMKtV/6OfC4fses0yqn4eXfWWnGyKwenpnCr XR9XI9nUgUKqCF2xcwguV7Up0FbcPHjo0VCQrHvoiNfLIk42FpH+obQdu6E+OJ0lfH5A GEp162c+nNNHfKN43Zx4ICG9MUc3vtMFdOq7wBZg90v72HytOz65H28HlzFgq/uGLea5 IKKA== 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=VDA9NpR+9Sg4wqsA/iVRiRDK6i8+5geo4C9KREefwqI=; fh=8SPOXdXcsbbrdLjCtKFrhdDDaSSTCLFzjvpt84tri9w=; b=tv0uVIKI5f7M2DBi+er0nhgifn6qdOvzbVdKSbsXT0/uSrdSfhAWy1cThOE94tM8Qv /7OytXznzw02L5YeIbHEYVu5NzhDX31mtni5s1Nzw59Kkgbh9tL5D1vGk6m353HqZVU4 c7o7fWbcUBTjxGFBpfFCoXVPFa6FxRmTMtcbijnlIRmyvE5aLSP4hIwm6m06Zzrn9wRb 16u/M5gioad0nbfMvhof/uoVokIwdTySkjuA/yfWoyY9O/v340y/W+IIN62onpU/u641 kYcHwVYoUFkLWxJXyGLeCiyi8zCQs6stFdP/+lwZsivgWjzOmxYyB4StSs7p2dw7FzB1 T3Qw== 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 u26-20020a1709064ada00b009924c43105csi9827143ejt.94.2023.07.14.19.47.54; Fri, 14 Jul 2023 19:48:17 -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 S230171AbjGOBEa (ORCPT + 99 others); Fri, 14 Jul 2023 21:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbjGOBE1 (ORCPT ); Fri, 14 Jul 2023 21:04:27 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0C5373AAD; Fri, 14 Jul 2023 18:04:25 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,206,1684767600"; d="scan'208";a="172657800" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 15 Jul 2023 10:04:25 +0900 Received: from mulinux.home (unknown [10.226.92.194]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C4D6140C4DA2; Sat, 15 Jul 2023 10:04:22 +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 03/10] spi: rzv2m-csi: Rework CSI_CKS_MAX definition Date: Sat, 15 Jul 2023 02:04:00 +0100 Message-Id: <20230715010407.1751715-4-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: 1771453071538712325 X-GMAIL-MSGID: 1771453071538712325 Clock "csiclk" gets divided by 2 * CSI_CLKSEL_CKS in order to generate the serial clock (output from master), with CSI_CLKSEL_CKS ranging from 0x1 (that means "csiclk" is divided by 2) to 0x3FFF ("csiclk" is divided by 32766). CSI_CKS_MAX is used for referring to the setting corresponding to the maximum frequency divider. Value 0x3FFF for CSI_CKS_MAX doesn't really means much to the reader without an explanation and a more readable definition. Add a comment with a meaningful description and also replace value 0x3FFF with the corresponding GENMASK, to make it very clear what the macro means. Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven --- drivers/spi/spi-rzv2m-csi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-rzv2m-csi.c b/drivers/spi/spi-rzv2m-csi.c index 3931045a85eb..621774949bde 100644 --- a/drivers/spi/spi-rzv2m-csi.c +++ b/drivers/spi/spi-rzv2m-csi.c @@ -65,7 +65,12 @@ #define CSI_FIFO_SIZE_BYTES 32 #define CSI_FIFO_HALF_SIZE 16 #define CSI_EN_DIS_TIMEOUT_US 100 -#define CSI_CKS_MAX 0x3FFF +/* + * Clock "csiclk" gets divided by 2 * CSI_CLKSEL_CKS in order to generate the + * serial clock (output from master), with CSI_CLKSEL_CKS ranging from 0x1 (that + * means "csiclk" is divided by 2) to 0x3FFF ("csiclk" is divided by 32766). + */ +#define CSI_CKS_MAX GENMASK(13, 0) #define UNDERRUN_ERROR BIT(0) #define OVERFLOW_ERROR BIT(1)