Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp286258rdb; Thu, 19 Oct 2023 04:45:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHk+f6oF9t3onjkiNn5JtsArpq0m9G6AEwC15cNh/hPjpPYii4+SVh375cx7Hmf6n57YQC5 X-Received: by 2002:a05:6e02:b4b:b0:352:a306:9ad1 with SMTP id f11-20020a056e020b4b00b00352a3069ad1mr2527182ilu.0.1697715907730; Thu, 19 Oct 2023 04:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697715907; cv=none; d=google.com; s=arc-20160816; b=fZSOSJqTvlpNotAWEl0VdKclG3/h5OMFrp7DoSB1ot6DJkqkaQegsSfDxPDIpbU3W4 bf+agFneSxhK2H8S+IBSwOQSOBGn1R/LThW51+9radQd2o7H442XrjSu5luLHiowZeuk NTVBPVQiUr35++vxHwE7e5Vtxud57sqrV22bIZl3NoJ1ZiYOxdcW7uVHUVZEsh2EqM0M UaleFQVeTVy6OflM2LMjw3zamRdlbZIggdfiu2i/7acAvvLF4xgJcUxf1r71/4/Wg0Zr V/iZCvVMv3H4DwhNsAvM3FcDDkXM9yuwBRxXkU1diDm0s5NMtoVel27jq/+vt1cCcvXa MTKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type:thread-index :content-language:content-transfer-encoding:mime-version:message-id :date:subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=63ihKBSu3G/vqK4eE3j6mAFoN2L9Sl4C+4eOviUKPPo=; fh=za2Ddqh0pPdNj4p+pypF3ipiFhfLO31rK06zIw+vlFU=; b=MNMGBvm35RHcABxQGGl4UW+0YPVZS6efOPNX/oug/r5+cqoHGL9Rk7eeFSRS78fsnd uqSKooipC3aukLojM2Fik2eBMGG6EZtq5kyx6lQdNW0xQNeENa+jIGihaXs2Flgj9UZW 4FEDygDHwCcKz5A7fzJohebs7fNDKWu1ki+KW2/VLiMsuABYSY1LYVUqJKlFV7AdXaiH wA8VVW8MofSlpr6ql4GLZ6OF/Ohq79aGBPagTi2DjiXAVXwwzXFmRt74MgwKYDNJiTO7 kA6K5Vnth4IIxk3ubM9L5ggLPve7oDpyfYiSACHtVBG5etxYqHKZe2fe7i0YFj+n8ukq 53KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cA28BYfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bx30-20020a056a02051e00b00577680ccf1bsi4958598pgb.709.2023.10.19.04.45.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cA28BYfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C2C42827D0DE; Thu, 19 Oct 2023 04:45:03 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233048AbjJSLo4 (ORCPT + 99 others); Thu, 19 Oct 2023 07:44:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235244AbjJSLoy (ORCPT ); Thu, 19 Oct 2023 07:44:54 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBF4913A for ; Thu, 19 Oct 2023 04:44:50 -0700 (PDT) Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231019114449epoutp010f80a28e251036f1547c1719ee4f4eb8~Pf5s61ZgT0905009050epoutp01T for ; Thu, 19 Oct 2023 11:44:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231019114449epoutp010f80a28e251036f1547c1719ee4f4eb8~Pf5s61ZgT0905009050epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1697715889; bh=63ihKBSu3G/vqK4eE3j6mAFoN2L9Sl4C+4eOviUKPPo=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=cA28BYfCVhmM7bxmD5xPsQ/sVf1k1aOSlqnjQGqDCXLAYvTrQPd5Go+2ZlW0KxI7W +P+OVdO1TNWfkZPFYZed4ldbJ+VM8QxuFxpqcSf3NgqX2CmOT3fk9S/uyRGh38wp7b AsAew7PEEZOTP9DRStJ643uql3gv5TOECMsWzvGA= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20231019114448epcas1p366f78a1bb07e8c4cf92ce22c3a311a1b~Pf5sL97dt3194231942epcas1p3A; Thu, 19 Oct 2023 11:44:48 +0000 (GMT) Received: from epsmgec1p1.samsung.com (unknown [182.195.38.236]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4SB5VR0rPkz4x9Pt; Thu, 19 Oct 2023 11:44:47 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmgec1p1.samsung.com (Symantec Messaging Gateway) with SMTP id D6.6D.08572.EA611356; Thu, 19 Oct 2023 20:44:47 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231019114446epcas1p1d101a7ff9d9f5f3997e5fab119e4003e~Pf5qU98Ha3129131291epcas1p1X; Thu, 19 Oct 2023 11:44:46 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231019114446epsmtrp2c2eb1e568beeef2038b9041c18e796c7~Pf5qT-Brc0385703857epsmtrp2L; Thu, 19 Oct 2023 11:44:46 +0000 (GMT) X-AuditID: b6c32a33-cefff7000000217c-70-653116ae95f1 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id C7.88.07368.EA611356; Thu, 19 Oct 2023 20:44:46 +0900 (KST) Received: from cw00choi03 (unknown [10.113.111.106]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20231019114446epsmtip197211385f5e777c8100f3e6579ddd765~Pf5p-tXKT1545115451epsmtip1H; Thu, 19 Oct 2023 11:44:46 +0000 (GMT) From: "Chanwoo Choi" To: "'Sascha Hauer'" , Cc: , , , "'Heiko Stuebner'" , "'Chanwoo Choi'" , "'Kyungmin Park'" , "'MyungJoo Ham'" , "'Will Deacon'" , "'Mark Rutland'" , , "'Michael Riesch'" , "'Robin Murphy'" , "'Vincent Legoll'" , "'Rob Herring'" , "'Krzysztof Kozlowski'" , "'Conor Dooley'" , , "'Sebastian Reichel'" In-Reply-To: <20231018061714.3553817-10-s.hauer@pengutronix.de> Subject: RE: [PATCH v8 09/26] PM / devfreq: rockchip-dfi: Clean up DDR type register defines Date: Thu, 19 Oct 2023 20:44:45 +0900 Message-ID: <001001da0281$a88dc130$f9a94390$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microso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V56XrJ+bmbGMHRr6Wxg/He/H96hxiZ OBiBPuRgVhLhVfUwSBXiTUmsrEotyo8vKs1JLT7EKM3BoiTOazhjdoqQQHpiSWp2ampBahFM lomDU6qBSd35+sXVup5yT8P2umheXmzY6OBy/095V8Y3/6MWJ/fZKc+7K2N3Z+MFH/0s6TWt +fEZB2UEOXZqbJSa+ERrl82Wd1YdiiGr/j0VZk81XjonuOvxfaOlbuUTC7dzn5o+Kz+6cMm9 xY9+uOwIqtWTnW8b/TDsprbvkY+/tesnNS4SsQn79Mr6TfKfRXP7rpyfwn7llSH/YpdH/ifL tplMuZ3+Lc7s2ze1xIy1J1gfrt21+b3zXIHspz1S904uDok4/fiatZP3nzWrn3NO/FBbU6rH NSfhpeetugk9egcKvJ8unfNPbV9dXJ3aNJW/fybXr2e5+yXyId8X3YDgdnYDn0Pbl4UqGut6 pJv1/3xYrqjEUpyRaKjFXFScCABq2KtMbQMAAA== X-CMS-MailID: 20231019114446epcas1p1d101a7ff9d9f5f3997e5fab119e4003e X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231018063811epcas1p218e4ddfbd99e2135ddb77facd9197207 References: <20231018061714.3553817-1-s.hauer@pengutronix.de> <20231018061714.3553817-10-s.hauer@pengutronix.de> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 19 Oct 2023 04:45:03 -0700 (PDT) > -----Original Message----- > From: Sascha Hauer > Sent: Wednesday, October 18, 2023 3:17 PM > To: linux-rockchip@lists.infradead.org > Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > linux-pm@vger.kernel.org; Heiko Stuebner ; Chanwoo Choi > ; Kyungmin Park ; MyungJoo > Ham ; Will Deacon ; Mark > Rutland ; kernel@pengutronix.de; Michael Riesch > ; Robin Murphy ; > Vincent Legoll ; Rob Herring > ; Krzysztof Kozlowski > ; Conor Dooley ; > devicetree@vger.kernel.org; Sebastian Reichel > ; Sascha Hauer ; > Chanwoo Choi > Subject: [PATCH v8 09/26] PM / devfreq: rockchip-dfi: Clean up DDR type > register defines > > Use the HIWORD_UPDATE() define known from other rockchip drivers to make > the defines look less odd to the readers who've seen other rockchip > drivers. > > The HIWORD registers have their functional bits in the lower 16 bits > whereas the upper 16 bits contain a mask. Only the functional bits that > have the corresponding mask bit set are modified during a write. Although > the register writes look different, the end result should be the same, at > least there's no functional change intended with this patch. > > Signed-off-by: Sascha Hauer > Reviewed-by: Sebastian Reichel > Acked-by: Chanwoo Choi > --- > drivers/devfreq/event/rockchip-dfi.c | 33 ++++++++++++++++++---------- > 1 file changed, 21 insertions(+), 12 deletions(-) > > diff --git a/drivers/devfreq/event/rockchip-dfi.c > b/drivers/devfreq/event/rockchip-dfi.c > index 82d18c60538a5..12f9096879235 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -26,15 +26,19 @@ > > #define DMC_MAX_CHANNELS 2 > > +#define HIWORD_UPDATE(val, mask) ((val) | (mask) << 16) > + > /* DDRMON_CTRL */ > #define DDRMON_CTRL 0x04 > -#define CLR_DDRMON_CTRL (0x1f0000 << 0) > -#define LPDDR4_EN (0x10001 << 4) > -#define HARDWARE_EN (0x10001 << 3) > -#define LPDDR3_EN (0x10001 << 2) > -#define SOFTWARE_EN (0x10001 << 1) > -#define SOFTWARE_DIS (0x10000 << 1) > -#define TIME_CNT_EN (0x10001 << 0) > +#define DDRMON_CTRL_DDR4 BIT(5) > +#define DDRMON_CTRL_LPDDR4 BIT(4) > +#define DDRMON_CTRL_HARDWARE_EN BIT(3) > +#define DDRMON_CTRL_LPDDR23 BIT(2) > +#define DDRMON_CTRL_SOFTWARE_EN BIT(1) > +#define DDRMON_CTRL_TIMER_CNT_EN BIT(0) > +#define DDRMON_CTRL_DDR_TYPE_MASK (DDRMON_CTRL_DDR4 | \ > + DDRMON_CTRL_LPDDR4 | \ > + DDRMON_CTRL_LPDDR23) > > #define DDRMON_CH0_COUNT_NUM 0x28 > #define DDRMON_CH0_DFI_ACCESS_NUM 0x2c > @@ -74,16 +78,20 @@ static void rockchip_dfi_start_hardware_counter(struct > devfreq_event_dev *edev) > void __iomem *dfi_regs = dfi->regs; > > /* clear DDRMON_CTRL setting */ > - writel_relaxed(CLR_DDRMON_CTRL, dfi_regs + DDRMON_CTRL); > + writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_TIMER_CNT_EN | > DDRMON_CTRL_SOFTWARE_EN | > + DDRMON_CTRL_HARDWARE_EN), dfi_regs + DDRMON_CTRL); > > /* set ddr type to dfi */ > if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR3) > - writel_relaxed(LPDDR3_EN, dfi_regs + DDRMON_CTRL); > + writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR23, > DDRMON_CTRL_DDR_TYPE_MASK), > + dfi_regs + DDRMON_CTRL); > else if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR4) > - writel_relaxed(LPDDR4_EN, dfi_regs + DDRMON_CTRL); > + writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_LPDDR4, > DDRMON_CTRL_DDR_TYPE_MASK), > + dfi_regs + DDRMON_CTRL); > > /* enable count, use software mode */ > - writel_relaxed(SOFTWARE_EN, dfi_regs + DDRMON_CTRL); > + writel_relaxed(HIWORD_UPDATE(DDRMON_CTRL_SOFTWARE_EN, > DDRMON_CTRL_SOFTWARE_EN), > + dfi_regs + DDRMON_CTRL); > } > > static void rockchip_dfi_stop_hardware_counter(struct devfreq_event_dev > *edev) @@ -91,7 +99,8 @@ static void > rockchip_dfi_stop_hardware_counter(struct devfreq_event_dev *edev) > struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev); > void __iomem *dfi_regs = dfi->regs; > > - writel_relaxed(SOFTWARE_DIS, dfi_regs + DDRMON_CTRL); > + writel_relaxed(HIWORD_UPDATE(0, DDRMON_CTRL_SOFTWARE_EN), > + dfi_regs + DDRMON_CTRL); > } > > static void rockchip_dfi_read_counters(struct devfreq_event_dev *edev, > struct dmc_count *count) > -- > 2.39.2 Applied it. Thanks Best Regards, Chanwoo Choi