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

From: Chen Wang
Date: Thu Sep 21 2023 - 17:05:49 EST


Regards,

unicornx

Conor Dooley <conor@xxxxxxxxxx> 于2023年9月21日周四 18:15写道:
>
> On Thu, Sep 21, 2023 at 05:56:28PM +0800, Chen Wang wrote:
> > Regards,
> >
> > unicornx
> >
......
> > > > +
> > > > +/ {
> > > > + 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?
>
> Thanks,
> Conor.
>

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.


> >
> >
> > >
> > > > + memory@0 {
> > > > + device_type = "memory";
> > > > + reg = <0x00000000 0x00000000 0x00000000 0x00000000>;
> > > > + };
> > > > +