* [PATCH v6 1/7] mips: loongson: minimal initial SoC support
[not found] <20260311052046.11265-1-sgdfkk@163.com>
@ 2026-03-11 5:20 ` sgdfkk
0 siblings, 0 replies; 15+ messages in thread
From: sgdfkk @ 2026-03-11 5:20 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
Loongson 1C is a cost-effective SOC chip for industrial control and
the Internet of Things. The Loongson 1C includes a floating-point
processing unit, supports multiple types of memory, and supports
high-capacity MLC NAND Flash. Loongson 1C provides developers with a
wealth of peripheral interfaces and on-chip modules, including Camera
controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD
controller, SPI interface, UART interface, etc., providing sufficient
computing power and multi-application connectivity.
Some highlights of this SoC are:
- Single core LS232, MIPS32 instruction set compatible, main frequency
300MHZ
- 16KB data cache and 16KB instruction cache
- 64 bit float unit, hardware division
- 8/16 bit SDRAM controller, 45 ~ 133MHz
- 8/16 bit SRAM, NAND
- I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC
- 12 UARTs
Links:
https://www.loongson.cn/
introduce base support for the ls1c300 SoC.
- debug UART2
- serial console
- clock
- watchdog
- sysreset
- uart
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
MAINTAINERS | 9 ++++
arch/mips/Kconfig | 11 ++++
arch/mips/Makefile | 1 +
arch/mips/mach-loongson/Kconfig | 69 ++++++++++++++++++++++++
arch/mips/mach-loongson/Makefile | 6 +++
arch/mips/mach-loongson/cpu.c | 19 +++++++
arch/mips/mach-loongson/ls1c300/Makefile | 7 +++
arch/mips/mach-loongson/ls1c300/init.c | 61 +++++++++++++++++++++
arch/mips/mach-loongson/spl.c | 46 ++++++++++++++++
9 files changed, 229 insertions(+)
create mode 100644 arch/mips/mach-loongson/Kconfig
create mode 100644 arch/mips/mach-loongson/Makefile
create mode 100644 arch/mips/mach-loongson/cpu.c
create mode 100644 arch/mips/mach-loongson/ls1c300/Makefile
create mode 100644 arch/mips/mach-loongson/ls1c300/init.c
create mode 100644 arch/mips/mach-loongson/spl.c
diff --git a/MAINTAINERS b/MAINTAINERS
index d2040fee252..d1e6e4bc0da 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1385,6 +1385,15 @@ F: drivers/net/cortina_ni.c
F: drivers/net/cortina_ni.h
F: drivers/net/phy/ca_phy.c
+MIPS LOONGSON LS1C300
+M: Du Huanpeng <u74147@gmail.com>
+S: Maintained
+F: arch/mips/dts/loongson32-ls1c300b.dtsi
+F: arch/mips/mach-loongson/
+F: drivers/clk/loongson/
+F: drivers/watchdog/loongson_wdt.c
+F: include/dt-bindings/clock/ls1c300-clk.h
+
MIPS MEDIATEK
M: Weijie Gao <weijie.gao@mediatek.com>
R: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 36612756294..0e3fc9ceeb5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -88,6 +88,16 @@ config ARCH_MTMIPS
select SUPPORT_LITTLE_ENDIAN
select SUPPORT_SPL
+config ARCH_LSMIPS
+ bool "Support Loongson MIPS platforms"
+ select DM
+ select DM_SERIAL
+ select OF_CONTROL
+ select SUPPORTS_CPU_MIPS32_R1
+ select SUPPORTS_CPU_MIPS32_R2
+ select SUPPORTS_LITTLE_ENDIAN
+ select SUPPORT_SPL
+
config ARCH_JZ47XX
bool "Support Ingenic JZ47xx"
select SUPPORT_SPL
@@ -202,6 +212,7 @@ source "arch/mips/mach-bmips/Kconfig"
source "arch/mips/mach-jz47xx/Kconfig"
source "arch/mips/mach-pic32/Kconfig"
source "arch/mips/mach-mtmips/Kconfig"
+source "arch/mips/mach-loongson/Kconfig"
source "arch/mips/mach-octeon/Kconfig"
if MIPS
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 453c7885075..72b800c755b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -19,6 +19,7 @@ machine-$(CONFIG_ARCH_BMIPS) += bmips
machine-$(CONFIG_ARCH_JZ47XX) += jz47xx
machine-$(CONFIG_MACH_PIC32) += pic32
machine-$(CONFIG_ARCH_MTMIPS) += mtmips
+machine-$(CONFIG_ARCH_LSMIPS) += loongson
machine-$(CONFIG_ARCH_MSCC) += mscc
machine-${CONFIG_ARCH_OCTEON} += octeon
diff --git a/arch/mips/mach-loongson/Kconfig b/arch/mips/mach-loongson/Kconfig
new file mode 100644
index 00000000000..57d22927270
--- /dev/null
+++ b/arch/mips/mach-loongson/Kconfig
@@ -0,0 +1,69 @@
+menu "Loongson MIPS platforms"
+ depends on ARCH_LSMIPS
+
+config SYS_MALLOC_F_LEN
+ default 0x1000
+
+config SYS_SOC
+ default "ls1c300" if SOC_LS1C300
+
+config SYS_DCACHE_SIZE
+ default 16384
+
+config SYS_DCACHE_LINE_SIZE
+ default 32
+
+config SYS_ICACHE_SIZE
+ default 16384
+
+config SYS_ICACHE_LINE_SIZE
+ default 32
+
+config SPL_PAYLOAD
+ default "u-boot-lzma.img" if SPL_LZMA
+
+config BUILD_TARGET
+ default "u-boot-with-spl.bin" if SPL
+ default "u-boot.bin" if !SPL
+
+choice
+ prompt "Loongson MIPS SoC select"
+
+config SOC_LS1C300
+ bool "LS1C300"
+ select CLK_CCF
+ select SPL_SEPARATE_BSS if SPL
+ select SPL_INIT_STACK_WITHOUT_MALLOC_F if SPL
+ select SPL_LOADER_SUPPORT if SPL
+ select SPL_OF_CONTROL if SPL_DM
+ select SPL_SIMPLE_BUS if SPL_DM
+ select SPL_DM_SERIAL if SPL_DM
+ select SPL_CLK if SPL_DM && SPL_SERIAL
+ select SPL_SYSRESET if SPL_DM
+ select SPL_OF_LIBFDT if SPL_OF_CONTROL
+ help
+ This supports Loongson LS1C300
+
+endchoice
+
+choice
+ prompt "Board select"
+
+config BOARD_LS1C300
+ bool "Loongson LS1C300 Eval"
+ depends on SOC_LS1C300
+ help
+ ls1c300-eval board has a LS1C300 SoC with 64MiB of SDRAM
+ and 512KiB of flash (SPI NOR) and additional NAND storage.
+
+endchoice
+
+config CONS_PIN
+ int "pin group used in uart"
+ default 0
+ help
+ Select pin group connected to UART for your board.
+
+source "board/loongson/ls1c300-eval/Kconfig"
+
+endmenu
diff --git a/arch/mips/mach-loongson/Makefile b/arch/mips/mach-loongson/Makefile
new file mode 100644
index 00000000000..654143a5f70
--- /dev/null
+++ b/arch/mips/mach-loongson/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += cpu.o
+obj-$(CONFIG_SPL_BUILD) += spl.o
+
+obj-$(CONFIG_SOC_LS1C300) += ls1c300/
diff --git a/arch/mips/mach-loongson/cpu.c b/arch/mips/mach-loongson/cpu.c
new file mode 100644
index 00000000000..249fdcbdc5f
--- /dev/null
+++ b/arch/mips/mach-loongson/cpu.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Stefan Roese <sr@denx.de>
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <init.h>
+#include <malloc.h>
+#include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ gd->ram_size = get_ram_size((void *)KSEG1, SZ_256M) - CONFIG_TEXT_BASE % SZ_256M;
+ return 0;
+}
diff --git a/arch/mips/mach-loongson/ls1c300/Makefile b/arch/mips/mach-loongson/ls1c300/Makefile
new file mode 100644
index 00000000000..17b9d6fb9ca
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += lowlevel_init.o
+obj-y += sdram.o
+obj-y += init.o
+obj-y += gpio.o
+obj-$(CONFIG_SPL_BUILD) += serial.o
diff --git a/arch/mips/mach-loongson/ls1c300/init.c b/arch/mips/mach-loongson/ls1c300/init.c
new file mode 100644
index 00000000000..aea0a863e3e
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/init.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * based on: arch/mips/mach-mtmips/mt7628/init.c
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <clk.h>
+#include <dm.h>
+#include <dm/uclass.h>
+#include <dt-bindings/clock/ls1c300-clk.h>
+#include <linux/io.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int print_cpuinfo(void)
+{
+ struct udevice *udev;
+ struct clk clk;
+ int ret;
+ ulong xtal;
+ char buf[SZ_32];
+
+ printf("CPU: Loongson ls1c300b\n");
+
+ ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(ls1c300_clk), &udev);
+ if (ret) {
+ printf("error: clock driver not found.\n");
+ return 0;
+ }
+
+ clk.dev = udev;
+
+ ret = clk_request(udev, &clk);
+ if (ret < 0)
+ return ret;
+
+ clk.id = CLK_XTAL;
+ xtal = clk_get_rate(&clk);
+
+ clk.id = CLK_CPU_THROT;
+ gd->cpu_clk = clk_get_rate(&clk);
+
+ clk.id = CLK_APB;
+ gd->mem_clk = clk_get_rate(&clk);
+
+ printf("Clock: CPU: %sMHz, ", strmhz(buf, gd->cpu_clk));
+ printf("SDRAM: %sMHz, ", strmhz(buf, gd->mem_clk));
+ printf("XTAL: %sMHz\n", strmhz(buf, xtal));
+
+ return 0;
+}
+
+ulong notrace get_tbclk(void)
+{
+ return gd->cpu_clk / 2;
+}
diff --git a/arch/mips/mach-loongson/spl.c b/arch/mips/mach-loongson/spl.c
new file mode 100644
index 00000000000..40454d2cbc9
--- /dev/null
+++ b/arch/mips/mach-loongson/spl.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <init.h>
+#include <spl.h>
+#include <asm/sections.h>
+#include <linux/libfdt.h>
+#include <linux/sizes.h>
+#include <mach/serial.h>
+
+void __noreturn board_init_f(ulong dummy)
+{
+ spl_init();
+
+#ifdef CONFIG_SPL_SERIAL
+ /*
+ * loongson_spl_serial_init() is useful if debug uart is enabled,
+ * or DM based serial is not enabled.
+ */
+ loongson_spl_serial_init();
+ preloader_console_init();
+#endif
+
+ board_init_r(NULL, 0);
+}
+
+void board_boot_order(u32 *spl_boot_list)
+{
+ spl_boot_list[0] = BOOT_DEVICE_NOR;
+}
+
+unsigned long spl_nor_get_uboot_base(void)
+{
+ void *uboot_base = __image_copy_end;
+
+ if (fdt_magic(uboot_base) == FDT_MAGIC)
+ return (unsigned long)uboot_base + fdt_totalsize(uboot_base);
+
+ return (unsigned long)uboot_base;
+}
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 0/7] add loongson mips ls1c300 initial support
@ 2026-03-11 8:41 sgdfkk
2026-03-11 8:41 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
---
Changelog for v6:
- rebase to 2026.3.10, version [ba7bf918dafcd093ad733b07ba490baeb20cf5da]
- no more includes common.h
- use <linux/time.h> MSEC_PER_SEC instead of self made
- The board specific parts should be in the board MAINTAINER file
- rename arch/mips/mach-lsmips/ to ...mach-loongson/
- rename functions names from lsmips_* to loongson_*
- rename drivers/clk/lsmips/ to ...loongson/, rename clk driver name too
- move TEXT_BASE, SPL_TEXT_BASE from mach-xxx/Kconfig to ls1c300_defconfig
- rename hardware register name CONFIG_VALID to VALID (checkpatch error)
- change dt bindings header license to gpl-2.0 OR MIT (checkpatch warning)
- change dm-u-boot to bootph- in device tree
- remove guards(#if/#endif) from include/configs/ls1c300.h
- keep ARCH_LSMIPS macro, should I change it too ???
Changelog for v5:
- add detail commit message
- small fix in watchdog driver
Changelog for v4:
- rebase to [247aa5a191159ea7e03bf1918e22fbbb784cd410]
- fix rebase issues
- use spl without SPL_DM
- fix some more codingstyle
- fix some more typo
- add comments about writing sdram controler
- keep .noreoder and do not use delay slot
Changelog for v3:
- change cpu clock id from CLK_CPU to CLK_CPU_THROT
- migrate all APB dev's clock id to CLK_APB
- remove uarts' <reg-shift> property to use default value <0>
- move /clocks/acc node to /soc/acc
- call clk_request() before use a clk
- make get_tbclk() return 1/2 clock of cpu
- disable debug_uart by default
- add ops for cpu_throt_factor clk
- declare MSEC_PER_SEC for converting between sec and msec
- return a error code when the wdt clock is out of range
- minor format and codingstyle fixes
- rebase to [9859465bfe838bc8264d45e1a1bed847bba74bad]
Changelog for v2:
1. dtsi:
add status disabled for uart0 ~ uart11
remove bootargs from chosen
make serial0 alias for uart2
oscillator remove @0 unit-address
change uart2 address to kuseg
2. cleanup Kconfig and update defconfig
- make these options configurable, disabled by default:
CMD_DM
DM_ETH
DM_GPIO
DM_SPI
DM_SPI_FLASH
DM_RESET
PINCONF
PINCTRL
PINMUX
RESET_LSMIPS
- make these options configurable, enabled by default:
CLK
DISPLAY_CPUINFO
SYSRESET
ROM_EXCEPTION_VECTORS
- disabled:
CONFIG_ENV_IS_IN_SPI_FLASH
3. fix codingstyle drivers/watchdog/lsmips-wdt.c
- priv->base + offset
- add comment for default clock value
4. remove address base definition header
- remove arch/mips/mach-lsmips/ls1c300/ls1c300.h
- clean up files uses this header
5. spl and debug uart
- add comment for spl & debug uart pinmuxing
- cleanup unused registers base header
6. dtsi
- add "loongson,ls1c300-uart" to all uart node
7. board dts
- add memory node to board dts, start at 0x80000000, size 64MB
8. Kconfig
- make ROM_EXCEPTION_VECTORS user configureable
- enable ROM_EXCEPTION_VECTORS in defconfig
9.
- seperate sdram_init to sdram_init.S
- add macro helpers to do sdram, pll lowlevel init
10. dtsi
- move clock nodes to /clocks/xxx
11.
- define CONFIG_SKIP_LOWLEVEL_INIT to 1
12.
- remove option PINCTRL_LS1C300 from Kconfig
13.
- dram_init, use get_ram_size() to detect ram size.
14. clk driver
- create custom clock ops for PLL
- remove debug code
15.
- rebase to 59bffec43a657598b194b9eb30dc01eec06078c7
- remove CONFIG_SYS_MONITOR_BASE from include/configs/
Du Huanpeng (7):
mips: loongson: minimal initial SoC support
mips: loongson: lowlevel initialize
mips: loongson: lowlevel debug serial
mips: loongson: ls1c300 board support
mips: loongson: add clk driver
mips: loongson: add watchdog driver
mips: loongson: ls1c300 dts and bindings
MAINTAINERS | 9 +
arch/mips/Kconfig | 11 ++
arch/mips/Makefile | 1 +
arch/mips/dts/loongson32-ls1c300b.dtsi | 151 +++++++++++++++
arch/mips/dts/ls1c300-eval.dts | 30 +++
arch/mips/mach-loongson/Kconfig | 69 +++++++
arch/mips/mach-loongson/Makefile | 6 +
arch/mips/mach-loongson/cpu.c | 19 ++
arch/mips/mach-loongson/include/mach/serial.h | 16 ++
arch/mips/mach-loongson/ls1c300/Makefile | 7 +
arch/mips/mach-loongson/ls1c300/gpio.c | 66 +++++++
arch/mips/mach-loongson/ls1c300/init.c | 61 ++++++
.../mach-loongson/ls1c300/lowlevel_init.S | 134 +++++++++++++
arch/mips/mach-loongson/ls1c300/sdram.S | 95 ++++++++++
arch/mips/mach-loongson/ls1c300/serial.c | 104 ++++++++++
arch/mips/mach-loongson/spl.c | 46 +++++
board/loongson/ls1c300-eval/Kconfig | 12 ++
board/loongson/ls1c300-eval/MAINTAINERS | 7 +
board/loongson/ls1c300-eval/Makefile | 3 +
board/loongson/ls1c300-eval/board.c | 19 ++
configs/ls1c300_defconfig | 52 +++++
drivers/clk/Makefile | 1 +
drivers/clk/loongson/Makefile | 3 +
drivers/clk/loongson/clk-ls1c300.c | 179 ++++++++++++++++++
drivers/watchdog/Kconfig | 8 +
drivers/watchdog/Makefile | 1 +
drivers/watchdog/loongson_wdt.c | 127 +++++++++++++
include/configs/ls1c300.h | 36 ++++
include/dt-bindings/clock/ls1c300-clk.h | 18 ++
include/dt-bindings/reset/ls1c300-reset.h | 36 ++++
30 files changed, 1327 insertions(+)
create mode 100644 arch/mips/dts/loongson32-ls1c300b.dtsi
create mode 100644 arch/mips/dts/ls1c300-eval.dts
create mode 100644 arch/mips/mach-loongson/Kconfig
create mode 100644 arch/mips/mach-loongson/Makefile
create mode 100644 arch/mips/mach-loongson/cpu.c
create mode 100644 arch/mips/mach-loongson/include/mach/serial.h
create mode 100644 arch/mips/mach-loongson/ls1c300/Makefile
create mode 100644 arch/mips/mach-loongson/ls1c300/gpio.c
create mode 100644 arch/mips/mach-loongson/ls1c300/init.c
create mode 100644 arch/mips/mach-loongson/ls1c300/lowlevel_init.S
create mode 100644 arch/mips/mach-loongson/ls1c300/sdram.S
create mode 100644 arch/mips/mach-loongson/ls1c300/serial.c
create mode 100644 arch/mips/mach-loongson/spl.c
create mode 100644 board/loongson/ls1c300-eval/Kconfig
create mode 100644 board/loongson/ls1c300-eval/MAINTAINERS
create mode 100644 board/loongson/ls1c300-eval/Makefile
create mode 100644 board/loongson/ls1c300-eval/board.c
create mode 100644 configs/ls1c300_defconfig
create mode 100644 drivers/clk/loongson/Makefile
create mode 100644 drivers/clk/loongson/clk-ls1c300.c
create mode 100644 drivers/watchdog/loongson_wdt.c
create mode 100644 include/configs/ls1c300.h
create mode 100644 include/dt-bindings/clock/ls1c300-clk.h
create mode 100644 include/dt-bindings/reset/ls1c300-reset.h
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v6 1/7] mips: loongson: minimal initial SoC support
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:05 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 2/7] mips: loongson: lowlevel initialize sgdfkk
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
Loongson 1C is a cost-effective SOC chip for industrial control and
the Internet of Things. The Loongson 1C includes a floating-point
processing unit, supports multiple types of memory, and supports
high-capacity MLC NAND Flash. Loongson 1C provides developers with a
wealth of peripheral interfaces and on-chip modules, including Camera
controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD
controller, SPI interface, UART interface, etc., providing sufficient
computing power and multi-application connectivity.
Some highlights of this SoC are:
- Single core LS232, MIPS32 instruction set compatible, main frequency
300MHZ
- 16KB data cache and 16KB instruction cache
- 64 bit float unit, hardware division
- 8/16 bit SDRAM controller, 45 ~ 133MHz
- 8/16 bit SRAM, NAND
- I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC
- 12 UARTs
Links:
https://www.loongson.cn/
introduce base support for the ls1c300 SoC.
- debug UART2
- serial console
- clock
- watchdog
- sysreset
- uart
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
MAINTAINERS | 9 ++++
arch/mips/Kconfig | 11 ++++
arch/mips/Makefile | 1 +
arch/mips/mach-loongson/Kconfig | 69 ++++++++++++++++++++++++
arch/mips/mach-loongson/Makefile | 6 +++
arch/mips/mach-loongson/cpu.c | 19 +++++++
arch/mips/mach-loongson/ls1c300/Makefile | 7 +++
arch/mips/mach-loongson/ls1c300/init.c | 61 +++++++++++++++++++++
arch/mips/mach-loongson/spl.c | 46 ++++++++++++++++
9 files changed, 229 insertions(+)
create mode 100644 arch/mips/mach-loongson/Kconfig
create mode 100644 arch/mips/mach-loongson/Makefile
create mode 100644 arch/mips/mach-loongson/cpu.c
create mode 100644 arch/mips/mach-loongson/ls1c300/Makefile
create mode 100644 arch/mips/mach-loongson/ls1c300/init.c
create mode 100644 arch/mips/mach-loongson/spl.c
diff --git a/MAINTAINERS b/MAINTAINERS
index d2040fee252..d1e6e4bc0da 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1385,6 +1385,15 @@ F: drivers/net/cortina_ni.c
F: drivers/net/cortina_ni.h
F: drivers/net/phy/ca_phy.c
+MIPS LOONGSON LS1C300
+M: Du Huanpeng <u74147@gmail.com>
+S: Maintained
+F: arch/mips/dts/loongson32-ls1c300b.dtsi
+F: arch/mips/mach-loongson/
+F: drivers/clk/loongson/
+F: drivers/watchdog/loongson_wdt.c
+F: include/dt-bindings/clock/ls1c300-clk.h
+
MIPS MEDIATEK
M: Weijie Gao <weijie.gao@mediatek.com>
R: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 36612756294..0e3fc9ceeb5 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -88,6 +88,16 @@ config ARCH_MTMIPS
select SUPPORT_LITTLE_ENDIAN
select SUPPORT_SPL
+config ARCH_LSMIPS
+ bool "Support Loongson MIPS platforms"
+ select DM
+ select DM_SERIAL
+ select OF_CONTROL
+ select SUPPORTS_CPU_MIPS32_R1
+ select SUPPORTS_CPU_MIPS32_R2
+ select SUPPORTS_LITTLE_ENDIAN
+ select SUPPORT_SPL
+
config ARCH_JZ47XX
bool "Support Ingenic JZ47xx"
select SUPPORT_SPL
@@ -202,6 +212,7 @@ source "arch/mips/mach-bmips/Kconfig"
source "arch/mips/mach-jz47xx/Kconfig"
source "arch/mips/mach-pic32/Kconfig"
source "arch/mips/mach-mtmips/Kconfig"
+source "arch/mips/mach-loongson/Kconfig"
source "arch/mips/mach-octeon/Kconfig"
if MIPS
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 453c7885075..72b800c755b 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -19,6 +19,7 @@ machine-$(CONFIG_ARCH_BMIPS) += bmips
machine-$(CONFIG_ARCH_JZ47XX) += jz47xx
machine-$(CONFIG_MACH_PIC32) += pic32
machine-$(CONFIG_ARCH_MTMIPS) += mtmips
+machine-$(CONFIG_ARCH_LSMIPS) += loongson
machine-$(CONFIG_ARCH_MSCC) += mscc
machine-${CONFIG_ARCH_OCTEON} += octeon
diff --git a/arch/mips/mach-loongson/Kconfig b/arch/mips/mach-loongson/Kconfig
new file mode 100644
index 00000000000..57d22927270
--- /dev/null
+++ b/arch/mips/mach-loongson/Kconfig
@@ -0,0 +1,69 @@
+menu "Loongson MIPS platforms"
+ depends on ARCH_LSMIPS
+
+config SYS_MALLOC_F_LEN
+ default 0x1000
+
+config SYS_SOC
+ default "ls1c300" if SOC_LS1C300
+
+config SYS_DCACHE_SIZE
+ default 16384
+
+config SYS_DCACHE_LINE_SIZE
+ default 32
+
+config SYS_ICACHE_SIZE
+ default 16384
+
+config SYS_ICACHE_LINE_SIZE
+ default 32
+
+config SPL_PAYLOAD
+ default "u-boot-lzma.img" if SPL_LZMA
+
+config BUILD_TARGET
+ default "u-boot-with-spl.bin" if SPL
+ default "u-boot.bin" if !SPL
+
+choice
+ prompt "Loongson MIPS SoC select"
+
+config SOC_LS1C300
+ bool "LS1C300"
+ select CLK_CCF
+ select SPL_SEPARATE_BSS if SPL
+ select SPL_INIT_STACK_WITHOUT_MALLOC_F if SPL
+ select SPL_LOADER_SUPPORT if SPL
+ select SPL_OF_CONTROL if SPL_DM
+ select SPL_SIMPLE_BUS if SPL_DM
+ select SPL_DM_SERIAL if SPL_DM
+ select SPL_CLK if SPL_DM && SPL_SERIAL
+ select SPL_SYSRESET if SPL_DM
+ select SPL_OF_LIBFDT if SPL_OF_CONTROL
+ help
+ This supports Loongson LS1C300
+
+endchoice
+
+choice
+ prompt "Board select"
+
+config BOARD_LS1C300
+ bool "Loongson LS1C300 Eval"
+ depends on SOC_LS1C300
+ help
+ ls1c300-eval board has a LS1C300 SoC with 64MiB of SDRAM
+ and 512KiB of flash (SPI NOR) and additional NAND storage.
+
+endchoice
+
+config CONS_PIN
+ int "pin group used in uart"
+ default 0
+ help
+ Select pin group connected to UART for your board.
+
+source "board/loongson/ls1c300-eval/Kconfig"
+
+endmenu
diff --git a/arch/mips/mach-loongson/Makefile b/arch/mips/mach-loongson/Makefile
new file mode 100644
index 00000000000..654143a5f70
--- /dev/null
+++ b/arch/mips/mach-loongson/Makefile
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += cpu.o
+obj-$(CONFIG_SPL_BUILD) += spl.o
+
+obj-$(CONFIG_SOC_LS1C300) += ls1c300/
diff --git a/arch/mips/mach-loongson/cpu.c b/arch/mips/mach-loongson/cpu.c
new file mode 100644
index 00000000000..249fdcbdc5f
--- /dev/null
+++ b/arch/mips/mach-loongson/cpu.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018 Stefan Roese <sr@denx.de>
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <init.h>
+#include <malloc.h>
+#include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+ gd->ram_size = get_ram_size((void *)KSEG1, SZ_256M) - CONFIG_TEXT_BASE % SZ_256M;
+ return 0;
+}
diff --git a/arch/mips/mach-loongson/ls1c300/Makefile b/arch/mips/mach-loongson/ls1c300/Makefile
new file mode 100644
index 00000000000..17b9d6fb9ca
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += lowlevel_init.o
+obj-y += sdram.o
+obj-y += init.o
+obj-y += gpio.o
+obj-$(CONFIG_SPL_BUILD) += serial.o
diff --git a/arch/mips/mach-loongson/ls1c300/init.c b/arch/mips/mach-loongson/ls1c300/init.c
new file mode 100644
index 00000000000..aea0a863e3e
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/init.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * based on: arch/mips/mach-mtmips/mt7628/init.c
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <clk.h>
+#include <dm.h>
+#include <dm/uclass.h>
+#include <dt-bindings/clock/ls1c300-clk.h>
+#include <linux/io.h>
+#include <linux/sizes.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int print_cpuinfo(void)
+{
+ struct udevice *udev;
+ struct clk clk;
+ int ret;
+ ulong xtal;
+ char buf[SZ_32];
+
+ printf("CPU: Loongson ls1c300b\n");
+
+ ret = uclass_get_device_by_driver(UCLASS_CLK, DM_DRIVER_GET(ls1c300_clk), &udev);
+ if (ret) {
+ printf("error: clock driver not found.\n");
+ return 0;
+ }
+
+ clk.dev = udev;
+
+ ret = clk_request(udev, &clk);
+ if (ret < 0)
+ return ret;
+
+ clk.id = CLK_XTAL;
+ xtal = clk_get_rate(&clk);
+
+ clk.id = CLK_CPU_THROT;
+ gd->cpu_clk = clk_get_rate(&clk);
+
+ clk.id = CLK_APB;
+ gd->mem_clk = clk_get_rate(&clk);
+
+ printf("Clock: CPU: %sMHz, ", strmhz(buf, gd->cpu_clk));
+ printf("SDRAM: %sMHz, ", strmhz(buf, gd->mem_clk));
+ printf("XTAL: %sMHz\n", strmhz(buf, xtal));
+
+ return 0;
+}
+
+ulong notrace get_tbclk(void)
+{
+ return gd->cpu_clk / 2;
+}
diff --git a/arch/mips/mach-loongson/spl.c b/arch/mips/mach-loongson/spl.c
new file mode 100644
index 00000000000..40454d2cbc9
--- /dev/null
+++ b/arch/mips/mach-loongson/spl.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <init.h>
+#include <spl.h>
+#include <asm/sections.h>
+#include <linux/libfdt.h>
+#include <linux/sizes.h>
+#include <mach/serial.h>
+
+void __noreturn board_init_f(ulong dummy)
+{
+ spl_init();
+
+#ifdef CONFIG_SPL_SERIAL
+ /*
+ * loongson_spl_serial_init() is useful if debug uart is enabled,
+ * or DM based serial is not enabled.
+ */
+ loongson_spl_serial_init();
+ preloader_console_init();
+#endif
+
+ board_init_r(NULL, 0);
+}
+
+void board_boot_order(u32 *spl_boot_list)
+{
+ spl_boot_list[0] = BOOT_DEVICE_NOR;
+}
+
+unsigned long spl_nor_get_uboot_base(void)
+{
+ void *uboot_base = __image_copy_end;
+
+ if (fdt_magic(uboot_base) == FDT_MAGIC)
+ return (unsigned long)uboot_base + fdt_totalsize(uboot_base);
+
+ return (unsigned long)uboot_base;
+}
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 2/7] mips: loongson: lowlevel initialize
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
2026-03-11 8:41 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:10 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 3/7] mips: loongson: lowlevel debug serial sgdfkk
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
- pll
- spi controller
- sdram
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
.../mach-loongson/ls1c300/lowlevel_init.S | 134 ++++++++++++++++++
arch/mips/mach-loongson/ls1c300/sdram.S | 95 +++++++++++++
2 files changed, 229 insertions(+)
create mode 100644 arch/mips/mach-loongson/ls1c300/lowlevel_init.S
create mode 100644 arch/mips/mach-loongson/ls1c300/sdram.S
diff --git a/arch/mips/mach-loongson/ls1c300/lowlevel_init.S b/arch/mips/mach-loongson/ls1c300/lowlevel_init.S
new file mode 100644
index 00000000000..8d9ba97130c
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/lowlevel_init.S
@@ -0,0 +1,134 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * Copyright (C) 2020-2023 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <config.h>
+#include <asm-offsets.h>
+#include <asm/cacheops.h>
+#include <asm/regdef.h>
+#include <asm/mipsregs.h>
+#include <asm/addrspace.h>
+#include <asm/asm.h>
+#include <linux/sizes.h>
+
+/* PLL control register */
+#define NAND_BASE 0xbfe70000
+#define START_FREQ 0x8030
+#define CLK_DIV_PARAM 0x8034
+#define CPU_THROT 0xc010
+
+/* START_FREQ */
+#define PLL_VALID 31
+#define Reserved_24 24
+#define FRAC_N 16
+#define M_PLL 8
+#define Reserved_4 4
+#define RST_TIME 2
+#define SDRAM_DIV 0
+ #define SDRAM_DIV2 0
+ #define SDRAM_DIV4 1
+ #define SDRAM_DIV3 2
+
+/* CLK_DIV_PARAM */
+#define PIX_DIV 24
+#define CAM_DIV 16
+#define CPU_DIV 8
+#define PIX_DIV_VALID 5
+#define PIX_SEL 4
+#define CAM_DIV_VALID 3
+#define CAM_SEL 2
+#define CPU_DIV_VALID 1
+#define CPU_SEL 0
+
+/* Document:
+ * Freq_PLL = XIN *(M_PLL + FRAC_N)/4
+ */
+#define XIN 24000000
+#define PLL_VALID_1 (1<<PLL_VALID)
+#define PREP_M_PLL(Freq_PLL) (((Freq_PLL * 4) / XIN) << M_PLL)
+#define PREP_SDRAM_DIV(div) (div<<SDRAM_DIV)
+#define PREP_CPU_DIV(div1) ((0x80|div1)<<CPU_DIV | (div1&&div1)<<CPU_DIV_VALID)
+#define PREP_PIX_DIV(div2) (div2<<PIX_DIV)
+#define PREP_CAM_DIV(div3) (div3<<CAM_DIV)
+
+/* PLL @264MHz, CPU @132MHz, SDRAM @66MHz */
+#define CFG_START_FREQ (PLL_VALID_1 | PREP_M_PLL(264000000) | SDRAM_DIV2)
+#define CFG_CLK_DIV_PARAM (PREP_CPU_DIV(2) | PREP_PIX_DIV(0x24) | PREP_CAM_DIV(0x24))
+#define CFG_CPU_THROT 15
+
+/* SPI0 control register */
+#define SPI0_BASE 0xbfe80000
+#define SPCR 0
+#define SPSR 1
+#define TxFIFO 2
+#define RxFIFO 2
+#define SPER 3
+#define SFC_PARAM 4
+ #define CLK_DIV 4
+ #define DUAL_IO 3
+ #define FAST_READ 2
+ #define BURST_EN 1
+ #define MEMORY_EN 0
+#define SFC_SOFTCS 5
+#define SFC_TIMING 6
+ #define T_FAST 2
+ #define T_CSH 0
+
+ .set noreorder
+LEAF(ls1c300_pll_init)
+#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
+ li t0, NAND_BASE
+ li t1, CFG_START_FREQ
+ li t2, CFG_CLK_DIV_PARAM
+ li t3, CFG_CPU_THROT
+
+ sw t3, CPU_THROT (t0)
+ sw t2, CLK_DIV_PARAM (t0)
+ sw t1, START_FREQ (t0)
+
+ ori t2, 1<<CPU_SEL
+ sw t2, CLK_DIV_PARAM (t0)
+#endif
+ jr ra
+ nop
+END(ls1c300_pll_init)
+
+LEAF(ls1c300_spi_init)
+#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
+ li t0, SPI0_BASE
+ li t1, (1<<MEMORY_EN) | (1<<BURST_EN) | (1<<FAST_READ) | (1<<DUAL_IO)
+ sb t1, SFC_PARAM (t0)
+ li t2, (1<<T_FAST) | (1<<T_CSH)
+ sb t2, SFC_TIMING (t0)
+#endif
+ jr ra
+ nop
+END(ls1c300_spi_init)
+
+NESTED(lowlevel_init, 0, ra)
+ /* Save ra and do real lowlevel initialization */
+ move s0, ra
+ /* Setup PLL @264MHz */
+ PTR_LA t9, ls1c300_pll_init
+ jalr t9
+ nop
+
+ /* Setup SPI Dual IO@33MHz */
+ PTR_LA t9, ls1c300_spi_init
+ jalr t9
+ nop
+
+ /* Setup external SDRAM @66MHz */
+ PTR_LA t9, ls1c300_sdram_init
+ jalr t9
+ nop
+
+ move ra, s0
+ jr ra
+ nop
+END(lowlevel_init)
diff --git a/arch/mips/mach-loongson/ls1c300/sdram.S b/arch/mips/mach-loongson/ls1c300/sdram.S
new file mode 100644
index 00000000000..0dadd41adea
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/sdram.S
@@ -0,0 +1,95 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020-2023 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <config.h>
+#include <asm-offsets.h>
+#include <asm/cacheops.h>
+#include <asm/regdef.h>
+#include <asm/mipsregs.h>
+#include <asm/addrspace.h>
+#include <asm/asm.h>
+#include <linux/sizes.h>
+
+/* sdram control 64 bit register */
+#define SD_CONFIG 0xbfd00000
+#define SD_CONFIGHI 0x414
+#define SD_CONFIGLO 0x410
+
+#define VALID 41
+#define HANG_UP 40
+#define DEF_SEL 39
+#define TWR 37
+#define TREF 25
+#define TRAS 21
+#define TRFC 17
+#define TRP 14
+#define TCL 11
+#define TRCD 8
+
+#define SD_BIT 6
+ #define SD_8BIT (0<<SD_BIT)
+ #define SD_16BIT (1<<SD_BIT)
+ #define SD_32BIT (2<<SD_BIT)
+#define SD_CSIZE 3
+ #define SD_CSIZE_512 (0<<SD_CSIZE)
+ #define SD_CSIZE_1K (1<<SD_CSIZE)
+ #define SD_CSIZE_2K (2<<SD_CSIZE)
+ #define SD_CSIZE_4K (3<<SD_CSIZE)
+ #define SD_CSIZE_256 (7<<SD_CSIZE)
+#define SD_RSIZE 0
+ #define SD_RSIZE_2K (0<<SD_RSIZE)
+ #define SD_RSIZE_4K (1<<SD_RSIZE)
+ #define SD_RSIZE_8K (2<<SD_RSIZE)
+ #define SD_RSIZE_16K (3<<SD_RSIZE)
+
+#define SD_CFG_1(tWR, tREF, tRAS, tRFC, tRP, tCL, tRCD) \
+ ((tWR<<TWR)|(tREF<<TREF)|(tRAS<<TRAS)|(tRFC<<TRFC)|(tRP<<TRP)|(tCL<<TCL)|(tRCD<<TRCD))
+#define CFG_SD_0(b, c, r) \
+ ((b<<SD_BIT)|(c<<SD_CSIZE)|(r<<SD_RSIZE))
+/*
+ * recommended values by ls1c300 user manual,
+ * tweak to fit your board.
+ */
+#define SD_CONFIG_133MHz SD_CFG_1(2, 0x818, 6, 8, 3, 3, 3)
+#define SD_CONFIG_100MHz SD_CFG_1(2, 0x620, 5, 6, 2, 3, 2)
+#define SD_CONFIG_75MHz SD_CFG_1(1, 0x494, 4, 5, 2, 2, 2)
+#define SD_CONFIG_33MHz SD_CFG_1(1, 0x204, 2, 2, 1, 2, 1)
+
+#define SD_CONFIG_66MHz SD_CFG_1(1, 0x401, 4, 4, 2, 2, 2)
+
+#define SD_CONFIG64 (SD_CONFIG_66MHz | SD_16BIT | SD_CSIZE_1K | SD_RSIZE_8K)
+#define CFG_SDCONFIGHI (SD_CONFIG64 /(1<<32))
+#define CFG_SDCONFIGLO (SD_CONFIG64 %(1<<32))
+
+ .set noreorder
+/*
+ * Loongson ls1c300 SoC do not have onchip sram for initial stack,
+ * initialize the external sdram on reset as early as possiable.
+ */
+LEAF(ls1c300_sdram_init)
+#if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
+ li t0, SD_CONFIG
+ li t1, CFG_SDCONFIGLO
+ li t2, CFG_SDCONFIGHI
+
+/* store twice as the hardware manual required. */
+ sw t1, SD_CONFIGLO (t0)
+ sw t2, SD_CONFIGHI (t0)
+ sync
+
+ sw t1, SD_CONFIGLO (t0)
+ sw t2, SD_CONFIGHI (t0)
+ sync
+
+ ori t2, 1<<(VALID-32)
+ sw t1, SD_CONFIGLO (t0)
+ sw t2, SD_CONFIGHI (t0)
+ sync
+#endif
+ jr ra
+ nop
+END(ls1c300_sdram_init)
+
+
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 3/7] mips: loongson: lowlevel debug serial
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
2026-03-11 8:41 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
2026-03-11 8:41 ` [PATCH v6 2/7] mips: loongson: lowlevel initialize sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:11 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 4/7] mips: loongson: ls1c300 board support sgdfkk
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
set pin to uart alternate function and enable uart for lowlevel debug,
also future pinctrl driver can base on this code.
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
arch/mips/mach-loongson/include/mach/serial.h | 16 +++
arch/mips/mach-loongson/ls1c300/gpio.c | 66 +++++++++++
arch/mips/mach-loongson/ls1c300/serial.c | 104 ++++++++++++++++++
3 files changed, 186 insertions(+)
create mode 100644 arch/mips/mach-loongson/include/mach/serial.h
create mode 100644 arch/mips/mach-loongson/ls1c300/gpio.c
create mode 100644 arch/mips/mach-loongson/ls1c300/serial.c
diff --git a/arch/mips/mach-loongson/include/mach/serial.h b/arch/mips/mach-loongson/include/mach/serial.h
new file mode 100644
index 00000000000..7afe5788cb7
--- /dev/null
+++ b/arch/mips/mach-loongson/include/mach/serial.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ *
+ * Copyright (C) 2022 Du Huanpeng <u74147@gmail.com>
+ */
+
+#ifndef __LSMIPS_SERIAL_H_
+#define __LSMIPS_SERIAL_H_
+
+void loongson_spl_serial_init(void);
+int gpio_set_alternate(int gpio, int func);
+
+#endif /* __LSMIPS_SERIAL_H_ */
diff --git a/arch/mips/mach-loongson/ls1c300/gpio.c b/arch/mips/mach-loongson/ls1c300/gpio.c
new file mode 100644
index 00000000000..7f160408382
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/gpio.c
@@ -0,0 +1,66 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <linux/errno.h>
+#include <asm/bitops.h>
+
+#define CBUS_FIRST0 0xbfd011c0
+#define CBUS_SECOND0 0xbfd011d0
+#define CBUS_THIRD0 0xbfd011e0
+#define CBUS_FOURTHT0 0xbfd011f0
+#define CBUS_FIFTHT0 0xbfd01200
+
+#define CBUS_FIRST1 0xbfd011c4
+#define CBUS_SECOND1 0xbfd011d4
+#define CBUS_THIRD1 0xbfd011e4
+#define CBUS_FOURTHT1 0xbfd011f4
+#define CBUS_FIFTHT1 0xbfd01204
+
+#define CBUS_FIRST2 0xbfd011c8
+#define CBUS_SECOND2 0xbfd011d8
+#define CBUS_THIRD2 0xbfd011e8
+#define CBUS_FOURTHT2 0xbfd011f8
+#define CBUS_FIFTHT2 0xbfd01208
+
+#define CBUS_FIRST3 0xbfd011cc
+#define CBUS_SECOND3 0xbfd011dc
+#define CBUS_THIRD3 0xbfd011ec
+#define CBUS_FOURTHT3 0xbfd011fc
+#define CBUS_FIFTHT3 0xbfd0120c
+
+/*
+ * pinmux for debug uart and spl only, for others, please
+ * use a pinctrl driver and device-tree for pin muxing.
+ *
+ * @gpio: gpio number
+ * @func: alternate function 1 to 5, 0 for GPIO.
+ */
+
+int gpio_set_alternate(int gpio, int func)
+{
+ volatile void __iomem *addr;
+ int i;
+
+ if (gpio < 0 || gpio > 104)
+ return -ENODEV;
+ if (func < 0 || func > 5)
+ return -EINVAL;
+
+ if (func) {
+ i = func - 1;
+ addr = (void *)CBUS_FIRST0 + i * 16;
+ set_bit(gpio, addr);
+ } else {
+ /* GPIO, clear CBUS 1 ~ 5 */
+ i = 5;
+ }
+
+ while (i--) {
+ addr = (void *)CBUS_FIRST0 + 16 * i;
+ clear_bit(gpio, addr);
+ }
+
+ return 0;
+}
diff --git a/arch/mips/mach-loongson/ls1c300/serial.c b/arch/mips/mach-loongson/ls1c300/serial.c
new file mode 100644
index 00000000000..a7697574dad
--- /dev/null
+++ b/arch/mips/mach-loongson/ls1c300/serial.c
@@ -0,0 +1,104 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <mach/serial.h>
+#include <linux/kernel.h>
+
+struct uart_pin_config {
+ char port;
+ char afunc;
+ char rx;
+ char tx;
+};
+
+struct uart_pin_config con[] = {
+#if CONFIG_CONS_INDEX == 0
+ { 0, 2, 74, 75 },
+ { 0, 3, 23, 24 },
+ { 0, 3, 99, 100 },
+
+#elif CONFIG_CONS_INDEX == 1
+ { 1, 1, 17, 18 },
+ { 1, 1, 101, 102 },
+ { 1, 2, 40, 41 },
+ { 1, 4, 2, 3 },
+
+#elif CONFIG_CONS_INDEX == 2
+ { 2, 2, 36, 37 },
+ { 2, 2, 42, 43 },
+ { 2, 3, 27, 28 },
+ { 2, 3, 103, 104 },
+ { 2, 4, 4, 5 },
+
+#elif CONFIG_CONS_INDEX == 3
+ { 3, 2, 17, 18 },
+ { 3, 2, 33, 34 },
+ { 3, 2, 44, 45 },
+ { 3, 4, 0, 1 },
+
+#elif CONFIG_CONS_INDEX == 4
+ { 4, 5, 23, 24 },
+ { 4, 5, 58, 59 },
+ { 4, 5, 80, 79 },
+
+#elif CONFIG_CONS_INDEX == 5
+ { 5, 5, 25, 26 },
+ { 5, 5, 60, 61 },
+ { 5, 5, 81, 78 },
+
+#elif CONFIG_CONS_INDEX == 6
+ { 6, 5, 27, 46 },
+ { 6, 5, 62, 63 },
+
+#elif CONFIG_CONS_INDEX == 7
+ { 7, 5, 57, 56 },
+ { 7, 5, 64, 65 },
+ { 7, 5, 87, 88 },
+
+#elif CONFIG_CONS_INDEX == 8
+ { 8, 5, 55, 54 },
+ { 8, 5, 66, 67 },
+ { 8, 5, 89, 90 },
+
+#elif CONFIG_CONS_INDEX == 9
+ { 9, 5, 53, 52 },
+ { 9, 5, 68, 69 },
+ { 9, 5, 85, 86 },
+
+#elif CONFIG_CONS_INDEX == 10
+ { 10, 5, 51, 50 },
+ { 10, 5, 70, 71 },
+ { 10, 5, 84, 82 },
+
+#elif CONFIG_CONS_INDEX == 11
+ { 11, 5, 49, 48 },
+ { 11, 5, 72, 73 },
+#endif /* CONFIG_CONS_INDEX */
+};
+
+#define UART2_RX 36
+#define UART2_TX 37
+#define AFUNC 2
+
+void loongson_spl_serial_init(void)
+{
+#if defined(CONFIG_SPL_SERIAL)
+ int pin_rx, pin_tx;
+ int afunc;
+
+ if (CONFIG_CONS_PIN < ARRAY_SIZE(con)) {
+ pin_rx = con[CONFIG_CONS_PIN].rx;
+ pin_tx = con[CONFIG_CONS_PIN].tx;
+ afunc = con[CONFIG_CONS_PIN].afunc;
+ } else {
+ pin_rx = UART2_RX;
+ pin_tx = UART2_TX;
+ afunc = AFUNC;
+ }
+
+ gpio_set_alternate(pin_rx, afunc);
+ gpio_set_alternate(pin_tx, afunc);
+#endif /* CONFIG_SPL_SERIAL */
+}
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 4/7] mips: loongson: ls1c300 board support
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
` (2 preceding siblings ...)
2026-03-11 8:41 ` [PATCH v6 3/7] mips: loongson: lowlevel debug serial sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:11 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 5/7] mips: loongson: add clk driver sgdfkk
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
- 64MiB SDRAM K9F1G08
- 4MiB spi flash
- ethernet DM9161CEP
- UART2 console
Links:
https://dfgh.top/loongson
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
board/loongson/ls1c300-eval/Kconfig | 12 ++++++
board/loongson/ls1c300-eval/MAINTAINERS | 7 ++++
board/loongson/ls1c300-eval/Makefile | 3 ++
board/loongson/ls1c300-eval/board.c | 19 +++++++++
configs/ls1c300_defconfig | 52 +++++++++++++++++++++++++
include/configs/ls1c300.h | 36 +++++++++++++++++
6 files changed, 129 insertions(+)
create mode 100644 board/loongson/ls1c300-eval/Kconfig
create mode 100644 board/loongson/ls1c300-eval/MAINTAINERS
create mode 100644 board/loongson/ls1c300-eval/Makefile
create mode 100644 board/loongson/ls1c300-eval/board.c
create mode 100644 configs/ls1c300_defconfig
create mode 100644 include/configs/ls1c300.h
diff --git a/board/loongson/ls1c300-eval/Kconfig b/board/loongson/ls1c300-eval/Kconfig
new file mode 100644
index 00000000000..e427570a836
--- /dev/null
+++ b/board/loongson/ls1c300-eval/Kconfig
@@ -0,0 +1,12 @@
+if BOARD_LS1C300
+
+config SYS_BOARD
+ default "ls1c300-eval"
+
+config SYS_VENDOR
+ default "loongson"
+
+config SYS_CONFIG_NAME
+ default "ls1c300"
+
+endif
diff --git a/board/loongson/ls1c300-eval/MAINTAINERS b/board/loongson/ls1c300-eval/MAINTAINERS
new file mode 100644
index 00000000000..d3498b18e2b
--- /dev/null
+++ b/board/loongson/ls1c300-eval/MAINTAINERS
@@ -0,0 +1,7 @@
+LS1C300_EVAL BOARD
+M: Du Huanpeng <u74147@gmail.com>
+S: Maintained
+F: board/loongson/ls1c300-eval/
+F: include/configs/ls1c300.h
+F: configs/ls1c300_defconfig
+F: arch/mips/dts/ls1c300-eval.dts
diff --git a/board/loongson/ls1c300-eval/Makefile b/board/loongson/ls1c300-eval/Makefile
new file mode 100644
index 00000000000..db129c5abae
--- /dev/null
+++ b/board/loongson/ls1c300-eval/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-y += board.o
diff --git a/board/loongson/ls1c300-eval/board.c b/board/loongson/ls1c300-eval/board.c
new file mode 100644
index 00000000000..0eb5df1dc7b
--- /dev/null
+++ b/board/loongson/ls1c300-eval/board.c
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <mach/serial.h>
+
+#if defined(CONFIG_DEBUG_UART_BOARD_INIT)
+
+#define UART2_RX 36
+#define UART2_TX 37
+#define AFUNC 2
+
+void board_debug_uart_init(void)
+{
+ gpio_set_alternate(UART2_TX, AFUNC);
+ gpio_set_alternate(UART2_RX, AFUNC);
+}
+#endif
diff --git a/configs/ls1c300_defconfig b/configs/ls1c300_defconfig
new file mode 100644
index 00000000000..22d6f18cac4
--- /dev/null
+++ b/configs/ls1c300_defconfig
@@ -0,0 +1,52 @@
+CONFIG_MIPS=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_TEXT_BASE=0x80200000
+CONFIG_SYS_MALLOC_F_LEN=0x40000
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1000
+CONFIG_DEFAULT_DEVICE_TREE="ls1c300-eval"
+CONFIG_DM_RESET=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_TEXT_BASE=0xbfc00000
+CONFIG_SPL_BSS_START_ADDR=0x80010000
+CONFIG_SPL_BSS_MAX_SIZE=0x10000
+CONFIG_SYS_LOAD_ADDR=0x80010000
+CONFIG_WATCHDOG_TIMEOUT_MSECS=3000
+CONFIG_SPL_SIZE_LIMIT=0x100000
+CONFIG_SPL=y
+CONFIG_ARCH_LSMIPS=y
+CONFIG_SPL_PAYLOAD="u-boot.img"
+CONFIG_ROM_EXCEPTION_VECTORS=y
+CONFIG_RESTORE_EXCEPTION_VECTOR_BASE=y
+CONFIG_MIPS_BOOT_FDT=y
+CONFIG_FIT=y
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_LOGLEVEL=9
+CONFIG_DISPLAY_CPUINFO=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_SPL_MAX_SIZE=0x10000
+CONFIG_SPL_PAD_TO=0
+CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK=y
+CONFIG_SPL_SYS_MALLOC_SIMPLE=y
+CONFIG_SPL_NOR_SUPPORT=y
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_CRC32 is not set
+CONFIG_CMD_CLK=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_OF_EMBED=y
+CONFIG_CLK=y
+CONFIG_SPL_CLK_CCF=y
+# CONFIG_INPUT is not set
+# CONFIG_POWER is not set
+CONFIG_CONS_INDEX=2
+CONFIG_SPL_SYS_NS16550_SERIAL=y
+CONFIG_SYS_NS16550_REG_SIZE=-1
+CONFIG_SPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
+CONFIG_SYSRESET_WATCHDOG_AUTO=y
+CONFIG_WDT_LOONGSON=y
+# CONFIG_GZIP is not set
diff --git a/include/configs/ls1c300.h b/include/configs/ls1c300.h
new file mode 100644
index 00000000000..8d834333ea8
--- /dev/null
+++ b/include/configs/ls1c300.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2020 MediaTek Inc.
+ *
+ * Author: Gao Weijie <weijie.gao@mediatek.com>
+ * based on: include/configs/mt7628.h
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#ifndef __CONFIG_LS1C300_H__
+#define __CONFIG_LS1C300_H__
+
+#define CFG_SYS_SDRAM_BASE 0x80200000
+#define CFG_SYS_INIT_SP_OFFSET 0x2000
+
+/* SPL */
+#if defined(CONFIG_SPL_BUILD)
+
+/* Serial SPL */
+#define CFG_SYS_NS16550_CLK 66000000
+#define CFG_SYS_NS16550_COM1 0xbfe44000
+#define CFG_SYS_NS16550_COM2 0xbfe48000
+#define CFG_SYS_NS16550_COM3 0xbfe4c000
+#define CFG_SYS_NS16550_COM4 0xbfe4c400
+#define CFG_SYS_NS16550_COM5 0xbfe4c500
+#define CFG_SYS_NS16550_COM6 0xbfe4c600
+
+#define CFG_MALLOC_F_ADDR 0x80100000 /* FIXME: find a proper place */
+#define CFG_SYS_UBOOT_BASE 0xbd000000
+
+#endif
+
+/* Serial common */
+#define CFG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 }
+
+#endif /* __CONFIG_LS1C300_H__ */
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 5/7] mips: loongson: add clk driver
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
` (3 preceding siblings ...)
2026-03-11 8:41 ` [PATCH v6 4/7] mips: loongson: ls1c300 board support sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 8:41 ` [PATCH v6 6/7] mips: loongson: add watchdog driver sgdfkk
2026-03-11 8:41 ` [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings sgdfkk
6 siblings, 0 replies; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
clk driver loongson mips for embedded SoC ls1c300
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
drivers/clk/Makefile | 1 +
drivers/clk/loongson/Makefile | 3 +
drivers/clk/loongson/clk-ls1c300.c | 179 +++++++++++++++++++++++++++++
3 files changed, 183 insertions(+)
create mode 100644 drivers/clk/loongson/Makefile
create mode 100644 drivers/clk/loongson/clk-ls1c300.c
diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index 5f0c0d8a5c2..e19bb17276e 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -23,6 +23,7 @@ obj-y += ti/
obj-$(CONFIG_CLK_THEAD) += thead/
obj-$(CONFIG_$(PHASE_)CLK_INTEL) += intel/
obj-$(CONFIG_ARCH_ASPEED) += aspeed/
+obj-$(CONFIG_ARCH_LSMIPS) += loongson/
obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
obj-$(CONFIG_ARCH_MESON) += meson/
obj-$(CONFIG_ARCH_MTMIPS) += mtmips/
diff --git a/drivers/clk/loongson/Makefile b/drivers/clk/loongson/Makefile
new file mode 100644
index 00000000000..0a47269cd30
--- /dev/null
+++ b/drivers/clk/loongson/Makefile
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_SOC_LS1C300) += clk-ls1c300.o
diff --git a/drivers/clk/loongson/clk-ls1c300.c b/drivers/clk/loongson/clk-ls1c300.c
new file mode 100644
index 00000000000..acca92cd657
--- /dev/null
+++ b/drivers/clk/loongson/clk-ls1c300.c
@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * reference:
+ * drivers/clk/microchip/mpfs_clk.c
+ * drivers/clk/clk_octeon.c
+ *
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <clk-uclass.h>
+#include <dm.h>
+#include <dt-bindings/clock/ls1c300-clk.h>
+#include <linux/bitops.h>
+#include <linux/bitfield.h>
+#include <linux/io.h>
+#include <linux/clk-provider.h>
+
+/* PLL/SDRAM Frequency Configuration Register */
+#define START_FREQ 0
+#define CLK_DIV_PARAM 4
+
+/* START_FREQ */
+#define PLL_VALID BIT(31)
+#define RESERVED0 GENMASK(30, 24)
+#define FRAC_N GENMASK(23, 16)
+#define M_PLL GENMASK(15, 8)
+#define RESERVED1 GENMASK(7, 4)
+#define RST_TIME GENMASK(3, 2)
+#define SDRAM_DIV GENMASK(1, 0)
+/* CLK_DIV_PARAM */
+#define PIX_DIV GENMASK(31, 24)
+#define CAM_DIV GENMASK(23, 16)
+#define CPU_DIV GENMASK(15, 8)
+#define RESERVED2 GENMASK(7, 6)
+#define PIX_DIV_VALID BIT(5)
+#define PIX_SEL BIT(4)
+#define CAM_DIV_VALID BIT(3)
+#define CAM_SEL BIT(2)
+#define CPU_DIV_VALID BIT(1)
+#define CPU_SEL BIT(0)
+/* CPU_THROT */
+#define CPU_THROT GENMASK(3, 0)
+
+static const struct clk_div_table sdram_div_table[] = {
+ {.val = 0, .div = 2},
+ {.val = 1, .div = 4},
+ {.val = 2, .div = 3},
+ {.val = 3, .div = 3},
+};
+
+ulong ls1c300_pll_get_rate(struct clk *clk)
+{
+ unsigned int mult;
+ long long parent_rate;
+ void *base;
+ unsigned int val;
+
+ parent_rate = clk_get_parent_rate(clk);
+ base = (void *)clk->data;
+
+ val = readl(base + START_FREQ);
+ mult = FIELD_GET(FRAC_N, val) + FIELD_GET(M_PLL, val);
+ return (mult * parent_rate) / 4;
+}
+
+static ulong ls1c300_clk_get_rate(struct clk *clk)
+{
+ struct clk *cl;
+ ulong rate;
+ int err;
+
+ err = clk_get_by_id(clk->id, &cl);
+ if (err)
+ return err;
+
+ rate = clk_get_rate(cl);
+ return rate;
+}
+
+static int ls1c300_clk_probe(struct udevice *dev)
+{
+ void __iomem *base;
+ void __iomem *cpu_throt;
+ void __iomem *addr;
+
+ struct clk *cl, clk;
+ const char *parent_name;
+ int flags;
+ int ret;
+
+ base = (void *)dev_remap_addr_index(dev, 0);
+ cpu_throt = (void *)dev_remap_addr_index(dev, 1);
+
+ ret = clk_get_by_index(dev, 0, &clk);
+ if (ret)
+ return ret;
+
+ ret = clk_get_rate(&clk);
+
+ parent_name = clk.dev->name;
+
+ cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+ cl->data = (unsigned long)base;
+ ret = clk_register(cl, "clk_ls1c300_pll", "pll", parent_name);
+ clk_dm(CLK_PLL, cl);
+
+ addr = base + CLK_DIV_PARAM;
+ flags = CLK_DIVIDER_ONE_BASED | CLK_DIVIDER_ALLOW_ZERO;
+ cl = clk_register_divider(NULL, "cpu_div", "pll", 0, addr, 8, 7, flags);
+ clk_dm(CLK_CPU, cl);
+ cl = clk_register_divider(NULL, "cam_div", "pll", 0, addr, 16, 7, flags);
+ clk_dm(CLK_CAMERA, cl);
+ cl = clk_register_divider(NULL, "pix_div", "pll", 0, addr, 24, 7, flags);
+ clk_dm(CLK_PIX, cl);
+
+ cl = kzalloc(sizeof(*cl), GFP_KERNEL);
+ cl->data = (unsigned long)cpu_throt;
+ ret = clk_register(cl, "clk_cpu_throt", "cpu_throt_factor", "cpu_div");
+ clk_dm(CLK_CPU_THROT, cl);
+
+ addr = base + START_FREQ;
+ cl = clk_register_divider(NULL, "sdram_div", "cpu_div", 0, addr, 0, 2, 0);
+ to_clk_divider(cl)->table = sdram_div_table;
+ clk_dm(CLK_APB, cl);
+
+ return 0;
+}
+
+static ulong cpu_throt_get_rate(struct clk *clk)
+{
+ void __iomem *cpu_throt;
+ long long parent_rate;
+ ulong ret;
+
+ parent_rate = clk_get_parent_rate(clk);
+ cpu_throt = (void *)clk->data;
+
+ ret = readl(cpu_throt) + 1;
+ ret = parent_rate * ret / 16;
+ return ret;
+}
+
+static const struct udevice_id ls1c300_clk_ids[] = {
+ { .compatible = "loongson,ls1c300-clk" },
+ { }
+};
+
+static const struct clk_ops clk_cpu_throt_ops = {
+ .get_rate = cpu_throt_get_rate,
+};
+
+static const struct clk_ops clk_ls1c300_pll_ops = {
+ .get_rate = ls1c300_pll_get_rate,
+};
+
+static const struct clk_ops ls1c300_clk_ops = {
+ .get_rate = ls1c300_clk_get_rate,
+};
+
+U_BOOT_DRIVER(clk_ls1c300_cpu_throt) = {
+ .name = "clk_cpu_throt",
+ .id = UCLASS_CLK,
+ .ops = &clk_cpu_throt_ops,
+};
+
+U_BOOT_DRIVER(clk_ls1c300_pll) = {
+ .name = "clk_ls1c300_pll",
+ .id = UCLASS_CLK,
+ .ops = &clk_ls1c300_pll_ops,
+};
+
+U_BOOT_DRIVER(ls1c300_clk) = {
+ .name = "clk_ls1c300",
+ .id = UCLASS_CLK,
+ .of_match = ls1c300_clk_ids,
+ .probe = ls1c300_clk_probe,
+ .priv_auto = sizeof(struct clk),
+ .ops = &ls1c300_clk_ops,
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 6/7] mips: loongson: add watchdog driver
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
` (4 preceding siblings ...)
2026-03-11 8:41 ` [PATCH v6 5/7] mips: loongson: add clk driver sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:12 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings sgdfkk
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
supports watchdog in loongson mips embedded SoCs
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
drivers/watchdog/Kconfig | 8 ++
drivers/watchdog/Makefile | 1 +
drivers/watchdog/loongson_wdt.c | 127 ++++++++++++++++++++++++++++++++
3 files changed, 136 insertions(+)
create mode 100644 drivers/watchdog/loongson_wdt.c
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 35ae7d106b1..63bf0e04c80 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -213,6 +213,14 @@ config SPL_WDT_GPIO
help
Support for external watchdog fed by toggling a gpio in SPL.
+config WDT_LOONGSON
+ bool "Loongson MIPS watchdog timer support"
+ depends on WDT
+ help
+ Select this to enable watchdog timer for Loongson SoCs.
+ The watchdog timer is stopped when initialized.
+ It performs full SoC reset.
+
config WDT_MAX6370
bool "MAX6370 watchdog timer support"
depends on WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 02e2674f8af..e9ffb417050 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_WDT_DA9063) += da9063-wdt.o
obj-$(CONFIG_WDT_DAVINCI) += davinci_wdt.o
obj-$(CONFIG_WDT_FTWDT010) += ftwdt010_wdt.o
obj-$(CONFIG_$(SPL_TPL_)WDT_GPIO) += gpio_wdt.o
+obj-$(CONFIG_WDT_LOONGSON) += loongson_wdt.o
obj-$(CONFIG_WDT_MAX6370) += max6370_wdt.o
obj-$(CONFIG_WDT_MCF) += mcf_wdt.o
obj-$(CONFIG_WDT_MESON_GXBB) += meson_gxbb_wdt.o
diff --git a/drivers/watchdog/loongson_wdt.c b/drivers/watchdog/loongson_wdt.c
new file mode 100644
index 00000000000..4d34d70296e
--- /dev/null
+++ b/drivers/watchdog/loongson_wdt.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Watchdog driver for MediaTek SoCs
+ *
+ * Copyright (C) 2018 MediaTek Inc.
+ * Author: Ryder Lee <ryder.lee@mediatek.com>
+ *
+ * based on: drivers/watchdog/mtk_wdt.c
+ * Copyright (C) 2020-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#include <dm.h>
+#include <hang.h>
+#include <wdt.h>
+#include <asm/io.h>
+#include <clk.h>
+#include <dm/device_compat.h>
+#include <linux/time.h>
+
+struct loongson_wdt_priv {
+ void __iomem *base;
+#define WDT_EN 0
+#define WDT_TIMER 4
+#define WDT_SET 8
+ ulong clock;
+ unsigned long timeout;
+};
+
+static int loongson_wdt_reset(struct udevice *dev)
+{
+ struct loongson_wdt_priv *priv = dev_get_priv(dev);
+
+ writel(priv->timeout, priv->base + WDT_TIMER);
+ writel(1, priv->base + WDT_SET);
+
+ return 0;
+}
+
+static int loongson_wdt_stop(struct udevice *dev)
+{
+ struct loongson_wdt_priv *priv = dev_get_priv(dev);
+
+ writel(0, priv->base + WDT_EN);
+ return 0;
+}
+
+static int loongson_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+ struct loongson_wdt_priv *priv = dev_get_priv(dev);
+
+ writel(1, priv->base + WDT_EN);
+ writel(1, priv->base + WDT_TIMER);
+ writel(1, priv->base + WDT_SET);
+
+ hang();
+ return 0;
+}
+
+static int loongson_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
+{
+ struct loongson_wdt_priv *priv = dev_get_priv(dev);
+ unsigned int timeout;
+
+ timeout = U32_MAX / (priv->clock / MSEC_PER_SEC);
+
+ if (timeout < timeout_ms)
+ timeout = U32_MAX;
+ else
+ timeout = timeout_ms * (priv->clock / MSEC_PER_SEC);
+
+ debug("WDT: reload = %08x\n", timeout);
+
+ writel(1, priv->base + WDT_EN);
+ writel(timeout, priv->base + WDT_TIMER);
+ writel(1, priv->base + WDT_SET);
+
+ priv->timeout = timeout;
+
+ return 0;
+}
+
+static int loongson_wdt_probe(struct udevice *dev)
+{
+ struct loongson_wdt_priv *priv = dev_get_priv(dev);
+ struct clk cl;
+ ulong clock;
+
+ priv->base = dev_remap_addr(dev);
+ if (!priv->base)
+ return -ENOENT;
+
+ if (clk_get_by_index(dev, 0, &cl) == 0)
+ clock = clk_get_rate(&cl);
+
+ debug("WDT: clock = %ld\n", clock);
+
+ if (IS_ERR_VALUE(clock)) {
+ dev_err(dev, "failed to get rate\n");
+ return clock;
+ }
+
+ priv->clock = clock;
+ writel(0, priv->base + WDT_EN);
+ return 0;
+}
+
+static const struct wdt_ops loongson_wdt_ops = {
+ .start = loongson_wdt_start,
+ .reset = loongson_wdt_reset,
+ .stop = loongson_wdt_stop,
+ .expire_now = loongson_wdt_expire_now,
+};
+
+static const struct udevice_id loongson_wdt_ids[] = {
+ { .compatible = "loongson,ls1c300-wdt"},
+ {}
+};
+
+U_BOOT_DRIVER(loongson_wdt) = {
+ .name = "loongson_wdt",
+ .id = UCLASS_WDT,
+ .of_match = loongson_wdt_ids,
+ .priv_auto = sizeof(struct loongson_wdt_priv),
+ .probe = loongson_wdt_probe,
+ .ops = &loongson_wdt_ops,
+ .flags = DM_FLAG_PRE_RELOC,
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
` (5 preceding siblings ...)
2026-03-11 8:41 ` [PATCH v6 6/7] mips: loongson: add watchdog driver sgdfkk
@ 2026-03-11 8:41 ` sgdfkk
2026-03-11 18:13 ` Daniel Schwierzeck
6 siblings, 1 reply; 15+ messages in thread
From: sgdfkk @ 2026-03-11 8:41 UTC (permalink / raw)
To: duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
From: Du Huanpeng <u74147@gmail.com>
- ls1c300 dtsi
- ls1c300-eval board dts
- clk binding header
- reset binding header
Signed-off-by: Du Huanpeng <u74147@gmail.com>
---
arch/mips/dts/loongson32-ls1c300b.dtsi | 151 ++++++++++++++++++++++
arch/mips/dts/ls1c300-eval.dts | 30 +++++
include/dt-bindings/clock/ls1c300-clk.h | 18 +++
include/dt-bindings/reset/ls1c300-reset.h | 36 ++++++
4 files changed, 235 insertions(+)
create mode 100644 arch/mips/dts/loongson32-ls1c300b.dtsi
create mode 100644 arch/mips/dts/ls1c300-eval.dts
create mode 100644 include/dt-bindings/clock/ls1c300-clk.h
create mode 100644 include/dt-bindings/reset/ls1c300-reset.h
diff --git a/arch/mips/dts/loongson32-ls1c300b.dtsi b/arch/mips/dts/loongson32-ls1c300b.dtsi
new file mode 100644
index 00000000000..26b0c707459
--- /dev/null
+++ b/arch/mips/dts/loongson32-ls1c300b.dtsi
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <dt-bindings/clock/ls1c300-clk.h>
+#include <dt-bindings/reset/ls1c300-reset.h>
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "loongson,ls1c300-soc";
+
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cpu@0 {
+ device_type = "cpu";
+ reg = <0>;
+ compatible = "loongson,gs232", "mips,mips4Kc";
+ clocks = <&acc CLK_CPU_THROT>;
+ };
+ };
+
+ clocks {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ bootph-all;
+
+
+ xtal: oscillator {
+ compatible = "fixed-clock";
+ clock-frequency = <24000000>;
+ #clock-cells = <0>;
+ };
+ };
+
+ soc {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ ranges;
+
+ acc: clock-controller@1fe78030 {
+ compatible = "loongson,ls1c300-clk";
+ clocks = <&xtal>;
+ #clock-cells = <1>;
+ reg = <0x1fe78030 0x8>, <0x1fe7c010 0x4>;
+ bootph-all;
+ };
+
+ uart0: serial@1fe40000 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe40000 0x100>;
+ status = "disabled";
+ };
+
+ uart1: serial@1fe44000 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe44000 0x100>;
+ status = "disabled";
+ };
+
+ uart2: serial@1fe48000 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe48000 0x100>;
+ resets = <&shut_ctrl UART2_SHUT>;
+ reset-names = "uart2";
+ status = "disabled";
+ };
+
+ uart3: serial@1fe4c000 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c000 0x100>;
+ status = "disabled";
+ };
+
+ uart4: serial@1fe4c400 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c400 0x100>;
+ status = "disabled";
+ };
+
+ uart5: serial@1fe4c500 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c500 0x100>;
+ status = "disabled";
+ };
+
+ uart6: serial@1fe4c600 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c600 0x100>;
+ status = "disabled";
+ };
+
+ uart7: serial@1fe4c700 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c700 0x100>;
+ status = "disabled";
+ };
+
+ uart8: serial@1fe4c800 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c800 0x100>;
+ status = "disabled";
+ };
+
+ uart9: serial@1fe4c900 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4c900 0x100>;
+ status = "disabled";
+ };
+
+ uart10: serial@1fe4ca00 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4ca00 0x100>;
+ status = "disabled";
+ };
+
+ uart11: serial@1fe4cb00 {
+ compatible = "loongson,ls1c300-uart", "ns16550a";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe4cb00 0x100>;
+ status = "disabled";
+ };
+
+ wdt: watchdog@1fe5c060 {
+ compatible = "loongson,ls1c300-wdt";
+ clocks = <&acc CLK_APB>;
+ reg = <0x1fe5c060 0x10>;
+ };
+
+ reset-controller {
+ compatible = "wdt-reboot";
+ wdt = <&wdt>;
+ };
+
+ shut_ctrl: reset-controller@1fd00420 {
+ compatible = "loongson,shut_ctrl";
+ reg = <0x1fd00420 0x4>;
+ #reset-cells = <1>;
+ };
+ };
+};
diff --git a/arch/mips/dts/ls1c300-eval.dts b/arch/mips/dts/ls1c300-eval.dts
new file mode 100644
index 00000000000..cc3c267a5bf
--- /dev/null
+++ b/arch/mips/dts/ls1c300-eval.dts
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 Du Huanpeng <u74147@gmail.com>
+ */
+
+/dts-v1/;
+
+#include "loongson32-ls1c300b.dtsi"
+
+/ {
+ compatible = "lsmips,ls1c300-soc";
+ model = "ls1c300-eval";
+
+ aliases {
+ serial0 = &uart2;
+ };
+
+ memory@80000000 {
+ device_type = "memory";
+ reg = <0x80000000 0x4000000>;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+};
+
+&uart2 {
+ status = "okay";
+};
diff --git a/include/dt-bindings/clock/ls1c300-clk.h b/include/dt-bindings/clock/ls1c300-clk.h
new file mode 100644
index 00000000000..ac3937adfb6
--- /dev/null
+++ b/include/dt-bindings/clock/ls1c300-clk.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
+/*
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#ifndef __DT_BINDINGS_LS1C300_CLK_H__
+#define __DT_BINDINGS_LS1C300_CLK_H__
+
+#define CLK_XTAL 0
+#define CLK_PLL 1
+#define CLK_CPU 2
+#define CLK_APB 3
+#define CLK_CAMERA 4
+#define CLK_PIX 5
+#define CLK_AXIMUX 6
+#define CLK_CPU_THROT 7
+
+#endif /* __DT_BINDINGS_LS1C300_CLK_H__ */
diff --git a/include/dt-bindings/reset/ls1c300-reset.h b/include/dt-bindings/reset/ls1c300-reset.h
new file mode 100644
index 00000000000..0aea03cc181
--- /dev/null
+++ b/include/dt-bindings/reset/ls1c300-reset.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR MIT */
+/*
+ * Copyright (C) 2022-2026 Du Huanpeng <u74147@gmail.com>
+ */
+
+#ifndef _DT_BINDINGS_LS1C300_RESET_H_
+#define _DT_BINDINGS_LS1C300_RESET_H_
+
+#define ADC_SHUT 25
+#define SDIO_SHUT 24
+#define DMA2_SHUT 23
+#define DMA1_SHUT 22
+#define DMA0_SHUT 21
+#define SPI1_SHUT 20
+#define SPI0_SHUT 19
+#define I2C2_SHUT 18
+#define I2C1_SHUT 17
+#define I2C0_SHUT 16
+#define AC97_SHUT 15
+#define I2S_SHUT 14
+#define UART3_SHUT 13
+#define UART2_SHUT 12
+#define UART1_SHUT 11
+#define UART0_SHUT 10
+#define CAN1_SHUT 9
+#define CAN0_SHUT 8
+#define ECC_SHUT 7
+#define MAC_SHUT 6
+#define USBHOST_SHUT 5
+#define USBOTG_SHUT 4
+#define SDRAM_SHUT 3
+#define SRAM_SHUT 2
+#define CAM_SHUT 1
+#define LCD_SHUT 0
+
+#endif /* _DT_BINDINGS_LS1C300_RESET_H_*/
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v6 1/7] mips: loongson: minimal initial SoC support
2026-03-11 8:41 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
@ 2026-03-11 18:05 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:05 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> Loongson 1C is a cost-effective SOC chip for industrial control and
> the Internet of Things. The Loongson 1C includes a floating-point
> processing unit, supports multiple types of memory, and supports
> high-capacity MLC NAND Flash. Loongson 1C provides developers with a
> wealth of peripheral interfaces and on-chip modules, including Camera
> controller, USB OTG and USB HOST interfaces, AC97/I2S controller, LCD
> controller, SPI interface, UART interface, etc., providing sufficient
> computing power and multi-application connectivity.
>
> Some highlights of this SoC are:
> - Single core LS232, MIPS32 instruction set compatible, main frequency
> 300MHZ
> - 16KB data cache and 16KB instruction cache
> - 64 bit float unit, hardware division
> - 8/16 bit SDRAM controller, 45 ~ 133MHz
> - 8/16 bit SRAM, NAND
> - I2S/AC97, LCD, MAC, USB, OTG, SPI, I2C, PWM, CAN, SDIO, ADC
> - 12 UARTs
>
> Links:
> https://www.loongson.cn/
>
> introduce base support for the ls1c300 SoC.
> - debug UART2
> - serial console
> - clock
> - watchdog
> - sysreset
> - uart
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> MAINTAINERS | 9 ++++
> arch/mips/Kconfig | 11 ++++
> arch/mips/Makefile | 1 +
> arch/mips/mach-loongson/Kconfig | 69 ++++++++++++++++++++++++
> arch/mips/mach-loongson/Makefile | 6 +++
> arch/mips/mach-loongson/cpu.c | 19 +++++++
> arch/mips/mach-loongson/ls1c300/Makefile | 7 +++
> arch/mips/mach-loongson/ls1c300/init.c | 61 +++++++++++++++++++++
> arch/mips/mach-loongson/spl.c | 46 ++++++++++++++++
> 9 files changed, 229 insertions(+)
> create mode 100644 arch/mips/mach-loongson/Kconfig
> create mode 100644 arch/mips/mach-loongson/Makefile
> create mode 100644 arch/mips/mach-loongson/cpu.c
> create mode 100644 arch/mips/mach-loongson/ls1c300/Makefile
> create mode 100644 arch/mips/mach-loongson/ls1c300/init.c
> create mode 100644 arch/mips/mach-loongson/spl.c
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 2/7] mips: loongson: lowlevel initialize
2026-03-11 8:41 ` [PATCH v6 2/7] mips: loongson: lowlevel initialize sgdfkk
@ 2026-03-11 18:10 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:10 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> - pll
> - spi controller
> - sdram
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> .../mach-loongson/ls1c300/lowlevel_init.S | 134 ++++++++++++++++++
> arch/mips/mach-loongson/ls1c300/sdram.S | 95 +++++++++++++
> 2 files changed, 229 insertions(+)
> create mode 100644 arch/mips/mach-loongson/ls1c300/lowlevel_init.S
> create mode 100644 arch/mips/mach-loongson/ls1c300/sdram.S
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 3/7] mips: loongson: lowlevel debug serial
2026-03-11 8:41 ` [PATCH v6 3/7] mips: loongson: lowlevel debug serial sgdfkk
@ 2026-03-11 18:11 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:11 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> set pin to uart alternate function and enable uart for lowlevel debug,
> also future pinctrl driver can base on this code.
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> arch/mips/mach-loongson/include/mach/serial.h | 16 +++
> arch/mips/mach-loongson/ls1c300/gpio.c | 66 +++++++++++
> arch/mips/mach-loongson/ls1c300/serial.c | 104 ++++++++++++++++++
> 3 files changed, 186 insertions(+)
> create mode 100644 arch/mips/mach-loongson/include/mach/serial.h
> create mode 100644 arch/mips/mach-loongson/ls1c300/gpio.c
> create mode 100644 arch/mips/mach-loongson/ls1c300/serial.c
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 4/7] mips: loongson: ls1c300 board support
2026-03-11 8:41 ` [PATCH v6 4/7] mips: loongson: ls1c300 board support sgdfkk
@ 2026-03-11 18:11 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:11 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> - 64MiB SDRAM K9F1G08
> - 4MiB spi flash
> - ethernet DM9161CEP
> - UART2 console
>
> Links:
> https://dfgh.top/loongson
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> board/loongson/ls1c300-eval/Kconfig | 12 ++++++
> board/loongson/ls1c300-eval/MAINTAINERS | 7 ++++
> board/loongson/ls1c300-eval/Makefile | 3 ++
> board/loongson/ls1c300-eval/board.c | 19 +++++++++
> configs/ls1c300_defconfig | 52 +++++++++++++++++++++++++
> include/configs/ls1c300.h | 36 +++++++++++++++++
> 6 files changed, 129 insertions(+)
> create mode 100644 board/loongson/ls1c300-eval/Kconfig
> create mode 100644 board/loongson/ls1c300-eval/MAINTAINERS
> create mode 100644 board/loongson/ls1c300-eval/Makefile
> create mode 100644 board/loongson/ls1c300-eval/board.c
> create mode 100644 configs/ls1c300_defconfig
> create mode 100644 include/configs/ls1c300.h
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 6/7] mips: loongson: add watchdog driver
2026-03-11 8:41 ` [PATCH v6 6/7] mips: loongson: add watchdog driver sgdfkk
@ 2026-03-11 18:12 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:12 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> supports watchdog in loongson mips embedded SoCs
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> drivers/watchdog/Kconfig | 8 ++
> drivers/watchdog/Makefile | 1 +
> drivers/watchdog/loongson_wdt.c | 127 ++++++++++++++++++++++++++++++++
> 3 files changed, 136 insertions(+)
> create mode 100644 drivers/watchdog/loongson_wdt.c
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings
2026-03-11 8:41 ` [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings sgdfkk
@ 2026-03-11 18:13 ` Daniel Schwierzeck
0 siblings, 0 replies; 15+ messages in thread
From: Daniel Schwierzeck @ 2026-03-11 18:13 UTC (permalink / raw)
To: sgdfkk, duhuanpeng, u-boot; +Cc: chenhuacai, jiaxun.yang, Du Huanpeng
On 3/11/26 09:41, sgdfkk@163.com wrote:
> From: Du Huanpeng <u74147@gmail.com>
>
> - ls1c300 dtsi
> - ls1c300-eval board dts
> - clk binding header
> - reset binding header
>
> Signed-off-by: Du Huanpeng <u74147@gmail.com>
> ---
> arch/mips/dts/loongson32-ls1c300b.dtsi | 151 ++++++++++++++++++++++
> arch/mips/dts/ls1c300-eval.dts | 30 +++++
> include/dt-bindings/clock/ls1c300-clk.h | 18 +++
> include/dt-bindings/reset/ls1c300-reset.h | 36 ++++++
> 4 files changed, 235 insertions(+)
> create mode 100644 arch/mips/dts/loongson32-ls1c300b.dtsi
> create mode 100644 arch/mips/dts/ls1c300-eval.dts
> create mode 100644 include/dt-bindings/clock/ls1c300-clk.h
> create mode 100644 include/dt-bindings/reset/ls1c300-reset.h
>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
--
- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-03-11 18:13 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-11 8:41 [PATCH v6 0/7] add loongson mips ls1c300 initial support sgdfkk
2026-03-11 8:41 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
2026-03-11 18:05 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 2/7] mips: loongson: lowlevel initialize sgdfkk
2026-03-11 18:10 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 3/7] mips: loongson: lowlevel debug serial sgdfkk
2026-03-11 18:11 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 4/7] mips: loongson: ls1c300 board support sgdfkk
2026-03-11 18:11 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 5/7] mips: loongson: add clk driver sgdfkk
2026-03-11 8:41 ` [PATCH v6 6/7] mips: loongson: add watchdog driver sgdfkk
2026-03-11 18:12 ` Daniel Schwierzeck
2026-03-11 8:41 ` [PATCH v6 7/7] mips: loongson: ls1c300 dts and bindings sgdfkk
2026-03-11 18:13 ` Daniel Schwierzeck
[not found] <20260311052046.11265-1-sgdfkk@163.com>
2026-03-11 5:20 ` [PATCH v6 1/7] mips: loongson: minimal initial SoC support sgdfkk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.