Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sebastian Reichel" <sebastian.reichel@collabora.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 8/9] PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON
Date: Tue, 17 Nov 2026 15:49:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-219111@kernel.org> (raw)
In-Reply-To: <20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-8-32ff1546b0e4@collabora.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] devfreq: rockchip-dfi: wrong LP5 mask in
  rockchip_dfi_v4_ddrtype_to_ctrl()
--

commit f6efa125e5d1445f73668d4878a7c97df5da332d
Author: Sebastian Reichel <sebastian.reichel@collabora.com>

PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON

This commit adds support for the control register layout of version 0x40
DDRMON controllers in preparation for RK3576 support.

> diff --git a/drivers/devfreq/event/rockchip-dfi.c b/drivers/devfreq/event/rockchip-dfi.c
> index 33a379618eb5a..ed28dc6446f10 100644
> --- a/drivers/devfreq/event/rockchip-dfi.c
> +++ b/drivers/devfreq/event/rockchip-dfi.c
> @@ -42,6 +42,19 @@
>  #define DDRMON_CTRL_TIMER_CNT_EN	BIT(0)
>  #define DDRMON_CTRL_LP5_BANK_MODE_MASK	GENMASK(8, 7)
>  
> +#define DDRMON_CTRL0	0x04
> +#define DDRMON_CTRL0_EXT_TRIGGER_EN		BIT(6)
> +#define DDRMON_CTRL0_DDR4			BIT(5)
> +#define DDRMON_CTRL0_LPDDR4			BIT(4)
> +#define DDRMON_CTRL0_HARDWARE_EN		BIT(3)
> +#define DDRMON_CTRL0_LPDDR23			BIT(2)
> +#define DDRMON_CTRL0_SOFTWARE_EN		BIT(1)
> +#define DDRMON_CTRL0_TIMER_CNT_EN		BIT(0)
> +#define DDRMON_CTRL0_HOT_RANK			GENMASK(8, 7)
> +
> +#define DDRMON_CTRL1	0x08
> +#define DDRMON_CTRL1_LPDDR5			BIT(0)
> +#define DDRMON_CTRL1_LP5_BANK_MODE_MASK		GENMASK(2, 1)

[ ... ]

> +static int rockchip_dfi_v4_ddrtype_to_ctrl(struct rockchip_dfi *dfi, u32 *ctrl0, u32 *ctrl1)
> +{
> +	switch (dfi->ddr_type) {
> +	case ROCKCHIP_DDRTYPE_LPDDR2:
> +	case ROCKCHIP_DDRTYPE_LPDDR3:
> +		*ctrl0 = FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR23, 1) |
> +			 FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR4, 0);
> +		*ctrl1 = FIELD_PREP_WM16(DDRMON_CTRL1_LPDDR5, 0);
> +		break;
> +	case ROCKCHIP_DDRTYPE_LPDDR4:
> +	case ROCKCHIP_DDRTYPE_LPDDR4X:
> +		*ctrl0 = FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR23, 0) |
> +			 FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR4, 1);
> +		*ctrl1 = FIELD_PREP_WM16(DDRMON_CTRL1_LPDDR5, 0);
> +		break;
> +	case ROCKCHIP_DDRTYPE_LPDDR5:
> +		*ctrl0 = FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR23, 0) |
> +			 FIELD_PREP_WM16(DDRMON_CTRL0_LPDDR4, 0);
> +		*ctrl1 = FIELD_PREP_WM16(DDRMON_CTRL1_LPDDR5, 1) |
> +			 FIELD_PREP_WM16(DDRMON_CTRL_LP5_BANK_MODE_MASK,
> +					dfi->lp5_bank_mode);
> +		break;

[Severity: Medium]
Should this use DDRMON_CTRL1_LP5_BANK_MODE_MASK instead of
DDRMON_CTRL_LP5_BANK_MODE_MASK when building *ctrl1?  Using
DDRMON_CTRL_LP5_BANK_MODE_MASK programs dfi->lp5_bank_mode into bits 8:7 of
DDRMON_CTRL1 rather than bits 2:1 on v4 DDRMON controllers with LPDDR5
memory.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-rockchip-dfi-rk3588-cleanups-and-rk3576-support-v3-0-32ff1546b0e4@collabora.com?part=8

  reply	other threads:[~2026-11-17 15:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 15:35 [PATCH v3 0/9] PM / devfreq: rockchip-dfi: cleanups and RK3576 support Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 1/9] dt-bindings: devfreq: event: rockchip,dfi: add clocks to rk3588 Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 2/9] dt-bindings: devfreq: event: rockchip,dfi: add rk3576 Sebastian Reichel
2026-11-17 15:42   ` sashiko-bot
2026-11-17 15:35 ` [PATCH v3 3/9] PM / devfreq: rockchip-dfi: move to per-variant const structs Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 4/9] PM / devfreq: rockchip-dfi: add NO_INTERRUPT perf capability Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 5/9] PM / devfreq: rockchip-dfi: use bulk clock APIs Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 6/9] PM / devfreq: rockchip-dfi: make RK3588 use its clocks Sebastian Reichel
2026-11-17 15:48   ` sashiko-bot
2026-11-17 15:35 ` [PATCH v3 7/9] PM / devfreq: rockchip-dfi: move register offsets to variant struct Sebastian Reichel
2026-11-17 15:35 ` [PATCH v3 8/9] PM / devfreq: rockchip-dfi: prepare support for v4 DDRMON Sebastian Reichel
2026-11-17 15:49   ` sashiko-bot [this message]
2026-11-17 15:35 ` [PATCH v3 9/9] PM / devfreq: rockchip-dfi: add RK3576 support Sebastian Reichel
2026-11-17 15:54   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-219111@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sebastian.reichel@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox