Skip to contentSkip to conversation

MIPS: Loongson: Add the Loongson-1A processor support

PATCH RESEND Superseded Binbin Zhou 3 participants 11 messages May 19, 2016 – Aug 2, 2016

Subsystems (2)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover MIPS: Loongson: Add the Loongson-1A processor support

The Loongson 1A is similar with Loongson 1B, which is a 32-bit SoC. It implements the MIPS32 release 2 instruction set.

They share the same PRID, so we rewrite the PRID_REV_LOONGSON1B to PRID_REV_LOONGSON1A_1B, and use their CPU macros to distinguish.

However, the pll register of Loongson-1A is write-only, so the cpu clk should be set manually with the command line.

The format of command is cpu_clk=osc_clk,cpu_mul
the osc_clk standby cpu clock and the cpu_mul repect the clock multiplier.

For example, we use the command cpu_clk=33333333,8

Changes since v1:

- According commit c908656a7531771ae7642990a7c5f3c7307bd612 (MIPS: Loongson: Naming style cleanup and rework) to fix the naming style.

Changes since v2:

- Remove__irq_set_handler_locked()
- Rebases on top of v4.5-rc5.

Changes since v3:
- Move ls1x CPU irq setting to driver/irqchip
- Rebases on top of v4.6-rc7.

Binbin Zhou(9):
MIPS: Loongson: Add basic Loongson-1A CPU support
MIPS: Loongson: Add Loongson-1A Kconfig options
MIPS: Loongson: Add platform devices for Loongson-1A/1B
MIPS: Loongson: Add loongson-1A board support
MIPS: Loongson-1A: workaround of pll register's write-only property
MIPS: irqchip/ls1x-cpu: Move the CPU IRQ driver from arch/mips/loongson32/common/
MIPS: Loongson-1A: Enable SPARSEMEN and HIGHMEM
MIPS: Loongson-1B: Update config file
MIPS: Loongson: Add a Loongson-1A default config file

Signature · 35 lines
 arch/mips/Kconfig                                 |  11 ++++++
 arch/mips/configs/loongson1a_defconfig            | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/mips/configs/loongson1b_defconfig            |   1 +
 arch/mips/include/asm/cpu-type.h                  |   3 +-
 arch/mips/include/asm/cpu.h                       |   2 +-
 arch/mips/include/asm/irq_cpu.h                   |   1 +
 arch/mips/include/asm/mach-loongson32/dma.h       |   1 +
 arch/mips/include/asm/mach-loongson32/irq.h       |   1 +
 arch/mips/include/asm/mach-loongson32/loongson1.h | 183 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
 arch/mips/include/asm/mach-loongson32/nand.h      |   1 +
 arch/mips/include/asm/mach-loongson32/platform.h  |  14 ++++++++
 arch/mips/include/asm/mach-loongson32/regs-mux.h  |   2 +-
 arch/mips/include/asm/sparsemem.h                 |   6 +++-
 arch/mips/kernel/cpu-probe.c                      |   6 +++-
 arch/mips/loongson32/Kconfig                      |  17 +++++++++
 arch/mips/loongson32/Makefile                     |   6 ++++
 arch/mips/loongson32/Platform                     |   1 +
 arch/mips/loongson32/common/irq.c                 | 128 +------------------------------------------------------------------
 arch/mips/loongson32/common/platform.c            | 256 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 arch/mips/loongson32/common/prom.c                |   6 ++++
 arch/mips/loongson32/common/reset.c               |   6 ++++
 arch/mips/loongson32/common/setup.c               |  49 +++++++++++++++++++++++++-
 arch/mips/loongson32/ls1a/Makefile                |   5 +++
 arch/mips/loongson32/ls1a/board.c                 | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 arch/mips/mm/c-r4k.c                              |   9 +++++
 drivers/clk/clk-ls1x.c                            |  22 +++++++++---
 drivers/irqchip/Makefile                          |   1 +
 drivers/irqchip/irq-ls1x-cpu.c                    | 242 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 28 files changed, 1054 insertions(+), 179 deletions(-)
 create mode 100644 arch/mips/configs/loongson1a_defconfig
 create mode 100644 arch/mips/loongson32/ls1a/Makefile
 create mode 100644 arch/mips/loongson32/ls1a/board.c
 create mode 100644 drivers/irqchip/irq-ls1x-cpu.c
--
1.9.0
#1 lore raw

PATCH RESEND v4 1/9 MIPS: Loongson: Add basic Loongson-1A CPU support

The Loongson 1A is similar with Loongson 1B, which is a 32-bit SoC. It implements the MIPS32 release 2 instruction set.

They share the same PRID, so we rewrite the PRID_REV_LOONGSON1B to PRID_REV_LOONGSON1A_1B, and use their CPU macros to distinguish.

---
 arch/mips/include/asm/cpu-type.h    | 3 ++-
 arch/mips/include/asm/cpu.h         | 2 +-
 arch/mips/kernel/cpu-probe.c        | 6 +++++-
 arch/mips/loongson32/Platform       | 1 +
 arch/mips/loongson32/common/setup.c | 6 +++++-
 arch/mips/mm/c-r4k.c                | 9 +++++++++
 6 files changed, 23 insertions(+), 4 deletions(-)
arch/mips/include/asm/cpu-type.h +2 -1
index fbe1881..ab69178 100644
@@ -24,7 +24,8 @@ static inline int __pure __get_cpu_type(const int cpu_type)
 	case CPU_LOONGSON3:
 #endif
 
-#ifdef CONFIG_SYS_HAS_CPU_LOONGSON1B
+#if defined(CONFIG_SYS_HAS_CPU_LOONGSON1A) || \
+    defined(CONFIG_SYS_HAS_CPU_LOONGSON1B)
 	case CPU_LOONGSON1:
 #endif
 
arch/mips/include/asm/cpu.h +1 -1
index f672df8..43812ba 100644
@@ -239,7 +239,7 @@
 #define PRID_REV_VR4181A	0x0070	/* Same as VR4122 */
 #define PRID_REV_VR4130		0x0080
 #define PRID_REV_34K_V1_0_2	0x0022
-#define PRID_REV_LOONGSON1B	0x0020
+#define PRID_REV_LOONGSON1A_1B	0x0020
 #define PRID_REV_LOONGSON2E	0x0002
 #define PRID_REV_LOONGSON2F	0x0003
 #define PRID_REV_LOONGSON3A_R1	0x0005
arch/mips/kernel/cpu-probe.c +5 -1
index 5ac5c3e..efa8c33 100644
@@ -1497,8 +1497,12 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 		c->cputype = CPU_LOONGSON1;
 
 		switch (c->processor_id & PRID_REV_MASK) {
-		case PRID_REV_LOONGSON1B:
+		case PRID_REV_LOONGSON1A_1B:
+#ifdef CONFIG_CPU_LOONGSON1A
+			__cpu_name[cpu] = "Loongson 1A";
+#else
 			__cpu_name[cpu] = "Loongson 1B";
+#endif
 			break;
 		}
 
arch/mips/loongson32/Platform +1 -0
index ebb6dc2..e114c85 100644
@@ -4,4 +4,5 @@ cflags-$(CONFIG_CPU_LOONGSON1)	+= \
 
 platform-$(CONFIG_MACH_LOONGSON32)	+= loongson32/
 cflags-$(CONFIG_MACH_LOONGSON32)	+= -I$(srctree)/arch/mips/include/asm/mach-loongson32
+load-$(CONFIG_LOONGSON1_LS1A)		+= 0xffffffff80200000
 load-$(CONFIG_LOONGSON1_LS1B)		+= 0xffffffff80100000
arch/mips/loongson32/common/setup.c +5 -1
index 62f41af..c3d2036 100644
@@ -21,8 +21,12 @@ const char *get_system_type(void)
 	unsigned int processor_id = (&current_cpu_data)->processor_id;
 
 	switch (processor_id & PRID_REV_MASK) {
-	case PRID_REV_LOONGSON1B:
+	case PRID_REV_LOONGSON1A_1B:
+#ifdef CONFIG_CPU_LOONGSON1A
+		return "LOONGSON LS1A";
+#else
 		return "LOONGSON LS1B";
+#endif
 	default:
 		return "LOONGSON (unknown)";
 	}
arch/mips/mm/c-r4k.c +9 -0
index ef7f925..8c9eabc 100644
@@ -1306,6 +1306,15 @@ static void probe_pcache(void)
 			c->dcache.flags |= MIPS_CACHE_PINDEX;
 			break;
 		}
+	case CPU_LOONGSON1:
+		if ((read_c0_config7() & (1 << 16))) {
+			/*
+			 * effectively physically indexed dcache,
+			 * thus no virtual aliases.
+			 */
+			c->dcache.flags |= MIPS_CACHE_PINDEX;
+			break;
+		}
 	default:
 		if (has_74k_erratum || c->dcache.waysize > PAGE_SIZE)
 			c->dcache.flags |= MIPS_CACHE_ALIASES;
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH RESEND v4 1/9] MIPS: Loongson: Add basic Loongson-1A CPU support

arch/mips/kernel/cpu-probe.c static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu) · line 1505

Quoted 13 lines · Binbin Zhou
arch/mips/kernel/cpu-probe.c +5 -1
@@ -1497,8 +1497,12 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c, unsigned int cpu)
 		c->cputype = CPU_LOONGSON1;
 
 		switch (c->processor_id & PRID_REV_MASK) {
-		case PRID_REV_LOONGSON1B:
+		case PRID_REV_LOONGSON1A_1B:
+#ifdef CONFIG_CPU_LOONGSON1A
+			__cpu_name[cpu] = "Loongson 1A";
+#else
 			__cpu_name[cpu] = "Loongson 1B";
+#endif

Is there no way to distinguish between Loongson 1A and 1B at runtime for example by looking at the version number or similar?

Quoted 6 lines
arch/mips/loongson32/common/setup.c +0 -0
@@ -21,8 +21,12 @@ const char *get_system_type(void)
 	unsigned int processor_id = (&current_cpu_data)->processor_id;
 
 	switch (processor_id & PRID_REV_MASK) {

arch/mips/loongson32/common/setup.c const char *get_system_type(void) · line 32

Quoted 10 lines
arch/mips/loongson32/common/setup.c +5 -1
-	case PRID_REV_LOONGSON1B:
+	case PRID_REV_LOONGSON1A_1B:
+#ifdef CONFIG_CPU_LOONGSON1A
+		return "LOONGSON LS1A";
+#else
 		return "LOONGSON LS1B";
+#endif
 	default:
 		return "LOONGSON (unknown)";
 	}

Ditto.

Ralf

#3 lore raw

PATCH RESEND v4 2/9 MIPS: Loongson: Add Loongson-1A Kconfig options

In reply to Binbin Zhou

Added Kconfig options include: Loongson-1A CPU and machine definition, CPU cache features, 32-bit kernel and early printk support.

---
 arch/mips/Kconfig            | 11 +++++++++++
 arch/mips/loongson32/Kconfig | 16 ++++++++++++++++
 2 files changed, 27 insertions(+)
arch/mips/Kconfig +11 -0
index ac9bfad..dffa359 100644
@@ -1402,6 +1402,14 @@ config CPU_LOONGSON2F
 	  have a similar programming interface with FPGA northbridge used in
 	  Loongson2E.
 
+config CPU_LOONGSON1A
+	bool "Loongson 1A"
+	depends on SYS_HAS_CPU_LOONGSON1A
+	select CPU_LOONGSON1
+	help
+	  The Loongson 1A is a 32-bit SoC, which implements the MIPS32
+	  release 2 instruction set.
+
 config CPU_LOONGSON1B
 	bool "Loongson 1B"
 	depends on SYS_HAS_CPU_LOONGSON1B
@@ -1856,6 +1864,9 @@ config SYS_HAS_CPU_LOONGSON2F
 	select CPU_SUPPORTS_ADDRWINCFG if 64BIT
 	select CPU_SUPPORTS_UNCACHED_ACCELERATED
 
+config SYS_HAS_CPU_LOONGSON1A
+	bool
+
 config SYS_HAS_CPU_LOONGSON1B
 	bool
 
arch/mips/loongson32/Kconfig +16 -0
index 7704f20..35effa8 100644
@@ -3,6 +3,22 @@ if MACH_LOONGSON32
 choice
 	prompt "Machine Type"
 
+config LOONGSON1_LS1A
+	bool "Loongson LS1A board"
+	select CEVT_R4K
+	select CSRC_R4K
+	select SYS_HAS_CPU_LOONGSON1A
+	select DMA_NONCOHERENT
+	select BOOT_ELF32
+	select IRQ_MIPS_CPU
+	select SYS_SUPPORTS_32BIT_KERNEL
+	select SYS_SUPPORTS_LITTLE_ENDIAN
+	select SYS_SUPPORTS_HIGHMEM
+	select SYS_SUPPORTS_MIPS16
+	select SYS_HAS_EARLY_PRINTK
+	select USE_GENERIC_EARLY_PRINTK_8250
+	select COMMON_CLK
+
 config LOONGSON1_LS1B
 	bool "Loongson LS1B board"
 	select CEVT_R4K if !MIPS_EXTERNAL_TIMER
Signature · 1 line
1.9.1
#4 lore raw

PATCH RESEND v4 3/9 MIPS: Loongson: Add platform devices for Loongson-1A/1B

In reply to Binbin Zhou

Added basic platform devices for Loongson 1A, including serial port, ethernet, AHCI, USB, RTC, SPI and so on.

Most of the devices are shared with Loongson 1B, like serial port, ethernet, USB and so on.
Specially, something like AHCI is only used in Loonson 1A.

---
 arch/mips/include/asm/mach-loongson32/dma.h       |   1 +
 arch/mips/include/asm/mach-loongson32/irq.h       |   1 +
 arch/mips/include/asm/mach-loongson32/loongson1.h | 172 ++++++++++++---
 arch/mips/include/asm/mach-loongson32/nand.h      |   1 +
 arch/mips/include/asm/mach-loongson32/platform.h  |  10 +
 arch/mips/include/asm/mach-loongson32/regs-mux.h  |   2 +-
 arch/mips/loongson32/common/irq.c                 |   2 +-
 arch/mips/loongson32/common/platform.c            | 243 +++++++++++++++++++++-
 8 files changed, 390 insertions(+), 42 deletions(-)
arch/mips/include/asm/mach-loongson32/dma.h +1 -0
index ad1dec7..170c16a 100644
@@ -20,6 +20,7 @@ struct plat_ls1x_dma {
 	int nr_channels;
 };
 
+extern struct plat_ls1x_dma ls1a_dma_pdata;
 extern struct plat_ls1x_dma ls1b_dma_pdata;
 
 #endif /* __ASM_MACH_LOONGSON32_DMA_H */
arch/mips/include/asm/mach-loongson32/irq.h +1 -0
index c1c7441..e17232c 100644
@@ -64,6 +64,7 @@
 #define LS1X_OHCI_IRQ			LS1X_IRQ(1, 1)
 #define LS1X_GMAC0_IRQ			LS1X_IRQ(1, 2)
 #define LS1X_GMAC1_IRQ			LS1X_IRQ(1, 3)
+#define LS1X_AHCI_IRQ			LS1X_IRQ(1, 4)
 
 #define LS1X_IRQS		(LS1X_IRQ(4, 31) + 1 - LS1X_IRQ_BASE)
 
arch/mips/include/asm/mach-loongson32/loongson1.h +143 -29

178 lines not on this page · raw message

arch/mips/include/asm/mach-loongson32/nand.h +1 -0
index e274912..d141e0a 100644
@@ -23,6 +23,7 @@ struct plat_ls1x_nand {
 	int wait_cycle;
 };
 
+extern struct plat_ls1x_nand ls1a_nand_pdata;
 extern struct plat_ls1x_nand ls1b_nand_pdata;
 
 bool ls1x_dma_filter_fn(struct dma_chan *chan, void *param);
arch/mips/include/asm/mach-loongson32/platform.h +10 -0
index 672531a..c48f17b 100644
@@ -25,6 +25,16 @@ extern struct platform_device ls1x_gpio0_pdev;
 extern struct platform_device ls1x_gpio1_pdev;
 extern struct platform_device ls1x_nand_pdev;
 extern struct platform_device ls1x_rtc_pdev;
+extern struct platform_device ls1x_fb_pdev;
+extern struct platform_device ls1x_i2c0_pdev;
+extern struct platform_device ls1x_i2c1_pdev;
+extern struct platform_device ls1x_i2c2_pdev;
+extern struct platform_device ls1x_ahci_pdev;
+extern struct platform_device ls1x_ohci_pdev;
+extern struct platform_device ls1x_wat_pdev;
+extern struct platform_device ls1x_audio_pdev;
+extern struct platform_device ls1x_spi0_pdev;
+extern struct platform_device ls1x_spi1_pdev;
 
 void __init ls1x_clk_init(void);
 void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata);
arch/mips/include/asm/mach-loongson32/regs-mux.h +1 -1
index 7c394f9..d52ea03 100644
@@ -13,7 +13,7 @@
 #define __ASM_MACH_LOONGSON32_REGS_MUX_H
 
 #define LS1X_MUX_REG(x) \
-		((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x)))
+		((void __iomem *)KSEG1ADDR(LS1X_GPIO_MUX_BASE + (x)))
 
 #define LS1X_MUX_CTRL0			LS1X_MUX_REG(0x0)
 #define LS1X_MUX_CTRL1			LS1X_MUX_REG(0x4)
arch/mips/loongson32/common/irq.c +1 -1
index 455a770..f2520f2 100644
@@ -15,7 +15,7 @@
 #include <irq.h>
 
 #define LS1X_INTC_REG(n, x) \
-		((void __iomem *)KSEG1ADDR(LS1X_INTC_BASE + (n * 0x18) + (x)))
+		((void __iomem *)KSEG1ADDR(LS1X_INT_REG_BASE + (n * 0x18) + (x)))
 
 #define LS1X_INTC_INTISR(n)		LS1X_INTC_REG(n, 0x0)
 #define LS1X_INTC_INTIEN(n)		LS1X_INTC_REG(n, 0x4)
arch/mips/loongson32/common/platform.c +232 -11

309 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH RESEND v4 4/9 MIPS: Loongson: Add loongson-1A board support

In reply to Binbin Zhou

Loongson 1A's platform devices register.

Specially, Loongson 1A use ACPI to control restart/poweroff/halt.

---
 arch/mips/include/asm/mach-loongson32/loongson1.h |  11 +++
 arch/mips/loongson32/Makefile                     |   6 ++
 arch/mips/loongson32/common/prom.c                |   6 ++
 arch/mips/loongson32/common/reset.c               |   6 ++
 arch/mips/loongson32/common/setup.c               |  42 +++++++++
 arch/mips/loongson32/ls1a/Makefile                |   5 ++
 arch/mips/loongson32/ls1a/board.c                 | 105 ++++++++++++++++++++++
 7 files changed, 181 insertions(+)
 create mode 100644 arch/mips/loongson32/ls1a/Makefile
 create mode 100644 arch/mips/loongson32/ls1a/board.c
arch/mips/include/asm/mach-loongson32/loongson1.h +11 -0
index 8ba34f9..67ca11c 100644
@@ -158,6 +158,17 @@
 #define LS1X_LPC_CFG2_REG		(LS1X_LPC_REG_BASE + 0x8)
 #define LS1X_LPC_CFG3_REG		(LS1X_LPC_REG_BASE + 0xc)
 
+#define LS1X_PCIIO_BASE			0x1c000000
+#define LS1X_PCIIO_SIZE			0x00100000	/* 1M */
+
+/* reg access */
+#define ls1x_readb(addr)		(*(volatile u8 *)CKSEG1ADDR(addr))
+#define ls1x_readw(addr)		(*(volatile u16 *)CKSEG1ADDR(addr))
+#define ls1x_readl(addr)		(*(volatile u32 *)CKSEG1ADDR(addr))
+#define ls1x_writeb(val, addr)		(*(volatile u8 *)CKSEG1ADDR(addr) = (val))
+#define ls1x_writew(val, addr)		(*(volatile u16 *)CKSEG1ADDR(addr) = (val))
+#define ls1x_writel(val, addr)		(*(volatile u32 *)CKSEG1ADDR(addr) = (val))
+
 #include <regs-clk.h>
 #include <regs-mux.h>
 #include <regs-pwm.h>
arch/mips/loongson32/Makefile +6 -0
index 5f4bd6e..c2a6559 100644
@@ -5,6 +5,12 @@
 obj-$(CONFIG_MACH_LOONGSON32) += common/
 
 #
+# Loongson LS1A board
+#
+
+obj-$(CONFIG_LOONGSON1_LS1A)  += ls1a/
+
+#
 # Loongson LS1B board
 #
 
arch/mips/loongson32/common/prom.c +6 -0
index 6860098..e07e473 100644
@@ -64,6 +64,12 @@ void __init prom_init(void)
 
 	prom_init_cmdline();
 
+#ifdef CONFIG_CPU_LOONGSON1A
+	/* init base address of io space */
+	set_io_port_base((unsigned long)
+		ioremap(LS1X_PCIIO_BASE, LS1X_PCIIO_SIZE));
+#endif
+
 	memsize = env_or_default("memsize", DEFAULT_MEMSIZE);
 	highmemsize = env_or_default("highmemsize", 0x0);
 
arch/mips/loongson32/common/reset.c +6 -0
index 8a1d9cc..0b653eb 100644
@@ -19,10 +19,16 @@ static void __iomem *wdt_reg_base;
 
 static void ls1x_halt(void)
 {
+#ifdef CONFIG_CPU_LOONGSON1A
+	u32 tmp;
+	tmp = ls1x_readl(LS1X_PM1_CNT_REG);
+	ls1x_writel(tmp | 0x3d00, LS1X_PM1_CNT_REG);
+#else
 	while (1) {
 		if (cpu_wait)
 			cpu_wait();
 	}
+#endif
 }
 
 static void ls1x_restart(char *command)
arch/mips/loongson32/common/setup.c +42 -0

55 lines not on this page · raw message

arch/mips/loongson32/ls1a/Makefile new file +5 -0
new file mode 100644
index 0000000..7f2baf3
@@ -0,0 +1,5 @@
+#
+# Makefile for Loongson 1A based machines.
+#
+
+obj-y += board.o
arch/mips/loongson32/ls1a/board.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH RESEND v4 7/9 MIPS: Loongson-1A: Enable SPARSEMEN and HIGHMEM

In reply to Binbin Zhou
---
 arch/mips/include/asm/sparsemem.h   | 6 +++++-
 arch/mips/loongson32/Kconfig        | 1 +
 arch/mips/loongson32/common/setup.c | 3 ++-
 3 files changed, 8 insertions(+), 2 deletions(-)
arch/mips/include/asm/sparsemem.h +5 -1
index b1071c1..f73e671 100644
@@ -11,7 +11,11 @@
 #else
 # define SECTION_SIZE_BITS	28
 #endif
-#define MAX_PHYSMEM_BITS	48
+#ifdef CONFIG_64BIT
+# define MAX_PHYSMEM_BITS	48
+#else
+# define MAX_PHYSMEM_BITS	36
+#endif
 
 #endif /* CONFIG_SPARSEMEM */
 #endif /* _MIPS_SPARSEMEM_H */
arch/mips/loongson32/Kconfig +1 -0
index 35effa8..0b5a125 100644
@@ -7,6 +7,7 @@ config LOONGSON1_LS1A
 	bool "Loongson LS1A board"
 	select CEVT_R4K
 	select CSRC_R4K
+	select ARCH_SPARSEMEM_ENABLE
 	select SYS_HAS_CPU_LOONGSON1A
 	select DMA_NONCOHERENT
 	select BOOT_ELF32
arch/mips/loongson32/common/setup.c +2 -1
index 95b0155..af9ccee 100644
@@ -54,7 +54,8 @@ void __init plat_mem_setup(void)
 		.orig_video_points	= 16,
 	};
 #endif
-	add_memory_region(0x20000000, 0x30000000, BOOT_MEM_RESERVED);
+	if (highmemsize > 0)
+		add_memory_region(0x50000000, highmemsize << 20, BOOT_MEM_RAM);
 #endif
 }
 
Signature · 1 line
1.9.1
#7 lore raw

Re: [PATCH RESEND v4 7/9] MIPS: Loongson-1A: Enable SPARSEMEN and HIGHMEM

Quoted 5 lines · Binbin Zhou
arch/mips/include/asm/sparsemem.h +0 -0
index b1071c1..f73e671 100644

arch/mips/include/asm/sparsemem.h line 18

Quoted 9 lines
arch/mips/include/asm/sparsemem.h +5 -1
@@ -11,7 +11,11 @@
 #else
 # define SECTION_SIZE_BITS	28
 #endif
-#define MAX_PHYSMEM_BITS	48
+#ifdef CONFIG_64BIT
+# define MAX_PHYSMEM_BITS	48
+#else
+# define MAX_PHYSMEM_BITS	36
+#endif

This doesn't look right for XPA. What do you think, James?

I think we don't use sparsemem on XPA atm so I can apply this safely - but it should be fixed properly.

Ralf

#8 lore raw

Re: [PATCH RESEND v4 7/9] MIPS: Loongson-1A: Enable SPARSEMEN and HIGHMEM

Quoted 18 lines · Ralf Baechle
Quoted 5 lines · Binbin Zhou
arch/mips/include/asm/sparsemem.h +0 -0
index b1071c1..f73e671 100644

arch/mips/include/asm/sparsemem.h line 18

Quoted 9 lines
arch/mips/include/asm/sparsemem.h +5 -1
@@ -11,7 +11,11 @@
 #else
 # define SECTION_SIZE_BITS	28
 #endif
-#define MAX_PHYSMEM_BITS	48
+#ifdef CONFIG_64BIT
+# define MAX_PHYSMEM_BITS	48
+#else
+# define MAX_PHYSMEM_BITS	36
+#endif

This doesn't look right for XPA. What do you think, James?

XPA appears to naturally support up to 59 physical address bits, but with a "practical limit" of 40 bits. I haven't quite figured out what the practical limit means to be honest (maybe MIPS32 XPA implementations are simply expected not to exceed 40 bits in practice).

So yeh, it should probably be at least 40 when CONFIG_XPA is enabled, although I'm unclear about the consequences. E.g. a bigger MAX_PHYSMEM_BITS increases the number of segment id bits (MAX_PHYSMEM_BITS - SECTION_SIZE_BITS).

Quoted 3 lines

I think we don't use sparsemem on XPA atm so I can apply this safely - but it should be fixed properly.

Right, sparsemem seems to be enabled depending on the platform, so it may only be a matter of time.

Cheers
James

#9 lore raw

PATCH RESEND v4 8/9 MIPS: Loongson-1B: Update config file

In reply to Binbin Zhou

CONFIG_LOONGSON1_LS1B=y is needed to be set, while Loongson-1A is added.

---
 arch/mips/configs/loongson1b_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/mips/configs/loongson1b_defconfig +1 -0
index c442f27..7b8ac02 100644
@@ -1,4 +1,5 @@
 CONFIG_MACH_LOONGSON32=y
+CONFIG_LOONGSON1_LS1B=y
 CONFIG_PREEMPT=y
 # CONFIG_SECCOMP is not set
 # CONFIG_LOCALVERSION_AUTO is not set
Signature · 6 lines
1.9.1




[i
#10 lore raw

PATCH RESEND v4 9/9 MIPS: Loongson: Add a Loongson-1A default config file

In reply to Binbin Zhou
---
 arch/mips/configs/loongson1a_defconfig | 131 +++++++++++++++++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 arch/mips/configs/loongson1a_defconfig
arch/mips/configs/loongson1a_defconfig new file +131 -0
new file mode 100644
index 0000000..6a0450e
@@ -0,0 +1,131 @@
+CONFIG_MACH_LOONGSON32=y
+CONFIG_PAGE_SIZE_16KB=y
+CONFIG_HIGHMEM=y
+CONFIG_HZ_1000=y
+CONFIG_PREEMPT_VOLUNTARY=y
+# CONFIG_SECCOMP is not set
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_BSD_PROCESS_ACCT=y
+CONFIG_BSD_PROCESS_ACCT_V3=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=16
+CONFIG_CGROUPS=y
+CONFIG_BLK_CGROUP=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CPUSETS=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_EXPERT=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODVERSIONS=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_SUSPEND is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_IPV6 is not set
+CONFIG_BRIDGE=y
+# CONFIG_BRIDGE_IGMP_SNOOPING is not set
+# CONFIG_WIRELESS is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+# CONFIG_STANDALONE is not set
+CONFIG_MTD=y
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_BLOCK=y
+CONFIG_NFTL=y
+CONFIG_NFTL_RW=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_SPI_NOR=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+# CONFIG_SCSI_PROC_FS is not set
+CONFIG_BLK_DEV_SD=y
+# CONFIG_SCSI_LOWLEVEL is not set
+CONFIG_ATA=y
+# CONFIG_SATA_PMP is not set
+CONFIG_SATA_AHCI_PLATFORM=y
+# CONFIG_ATA_SFF is not set
+CONFIG_NETDEVICES=y
+CONFIG_NETCONSOLE=y
+# CONFIG_NET_VENDOR_ARC is not set
+# CONFIG_NET_VENDOR_BROADCOM is not set
+# CONFIG_NET_VENDOR_INTEL is not set
+# CONFIG_NET_VENDOR_MARVELL is not set
+# CONFIG_NET_VENDOR_MICREL is not set
+# CONFIG_NET_VENDOR_NATSEMI is not set
+# CONFIG_NET_VENDOR_SAMSUNG is not set
+# CONFIG_NET_VENDOR_SEEQ is not set
+# CONFIG_NET_VENDOR_SMSC is not set
+CONFIG_STMMAC_ETH=y
+# CONFIG_NET_VENDOR_VIA is not set
+# CONFIG_NET_VENDOR_WIZNET is not set
+CONFIG_REALTEK_PHY=y
+# CONFIG_USB_NET_DRIVERS is not set
+# CONFIG_WLAN is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+CONFIG_VT_HW_CONSOLE_BINDING=y
+CONFIG_LEGACY_PTY_COUNT=8
+# CONFIG_DEVKMEM is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_I2C=y
+CONFIG_SPI=y
+# CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_USB=y
+CONFIG_USB_MON=y
+CONFIG_USB_XHCI_HCD=m
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_HCD_PLATFORM=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_HCD_PLATFORM=y
+CONFIG_USB_STORAGE=m
+CONFIG_USB_GADGET=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_PCF8563=y
+# CONFIG_IOMMU_SUPPORT is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+CONFIG_EXT2_FS_SECURITY=y
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+CONFIG_EXT3_FS_SECURITY=y
+# CONFIG_DNOTIFY is not set
+CONFIG_VFAT_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+# CONFIG_MISC_FILESYSTEMS is not set
+# CONFIG_NETWORK_FILESYSTEMS is not set
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_ISO8859_1=y
+CONFIG_PRINTK_TIME=y
+# CONFIG_ENABLE_WARN_DEPRECATED is not set
+# CONFIG_ENABLE_MUST_CHECK is not set
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_FTRACE is not set
+CONFIG_XZ_DEC=y
Signature · 1 line
1.9.1