mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree
@ 2026-09-27  9:15 Thomas Bogendoerfer
  2026-09-27  9:15 ` [PATCH 2/2] MIPS: octeon: Add detection of UBNT Edgeroute Lite devices Thomas Bogendoerfer
  2026-10-01 12:12 ` [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree Thomas Bogendoerfer
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-09-27  9:15 UTC (permalink / raw)
  To: linux-mips, linux-kernel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] MIPS: octeon: Add detection of UBNT Edgeroute Lite devices
  2026-09-27  9:15 [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree Thomas Bogendoerfer
@ 2026-09-27  9:15 ` 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
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-09-27  9:15 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	linux-mips, linux-kernel

The U-Boot of Ubiquiti Edgerouter Lite don't provide a DT to the kernel.
Use MIPS_MACHINE mechanism to provide one.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---
 arch/mips/boot/dts/cavium-octeon/Makefile |  1 +
 arch/mips/cavium-octeon/Kconfig           |  5 +++++
 arch/mips/cavium-octeon/Makefile          |  2 ++
 arch/mips/cavium-octeon/board-ubnt.c      | 16 ++++++++++++++++
 4 files changed, 24 insertions(+)
 create mode 100644 arch/mips/cavium-octeon/board-ubnt.c

diff --git a/arch/mips/boot/dts/cavium-octeon/Makefile b/arch/mips/boot/dts/cavium-octeon/Makefile
index 48085bca666c..aa3a5ff1468d 100644
--- a/arch/mips/boot/dts/cavium-octeon/Makefile
+++ b/arch/mips/boot/dts/cavium-octeon/Makefile
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_CAVIUM_OCTEON_SOC)	+= octeon_3xxx.dtb octeon_68xx.dtb
+dtb-$(CONFIG_OCTEON_BOARD_UBNT)	+= ubnt_e100.dtb
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 450e979ef5d9..f3618117cc39 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -89,4 +89,9 @@ config OCTEON_ILM
 	  To compile this driver as a module, choose M here.  The module
 	  will be called octeon-ilm
 
+config OCTEON_BOARD_UBNT
+	bool "Support Ubiquiti Devices"
+	help
+	  Enable this for missing Ubiquit device trees and quirks
+
 endif # CAVIUM_OCTEON_SOC
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index ab84ede0cbe0..c9b52c94a8ca 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -18,3 +18,5 @@ obj-y += executive/
 obj-$(CONFIG_MTD)		      += flash_setup.o
 obj-$(CONFIG_SMP)		      += smp.o
 obj-$(CONFIG_OCTEON_ILM)	      += oct_ilm.o
+
+obj-$(CONFIG_OCTEON_BOARD_UBNT)	      += board-ubnt.o
diff --git a/arch/mips/cavium-octeon/board-ubnt.c b/arch/mips/cavium-octeon/board-ubnt.c
new file mode 100644
index 000000000000..e89ab3a02f49
--- /dev/null
+++ b/arch/mips/cavium-octeon/board-ubnt.c
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <asm/machine.h>
+#include <asm/octeon/octeon.h>
+
+static __init bool ubnt_e100_detect(void)
+{
+	return cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_UBNT_E100;
+}
+
+extern const char __dtb_ubnt_e100_begin[];
+
+MIPS_MACHINE(ubnt_e100) = {
+	.fdt = __dtb_ubnt_e100_begin,
+	.detect = ubnt_e100_detect,
+};
-- 
2.51.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree
  2026-09-27  9:15 [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree Thomas Bogendoerfer
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-10-01 12:12 UTC (permalink / raw)
  To: linux-mips, linux-kernel

On Sun, Sep 27, 2026 at 11:15:10AM +0200, Thomas Bogendoerfer wrote:
> 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(-)

applied to mips-next

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] MIPS: octeon: Add detection of UBNT Edgeroute Lite devices
  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
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Bogendoerfer @ 2026-10-01 12:12 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree,
	linux-mips, linux-kernel

On Sun, Sep 27, 2026 at 11:15:11AM +0200, Thomas Bogendoerfer wrote:
> The U-Boot of Ubiquiti Edgerouter Lite don't provide a DT to the kernel.
> Use MIPS_MACHINE mechanism to provide one.
> 
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
> ---
>  arch/mips/boot/dts/cavium-octeon/Makefile |  1 +
>  arch/mips/cavium-octeon/Kconfig           |  5 +++++
>  arch/mips/cavium-octeon/Makefile          |  2 ++
>  arch/mips/cavium-octeon/board-ubnt.c      | 16 ++++++++++++++++
>  4 files changed, 24 insertions(+)
>  create mode 100644 arch/mips/cavium-octeon/board-ubnt.c

applied to mips-next

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-01 12:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-27  9:15 [PATCH 1/2] MIPS: octeon: Use MIPS_MACHINE for boards without provided device tree Thomas Bogendoerfer
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®