Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp285713rdb; Thu, 19 Oct 2023 04:43:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLq34IxwdM/FltLtpwO0+omUHowCQdtZQGyqyKWVx0mGZTsnObPilI2VlavyzNDL6hjxXQ X-Received: by 2002:a05:6a00:13a3:b0:6be:5e64:babb with SMTP id t35-20020a056a0013a300b006be5e64babbmr2003224pfg.18.1697715836558; Thu, 19 Oct 2023 04:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697715836; cv=none; d=google.com; s=arc-20160816; b=eXdmcTxWzCwoGOdGA5SBTNgWHmL41WmtAb3hV4rMfvPqWB3NWJjgW5P8TbQ0qnn4nL Q9Vapv5OeY1H/nZfczi+IszzxTVImhrIlO7AsbjWq8fAdvyUt67XJjEFNclHKZT/DtOF 6a+w/cx0jEVAzfEIBR97bdlGIPQDw1DQdUbvTsU2p5fp1+IELxEaCjOVjmWPQk/wySjV 29Nj+0Hly4K4PtW5WqOjmbmvkdmHoS8DUTEuJDZ0BtPp6+BXdifP1IJM37gARzWWUX9H YxwuKozwTNYl/sOXcp0qAy9ez3BKmArX0f9/qFp1y3YJdT66GuT042JWCvLrbgWX1uqx 71ww== 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=K1ITzz+sTFe6DaFJgr1p3d9Rn4oprGlq4PJl8l40mZQ=; fh=za2Ddqh0pPdNj4p+pypF3ipiFhfLO31rK06zIw+vlFU=; b=Wnutq+uM+VX+GWAiMfqK0nGoa9styOwj9rCX5SL/IPTs7/vFGp9gj/x9ZTKbG1QIY5 yuHCRVGrXATgNEwB5oOOZ0V8XSv8VjHjkdHLIX0Kv4KmOX3LzWYSDg5o7sGRE2/QrGCM HMMi1Uja4odAxtV3H2aq2YGzP9FzwIalTt1bu0Vap4ymOpdscjiw1Sg8Nrxk3VXvKCQX WlQrJDcycBKWRvzoUIwDRXtSVR5y//h8qa2RcW3UFonuOYzprbOmsdJ1S8Gls/aCvY+G rKtRHb8EIEfyqYXgX5S/ZEAJDc/5L65bBSFamu+WSTSFY+qiqyzGDZ9AkQroBejPd8LB fZeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=auFC0JBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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. [23.128.96.31]) by mx.google.com with ESMTPS id d3-20020a056a00244300b006b0cfed2c77si6390355pfj.135.2023.10.19.04.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 04:43:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=auFC0JBM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 EDABA826EE0E; Thu, 19 Oct 2023 04:43:53 -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 S1345355AbjJSLnp (ORCPT + 99 others); Thu, 19 Oct 2023 07:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234920AbjJSLnn (ORCPT ); Thu, 19 Oct 2023 07:43:43 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADE412F for ; Thu, 19 Oct 2023 04:43:40 -0700 (PDT) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20231019114338epoutp011faf8e201c5f697019a13a4ebda0da42~Pf4q_hy7F0692206922epoutp016 for ; Thu, 19 Oct 2023 11:43:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20231019114338epoutp011faf8e201c5f697019a13a4ebda0da42~Pf4q_hy7F0692206922epoutp016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1697715818; bh=K1ITzz+sTFe6DaFJgr1p3d9Rn4oprGlq4PJl8l40mZQ=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=auFC0JBM9Zm/6kBYhdRRp2ocsK6OeCfkqUdsWkYaTrGk0VZ1W/QYvbBgDsDjKu7zQ ZjKpK/CWHIHpjkheZQkbTwKYPgoMcy3u3A114yfl9lVtXz0NIPnXCCXcMKZqxY+q6P BRUi5s9tdBV3s51BPdUnE6km5OfwVsUZxkpFphq0= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20231019114337epcas1p49dcfa98fbe54331e5ca2ffc9f652b543~Pf4qWSjxt1956119561epcas1p4S; Thu, 19 Oct 2023 11:43:37 +0000 (GMT) Received: from epsmges1p4.samsung.com (unknown [182.195.38.235]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4SB5T45k8sz4x9Px; Thu, 19 Oct 2023 11:43:36 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p4.samsung.com (Symantec Messaging Gateway) with SMTP id 56.AC.10211.86611356; Thu, 19 Oct 2023 20:43:36 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20231019114336epcas1p3f095e27fc7963b81600827776bcd46da~Pf4o2eh-p0809508095epcas1p3-; Thu, 19 Oct 2023 11:43:36 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231019114336epsmtrp167c58f9a220bb591f15e5399838662ad~Pf4o1d5Eq1431314313epsmtrp1j; Thu, 19 Oct 2023 11:43:36 +0000 (GMT) X-AuditID: b6c32a38-6d3fd700000027e3-85-65311668a211 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 2A.78.07368.76611356; Thu, 19 Oct 2023 20:43:36 +0900 (KST) Received: from cw00choi03 (unknown [10.113.111.106]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231019114335epsmtip21801ba4e2c8672366111816f39abca46~Pf4oiWFYt2627126271epsmtip2H; Thu, 19 Oct 2023 11:43:35 +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-9-s.hauer@pengutronix.de> Subject: RE: [PATCH v8 08/26] PM / devfreq: rk3399_dmc,dfi: generalize DDRTYPE defines Date: Thu, 19 Oct 2023 20:43:35 +0900 Message-ID: <000f01da0281$7ea9b9a0$7bfd2ce0$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft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35v/TO8TIxMF4 iFGCg1lJhFfVwyBViDclsbIqtSg/vqg0J7X4EKM0B4uSOK/hjNkpQgLpiSWp2ampBalFMFkm Dk6pBqbG2oT2XQqeLHWH5s+aef7ToWmXJb36/Ga/XVA02VpJOisoVUIgMlQspZW95OfO7zMf bUjgPrXpq9tczqvvNu5n5PprG6fh9/Gz2GKV7UemlmrnloR8WZ6bPzU/2fIli9UHlnr2HkNh ZdVSx+2yW40KOrmrY0XEzNdwxR1Mf5o1+eptxxmvJKvnHTrHGWT+5ldog32VkJGpVfn8DxGn 30/LPZCb8mF/GufXpsd2Qgpb4uVl1R6XnfNUen6g3WGd89YtaZcWNRawncn+fsBxc3jblZdm vx5viFqnGNNz3j3Wj1/n5d0wxTcGNoFBcw6GBCav7dmZWHqPSzndcu6a/R8up/86duHem4js NVx/0pRYijMSDbWYi4oTAS5nc6xuAwAA X-CMS-MailID: 20231019114336epcas1p3f095e27fc7963b81600827776bcd46da 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: 20231018063650epcas1p1e1d5a928d4dd4b205cc9e2b71b35e23a References: <20231018061714.3553817-1-s.hauer@pengutronix.de> <20231018061714.3553817-9-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:43:54 -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 08/26] PM / devfreq: rk3399_dmc,dfi: generalize DDRTYPE > defines > > The DDRTYPE defines are named to be RK3399 specific, but they can be used > for other Rockchip SoCs as well, so replace the RK3399_PMUGRF_ prefix with > ROCKCHIP_. They are defined in a SoC specific header file, so when > generalizing the prefix also move the new defines to a SoC agnostic header > file. While at it use GENMASK to define the DDRTYPE bitfield and give it a > name including the full register name. > > Reviewed-by: Sebastian Reichel > Acked-by: Chanwoo Choi > Signed-off-by: Sascha Hauer > --- > drivers/devfreq/event/rockchip-dfi.c | 9 +++++---- > drivers/devfreq/rk3399_dmc.c | 10 +++++----- > include/soc/rockchip/rk3399_grf.h | 7 +------ > include/soc/rockchip/rockchip_grf.h | 17 +++++++++++++++++ > 4 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 > include/soc/rockchip/rockchip_grf.h > > diff --git a/drivers/devfreq/event/rockchip-dfi.c > b/drivers/devfreq/event/rockchip-dfi.c > index 28c18bbf6baa5..82d18c60538a5 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -18,8 +18,10 @@ > #include > #include > #include > +#include > #include > > +#include > #include > > #define DMC_MAX_CHANNELS 2 > @@ -75,9 +77,9 @@ static void rockchip_dfi_start_hardware_counter(struct > devfreq_event_dev *edev) > writel_relaxed(CLR_DDRMON_CTRL, dfi_regs + DDRMON_CTRL); > > /* set ddr type to dfi */ > - if (dfi->ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR3) > + if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR3) > writel_relaxed(LPDDR3_EN, dfi_regs + DDRMON_CTRL); > - else if (dfi->ddr_type == RK3399_PMUGRF_DDRTYPE_LPDDR4) > + else if (dfi->ddr_type == ROCKCHIP_DDRTYPE_LPDDR4) > writel_relaxed(LPDDR4_EN, dfi_regs + DDRMON_CTRL); > > /* enable count, use software mode */ > @@ -192,8 +194,7 @@ static int rk3399_dfi_init(struct rockchip_dfi *dfi) > > /* get ddr type */ > regmap_read(regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); > - dfi->ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) & > - RK3399_PMUGRF_DDRTYPE_MASK; > + dfi->ddr_type = FIELD_GET(RK3399_PMUGRF_OS_REG2_DDRTYPE, val); > > dfi->channel_mask = GENMASK(1, 0); > dfi->max_channels = 2; > diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c > index daff407026157..fd2c5ffedf41e 100644 > --- a/drivers/devfreq/rk3399_dmc.c > +++ b/drivers/devfreq/rk3399_dmc.c > @@ -22,6 +22,7 @@ > #include > > #include > +#include > #include > #include > > @@ -381,17 +382,16 @@ static int rk3399_dmcfreq_probe(struct > platform_device *pdev) > } > > regmap_read(data->regmap_pmu, RK3399_PMUGRF_OS_REG2, &val); > - ddr_type = (val >> RK3399_PMUGRF_DDRTYPE_SHIFT) & > - RK3399_PMUGRF_DDRTYPE_MASK; > + ddr_type = FIELD_GET(RK3399_PMUGRF_OS_REG2_DDRTYPE, val); > > switch (ddr_type) { > - case RK3399_PMUGRF_DDRTYPE_DDR3: > + case ROCKCHIP_DDRTYPE_DDR3: > data->odt_dis_freq = data->ddr3_odt_dis_freq; > break; > - case RK3399_PMUGRF_DDRTYPE_LPDDR3: > + case ROCKCHIP_DDRTYPE_LPDDR3: > data->odt_dis_freq = data->lpddr3_odt_dis_freq; > break; > - case RK3399_PMUGRF_DDRTYPE_LPDDR4: > + case ROCKCHIP_DDRTYPE_LPDDR4: > data->odt_dis_freq = data->lpddr4_odt_dis_freq; > break; > default: > diff --git a/include/soc/rockchip/rk3399_grf.h > b/include/soc/rockchip/rk3399_grf.h > index 3eebabcb28123..775f8444bea8d 100644 > --- a/include/soc/rockchip/rk3399_grf.h > +++ b/include/soc/rockchip/rk3399_grf.h > @@ -11,11 +11,6 @@ > > /* PMU GRF Registers */ > #define RK3399_PMUGRF_OS_REG2 0x308 > -#define RK3399_PMUGRF_DDRTYPE_SHIFT 13 > -#define RK3399_PMUGRF_DDRTYPE_MASK 7 > -#define RK3399_PMUGRF_DDRTYPE_DDR3 3 > -#define RK3399_PMUGRF_DDRTYPE_LPDDR2 5 > -#define RK3399_PMUGRF_DDRTYPE_LPDDR3 6 > -#define RK3399_PMUGRF_DDRTYPE_LPDDR4 7 > +#define RK3399_PMUGRF_OS_REG2_DDRTYPE GENMASK(15, 13) > > #endif > diff --git a/include/soc/rockchip/rockchip_grf.h > b/include/soc/rockchip/rockchip_grf.h > new file mode 100644 > index 0000000000000..dde1a9796ccb5 > --- /dev/null > +++ b/include/soc/rockchip/rockchip_grf.h > @@ -0,0 +1,17 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +/* > + * Rockchip General Register Files definitions */ > + > +#ifndef __SOC_ROCKCHIP_GRF_H > +#define __SOC_ROCKCHIP_GRF_H > + > +/* Rockchip DDRTYPE defines */ > +enum { > + ROCKCHIP_DDRTYPE_DDR3 = 3, > + ROCKCHIP_DDRTYPE_LPDDR2 = 5, > + ROCKCHIP_DDRTYPE_LPDDR3 = 6, > + ROCKCHIP_DDRTYPE_LPDDR4 = 7, > +}; > + > +#endif /* __SOC_ROCKCHIP_GRF_H */ > -- > 2.39.2 Applied it. Thanks Best Regards, Chanwoo Choi