Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3866921rdg; Wed, 18 Oct 2023 08:12:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG9706NHz/iNZL8m5wH/mUdYpAjdYrI+eD9mu7QmHLAi3akgun7IO9YLL3QFUK4YAhA3nt/ X-Received: by 2002:a92:b0d:0:b0:357:60b5:d8 with SMTP id b13-20020a920b0d000000b0035760b500d8mr6361435ilf.17.1697641970652; Wed, 18 Oct 2023 08:12:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697641970; cv=none; d=google.com; s=arc-20160816; b=UnBCazXYMrsrj6TdJfYZRfl0oBA7bvSVDCMkNKjA1MFfO4sctgv0Xo629sF/YJ5Rnu UqQQu6mA0Zo1t81tYvyYp8D4royGbDQSRiNu/40PkPIa4baRLF2axDJtCACOyO+6NAMe g/rKNn+4ZGklhpjcr5T2ZD5XwmKRfRjVicQVWvodS7cEqGiJ3oYgv7cZpkj6SzGwpYvc DYzBf9pv03Ozwq9dxrbBL0VMXTsD968HI96FqCVyoTyf5QgNc1xvhhf5VQWXArDSvp3Q 4yLH0cc6Ntdi4nIRXcSFk///SMJzI9OjWnyM6h06yBawN7CHjWCBt53GDSp2zU6kwoQx yA8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=39AhkOotOhzvuqW8PiZuKT7s9q4RY9WbZ8Dqesj2o9c=; fh=kza8t5ZS209zVoEG4uwLJLlWKsmyNnta4nic2PYIVdM=; b=KI0ymSdxuzm9hFIemXTOxka+jekPaEcxwBHxD2JKHo68GJsDVV3bicInnUBpkYds2Z vK4cKIsgOsqKQwRAa9ZU1pSwxxXU4WW5Tgw9AcSCzeivzBAHOlryFJrDaw8ly/BcUfn4 P7RWyelIQ4qmhfuIztywLkhbOKQ3P47Q/ZWCpQT5hSygSXNMTTCmoha4owm8o9R/rJrI k08a+OyxoEkaIFTc3T1JRc6SDJHizZflinHJoqPyjlTrZzyVBjaUPWD1cnc54vECNOTd Z+zEnLoRfY4kY/3TV/GiVNVNhmun5PlJOmN1SwcSQWnRhz25SFqblOLAHlB/LxHEYV/o VvMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lc5skqHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id a21-20020a63e855000000b0057751b7788esi2205267pgk.488.2023.10.18.08.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 08:12:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lc5skqHj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id C609C8022ABC; Wed, 18 Oct 2023 08:12:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345188AbjJRPMd (ORCPT + 99 others); Wed, 18 Oct 2023 11:12:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344665AbjJRPMc (ORCPT ); Wed, 18 Oct 2023 11:12:32 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2E02AB; Wed, 18 Oct 2023 08:12:30 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 629BFC433C8; Wed, 18 Oct 2023 15:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697641950; bh=FQeLVQ03xYeQQtOosvC2A7mk735Ug07ldWBeoCuDr3s=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lc5skqHjb9nLqfPWMcQdGrtNQbKYW7tLWgJ7EmXjCYfOth4McrikeqUJJSx3Nk7gS PMtid+U3FzR+w7VBzky/ruQEJE5Q1n8a+QJUzZnFdjW0/Y4BsEeuNZd37cyPMQvBmf BGVWFvVYQj8Wn5+SgMBw9lc+sR6aIdHWFBMpBD+TE5CzaYwkQYdrPn8VoRh0wDjS2m IHlr9OQQKVcZvfrwQ3INzwWQIw/DYkdScfX0rRAzc1Y4BK14McX6IpQSx/dfkRk6+f cYD2Hic3sozJpE6cWTHNbSIH+ro1IknzQV/m8rd6MBsx63solU9VbxJlis/z62sqRg oTjbGS7llg3OQ== Message-ID: Date: Thu, 19 Oct 2023 00:12:26 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 19/26] PM / devfreq: rockchip-dfi: add support for RK3588 Content-Language: en-US To: Sascha Hauer , linux-rockchip@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Heiko Stuebner , 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 , Jonathan Cameron References: <20231018061714.3553817-1-s.hauer@pengutronix.de> <20231018061714.3553817-20-s.hauer@pengutronix.de> From: Chanwoo Choi In-Reply-To: <20231018061714.3553817-20-s.hauer@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 18 Oct 2023 08:12:47 -0700 (PDT) On 23. 10. 18. 15:17, Sascha Hauer wrote: > Add support for the RK3588 to the driver. The RK3588 has four DDR > channels with a register stride of 0x4000 between the channel > registers, also it has a DDRMON_CTRL register per channel. > > Reviewed-by: Jonathan Cameron > Reviewed-by: Sebastian Reichel > Signed-off-by: Sascha Hauer > --- > drivers/devfreq/event/rockchip-dfi.c | 36 +++++++++++++++++++++++++++- > include/soc/rockchip/rk3588_grf.h | 18 ++++++++++++++ > 2 files changed, 53 insertions(+), 1 deletion(-) > create mode 100644 include/soc/rockchip/rk3588_grf.h > > diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c > index bf38829a2a4af..794f36e7eebd1 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -26,8 +26,9 @@ > #include > #include > #include > +#include > > -#define DMC_MAX_CHANNELS 2 > +#define DMC_MAX_CHANNELS 4 > > #define HIWORD_UPDATE(val, mask) ((val) | (mask) << 16) > > @@ -723,9 +724,42 @@ static int rk3568_dfi_init(struct rockchip_dfi *dfi) > return 0; > }; > > +static int rk3588_dfi_init(struct rockchip_dfi *dfi) > +{ > + struct regmap *regmap_pmu = dfi->regmap_pmu; > + u32 reg2, reg3, reg4; > + > + regmap_read(regmap_pmu, RK3588_PMUGRF_OS_REG2, ®2); > + regmap_read(regmap_pmu, RK3588_PMUGRF_OS_REG3, ®3); > + regmap_read(regmap_pmu, RK3588_PMUGRF_OS_REG4, ®4); > + > + /* lower 3 bits of the DDR type */ > + dfi->ddr_type = FIELD_GET(RK3588_PMUGRF_OS_REG2_DRAMTYPE_INFO, reg2); > + > + /* > + * For version three and higher the upper two bits of the DDR type are > + * in RK3588_PMUGRF_OS_REG3 > + */ > + if (FIELD_GET(RK3588_PMUGRF_OS_REG3_SYSREG_VERSION, reg3) >= 0x3) > + dfi->ddr_type |= FIELD_GET(RK3588_PMUGRF_OS_REG3_DRAMTYPE_INFO_V3, reg3) << 3; > + > + dfi->buswidth[0] = FIELD_GET(RK3588_PMUGRF_OS_REG2_BW_CH0, reg2) == 0 ? 4 : 2; > + dfi->buswidth[1] = FIELD_GET(RK3588_PMUGRF_OS_REG2_BW_CH1, reg2) == 0 ? 4 : 2; > + dfi->buswidth[2] = FIELD_GET(RK3568_PMUGRF_OS_REG2_BW_CH0, reg4) == 0 ? 4 : 2; > + dfi->buswidth[3] = FIELD_GET(RK3588_PMUGRF_OS_REG2_BW_CH1, reg4) == 0 ? 4 : 2; > + dfi->channel_mask = FIELD_GET(RK3588_PMUGRF_OS_REG2_CH_INFO, reg2) | > + FIELD_GET(RK3588_PMUGRF_OS_REG2_CH_INFO, reg4) << 2; > + dfi->max_channels = 4; > + > + dfi->ddrmon_stride = 0x4000; > + > + return 0; > +}; > + > static const struct of_device_id rockchip_dfi_id_match[] = { > { .compatible = "rockchip,rk3399-dfi", .data = rk3399_dfi_init }, > { .compatible = "rockchip,rk3568-dfi", .data = rk3568_dfi_init }, > + { .compatible = "rockchip,rk3588-dfi", .data = rk3588_dfi_init }, > { }, > }; > > diff --git a/include/soc/rockchip/rk3588_grf.h b/include/soc/rockchip/rk3588_grf.h > new file mode 100644 > index 0000000000000..630b35a550640 > --- /dev/null > +++ b/include/soc/rockchip/rk3588_grf.h > @@ -0,0 +1,18 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +#ifndef __SOC_RK3588_GRF_H > +#define __SOC_RK3588_GRF_H > + > +#define RK3588_PMUGRF_OS_REG2 0x208 > +#define RK3588_PMUGRF_OS_REG2_DRAMTYPE_INFO GENMASK(15, 13) > +#define RK3588_PMUGRF_OS_REG2_BW_CH0 GENMASK(3, 2) > +#define RK3588_PMUGRF_OS_REG2_BW_CH1 GENMASK(19, 18) > +#define RK3588_PMUGRF_OS_REG2_CH_INFO GENMASK(29, 28) > + > +#define RK3588_PMUGRF_OS_REG3 0x20c > +#define RK3588_PMUGRF_OS_REG3_DRAMTYPE_INFO_V3 GENMASK(13, 12) > +#define RK3588_PMUGRF_OS_REG3_SYSREG_VERSION GENMASK(31, 28) > + > +#define RK3588_PMUGRF_OS_REG4 0x210 > +#define RK3588_PMUGRF_OS_REG5 0x214 > + > +#endif /* __SOC_RK3588_GRF_H */ Acked-by: Chanwoo Choi -- Best Regards, Samsung Electronics Chanwoo Choi