Re: [PATCH v6 07/25] arm: rpi: Add a devicetree file for rpi_4

2021-12-03 Thread Simon Glass
Hi Peter,

Taking another look at https://github.com/raspberrypi/firmware.git I
see that the README says that the .dtb files are build from Linux. So
it seems I can simply grab them from there.

Regards,
Simon


On Fri, 3 Dec 2021 at 05:16, Peter Robinson  wrote:
>
> On Thu, Dec 2, 2021 at 6:26 PM Simon Glass  wrote:
> >
> > Hi Mark,
> >
> > On Thu, 2 Dec 2021 at 10:34, Mark Kettenis  wrote:
> > >
> > > > From: Simon Glass 
> > > > Date: Thu,  2 Dec 2021 08:59:01 -0700
> > > >
> > > > Add this file, obtained from the Raspbian boot disk, so there is a
> > > > reference devicetree in the U-Boot tree. The same one is used for
> > > > 32- and 64-bit variants.
> > > >
> > > > Note that U-Boot does not normally need this at runtime, since
> > > > CONFIG_OF_BOARD is enabled. The previous firmware stage provides a
> > > > devicetree at runtime.
> > > >
> > > > Signed-off-by: Simon Glass 
> > > > ---
> > > >
> > > > (no changes since v1)
> > > >
> > > >  arch/arm/dts/Makefile|3 +-
> > > >  arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++
> > > >  configs/rpi_4_32b_defconfig  |1 +
> > > >  configs/rpi_4_defconfig  |1 +
> > > >  configs/rpi_arm64_defconfig  |1 +
> > > >  5 files changed, 1963 insertions(+), 1 deletion(-)
> > > >  create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
> > > >
> > > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > > > index 2d92b2f940d..9cddab37207 100644
> > > > --- a/arch/arm/dts/Makefile
> > > > +++ b/arch/arm/dts/Makefile
> > > > @@ -1077,7 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
> > > >   bcm2837-rpi-3-a-plus.dtb \
> > > >   bcm2837-rpi-3-b.dtb \
> > > >   bcm2837-rpi-3-b-plus.dtb \
> > > > - bcm2837-rpi-cm3-io3.dtb
> > > > + bcm2837-rpi-cm3-io3.dtb \
> > > > + bcm2711-rpi-4-b.dtb
> > > >
> > > >  dtb-$(CONFIG_ARCH_BCM63158) += \
> > > >   bcm963158.dtb
> > > > diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts 
> > > > b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > > > new file mode 100644
> > > > index 000..425e9fb91c4
> > > > --- /dev/null
> > > > +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > > > @@ -0,0 +1,1958 @@
> > > > +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> > > > +/*
> > > > + * Sample device tree for rpi_4
> > > > +
> > > > + * Copyright 2021 Google LLC
> > > > + */
> > >
> > > This is of course an utter lie.  This wasn't written from scratch by a
> > > Google employee.
> > >
> > > The original copyright and license for the dtb files you
> > > "disassembled" applies.  You don't specify exactly where you obtained
> > > the file from, but it probably came from here:
> > >
> > >   https://github.com/raspberrypi/firmware
> > >
> > > And the README.md for that repo states that:
> > >
> > >   "The dtbs, overlays and associated README are built from Linux
> > >kernel sources, released under the GPL (see boot/COPYING.linux)"
> > >
> > > They're probably talking about their own fork of the Linux kernel
> > > sources here as there are still differences between their device trees
> > > and the the device trees in the official Linux tree.  But if you
> > > insist on having a device tree in the U-Boot tree, that's where you
> > > should look.
> >
> > IANAL and didn't consider this point.
> >
> > I got this from the boot disk (using fdtdump) and it does not include
> > a copyright message. I'll change this in the next version.
>
> Should probably just get the original one from their upstream source
> repo then rather than decompiling it.


Re: [PATCH v6 07/25] arm: rpi: Add a devicetree file for rpi_4

2021-12-03 Thread Peter Robinson
On Thu, Dec 2, 2021 at 6:26 PM Simon Glass  wrote:
>
> Hi Mark,
>
> On Thu, 2 Dec 2021 at 10:34, Mark Kettenis  wrote:
> >
> > > From: Simon Glass 
> > > Date: Thu,  2 Dec 2021 08:59:01 -0700
> > >
> > > Add this file, obtained from the Raspbian boot disk, so there is a
> > > reference devicetree in the U-Boot tree. The same one is used for
> > > 32- and 64-bit variants.
> > >
> > > Note that U-Boot does not normally need this at runtime, since
> > > CONFIG_OF_BOARD is enabled. The previous firmware stage provides a
> > > devicetree at runtime.
> > >
> > > Signed-off-by: Simon Glass 
> > > ---
> > >
> > > (no changes since v1)
> > >
> > >  arch/arm/dts/Makefile|3 +-
> > >  arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++
> > >  configs/rpi_4_32b_defconfig  |1 +
> > >  configs/rpi_4_defconfig  |1 +
> > >  configs/rpi_arm64_defconfig  |1 +
> > >  5 files changed, 1963 insertions(+), 1 deletion(-)
> > >  create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
> > >
> > > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > > index 2d92b2f940d..9cddab37207 100644
> > > --- a/arch/arm/dts/Makefile
> > > +++ b/arch/arm/dts/Makefile
> > > @@ -1077,7 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
> > >   bcm2837-rpi-3-a-plus.dtb \
> > >   bcm2837-rpi-3-b.dtb \
> > >   bcm2837-rpi-3-b-plus.dtb \
> > > - bcm2837-rpi-cm3-io3.dtb
> > > + bcm2837-rpi-cm3-io3.dtb \
> > > + bcm2711-rpi-4-b.dtb
> > >
> > >  dtb-$(CONFIG_ARCH_BCM63158) += \
> > >   bcm963158.dtb
> > > diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts 
> > > b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > > new file mode 100644
> > > index 000..425e9fb91c4
> > > --- /dev/null
> > > +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > > @@ -0,0 +1,1958 @@
> > > +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> > > +/*
> > > + * Sample device tree for rpi_4
> > > +
> > > + * Copyright 2021 Google LLC
> > > + */
> >
> > This is of course an utter lie.  This wasn't written from scratch by a
> > Google employee.
> >
> > The original copyright and license for the dtb files you
> > "disassembled" applies.  You don't specify exactly where you obtained
> > the file from, but it probably came from here:
> >
> >   https://github.com/raspberrypi/firmware
> >
> > And the README.md for that repo states that:
> >
> >   "The dtbs, overlays and associated README are built from Linux
> >kernel sources, released under the GPL (see boot/COPYING.linux)"
> >
> > They're probably talking about their own fork of the Linux kernel
> > sources here as there are still differences between their device trees
> > and the the device trees in the official Linux tree.  But if you
> > insist on having a device tree in the U-Boot tree, that's where you
> > should look.
>
> IANAL and didn't consider this point.
>
> I got this from the boot disk (using fdtdump) and it does not include
> a copyright message. I'll change this in the next version.

Should probably just get the original one from their upstream source
repo then rather than decompiling it.


Re: [PATCH v6 07/25] arm: rpi: Add a devicetree file for rpi_4

2021-12-02 Thread Simon Glass
Hi Mark,

On Thu, 2 Dec 2021 at 10:34, Mark Kettenis  wrote:
>
> > From: Simon Glass 
> > Date: Thu,  2 Dec 2021 08:59:01 -0700
> >
> > Add this file, obtained from the Raspbian boot disk, so there is a
> > reference devicetree in the U-Boot tree. The same one is used for
> > 32- and 64-bit variants.
> >
> > Note that U-Boot does not normally need this at runtime, since
> > CONFIG_OF_BOARD is enabled. The previous firmware stage provides a
> > devicetree at runtime.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > (no changes since v1)
> >
> >  arch/arm/dts/Makefile|3 +-
> >  arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++
> >  configs/rpi_4_32b_defconfig  |1 +
> >  configs/rpi_4_defconfig  |1 +
> >  configs/rpi_arm64_defconfig  |1 +
> >  5 files changed, 1963 insertions(+), 1 deletion(-)
> >  create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
> >
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 2d92b2f940d..9cddab37207 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -1077,7 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
> >   bcm2837-rpi-3-a-plus.dtb \
> >   bcm2837-rpi-3-b.dtb \
> >   bcm2837-rpi-3-b-plus.dtb \
> > - bcm2837-rpi-cm3-io3.dtb
> > + bcm2837-rpi-cm3-io3.dtb \
> > + bcm2711-rpi-4-b.dtb
> >
> >  dtb-$(CONFIG_ARCH_BCM63158) += \
> >   bcm963158.dtb
> > diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts 
> > b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > new file mode 100644
> > index 000..425e9fb91c4
> > --- /dev/null
> > +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > @@ -0,0 +1,1958 @@
> > +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> > +/*
> > + * Sample device tree for rpi_4
> > +
> > + * Copyright 2021 Google LLC
> > + */
>
> This is of course an utter lie.  This wasn't written from scratch by a
> Google employee.
>
> The original copyright and license for the dtb files you
> "disassembled" applies.  You don't specify exactly where you obtained
> the file from, but it probably came from here:
>
>   https://github.com/raspberrypi/firmware
>
> And the README.md for that repo states that:
>
>   "The dtbs, overlays and associated README are built from Linux
>kernel sources, released under the GPL (see boot/COPYING.linux)"
>
> They're probably talking about their own fork of the Linux kernel
> sources here as there are still differences between their device trees
> and the the device trees in the official Linux tree.  But if you
> insist on having a device tree in the U-Boot tree, that's where you
> should look.

IANAL and didn't consider this point.

I got this from the boot disk (using fdtdump) and it does not include
a copyright message. I'll change this in the next version.

Regards,
Simon


Re: [PATCH v6 07/25] arm: rpi: Add a devicetree file for rpi_4

2021-12-02 Thread François Ozog
Hi Mark,

On Thu, 2 Dec 2021 at 18:34, Mark Kettenis  wrote:

> > From: Simon Glass 
> > Date: Thu,  2 Dec 2021 08:59:01 -0700
> >
> > Add this file, obtained from the Raspbian boot disk, so there is a
> > reference devicetree in the U-Boot tree. The same one is used for
> > 32- and 64-bit variants.
> >
> > Note that U-Boot does not normally need this at runtime, since
> > CONFIG_OF_BOARD is enabled. The previous firmware stage provides a
> > devicetree at runtime.
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > (no changes since v1)
> >
> >  arch/arm/dts/Makefile|3 +-
> >  arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++
> >  configs/rpi_4_32b_defconfig  |1 +
> >  configs/rpi_4_defconfig  |1 +
> >  configs/rpi_arm64_defconfig  |1 +
> >  5 files changed, 1963 insertions(+), 1 deletion(-)
> >  create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
> >
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 2d92b2f940d..9cddab37207 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -1077,7 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
> >   bcm2837-rpi-3-a-plus.dtb \
> >   bcm2837-rpi-3-b.dtb \
> >   bcm2837-rpi-3-b-plus.dtb \
> > - bcm2837-rpi-cm3-io3.dtb
> > + bcm2837-rpi-cm3-io3.dtb \
> > + bcm2711-rpi-4-b.dtb
> >
> >  dtb-$(CONFIG_ARCH_BCM63158) += \
> >   bcm963158.dtb
> > diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts
> b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > new file mode 100644
> > index 000..425e9fb91c4
> > --- /dev/null
> > +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
> > @@ -0,0 +1,1958 @@
> > +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> > +/*
> > + * Sample device tree for rpi_4
> > +
> > + * Copyright 2021 Google LLC
> > + */
>
> This is of course an utter lie.  This wasn't written from scratch by a
> Google employee.
>
> The original copyright and license for the dtb files you
> "disassembled" applies.  You don't specify exactly where you obtained
> the file from, but it probably came from here:
>
>   https://github.com/raspberrypi/firmware
>
> And the README.md for that repo states that:
>
>   "The dtbs, overlays and associated README are built from Linux
>kernel sources, released under the GPL (see boot/COPYING.linux)"
>
> That's quite a point! thanks for bringing this additional "legal"
standpoint.

> They're probably talking about their own fork of the Linux kernel
> sources here as there are still differences between their device trees
> and the the device trees in the official Linux tree.  But if you
> insist on having a device tree in the U-Boot tree, that's where you
> should look.


> > +
> > +/dts-v1/;
> > +
> > +/memreserve/ 0x 0x1000;
> > +/ {
> > + compatible = "raspberrypi,4-model-b\0brcm,bcm2838\0brcm,bcm2837";
> > + model = "Raspberry Pi 4 Model B";
> > + interrupt-parent = <0x01>;
> > + #address-cells = <0x02>;
> > + #size-cells = <0x01>;
> > +
> > + aliases {
> > + serial0 = "/soc/serial@7e215040";
> > + serial1 = "/soc/serial@7e201000";
> > + audio = "/soc/audio";
> > + aux = "/soc/aux@7e215000";
> > + sound = "/soc/sound";
> > + soc = "/soc";
> > + dma = "/soc/dma@7e007000";
> > + watchdog = "/soc/watchdog@7e10";
> > + random = "/soc/rng@7e104000";
> > + mailbox = "/soc/mailbox@7e00b880";
> > + gpio = "/soc/gpio@7e20";
> > + uart0 = "/soc/serial@7e201000";
> > + sdhost = "/soc/mmc@7e202000";
> > + mmc0 = "/soc/emmc2@7e34";
> > + i2s = "/soc/i2s@7e203000";
> > + spi0 = "/soc/spi@7e204000";
> > + i2c0 = "/soc/i2c@7e205000";
> > + uart1 = "/soc/serial@7e215040";
> > + spi1 = "/soc/spi@7e215080";
> > + spi2 = "/soc/spi@7e2150c0";
> > + mmc = "/soc/mmc@7e30";
> > + mmc1 = "/soc/mmcnr@7e30";
> > + i2c1 = "/soc/i2c@7e804000";
> > + i2c2 = "/soc/i2c@7e805000";
> > + usb = "/soc/usb@7e98";
> > + leds = "/leds";
> > + fb = "/soc/fb";
> > + thermal = "/soc/thermal@7d5d2200";
> > + axiperf = "/soc/axiperf";
> > + mmc2 = "/soc/mmc@7e202000";
> > + ethernet0 = "/scb/genet@7d58";
> > + };
> > +
> > + chosen {
> > + bootargs = "8250.nr_uarts=1 cma=64M";
> > + };
> > +
> > + thermal-zones {
> > +
> > + cpu-thermal {
> > + polling-delay-passive = <0x00>;
> > + polling-delay = <0x3e8>;
> > + thermal-sensors = <0x02>;
> > + coefficients = <0xfe19 0x641b8>;
> > + phandle = <0x2f>;
> > +
> > + cooling-maps {
> > + };
> > +   

Re: [PATCH v6 07/25] arm: rpi: Add a devicetree file for rpi_4

2021-12-02 Thread Mark Kettenis
> From: Simon Glass 
> Date: Thu,  2 Dec 2021 08:59:01 -0700
> 
> Add this file, obtained from the Raspbian boot disk, so there is a
> reference devicetree in the U-Boot tree. The same one is used for
> 32- and 64-bit variants.
> 
> Note that U-Boot does not normally need this at runtime, since
> CONFIG_OF_BOARD is enabled. The previous firmware stage provides a
> devicetree at runtime.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> (no changes since v1)
> 
>  arch/arm/dts/Makefile|3 +-
>  arch/arm/dts/bcm2711-rpi-4-b.dts | 1958 ++
>  configs/rpi_4_32b_defconfig  |1 +
>  configs/rpi_4_defconfig  |1 +
>  configs/rpi_arm64_defconfig  |1 +
>  5 files changed, 1963 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/bcm2711-rpi-4-b.dts
> 
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 2d92b2f940d..9cddab37207 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -1077,7 +1077,8 @@ dtb-$(CONFIG_ARCH_BCM283X) += \
>   bcm2837-rpi-3-a-plus.dtb \
>   bcm2837-rpi-3-b.dtb \
>   bcm2837-rpi-3-b-plus.dtb \
> - bcm2837-rpi-cm3-io3.dtb
> + bcm2837-rpi-cm3-io3.dtb \
> + bcm2711-rpi-4-b.dtb
>  
>  dtb-$(CONFIG_ARCH_BCM63158) += \
>   bcm963158.dtb
> diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts 
> b/arch/arm/dts/bcm2711-rpi-4-b.dts
> new file mode 100644
> index 000..425e9fb91c4
> --- /dev/null
> +++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
> @@ -0,0 +1,1958 @@
> +// SPDX-License-Identifier: GPL-2.0+ OR MIT
> +/*
> + * Sample device tree for rpi_4
> +
> + * Copyright 2021 Google LLC
> + */

This is of course an utter lie.  This wasn't written from scratch by a
Google employee.

The original copyright and license for the dtb files you
"disassembled" applies.  You don't specify exactly where you obtained
the file from, but it probably came from here:

  https://github.com/raspberrypi/firmware

And the README.md for that repo states that:

  "The dtbs, overlays and associated README are built from Linux
   kernel sources, released under the GPL (see boot/COPYING.linux)"

They're probably talking about their own fork of the Linux kernel
sources here as there are still differences between their device trees
and the the device trees in the official Linux tree.  But if you
insist on having a device tree in the U-Boot tree, that's where you
should look.

> +
> +/dts-v1/;
> +
> +/memreserve/ 0x 0x1000;
> +/ {
> + compatible = "raspberrypi,4-model-b\0brcm,bcm2838\0brcm,bcm2837";
> + model = "Raspberry Pi 4 Model B";
> + interrupt-parent = <0x01>;
> + #address-cells = <0x02>;
> + #size-cells = <0x01>;
> +
> + aliases {
> + serial0 = "/soc/serial@7e215040";
> + serial1 = "/soc/serial@7e201000";
> + audio = "/soc/audio";
> + aux = "/soc/aux@7e215000";
> + sound = "/soc/sound";
> + soc = "/soc";
> + dma = "/soc/dma@7e007000";
> + watchdog = "/soc/watchdog@7e10";
> + random = "/soc/rng@7e104000";
> + mailbox = "/soc/mailbox@7e00b880";
> + gpio = "/soc/gpio@7e20";
> + uart0 = "/soc/serial@7e201000";
> + sdhost = "/soc/mmc@7e202000";
> + mmc0 = "/soc/emmc2@7e34";
> + i2s = "/soc/i2s@7e203000";
> + spi0 = "/soc/spi@7e204000";
> + i2c0 = "/soc/i2c@7e205000";
> + uart1 = "/soc/serial@7e215040";
> + spi1 = "/soc/spi@7e215080";
> + spi2 = "/soc/spi@7e2150c0";
> + mmc = "/soc/mmc@7e30";
> + mmc1 = "/soc/mmcnr@7e30";
> + i2c1 = "/soc/i2c@7e804000";
> + i2c2 = "/soc/i2c@7e805000";
> + usb = "/soc/usb@7e98";
> + leds = "/leds";
> + fb = "/soc/fb";
> + thermal = "/soc/thermal@7d5d2200";
> + axiperf = "/soc/axiperf";
> + mmc2 = "/soc/mmc@7e202000";
> + ethernet0 = "/scb/genet@7d58";
> + };
> +
> + chosen {
> + bootargs = "8250.nr_uarts=1 cma=64M";
> + };
> +
> + thermal-zones {
> +
> + cpu-thermal {
> + polling-delay-passive = <0x00>;
> + polling-delay = <0x3e8>;
> + thermal-sensors = <0x02>;
> + coefficients = <0xfe19 0x641b8>;
> + phandle = <0x2f>;
> +
> + cooling-maps {
> + };
> + };
> + };
> +
> + soc {
> + compatible = "simple-bus";
> + #address-cells = <0x01>;
> + #size-cells = <0x01>;
> + ranges = <0x7e00 0x00 0xfe00 0x180
> + 0x7c00 0x00 0xfc00 0x200
> + 0x4000 0x00 0xff80 0x80>;
> + dma-ranges = <0xc000 0x00