Skip to contentSkip to conversation

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

PATCH In review Sergio Paracuellos 2 participants 3 messages Sep 8, 2022 – Sep 9, 2022

Subsystems (2)
lore
Share & tools
lore

Sergio Paracuellos

author maintainer
#0 lore raw

PATCH 1/1 mips: ralink: mt7621: add device tree into the kernel

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")
---
 arch/mips/ralink/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/mips/ralink/Kconfig +1 -0
index f9fe15630abb..f3b14bfc8066 100644
@@ -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,
Signature · 1 line
2.25.1
#1 lore raw
Quoted 10 lines · Sergio Paracuellos

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")

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ç

Quoted 16 lines
---
  arch/mips/ralink/Kconfig | 1 +
  1 file changed, 1 insertion(+)
arch/mips/ralink/Kconfig +1 -0
index f9fe15630abb..f3b14bfc8066 100644
@@ -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,
author maintainer
#2 lore raw

Hi Arinc,

Quoted 28 lines · Arınç ÜNAL
Quoted 10 lines · Sergio Paracuellos

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")

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
Quoted 4 lines

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.

Quoted 2 lines

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

Quoted 19 lines

Arınç

Quoted 16 lines
---
  arch/mips/ralink/Kconfig | 1 +
  1 file changed, 1 insertion(+)
arch/mips/ralink/Kconfig +1 -0
index f9fe15630abb..f3b14bfc8066 100644
@@ -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,