diff mbox series

mips: ralink: mt7621: add device tree into the kernel

Message ID 20220908060804.1531428-1-sergio.paracuellos@gmail.com (mailing list archive)
State Superseded
Headers show
Series mips: ralink: mt7621: add device tree into the kernel | expand

Commit Message

Sergio Paracuellos Sept. 8, 2022, 6:08 a.m. UTC
Device tree blobs for ralink mt7621 SoCs depends on configuration
CONFIG_SOC_MT7621 kernel option. This blobs needs to be properly
builtin into the kernel in order to be able to properly boot the
Gnubee boards. Hence, select CONFIG_BUILTIN_DTB for mt7621 Socs.
This option was a miss when this related device tree files were
moved from staging into the real 'arch/mips/boot/dts/ralink'
folder in kernel.

Fixes: 7a6ee0bbab25 ("mips: dts: ralink: add MT7621 SoC")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 arch/mips/ralink/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Arınç ÜNAL Sept. 8, 2022, 6:34 p.m. UTC | #1
On 8.09.2022 09:08, Sergio Paracuellos wrote:
> Device tree blobs for ralink mt7621 SoCs depends on configuration
> CONFIG_SOC_MT7621 kernel option. This blobs needs to be properly
> builtin into the kernel in order to be able to properly boot the
> Gnubee boards. Hence, select CONFIG_BUILTIN_DTB for mt7621 Socs.
> This option was a miss when this related device tree files were
> moved from staging into the real 'arch/mips/boot/dts/ralink'
> folder in kernel.
> 
> Fixes: 7a6ee0bbab25 ("mips: dts: ralink: add MT7621 SoC")
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

I just tested this on a GB-PC2. If I understand correctly, this option 
adds all compiled DT on top of the compiled linux image, vmlinux, 
vmlinuz, etc..

DTB for GB-PC1 must come first since the bootloader on my GB-PC2 thinks 
the device is GB-PC1.

[    0.000000] Linux version 6.0.0-rc3+ (arinc9@arinc9-PC) 
(mipsel-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU 
Binutils for Ubuntu) 2.38) #8 SMP Thu Sep 8 21:16:57 +03 2022
[    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
[    0.000000] printk: bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] MIPS: machine is GB-PC1

I think we should not make SOC_MT7621 select this option now that we 
compile devicetrees for all devices which use the MT7621 SoC but rather 
leave it to the OS builder, OpenWrt SDK, etc. to decide and add the DTB 
on top of the compiled linux image.

I think this is already the case for all arm devicetrees?

Arınç

> ---
>   arch/mips/ralink/Kconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
> index f9fe15630abb..f3b14bfc8066 100644
> --- a/arch/mips/ralink/Kconfig
> +++ b/arch/mips/ralink/Kconfig
> @@ -54,6 +54,7 @@ choice
>   		select HAVE_PCI
>   		select PCI_DRIVERS_GENERIC
>   		select SOC_BUS
> +		select BUILTIN_DTB
>   
>   		help
>   		  The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU,
Sergio Paracuellos Sept. 9, 2022, 4:01 a.m. UTC | #2
Hi Arinc,

On Thu, Sep 8, 2022 at 8:34 PM Arınç ÜNAL <arinc.unal@arinc9.com> wrote:
>
> On 8.09.2022 09:08, Sergio Paracuellos wrote:
> > Device tree blobs for ralink mt7621 SoCs depends on configuration
> > CONFIG_SOC_MT7621 kernel option. This blobs needs to be properly
> > builtin into the kernel in order to be able to properly boot the
> > Gnubee boards. Hence, select CONFIG_BUILTIN_DTB for mt7621 Socs.
> > This option was a miss when this related device tree files were
> > moved from staging into the real 'arch/mips/boot/dts/ralink'
> > folder in kernel.
> >
> > Fixes: 7a6ee0bbab25 ("mips: dts: ralink: add MT7621 SoC")
> > Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
>
> I just tested this on a GB-PC2. If I understand correctly, this option
> adds all compiled DT on top of the compiled linux image, vmlinux,
> vmlinuz, etc..
>
> DTB for GB-PC1 must come first since the bootloader on my GB-PC2 thinks
> the device is GB-PC1.
>
> [    0.000000] Linux version 6.0.0-rc3+ (arinc9@arinc9-PC)
> (mipsel-linux-gnu-gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0, GNU ld (GNU
> Binutils for Ubuntu) 2.38) #8 SMP Thu Sep 8 21:16:57 +03 2022
> [    0.000000] SoC Type: MediaTek MT7621 ver:1 eco:3
> [    0.000000] printk: bootconsole [early0] enabled
> [    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
> [    0.000000] MIPS: machine is GB-PC1
>
> I think we should not make SOC_MT7621 select this option now that we
> compile devicetrees for all devices which use the MT7621 SoC but rather
> leave it to the OS builder, OpenWrt SDK, etc. to decide and add the DTB
> on top of the compiled linux image.

I see. If this is the case I think we need to add DTB options to know
which dtb must be included in the kernel like other ralink platforms
do in 'arch/mips/ralink/Kconfig' and make each one dependant on
MT7621_SOC and select BUILTIN_DTB in each of them:

config DTB_GNUBEE1
     bool "GnuBee1 2.5inch NAS"
     depends on SOC_MT7621
     select BUILTIN_DTB

config DTB_GNUBEE2
     bool "GnuBee2 3.5inch NAS"
     depends on SOC_MT7621
     select BUILTIN_DTB

And then in 'arch/mips/boot/dts/ralink/Makefile' do:

dtb-$(CONFIG_DTB_GNUBEE1) += mt7621-gnubee-gb-pc1.dtb
dtb-$(CONFIG_DTB_GNUBEE2) += mt7621-gnubee-gb-pc2.dtb

I am not a Kconfig expert so I don't know if there is a better option.

>
> I think this is already the case for all arm devicetrees?

AFAIK, arm device trees are not normally embedded in the image but
loaded in memory in the boot process and from there a pointer is
passed to the kernel so I think just making all of them available for
a SoC makes sense.

Best regards,
    Sergio Paracuellos
>
> Arınç
>
> > ---
> >   arch/mips/ralink/Kconfig | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
> > index f9fe15630abb..f3b14bfc8066 100644
> > --- a/arch/mips/ralink/Kconfig
> > +++ b/arch/mips/ralink/Kconfig
> > @@ -54,6 +54,7 @@ choice
> >               select HAVE_PCI
> >               select PCI_DRIVERS_GENERIC
> >               select SOC_BUS
> > +             select BUILTIN_DTB
> >
> >               help
> >                 The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU,
diff mbox series

Patch

diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
index f9fe15630abb..f3b14bfc8066 100644
--- a/arch/mips/ralink/Kconfig
+++ b/arch/mips/ralink/Kconfig
@@ -54,6 +54,7 @@  choice
 		select HAVE_PCI
 		select PCI_DRIVERS_GENERIC
 		select SOC_BUS
+		select BUILTIN_DTB
 
 		help
 		  The MT7621 system-on-a-chip includes an 880 MHz MIPS1004Kc dual-core CPU,