platform.c contains several unused platform device with no drivers submited. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- .../include/asm/mach-loongson32/platform.h | 4 -- arch/mips/loongson32/common/platform.c | 63 ------------------- 2 files changed, 67 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson32/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h index 8f8fa43ba095..15d1de2300fe 100644 --- a/arch/mips/include/asm/mach-loongson32/platform.h +++ b/arch/mips/include/asm/mach-loongson32/platform.h @@ -17,19 +17,15 @@ extern struct platform_device ls1x_uart_pdev; extern struct platform_device ls1x_cpufreq_pdev; -extern struct platform_device ls1x_dma_pdev; extern struct platform_device ls1x_eth0_pdev; extern struct platform_device ls1x_eth1_pdev; extern struct platform_device ls1x_ehci_pdev; 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_wdt_pdev; void __init ls1x_clk_init(void); -void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata); -void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata); void __init ls1x_rtc_set_extclk(struct platform_device *pdev); void __init ls1x_serial_set_uartclk(struct platform_device *pdev); diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c index ac584c5823d0..0bf355c8bcb2 100644 --- a/arch/mips/loongson32/common/platform.c +++ b/arch/mips/loongson32/common/platform.c @@ -81,42 +81,6 @@ struct platform_device ls1x_cpufreq_pdev = { }, }; -/* DMA */ -static struct resource ls1x_dma_resources[] = { - [0] = { - .start = LS1X_DMAC_BASE, - .end = LS1X_DMAC_BASE + SZ_4 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = LS1X_DMA0_IRQ, - .end = LS1X_DMA0_IRQ, - .flags = IORESOURCE_IRQ, - }, - [2] = { - .start = LS1X_DMA1_IRQ, - .end = LS1X_DMA1_IRQ, - .flags = IORESOURCE_IRQ, - }, - [3] = { - .start = LS1X_DMA2_IRQ, - .end = LS1X_DMA2_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -struct platform_device ls1x_dma_pdev = { - .name = "ls1x-dma", - .id = -1, - .num_resources = ARRAY_SIZE(ls1x_dma_resources), - .resource = ls1x_dma_resources, -}; - -void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata) -{ - ls1x_dma_pdev.dev.platform_data = pdata; -} - /* Synopsys Ethernet GMAC */ static struct stmmac_mdio_bus_data ls1x_mdio_bus_data = { .phy_mask = 0, @@ -291,33 +255,6 @@ struct platform_device ls1x_gpio1_pdev = { .resource = ls1x_gpio1_resources, }; -/* NAND Flash */ -static struct resource ls1x_nand_resources[] = { - [0] = { - .start = LS1X_NAND_BASE, - .end = LS1X_NAND_BASE + SZ_32 - 1, - .flags = IORESOURCE_MEM, - }, - [1] = { - /* DMA channel 0 is dedicated to NAND */ - .start = LS1X_DMA_CHANNEL0, - .end = LS1X_DMA_CHANNEL0, - .flags = IORESOURCE_DMA, - }, -}; - -struct platform_device ls1x_nand_pdev = { - .name = "ls1x-nand", - .id = -1, - .num_resources = ARRAY_SIZE(ls1x_nand_resources), - .resource = ls1x_nand_resources, -}; - -void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata) -{ - ls1x_nand_pdev.dev.platform_data = pdata; -} - /* USB EHCI */ static u64 ls1x_ehci_dmamask = DMA_BIT_MASK(32); -- 2.20.1
GS232 core used in Loongson-1 processors has a bug that di instruction doesn't save the irqflag immediately. Workaround by set irqflag in CP0 before di instructions as same as Loongson-3. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/include/asm/irqflags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h index 9d3610be2323..59549d972439 100644 --- a/arch/mips/include/asm/irqflags.h +++ b/arch/mips/include/asm/irqflags.h @@ -41,7 +41,7 @@ static inline unsigned long arch_local_irq_save(void) " .set push \n" " .set reorder \n" " .set noat \n" -#if defined(CONFIG_CPU_LOONGSON3) +#if defined(CONFIG_CPU_LOONGSON3) || defined (CONFIG_CPU_LOONGSON1) " mfc0 %[flags], $12 \n" " di \n" #else -- 2.20.1
GS232 core have implemented all necessary mips32r2 instructions. Serval missing FP instructions can be emulated by kernel. The issue of di instruction have been solved. Thus we revert the ISA level back to MIPS32R2. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/Kconfig | 2 +- arch/mips/loongson32/Platform | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 787290781b8c..5f6cf6fe6382 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1866,7 +1866,7 @@ config CPU_LOONGSON2 config CPU_LOONGSON1 bool select CPU_MIPS32 - select CPU_MIPSR1 + select CPU_MIPSR2 select CPU_HAS_PREFETCH select CPU_HAS_LOAD_STORE_LR select CPU_SUPPORTS_32BIT_KERNEL diff --git a/arch/mips/loongson32/Platform b/arch/mips/loongson32/Platform index a0dbb3b2f2de..0db38f64f571 100644 --- a/arch/mips/loongson32/Platform +++ b/arch/mips/loongson32/Platform @@ -1,4 +1,4 @@ -cflags-$(CONFIG_CPU_LOONGSON1) += -march=mips32 -Wa,--trap +cflags-$(CONFIG_CPU_LOONGSON1) += -march=mips32r2 -Wa,--trap platform-$(CONFIG_MACH_LOONGSON32) += loongson32/ cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32 load-$(CONFIG_CPU_LOONGSON1) += 0xffffffff80100000 -- 2.20.1
Accorading to GS232 core user's manual, it doesn't support MIPS16. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/Kconfig | 4 ++++ arch/mips/loongson32/Kconfig | 15 --------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 5f6cf6fe6382..d4c01f9baf19 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -1870,6 +1870,10 @@ config CPU_LOONGSON1 select CPU_HAS_PREFETCH select CPU_HAS_LOAD_STORE_LR select CPU_SUPPORTS_32BIT_KERNEL + select IRQ_MIPS_CPU + select DMA_NONCOHERENT + select BOOT_ELF32 + select SYS_SUPPORTS_LITTLE_ENDIAN select CPU_SUPPORTS_HIGHMEM select CPU_SUPPORTS_CPUFREQ diff --git a/arch/mips/loongson32/Kconfig b/arch/mips/loongson32/Kconfig index 462b126f45aa..b4eed5b59b39 100644 --- a/arch/mips/loongson32/Kconfig +++ b/arch/mips/loongson32/Kconfig @@ -9,13 +9,6 @@ config LOONGSON1_LS1B select CEVT_R4K if !MIPS_EXTERNAL_TIMER select CSRC_R4K if !MIPS_EXTERNAL_TIMER select SYS_HAS_CPU_LOONGSON1B - 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 @@ -24,14 +17,6 @@ config LOONGSON1_LS1C bool "Loongson LS1C board" select CEVT_R4K if !MIPS_EXTERNAL_TIMER select CSRC_R4K if !MIPS_EXTERNAL_TIMER - select SYS_HAS_CPU_LOONGSON1C - 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 -- 2.20.1
PMON bootloader on Loongson-1C will use memory between 0x80100000 and 0x80200000 as stack. Use 0x80100000 as load address may hang the bootloader during loading. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/loongson32/Platform | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/loongson32/Platform b/arch/mips/loongson32/Platform index 0db38f64f571..333215593092 100644 --- a/arch/mips/loongson32/Platform +++ b/arch/mips/loongson32/Platform @@ -1,4 +1,4 @@ cflags-$(CONFIG_CPU_LOONGSON1) += -march=mips32r2 -Wa,--trap platform-$(CONFIG_MACH_LOONGSON32) += loongson32/ cflags-$(CONFIG_MACH_LOONGSON32) += -I$(srctree)/arch/mips/include/asm/mach-loongson32 -load-$(CONFIG_CPU_LOONGSON1) += 0xffffffff80100000 +load-$(CONFIG_CPU_LOONGSON1) += 0xffffffff80200000 -- 2.20.1
The Loongson-1A/1B/1C are shareing the same PRID. Rename previous Loongson 1B to the core used in these processors. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/include/asm/cpu.h | 2 +- arch/mips/kernel/cpu-probe.c | 4 ++-- arch/mips/loongson32/common/setup.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h index 532b49b1dbb3..b37c1be08dbd 100644 --- a/arch/mips/include/asm/cpu.h +++ b/arch/mips/include/asm/cpu.h @@ -241,7 +241,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_LOONGSON_GS232 0x0020 #define PRID_REV_LOONGSON1C 0x0020 /* Same as Loongson-1B */ #define PRID_REV_LOONGSON2E 0x0002 #define PRID_REV_LOONGSON2F 0x0003 diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index 95b18a194f53..64bf2a971012 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c @@ -1546,8 +1546,8 @@ 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: - __cpu_name[cpu] = "Loongson 1B"; + case PRID_REV_LOONGSON_GS232: + __cpu_name[cpu] = "Loongson GS232"; break; } diff --git a/arch/mips/loongson32/common/setup.c b/arch/mips/loongson32/common/setup.c index 1640744288ee..a1cb26dfc366 100644 --- a/arch/mips/loongson32/common/setup.c +++ b/arch/mips/loongson32/common/setup.c @@ -21,7 +21,7 @@ const char *get_system_type(void) unsigned int processor_id = (¤t_cpu_data)->processor_id; switch (processor_id & PRID_REV_MASK) { - case PRID_REV_LOONGSON1B: + case PRID_REV_LOONGSON_GS232: #if defined(CONFIG_LOONGSON1_LS1B) return "LOONGSON LS1B"; #elif defined(CONFIG_LOONGSON1_LS1C) -- 2.20.1
Hi Jiaxun,
On Tue, Jan 22, 2019 at 09:04:11PM +0800, Jiaxun Yang wrote:
> GS232 core used in Loongson-1 processors has a bug that
> di instruction doesn't save the irqflag immediately.
>
> Workaround by set irqflag in CP0 before di instructions
> as same as Loongson-3.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/include/asm/irqflags.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/include/asm/irqflags.h b/arch/mips/include/asm/irqflags.h
> index 9d3610be2323..59549d972439 100644
> --- a/arch/mips/include/asm/irqflags.h
> +++ b/arch/mips/include/asm/irqflags.h
> @@ -41,7 +41,7 @@ static inline unsigned long arch_local_irq_save(void)
> " .set push \n"
> " .set reorder \n"
> " .set noat \n"
> -#if defined(CONFIG_CPU_LOONGSON3)
> +#if defined(CONFIG_CPU_LOONGSON3) || defined (CONFIG_CPU_LOONGSON1)
> " mfc0 %[flags], $12 \n"
> " di \n"
> #else
> --
> 2.20.1
Thanks for your patches.
Since this bug exists on both Loongson 1 CPUs & Loongson 3 CPUs, I'm
wondering whether it also exists on Loongson 2 CPUs. Do you happen to
know whether that is the case?
Thanks,
Paul
On January 23, 2019 1:39:36 AM GMT+08:00, Paul Burton <paul.burton@mips.com> wrote: >Hi Jiaxun, > > > >Thanks for your patches. > >Since this bug exists on both Loongson 1 CPUs & Loongson 3 CPUs, I'm >wondering whether it also exists on Loongson 2 CPUs. Do you happen to >know whether that is the case? Early Loongson-2 such as Loongson-2E/F/G/H does not have di/ei instructions, they are not R2 compatible. The latest Loongson-2K1000 have the same di/ei bug but it hasn't been submitted to the mainline. Thanks > >Thanks, > Paul -- Jiaxun Yang
Hello,
Jiaxun Yang wrote:
> platform.c contains several unused platform device with no
> drivers submited.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
Hello,
Jiaxun Yang wrote:
> Accorading to GS232 core user's manual, it doesn't support MIPS16.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
Hello,
Jiaxun Yang wrote:
> PMON bootloader on Loongson-1C will use memory between
> 0x80100000 and 0x80200000 as stack.
>
> Use 0x80100000 as load address may hang the bootloader
> during loading.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
Hello,
Jiaxun Yang wrote:
> GS232 core used in Loongson-1 processors has a bug that
> di instruction doesn't save the irqflag immediately.
>
> Workaround by set irqflag in CP0 before di instructions
> as same as Loongson-3.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
Hello,
Jiaxun Yang wrote:
> GS232 core have implemented all necessary mips32r2 instructions.
> Serval missing FP instructions can be emulated by kernel.
>
> The issue of di instruction have been solved.
> Thus we revert the ISA level back to MIPS32R2.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Applied to mips-next.
Thanks,
Paul
[ This message was auto-generated; if you believe anything is incorrect
then please email paul.burton@mips.com to report it. ]
On January 23, 2019 11:26:01 AM GMT+08:00, Kelvin Cheung <keguang.zhang@gmail.com> wrote: >Hi Paul, Jiaxun, >The platform.[ch] is the common code for both Loongson1B and >Loongson1C. >And the DMA and NAND device are used by Loongson1B. Hi Kevin: It seemed like there are no drivers for these devices in mainline kernel. It would be nice if you can submit these driver before revert this patch. BTW: I'm currently working on refactor Loongson32 platform with DeviceTree. Thanks >Could you please revert this patch. >Thanks! > >Paul Burton <paul.burton@mips.com> 于2019年1月23日周三 上午9:34写道: > >> Hello, >> >> Jiaxun Yang wrote: >> > platform.c contains several unused platform device with no >> > drivers submited. >> > >> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >> >> Applied to mips-next. >> >> Thanks, >> Paul >> >> [ This message was auto-generated; if you believe anything is >incorrect >> then please email paul.burton@mips.com to report it. ] >> -- Jiaxun Yang
Hi Jiaxun & Kevin, On Wed, Jan 23, 2019 at 11:40:12AM +0800, Jiaxun Yang wrote: > On January 23, 2019 11:26:01 AM GMT+08:00, Kelvin Cheung <keguang.zhang@gmail.com> wrote: > >Hi Paul, Jiaxun, > >The platform.[ch] is the common code for both Loongson1B and > >Loongson1C. > >And the DMA and NAND device are used by Loongson1B. > > Hi Kevin: > It seemed like there are no drivers for these devices in mainline kernel. > It would be nice if you can submit these driver before revert this patch. I agree with Jiaxun here - if you want the platform code to be part of mainline then the driver needs to be too. Conversely if you have drivers that are not part of the mainline kernel then maintaining the platform code to go with them should be a negligible amount of extra work. > BTW: I'm currently working on refactor Loongson32 platform with DeviceTree. Neat - I look forward to seeing that :) Thanks, Paul