From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree
Date: Sun, 27 Sep 2026 11:15:10 +0200 [thread overview]
Message-ID: <20260927091512.117046-1-tsbogend@alpha.franken.de> (raw)
There are older Octeon boards with ld U-Boots, which don't use and pass
a device tree to the kernel. Use MIPS_MACHINE mechanism to get a device
tree.
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
arch/mips/cavium-octeon/setup.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index d2bba2fe636d..7497be7b9431 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -30,6 +30,7 @@
#include <linux/libfdt.h>
#include <linux/kexec.h>
+#include <asm/machine.h>
#include <asm/processor.h>
#include <asm/reboot.h>
#include <asm/smp-ops.h>
@@ -1159,7 +1160,7 @@ void __init octeon_fill_mac_addresses(void);
void __init device_tree_init(void)
{
- const void *fdt;
+ const void *fdt = NULL;
bool do_prune;
bool fill_mac;
@@ -1178,12 +1179,28 @@ void __init device_tree_init(void)
do_prune = false;
fill_mac = false;
pr_info("Using passed Device Tree.\n");
- } else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
- fdt = &__dtb_octeon_68xx_begin;
- do_prune = true;
- fill_mac = true;
} else {
- fdt = &__dtb_octeon_3xxx_begin;
+ const struct mips_machine *check_mach;
+
+ for_each_mips_machine(check_mach) {
+ if (!check_mach->detect)
+ continue;
+ if (!check_mach->detect())
+ continue;
+
+ fdt = check_mach->fdt;
+ do_prune = false;
+ fill_mac = true;
+ pr_info("Using compiled-in Device Tree.\n");
+ break;
+ }
+ }
+
+ if (!fdt) {
+ if (OCTEON_IS_MODEL(OCTEON_CN68XX))
+ fdt = &__dtb_octeon_68xx_begin;
+ else
+ fdt = &__dtb_octeon_3xxx_begin;
do_prune = true;
fill_mac = true;
}
--
2.51.0
next reply other threads:[~2026-09-27 9:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 9:15 Thomas Bogendoerfer [this message]
2026-09-27 9:15 ` [PATCH 2/2] MIPS: octeon: Add detection of UBNT Edgeroute Lite devices Thomas Bogendoerfer
2026-10-01 12:12 ` Thomas Bogendoerfer
2026-10-01 12:12 ` [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree Thomas Bogendoerfer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260927091512.117046-1-tsbogend@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox