Skip to content

Commit 35fb26f

Browse files
cjdelisletsbogend
authored andcommitted
mips: Add EcoNet MIPS platform support
Add platform support for EcoNet MIPS SoCs. Signed-off-by: Caleb James DeLisle <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent be8b417 commit 35fb26f

File tree

7 files changed

+153
-0
lines changed

7 files changed

+153
-0
lines changed

arch/mips/Kbuild.platforms

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ platform-$(CONFIG_CAVIUM_OCTEON_SOC) += cavium-octeon/
1111
platform-$(CONFIG_EYEQ) += mobileye/
1212
platform-$(CONFIG_MIPS_COBALT) += cobalt/
1313
platform-$(CONFIG_MACH_DECSTATION) += dec/
14+
platform-$(CONFIG_ECONET) += econet/
1415
platform-$(CONFIG_MIPS_GENERIC) += generic/
1516
platform-$(CONFIG_MACH_JAZZ) += jazz/
1617
platform-$(CONFIG_LANTIQ) += lantiq/

arch/mips/Kconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,30 @@ config MACH_DECSTATION
391391

392392
otherwise choose R3000.
393393

394+
config ECONET
395+
bool "EcoNet MIPS family"
396+
select BOOT_RAW
397+
select CPU_BIG_ENDIAN
398+
select DEBUG_ZBOOT
399+
select EARLY_PRINTK_8250
400+
select ECONET_EN751221_TIMER
401+
select SERIAL_OF_PLATFORM
402+
select SYS_SUPPORTS_BIG_ENDIAN
403+
select SYS_HAS_CPU_MIPS32_R1
404+
select SYS_HAS_CPU_MIPS32_R2
405+
select SYS_HAS_EARLY_PRINTK
406+
select SYS_SUPPORTS_32BIT_KERNEL
407+
select SYS_SUPPORTS_MIPS16
408+
select SYS_SUPPORTS_ZBOOT_UART16550
409+
select USE_GENERIC_EARLY_PRINTK_8250
410+
select USE_OF
411+
help
412+
EcoNet EN75xx MIPS devices are big endian MIPS machines used
413+
in XPON (fiber) and DSL applications. They have SPI, PCI, USB,
414+
GPIO, and Ethernet, with optional XPON, DSL, and VoIP DSP cores.
415+
Don't confuse these with the Airoha ARM devices sometimes referred
416+
to as "EcoNet", this family is for MIPS based devices only.
417+
394418
config MACH_JAZZ
395419
bool "Jazz family of machines"
396420
select ARC_MEMORY
@@ -1021,6 +1045,7 @@ source "arch/mips/ath79/Kconfig"
10211045
source "arch/mips/bcm47xx/Kconfig"
10221046
source "arch/mips/bcm63xx/Kconfig"
10231047
source "arch/mips/bmips/Kconfig"
1048+
source "arch/mips/econet/Kconfig"
10241049
source "arch/mips/generic/Kconfig"
10251050
source "arch/mips/ingenic/Kconfig"
10261051
source "arch/mips/jazz/Kconfig"

arch/mips/boot/compressed/uart-16550.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#define PORT(offset) (CKSEG1ADDR(INGENIC_UART_BASE_ADDR) + (4 * offset))
2121
#endif
2222

23+
#ifdef CONFIG_ECONET
24+
#define EN75_UART_BASE 0x1fbf0003
25+
#define PORT(offset) (CKSEG1ADDR(EN75_UART_BASE) + (4 * (offset)))
26+
#endif
27+
2328
#ifndef IOTYPE
2429
#define IOTYPE char
2530
#endif

arch/mips/econet/Kconfig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
if ECONET
3+
4+
choice
5+
prompt "EcoNet SoC selection"
6+
default SOC_ECONET_EN751221
7+
help
8+
Select EcoNet MIPS SoC type. Individual SoCs within a family are
9+
very similar, so is it enough to select the right family, and
10+
then customize to the specific SoC using the device tree only.
11+
12+
config SOC_ECONET_EN751221
13+
bool "EN751221 family"
14+
select COMMON_CLK
15+
select ECONET_EN751221_INTC
16+
select IRQ_MIPS_CPU
17+
select SMP
18+
select SMP_UP
19+
select SYS_SUPPORTS_SMP
20+
help
21+
The EN751221 family includes EN7512, RN7513, EN7521, EN7526.
22+
They are based on single core MIPS 34Kc processors. To boot
23+
this kernel, you will need a device tree such as
24+
MIPS_RAW_APPENDED_DTB=y, and a root filesystem.
25+
endchoice
26+
27+
choice
28+
prompt "Devicetree selection"
29+
default DTB_ECONET_NONE
30+
help
31+
Select the devicetree.
32+
33+
config DTB_ECONET_NONE
34+
bool "None"
35+
endchoice
36+
37+
endif

arch/mips/econet/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
obj-y := init.o

arch/mips/econet/Platform

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# To address a 7.2MB kernel size limit in the EcoNet SDK bootloader,
2+
# we put the load address well above where the bootloader loads and then use
3+
# zboot. So please set CONFIG_ZBOOT_LOAD_ADDRESS to the address where your
4+
# bootloader actually places the kernel.
5+
load-$(CONFIG_ECONET) += 0xffffffff81000000

arch/mips/econet/init.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
/*
3+
* EcoNet setup code
4+
*
5+
* Copyright (C) 2025 Caleb James DeLisle <[email protected]>
6+
*/
7+
8+
#include <linux/init.h>
9+
#include <linux/of_clk.h>
10+
#include <linux/irqchip.h>
11+
12+
#include <asm/addrspace.h>
13+
#include <asm/io.h>
14+
#include <asm/bootinfo.h>
15+
#include <asm/time.h>
16+
#include <asm/prom.h>
17+
#include <asm/smp-ops.h>
18+
#include <asm/reboot.h>
19+
20+
#define CR_AHB_RSTCR ((void __iomem *)CKSEG1ADDR(0x1fb00040))
21+
#define RESET BIT(31)
22+
23+
#define UART_BASE CKSEG1ADDR(0x1fbf0003)
24+
#define UART_REG_SHIFT 2
25+
26+
static void hw_reset(char *command)
27+
{
28+
iowrite32(RESET, CR_AHB_RSTCR);
29+
}
30+
31+
/* 1. Bring up early printk. */
32+
void __init prom_init(void)
33+
{
34+
setup_8250_early_printk_port(UART_BASE, UART_REG_SHIFT, 0);
35+
_machine_restart = hw_reset;
36+
}
37+
38+
/* 2. Parse the DT and find memory */
39+
void __init plat_mem_setup(void)
40+
{
41+
void *dtb;
42+
43+
set_io_port_base(KSEG1);
44+
45+
dtb = get_fdt();
46+
if (!dtb)
47+
panic("no dtb found");
48+
49+
__dt_setup_arch(dtb);
50+
51+
early_init_dt_scan_memory();
52+
}
53+
54+
/* 3. Overload __weak device_tree_init(), add SMP_UP ops */
55+
void __init device_tree_init(void)
56+
{
57+
unflatten_and_copy_device_tree();
58+
59+
register_up_smp_ops();
60+
}
61+
62+
const char *get_system_type(void)
63+
{
64+
return "EcoNet-EN75xx";
65+
}
66+
67+
/* 4. Initialize the IRQ subsystem */
68+
void __init arch_init_irq(void)
69+
{
70+
irqchip_init();
71+
}
72+
73+
/* 5. Timers */
74+
void __init plat_time_init(void)
75+
{
76+
of_clk_init(NULL);
77+
timer_probe();
78+
}

0 commit comments

Comments
 (0)