]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mips: Add EcoNet MIPS platform support
authorCaleb James DeLisle <cjd@cjdns.fr>
Wed, 7 May 2025 13:44:57 +0000 (13:44 +0000)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 20 May 2025 06:46:58 +0000 (08:46 +0200)
Add platform support for EcoNet MIPS SoCs.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
arch/mips/Kbuild.platforms
arch/mips/Kconfig
arch/mips/boot/compressed/uart-16550.c
arch/mips/econet/Kconfig [new file with mode: 0644]
arch/mips/econet/Makefile [new file with mode: 0644]
arch/mips/econet/Platform [new file with mode: 0644]
arch/mips/econet/init.c [new file with mode: 0644]

index bca37ddf974b80c3c2df215feac72c4b5d990f2b..41a00fa860c18d5c8a3f20e921c949302022960d 100644 (file)
@@ -11,6 +11,7 @@ platform-$(CONFIG_CAVIUM_OCTEON_SOC)  += cavium-octeon/
 platform-$(CONFIG_EYEQ)                        += mobileye/
 platform-$(CONFIG_MIPS_COBALT)         += cobalt/
 platform-$(CONFIG_MACH_DECSTATION)     += dec/
+platform-$(CONFIG_ECONET)              += econet/
 platform-$(CONFIG_MIPS_GENERIC)                += generic/
 platform-$(CONFIG_MACH_JAZZ)           += jazz/
 platform-$(CONFIG_LANTIQ)              += lantiq/
index e0e6ce2592b4168facf337b60fd889d76e81a407..c3dbdc808664568f129c96738d8b1f09b6c8626f 100644 (file)
@@ -391,6 +391,30 @@ config MACH_DECSTATION
 
          otherwise choose R3000.
 
+config ECONET
+       bool "EcoNet MIPS family"
+       select BOOT_RAW
+       select CPU_BIG_ENDIAN
+       select DEBUG_ZBOOT
+       select EARLY_PRINTK_8250
+       select ECONET_EN751221_TIMER
+       select SERIAL_OF_PLATFORM
+       select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_HAS_CPU_MIPS32_R1
+       select SYS_HAS_CPU_MIPS32_R2
+       select SYS_HAS_EARLY_PRINTK
+       select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_MIPS16
+       select SYS_SUPPORTS_ZBOOT_UART16550
+       select USE_GENERIC_EARLY_PRINTK_8250
+       select USE_OF
+       help
+         EcoNet EN75xx MIPS devices are big endian MIPS machines used
+         in XPON (fiber) and DSL applications. They have SPI, PCI, USB,
+         GPIO, and Ethernet, with optional XPON, DSL, and VoIP DSP cores.
+         Don't confuse these with the Airoha ARM devices sometimes referred
+         to as "EcoNet", this family is for MIPS based devices only.
+
 config MACH_JAZZ
        bool "Jazz family of machines"
        select ARC_MEMORY
@@ -1021,6 +1045,7 @@ source "arch/mips/ath79/Kconfig"
 source "arch/mips/bcm47xx/Kconfig"
 source "arch/mips/bcm63xx/Kconfig"
 source "arch/mips/bmips/Kconfig"
+source "arch/mips/econet/Kconfig"
 source "arch/mips/generic/Kconfig"
 source "arch/mips/ingenic/Kconfig"
 source "arch/mips/jazz/Kconfig"
index db618e72a0c42a9da610a881eeb851c1b357c745..529e77a6487c1d30af3000d13c355aca14dafe37 100644 (file)
 #define PORT(offset) (CKSEG1ADDR(INGENIC_UART_BASE_ADDR) + (4 * offset))
 #endif
 
+#ifdef CONFIG_ECONET
+#define EN75_UART_BASE 0x1fbf0003
+#define PORT(offset)   (CKSEG1ADDR(EN75_UART_BASE) + (4 * (offset)))
+#endif
+
 #ifndef IOTYPE
 #define IOTYPE char
 #endif
diff --git a/arch/mips/econet/Kconfig b/arch/mips/econet/Kconfig
new file mode 100644 (file)
index 0000000..d03f90f
--- /dev/null
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: GPL-2.0
+if ECONET
+
+choice
+       prompt "EcoNet SoC selection"
+       default SOC_ECONET_EN751221
+       help
+         Select EcoNet MIPS SoC type. Individual SoCs within a family are
+         very similar, so is it enough to select the right family, and
+         then customize to the specific SoC using the device tree only.
+
+       config SOC_ECONET_EN751221
+               bool "EN751221 family"
+               select COMMON_CLK
+               select ECONET_EN751221_INTC
+               select IRQ_MIPS_CPU
+               select SMP
+               select SMP_UP
+               select SYS_SUPPORTS_SMP
+               help
+                 The EN751221 family includes EN7512, RN7513, EN7521, EN7526.
+                 They are based on single core MIPS 34Kc processors. To boot
+                 this kernel, you will need a device tree such as
+                 MIPS_RAW_APPENDED_DTB=y, and a root filesystem.
+endchoice
+
+choice
+       prompt "Devicetree selection"
+       default DTB_ECONET_NONE
+       help
+         Select the devicetree.
+
+       config DTB_ECONET_NONE
+               bool "None"
+endchoice
+
+endif
diff --git a/arch/mips/econet/Makefile b/arch/mips/econet/Makefile
new file mode 100644 (file)
index 0000000..7e4529e
--- /dev/null
@@ -0,0 +1,2 @@
+
+obj-y := init.o
diff --git a/arch/mips/econet/Platform b/arch/mips/econet/Platform
new file mode 100644 (file)
index 0000000..ea56164
--- /dev/null
@@ -0,0 +1,5 @@
+# To address a 7.2MB kernel size limit in the EcoNet SDK bootloader,
+# we put the load address well above where the bootloader loads and then use
+# zboot. So please set CONFIG_ZBOOT_LOAD_ADDRESS to the address where your
+# bootloader actually places the kernel.
+load-$(CONFIG_ECONET)  += 0xffffffff81000000
diff --git a/arch/mips/econet/init.c b/arch/mips/econet/init.c
new file mode 100644 (file)
index 0000000..6f43ffb
--- /dev/null
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * EcoNet setup code
+ *
+ * Copyright (C) 2025 Caleb James DeLisle <cjd@cjdns.fr>
+ */
+
+#include <linux/init.h>
+#include <linux/of_clk.h>
+#include <linux/irqchip.h>
+
+#include <asm/addrspace.h>
+#include <asm/io.h>
+#include <asm/bootinfo.h>
+#include <asm/time.h>
+#include <asm/prom.h>
+#include <asm/smp-ops.h>
+#include <asm/reboot.h>
+
+#define CR_AHB_RSTCR           ((void __iomem *)CKSEG1ADDR(0x1fb00040))
+#define RESET                  BIT(31)
+
+#define UART_BASE              CKSEG1ADDR(0x1fbf0003)
+#define UART_REG_SHIFT         2
+
+static void hw_reset(char *command)
+{
+       iowrite32(RESET, CR_AHB_RSTCR);
+}
+
+/* 1. Bring up early printk. */
+void __init prom_init(void)
+{
+       setup_8250_early_printk_port(UART_BASE, UART_REG_SHIFT, 0);
+       _machine_restart = hw_reset;
+}
+
+/* 2. Parse the DT and find memory */
+void __init plat_mem_setup(void)
+{
+       void *dtb;
+
+       set_io_port_base(KSEG1);
+
+       dtb = get_fdt();
+       if (!dtb)
+               panic("no dtb found");
+
+       __dt_setup_arch(dtb);
+
+       early_init_dt_scan_memory();
+}
+
+/* 3. Overload __weak device_tree_init(), add SMP_UP ops */
+void __init device_tree_init(void)
+{
+       unflatten_and_copy_device_tree();
+
+       register_up_smp_ops();
+}
+
+const char *get_system_type(void)
+{
+       return "EcoNet-EN75xx";
+}
+
+/* 4. Initialize the IRQ subsystem */
+void __init arch_init_irq(void)
+{
+       irqchip_init();
+}
+
+/* 5. Timers */
+void __init plat_time_init(void)
+{
+       of_clk_init(NULL);
+       timer_probe();
+}