From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60B80C77B75 for ; Wed, 17 May 2023 11:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sQ6nTMiCHq8BfX4zn0P4KjFY8bSOs9gkP8Of/Onr6XY=; b=JP55zYxsPDYvX5 4gHAlZuCTqOqhZGZsV4n++2RRoZ3zoOLNBikEMXgcP+GrFLn3GyjLmBxwU94iJBy6+4+q3XxDs4Y4 OJIrTtmS77x3DBtQjyQgORuDGwXsi/QNMVpkmXoUL9P0d6s/LPA5cA2jvzcUWXJoVVZRgt6WE5BzQ nT7oI3q1hGn6tK0IiOWsNEHlcwal+4GowOVb3+4B3hnw28WXdosHxKO/7W0+VXXbaZejJMXzS6z0b awM5YTUnWrEqlFTh+wpypJi3pi6KF8sZuQI8FyoERmaNM9jnUzmrJhQNaTfbzQs25nMcGkgxCpzh+ RLArBvtibs9tYNM+MYZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pzFUP-009dNc-0S; Wed, 17 May 2023 11:38:41 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pzFUL-009dLz-0R for linux-arm-kernel@lists.infradead.org; Wed, 17 May 2023 11:38:38 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pzFUE-0004Em-Nv; Wed, 17 May 2023 13:38:30 +0200 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pzFUC-0000pG-9y; Wed, 17 May 2023 13:38:28 +0200 Date: Wed, 17 May 2023 13:38:28 +0200 From: Sascha Hauer To: Jonathan Cameron Cc: linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Heiko Stuebner , Kyungmin Park , MyungJoo Ham , Will Deacon , Mark Rutland , kernel@pengutronix.de, Michael Riesch Subject: Re: [PATCH v4 10/21] PM / devfreq: rockchip-dfi: Add RK3568 support Message-ID: <20230517113828.GY29365@pengutronix.de> References: <20230505113856.463650-1-s.hauer@pengutronix.de> <20230505113856.463650-11-s.hauer@pengutronix.de> <20230516170435.000040f5@Huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230516170435.000040f5@Huawei.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230517_043837_175649_07E0888C X-CRM114-Status: GOOD ( 33.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 16, 2023 at 05:04:35PM +0100, Jonathan Cameron wrote: > On Fri, 5 May 2023 13:38:45 +0200 > Sascha Hauer wrote: > > > This adds RK3568 support to the DFI driver. The driver itself doesn't > > need a change, only initialization differs from the currently supported > > RK3399. > I'm not sure on distinction between driver and init (which is part of driver) > so that description might want to just say > > Only initialization differs from currently supported RK3399. > > and leave it at that! > > > > > Signed-off-by: Sascha Hauer > > --- > > drivers/devfreq/event/rockchip-dfi.c | 24 ++++++++++++++++++++++++ > > include/soc/rockchip/rk3568_grf.h | 12 ++++++++++++ > > 2 files changed, 36 insertions(+) > > create mode 100644 include/soc/rockchip/rk3568_grf.h > > > > diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c > > index 035984d3c7b01..78cb594bd2a81 100644 > > --- a/drivers/devfreq/event/rockchip-dfi.c > > +++ b/drivers/devfreq/event/rockchip-dfi.c > > @@ -23,6 +23,7 @@ > > > > #include > > #include > > +#include > > > > #define DMC_MAX_CHANNELS 2 > > > > @@ -209,6 +210,24 @@ static int rk3399_dfi_init(struct rockchip_dfi *dfi) > > return 0; > > }; > > > > +static int rk3568_dfi_init(struct rockchip_dfi *dfi) > > +{ > > + struct regmap *regmap_pmu = dfi->regmap_pmu; > > + u32 reg2, reg3; > > + > > + regmap_read(regmap_pmu, RK3568_PMUGRF_OS_REG2, ®2); > > + regmap_read(regmap_pmu, RK3568_PMUGRF_OS_REG3, ®3); > > + > > + dfi->ddr_type = FIELD_GET(RK3568_PMUGRF_OS_REG2_DRAMTYPE_INFO, reg2); > > + > > + if (FIELD_GET(RK3568_PMUGRF_OS_REG3_SYSREG_VERSION, reg3) >= 0x3) > > + dfi->ddr_type |= FIELD_GET(RK3568_PMUGRF_OS_REG3_DRAMTYPE_INFO_V3, reg3) << 3; > > This is unusual enough that I'd suggest some comments to say how > the bits are distributed across the two registers. I'd say in version 3 of the register structure they realized that they need two bits more for the ddr_type and have put them in BIT(12) and BIT(13) of RK3568_PMUGRF_OS_REG3. I think the code makes that sufficiently clear and apart from this code taken from the downstream kernel I don't have any documentation of these registers. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel