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 B4166C77B7A for ; Tue, 16 May 2023 16:04:58 +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:MIME-Version:References:In-Reply-To: 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=hMzwPxM1Pl5Uca7AkfCNxwKp9cEDY7Yj377GVlW+B/w=; b=0Zf0dlvsiAHBgp 3PwRq+jEajCSwOy9UC67QNEaa6U78nejNJkUvO/oHoJxzwpIAnQ5KSFOF9V7smvIESU3/9tUtBpKO ECe115iUb8lADgQ/vGmViKwSZTOnk2VxA4giy3AVmkxMMsiYVhC53Ne3uZ4LCFZliPpRv4xbA4stV oBxBxJULTUlaFXNzjPvKOY9/rIyT8JE1DZvrLeCIqBPuY+OVzg7Ji6XKGoRHOT757wgxaVN2PKHMd qMeQJWWm2+DqGRux18GRj0MB/6JMy5K3wEq04LtpA6i9yM76Nkj039jViCGapKVgtImiLSBcj+pjc SXmFliezkZRM/bi6MGJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyxAQ-006O2m-2R; Tue, 16 May 2023 16:04:50 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyxAN-006O0q-0Q; Tue, 16 May 2023 16:04:48 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QLLc94fQDz67L3x; Wed, 17 May 2023 00:02:49 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 16 May 2023 17:04:36 +0100 Date: Tue, 16 May 2023 17:04:35 +0100 From: Jonathan Cameron To: Sascha Hauer CC: , , Heiko Stuebner , Kyungmin Park , MyungJoo Ham , Will Deacon , Mark Rutland , , Michael Riesch Subject: Re: [PATCH v4 10/21] PM / devfreq: rockchip-dfi: Add RK3568 support Message-ID: <20230516170435.000040f5@Huawei.com> In-Reply-To: <20230505113856.463650-11-s.hauer@pengutronix.de> References: <20230505113856.463650-1-s.hauer@pengutronix.de> <20230505113856.463650-11-s.hauer@pengutronix.de> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100005.china.huawei.com (7.191.160.25) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230516_090447_466868_8F256639 X-CRM114-Status: GOOD ( 24.39 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org 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. > + > + dfi->channel_mask = 1; GENMASK(0, 0); Or just use a count as that still looks fine to me. Maybe that will change! > + > + return 0; > +}; > + > struct rockchip_dfi_devtype_data { > int (*init)(struct rockchip_dfi *dfi); > }; > @@ -217,8 +236,13 @@ static struct rockchip_dfi_devtype_data rk3399_devtype_data = { > .init = rk3399_dfi_init, > }; > > +static struct rockchip_dfi_devtype_data rk3568_devtype_data = { > + .init = rk3568_dfi_init, > +}; > + > static const struct of_device_id rockchip_dfi_id_match[] = { > { .compatible = "rockchip,rk3399-dfi", .data = &rk3399_devtype_data }, > + { .compatible = "rockchip,rk3568-dfi", .data = &rk3568_devtype_data }, > { }, > }; > MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match); > diff --git a/include/soc/rockchip/rk3568_grf.h b/include/soc/rockchip/rk3568_grf.h > new file mode 100644 > index 0000000000000..575584e9d8834 > --- /dev/null > +++ b/include/soc/rockchip/rk3568_grf.h > @@ -0,0 +1,12 @@ > +/* SPDX-License-Identifier: GPL-2.0+ */ > +#ifndef __SOC_RK3568_GRF_H > +#define __SOC_RK3568_GRF_H > + > +#define RK3568_PMUGRF_OS_REG2 0x208 > +#define RK3568_PMUGRF_OS_REG2_DRAMTYPE_INFO GENMASK(15, 13) > + > +#define RK3568_PMUGRF_OS_REG3 0x20c > +#define RK3568_PMUGRF_OS_REG3_DRAMTYPE_INFO_V3 GENMASK(13, 12) > +#define RK3568_PMUGRF_OS_REG3_SYSREG_VERSION GENMASK(31, 28) > + > +#endif /* __SOC_RK3568_GRF_H */ _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip