Re: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

Conor Dooley
2023-09-21T12:06:26Z

[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

On Thu, Sep 21, 2023 at 06:27:09PM +0800, Chen Wang wrote:
> Conor Dooley <conor@kernel.org> 于2023年9月21日周四 18:15写道：
> >
> > On Thu, Sep 21, 2023 at 05:56:28PM +0800, Chen Wang wrote:

> > > > > +
> > > > > +/ {
> > > > > + compatible = "sophgo,sg2042";
> > > > > + #address-cells = <2>;
> > > > > + #size-cells = <2>;
> > > > > + dma-noncoherent;
> > > > > +
> > > > > + aliases {
> > > > > + serial0 = &uart0;
> > > > > + };
> > > > > +
> > > > > + /* the mem node will be updated by ZSBL. */
> > > >
> > > > huh? So these are random numbers below? Either put something useful here
> > > > or delete it please.
> > >
> > > The memory for SG2042 is not fixed, the bootloader will detect memory
> > > installed on board during booting and fill the actual address and size
> > > in the memory node. The comment " /* the mem node will be updated by
> > > ZSBL. */" is telling this.
> >
> > Yes, I read the comment!
> >
> > > We write memory nodes like this to make them act just as placeholders
> > > and the value is by default written as zero.
> >
> > Why knowingly add something that is wrong, rather than omitting them
> > entirely?
>
> We learn this from arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts,
> it writes DTS as following:
>
> ```
> memory@0 {
> device_type = "memory";
> /* rewrite this at bootloader */
> reg = <0x0 0x0 0x0 0x0>;
> };
> ```
> So you mean we can totally remove the memory nodes in DTS and make
> bootloader add it by itself? That sounds a good idea, I will have a
> try. I used to think memory nodes are must-have in DTS.

AFAIR, the ones for the d1 based systems (like the nezha I have) don't
have a memory node at all.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]