Message ID | 20231018061714.3553817-11-s.hauer@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add perf support to the rockchip-dfi driver | expand |
On 23. 10. 18. 15:16, Sascha Hauer wrote: > This adds RK3568 support to the DFI driver. Only iniitialization > differs from the currently supported RK3399. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > > Notes: > Changes since v7: > - Add comment to explain << 3 > > drivers/devfreq/event/rockchip-dfi.c | 27 +++++++++++++++++++++++++++ > include/soc/rockchip/rk3568_grf.h | 12 ++++++++++++ > 2 files changed, 39 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 12f9096879235..571d72d1abd1c 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -23,6 +23,7 @@ > > #include <soc/rockchip/rockchip_grf.h> > #include <soc/rockchip/rk3399_grf.h> > +#include <soc/rockchip/rk3568_grf.h> > > #define DMC_MAX_CHANNELS 2 > > @@ -211,10 +212,36 @@ 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); > + > + /* lower 3 bits of the DDR type */ > + dfi->ddr_type = FIELD_GET(RK3568_PMUGRF_OS_REG2_DRAMTYPE_INFO, reg2); > + > + /* > + * For version three and higher the upper two bits of the DDR type are > + * in RK3568_PMUGRF_OS_REG3 > + */ > + 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; > + > + dfi->channel_mask = BIT(0); > + dfi->max_channels = 1; > + > + 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 }, > { }, > }; > + > MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match); > > static int rockchip_dfi_probe(struct platform_device *pdev) > 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 */ Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Am Mittwoch, 18. Oktober 2023, 08:16:58 CEST schrieb Sascha Hauer: > This adds RK3568 support to the DFI driver. Only iniitialization > differs from the currently supported RK3399. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > > Notes: > Changes since v7: > - Add comment to explain << 3 > > drivers/devfreq/event/rockchip-dfi.c | 27 +++++++++++++++++++++++++++ > include/soc/rockchip/rk3568_grf.h | 12 ++++++++++++ > 2 files changed, 39 insertions(+) > create mode 100644 include/soc/rockchip/rk3568_grf.h Acked-by: Heiko Stuebner <heiko@sntech.de>
> -----Original Message----- > From: Sascha Hauer <s.hauer@pengutronix.de> > 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 <heiko@sntech.de>; Chanwoo Choi > <chanwoo@kernel.org>; Kyungmin Park <kyungmin.park@samsung.com>; MyungJoo > Ham <myungjoo.ham@samsung.com>; Will Deacon <will@kernel.org>; Mark > Rutland <mark.rutland@arm.com>; kernel@pengutronix.de; Michael Riesch > <michael.riesch@wolfvision.net>; Robin Murphy <robin.murphy@arm.com>; > Vincent Legoll <vincent.legoll@gmail.com>; Rob Herring > <robh+dt@kernel.org>; Krzysztof Kozlowski > <krzysztof.kozlowski+dt@linaro.org>; Conor Dooley <conor+dt@kernel.org>; > devicetree@vger.kernel.org; Sebastian Reichel > <sebastian.reichel@collabora.com>; Sascha Hauer <s.hauer@pengutronix.de> > Subject: [PATCH v8 10/26] PM / devfreq: rockchip-dfi: Add RK3568 support > > This adds RK3568 support to the DFI driver. Only iniitialization differs > from the currently supported RK3399. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> > --- > > Notes: > Changes since v7: > - Add comment to explain << 3 > > drivers/devfreq/event/rockchip-dfi.c | 27 +++++++++++++++++++++++++++ > include/soc/rockchip/rk3568_grf.h | 12 ++++++++++++ > 2 files changed, 39 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 12f9096879235..571d72d1abd1c 100644 > --- a/drivers/devfreq/event/rockchip-dfi.c > +++ b/drivers/devfreq/event/rockchip-dfi.c > @@ -23,6 +23,7 @@ > > #include <soc/rockchip/rockchip_grf.h> > #include <soc/rockchip/rk3399_grf.h> > +#include <soc/rockchip/rk3568_grf.h> > > #define DMC_MAX_CHANNELS 2 > > @@ -211,10 +212,36 @@ 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); > + > + /* lower 3 bits of the DDR type */ > + dfi->ddr_type = FIELD_GET(RK3568_PMUGRF_OS_REG2_DRAMTYPE_INFO, > reg2); > + > + /* > + * For version three and higher the upper two bits of the DDR type > are > + * in RK3568_PMUGRF_OS_REG3 > + */ > + 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; > + > + dfi->channel_mask = BIT(0); > + dfi->max_channels = 1; > + > + 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 }, > { }, > }; > + > MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match); > > static int rockchip_dfi_probe(struct platform_device *pdev) 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 */ > -- > 2.39.2 Applied it. Thanks Best Regards, Chanwoo Choi
diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c index 12f9096879235..571d72d1abd1c 100644 --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -23,6 +23,7 @@ #include <soc/rockchip/rockchip_grf.h> #include <soc/rockchip/rk3399_grf.h> +#include <soc/rockchip/rk3568_grf.h> #define DMC_MAX_CHANNELS 2 @@ -211,10 +212,36 @@ 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); + + /* lower 3 bits of the DDR type */ + dfi->ddr_type = FIELD_GET(RK3568_PMUGRF_OS_REG2_DRAMTYPE_INFO, reg2); + + /* + * For version three and higher the upper two bits of the DDR type are + * in RK3568_PMUGRF_OS_REG3 + */ + 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; + + dfi->channel_mask = BIT(0); + dfi->max_channels = 1; + + 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 }, { }, }; + MODULE_DEVICE_TABLE(of, rockchip_dfi_id_match); static int rockchip_dfi_probe(struct platform_device *pdev) 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 */
This adds RK3568 support to the DFI driver. Only iniitialization differs from the currently supported RK3399. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- Notes: Changes since v7: - Add comment to explain << 3 drivers/devfreq/event/rockchip-dfi.c | 27 +++++++++++++++++++++++++++ include/soc/rockchip/rk3568_grf.h | 12 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/soc/rockchip/rk3568_grf.h