mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Crystal Guo (郭晶)" <Crystal.Guo@mediatek.com>
To: "robh@kernel.org" <robh@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [PATCH 2/2] dt-bindings: memory-controllers: Add mediatek common-dramc dt-bindings
Date: Tue, 11 Feb 2025 12:46:48 +0000	[thread overview]
Message-ID: <ab82119032f2517241860ce2149e31c4bbd30abd.camel@mediatek.com> (raw)
In-Reply-To: <5d06211b-5ee2-48dd-9334-7c8bcffb894e@collabora.com>

On Thu, 2024-12-12 at 11:27 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> 
> 
> Il 12/12/24 09:59, Crystal Guo ha scritto:
> > Add devicetree binding for mediatek common-dramc driver.
> > 
> > The DRAM controller of MediaTek SoC provides an interface to
> > get the current data rate of DRAM.
> > 
> > Signed-off-by: Crystal Guo <crystal.guo@mediatek.com>
> > ---
> >   .../mediatek,common-dramc.yaml                | 129
> > ++++++++++++++++++
> >   1 file changed, 129 insertions(+)
> >   create mode 100644 Documentation/devicetree/bindings/memory-
> > controllers/mediatek,common-dramc.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/memory-
> > controllers/mediatek,common-dramc.yaml
> > b/Documentation/devicetree/bindings/memory-
> > controllers/mediatek,common-dramc.yaml
> > new file mode 100644
> > index 000000000000..c9e608c7f183
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/memory-
> > controllers/mediatek,common-dramc.yaml
> > @@ -0,0 +1,129 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +# Copyright (c) 2024 MediaTek Inc.
> > +%YAML 1.2
> > +---
> > +$id: 
> > https://urldefense.com/v3/__http://devicetree.org/schemas/memory-controllers/mediatek,common-dramc.yaml*__;Iw!!CTRNKA9wMg0ARbw!hkObFeP7J-uvNSyDsepqqdH_jZQcf9NQ1knBRGY1ODpH6FoZyBzL1x5rEIWPppp1wNmLdo41PQTZM4ulMP1Qg7wr9PwFEdeN$
> > +$schema: 
> > https://urldefense.com/v3/__http://devicetree.org/meta-schemas/core.yaml*__;Iw!!CTRNKA9wMg0ARbw!hkObFeP7J-uvNSyDsepqqdH_jZQcf9NQ1knBRGY1ODpH6FoZyBzL1x5rEIWPppp1wNmLdo41PQTZM4ulMP1Qg7wr9FN7m95w$
> > +
> > +title: MediaTek Common DRAMC (DRAM Controller)
> 
> MediaTek DRAM Controller (DRAMC)

Okay, change title to "MediaTek DRAM Controller (DRAMC)"

> 
> > +
> > +maintainers:
> > +  - Crystal Guo <crystal.guo@mediatek.com>
> > +
> > +description: |
> > +  The DRAM controller of MediaTek SoC provides an interface to
> > +  get the current data rate of DRAM.
> 
> No, the DRAM Controller does much more than just that.
> 

Change the description to "A MediaTek DRAM controller interface to
provide the current data rate of DRAM.", is it okay?.

> > +
> > +properties:
> > +  compatible:
> > +    const: mediatek,common-dramc
> 
> Absolutely no! Compatibles are per-soc.
> 
> mediatek,mt8186-dramc
> mediatek,mt8188-dramc
> mediatek,mt8195-dramc
> 
> etc
> 

Change the compatible to "mediatek,mt8196-dramc"

> > +
> > +  reg:
> > +    minItems: 9
> > +    items:
> > +      - description: DRAMC_AO_CHA_BASE
> > +      - description: DRAMC_AO_CHB_BASE
> > +      - description: DRAMC_AO_CHC_BASE
> > +      - description: DRAMC_AO_CHD_BASE
> 
> All those channels are sequential in AO->NAO, in the sense that
> every channel is:
> 
> CH0     AO: 0x10230000   len: 0x4000
> CH0    NAO: 0x10234000   len: 0x2000
> CH0 PHY_AO: 0x10236000   len: 0x2000
> CH0 PHY_AO: 0x10238000   len: 0x2000
> 
> So the reg can be simplified as
> 
> minItems: 4
> items:
>    - description: DRAM Controller Channel 0
>    - description: DRAM Controller Channel 1
>    - description: DRAM Controller Channel 2
>    - description: DRAM Controller Channel 3
> 
> 
> > +      - description: DRAMC_NAO_CHA_BASE
> > +      - description: DRAMC_NAO_CHB_BASE
> > +      - description: DRAMC_NAO_CHC_BASE
> > +      - description: DRAMC_NAO_CHD_BASE
> > +      - description: DDRPHY_AO_CHA_BASE
> > +      - description: DDRPHY_AO_CHB_BASE
> > +      - description: DDRPHY_AO_CHC_BASE
> > +      - description: DDRPHY_AO_CHD_BASE
> > +      - description: DDRPHY_NAO_CHA_BASE
> > +      - description: DDRPHY_NAO_CHB_BASE
> > +      - description: DDRPHY_NAO_CHC_BASE
> > +      - description: DDRPHY_NAO_CHD_BASE
> > +      - description: SLEEP_BASE
> 
> You're not using the SLEEP_BASE iospace, and that's not even really
> specific
> to the DRAM Controller. Drop it.

Actually the driver only use DDRPHY_AO_CHA_BASE and
DDRPHY_NAO_CHA_BASE,
Thus simplify the reg properity to:
  reg:
    items:
      - description: anaphy registers
      - description: ddrphy registers
> 
> > +
> > +  support-ch-cnt:
> > +    maxItems: 1
> 
> Don't tell me that the DRAM Controller in MediaTek SoCs cannot see
> how many
> channels are actually occupied by a DRAM bank, because I will be
> really skeptical.
> 
> You can autodetect that in the driver, you don't need a DT property
> for that.

Okay, remove the property "support-ch-cnt".
> 
> > +
> > +  fmeter-version:
> > +    maxItems: 1
> > +    description:
> > +      Fmeter version for calculating dram data rate
> 
> The Fmeter version is SoC-specific, you need platform data, not DT
> property.
> 

Okay, move the "fmeter-version" to platform data.

> > +
> > +  crystal-freq:
> > +    maxItems: 1
> > +    description:
> > +      Reference clock rate in MHz
> 
> Is this crystal an external component, or is it integrated into the
> SoC?

This is the reference frequency used to calculate the DDR frequency.
In v2, the "crystal-freq" property has been removed and defined
directly in the driver.

> 
> > +
> > +  shu-of:
> > +    maxItems: 1
> 
> There's no description, what is shu-of?
> 
> > +
> > +  pll-id: true
> > +  shu-lv: true
> > +  sdmpcw: true
> > +  posdiv: true
> > +  fbksel: true
> > +  dqsopen: true
> > +  async-ca: true
> > +  dq-ser-mode: true
> 
> Same for these ones, please describe them - but then remember: if
> those parameters
> are board-specific, they can stay here, otherwise those go in
> platform data.
> 
> Besides, I doubt that those are board specific.
> 
> Regards,
> Angelo
> 

These parameters are SoC-specific.
In v2, the offsets of the registers storing these parameters are
defined directly in the driver.
THus these parameters can be removed from DT property.

Thanks
Crystal

  parent reply	other threads:[~2025-02-11 12:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12  8:59 [PATCH 0/2] Add MediaTek DRAMC driver support Crystal Guo
2024-12-12  8:59 ` [PATCH 1/2] memory/mediatek: Add an interface to get current DDR data rate Crystal Guo
2024-12-12 10:46   ` AngeloGioacchino Del Regno
2025-02-08  4:14     ` Crystal Guo (郭晶)
2025-02-11 12:13     ` Crystal Guo (郭晶)
2024-12-12 11:02   ` Krzysztof Kozlowski
2025-02-08  4:21     ` Crystal Guo (郭晶)
2025-02-11 12:21     ` Crystal Guo (郭晶)
2024-12-21  1:42   ` kernel test robot
2024-12-21 11:03   ` kernel test robot
2024-12-12  8:59 ` [PATCH 2/2] dt-bindings: memory-controllers: Add mediatek common-dramc dt-bindings Crystal Guo
2024-12-12 10:27   ` Rob Herring (Arm)
2025-02-08  4:24     ` Crystal Guo (郭晶)
2024-12-12 10:27   ` AngeloGioacchino Del Regno
2025-02-08  4:33     ` Crystal Guo (郭晶)
2025-02-11 12:46     ` Crystal Guo (郭晶) [this message]
2024-12-12 10:58   ` Krzysztof Kozlowski
2025-02-08  4:40     ` Crystal Guo (郭晶)
2025-02-09 10:52       ` Krzysztof Kozlowski
2025-02-11 12:59         ` Crystal Guo (郭晶)
2025-02-11 15:57           ` Krzysztof Kozlowski
2025-02-12  3:21             ` Crystal Guo (郭晶)
2025-02-11 12:56     ` Crystal Guo (郭晶)
2025-02-11 15:55       ` Krzysztof Kozlowski
2025-02-12  2:47         ` Crystal Guo (郭晶)

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=ab82119032f2517241860ce2149e31c4bbd30abd.camel@mediatek.com \
    --to=crystal.guo@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=robh@kernel.org \
    /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

all inboxes | Powered by JetHome®