2021-03-05 00:10:50

by Qing Zhang

[permalink] [raw]
Subject: [PATCH 0/2] some cleanup code

These patches clean up some code about Loongson64.

Qing Zhang (2):
MIPS: Loongson64: Remove unused sysconf members
MIPS: Loongson64: Move loongson_system_configuration to loongson.h

.../include/asm/mach-loongson64/boot_param.h | 27 ------------
.../include/asm/mach-loongson64/loongson.h | 18 ++++++++
arch/mips/loongson64/Makefile | 2 +-
arch/mips/loongson64/env.c | 20 ---------
arch/mips/loongson64/platform.c | 42 -------------------
drivers/irqchip/irq-loongson-liointc.c | 2 +-
6 files changed, 20 insertions(+), 91 deletions(-)
delete mode 100644 arch/mips/loongson64/platform.c

--
2.20.1


2021-03-05 00:10:50

by Qing Zhang

[permalink] [raw]
Subject: [PATCH 1/2] MIPS: Loongson64: Remove unused sysconf members

We don't need them anymore, They are uniform on all Loongson64 systems
and have been fixed in DeviceTree.loongson3_platform_init is replaced
with DTS + driver.

Signed-off-by: Jiaxun Yang <[email protected]>
Signed-off-by: Qing Zhang <[email protected]>
---
.../include/asm/mach-loongson64/boot_param.h | 9 ----
arch/mips/loongson64/Makefile | 2 +-
arch/mips/loongson64/env.c | 20 ---------
arch/mips/loongson64/platform.c | 42 -------------------
4 files changed, 1 insertion(+), 72 deletions(-)
delete mode 100644 arch/mips/loongson64/platform.c

diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
index 4592841b6b0c..1c1cdf57137e 100644
--- a/arch/mips/include/asm/mach-loongson64/boot_param.h
+++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
@@ -207,20 +207,11 @@ struct loongson_system_configuration {
u16 reserved_cpus_mask;
enum loongson_cpu_type cputype;
enum loongson_bridge_type bridgetype;
- u64 ht_control_base;
- u64 pci_mem_start_addr;
- u64 pci_mem_end_addr;
- u64 pci_io_base;
u64 restart_addr;
u64 poweroff_addr;
u64 suspend_addr;
u64 vgabios_addr;
u32 dma_mask_bits;
- char ecname[32];
- u32 nr_uarts;
- struct uart_device uarts[MAX_UARTS];
- u32 nr_sensors;
- struct sensor_device sensors[MAX_SENSORS];
u64 workarounds;
void (*early_config)(void);
};
diff --git a/arch/mips/loongson64/Makefile b/arch/mips/loongson64/Makefile
index cc76944b1a9d..e806280bbb85 100644
--- a/arch/mips/loongson64/Makefile
+++ b/arch/mips/loongson64/Makefile
@@ -2,7 +2,7 @@
#
# Makefile for Loongson-3 family machines
#
-obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o platform.o dma.o \
+obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o dma.o \
setup.o init.o env.o time.o reset.o \

obj-$(CONFIG_SMP) += smp.o
diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
index 51a5d050a94c..1821d461b606 100644
--- a/arch/mips/loongson64/env.c
+++ b/arch/mips/loongson64/env.c
@@ -95,7 +95,6 @@ void __init prom_init_env(void)
loongson_freqctrl[1] = 0x900010001fe001d0;
loongson_freqctrl[2] = 0x900020001fe001d0;
loongson_freqctrl[3] = 0x900030001fe001d0;
- loongson_sysconf.ht_control_base = 0x90000EFDFB000000;
loongson_sysconf.workarounds = WORKAROUND_CPUFREQ;
break;
case Legacy_3B:
@@ -118,7 +117,6 @@ void __init prom_init_env(void)
loongson_freqctrl[1] = 0x900020001fe001d0;
loongson_freqctrl[2] = 0x900040001fe001d0;
loongson_freqctrl[3] = 0x900060001fe001d0;
- loongson_sysconf.ht_control_base = 0x90001EFDFB000000;
loongson_sysconf.workarounds = WORKAROUND_CPUHOTPLUG;
break;
default:
@@ -136,9 +134,6 @@ void __init prom_init_env(void)
loongson_sysconf.cores_per_node - 1) /
loongson_sysconf.cores_per_node;

- loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr;
- loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr;
- loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
if (loongson_sysconf.dma_mask_bits < 32 ||
loongson_sysconf.dma_mask_bits > 64)
@@ -153,23 +148,8 @@ void __init prom_init_env(void)
loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr,
loongson_sysconf.vgabios_addr);

- memset(loongson_sysconf.ecname, 0, 32);
- if (esys->has_ec)
- memcpy(loongson_sysconf.ecname, esys->ec_name, 32);
loongson_sysconf.workarounds |= esys->workarounds;

- loongson_sysconf.nr_uarts = esys->nr_uarts;
- if (esys->nr_uarts < 1 || esys->nr_uarts > MAX_UARTS)
- loongson_sysconf.nr_uarts = 1;
- memcpy(loongson_sysconf.uarts, esys->uarts,
- sizeof(struct uart_device) * loongson_sysconf.nr_uarts);
-
- loongson_sysconf.nr_sensors = esys->nr_sensors;
- if (loongson_sysconf.nr_sensors > MAX_SENSORS)
- loongson_sysconf.nr_sensors = 0;
- if (loongson_sysconf.nr_sensors)
- memcpy(loongson_sysconf.sensors, esys->sensors,
- sizeof(struct sensor_device) * loongson_sysconf.nr_sensors);
pr_info("CpuClock = %u\n", cpu_clock_freq);

/* Read the ID of PCI host bridge to detect bridge type */
diff --git a/arch/mips/loongson64/platform.c b/arch/mips/loongson64/platform.c
deleted file mode 100644
index 9674ae1361a8..000000000000
--- a/arch/mips/loongson64/platform.c
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2009 Lemote Inc.
- * Author: Wu Zhangjin, [email protected]
- * Xiang Yu, [email protected]
- * Chen Huacai, [email protected]
- */
-
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/platform_device.h>
-#include <asm/bootinfo.h>
-#include <boot_param.h>
-#include <loongson_hwmon.h>
-#include <workarounds.h>
-
-static int __init loongson3_platform_init(void)
-{
- int i;
- struct platform_device *pdev;
-
- if (loongson_sysconf.ecname[0] != '\0')
- platform_device_register_simple(loongson_sysconf.ecname, -1, NULL, 0);
-
- for (i = 0; i < loongson_sysconf.nr_sensors; i++) {
- if (loongson_sysconf.sensors[i].type > SENSOR_FAN)
- continue;
-
- pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
- if (!pdev)
- return -ENOMEM;
-
- pdev->name = loongson_sysconf.sensors[i].name;
- pdev->id = loongson_sysconf.sensors[i].id;
- pdev->dev.platform_data = &loongson_sysconf.sensors[i];
- platform_device_register(pdev);
- }
-
- return 0;
-}
-
-arch_initcall(loongson3_platform_init);
--
2.20.1

2021-03-05 02:33:06

by Jiaxun Yang

[permalink] [raw]
Subject: Re: [PATCH 1/2] MIPS: Loongson64: Remove unused sysconf members



?? 2021/3/4 ????7:00, Qing Zhang д??:
> We don't need them anymore, They are uniform on all Loongson64 systems
> and have been fixed in DeviceTree.loongson3_platform_init is replaced
> with DTS + driver.
>
> Signed-off-by: Jiaxun Yang <[email protected]>
> Signed-off-by: Qing Zhang <[email protected]>

Acked-by: Jiaxun Yang <[email protected]>

Hmm, why it comes with my sign-off?
I assue it's my patch somewhere off the tree?

Thanks.

- Jiaxun

> ---
> .../include/asm/mach-loongson64/boot_param.h | 9 ----
> arch/mips/loongson64/Makefile | 2 +-
> arch/mips/loongson64/env.c | 20 ---------
> arch/mips/loongson64/platform.c | 42 -------------------
> 4 files changed, 1 insertion(+), 72 deletions(-)
> delete mode 100644 arch/mips/loongson64/platform.c
>
> diff --git a/arch/mips/include/asm/mach-loongson64/boot_param.h b/arch/mips/include/asm/mach-loongson64/boot_param.h
> index 4592841b6b0c..1c1cdf57137e 100644
> --- a/arch/mips/include/asm/mach-loongson64/boot_param.h
> +++ b/arch/mips/include/asm/mach-loongson64/boot_param.h
> @@ -207,20 +207,11 @@ struct loongson_system_configuration {
> u16 reserved_cpus_mask;
> enum loongson_cpu_type cputype;
> enum loongson_bridge_type bridgetype;
> - u64 ht_control_base;
> - u64 pci_mem_start_addr;
> - u64 pci_mem_end_addr;
> - u64 pci_io_base;
> u64 restart_addr;
> u64 poweroff_addr;
> u64 suspend_addr;
> u64 vgabios_addr;
> u32 dma_mask_bits;
> - char ecname[32];
> - u32 nr_uarts;
> - struct uart_device uarts[MAX_UARTS];
> - u32 nr_sensors;
> - struct sensor_device sensors[MAX_SENSORS];
> u64 workarounds;
> void (*early_config)(void);
> };
> diff --git a/arch/mips/loongson64/Makefile b/arch/mips/loongson64/Makefile
> index cc76944b1a9d..e806280bbb85 100644
> --- a/arch/mips/loongson64/Makefile
> +++ b/arch/mips/loongson64/Makefile
> @@ -2,7 +2,7 @@
> #
> # Makefile for Loongson-3 family machines
> #
> -obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o platform.o dma.o \
> +obj-$(CONFIG_MACH_LOONGSON64) += cop2-ex.o dma.o \
> setup.o init.o env.o time.o reset.o \
>
> obj-$(CONFIG_SMP) += smp.o
> diff --git a/arch/mips/loongson64/env.c b/arch/mips/loongson64/env.c
> index 51a5d050a94c..1821d461b606 100644
> --- a/arch/mips/loongson64/env.c
> +++ b/arch/mips/loongson64/env.c
> @@ -95,7 +95,6 @@ void __init prom_init_env(void)
> loongson_freqctrl[1] = 0x900010001fe001d0;
> loongson_freqctrl[2] = 0x900020001fe001d0;
> loongson_freqctrl[3] = 0x900030001fe001d0;
> - loongson_sysconf.ht_control_base = 0x90000EFDFB000000;
> loongson_sysconf.workarounds = WORKAROUND_CPUFREQ;
> break;
> case Legacy_3B:
> @@ -118,7 +117,6 @@ void __init prom_init_env(void)
> loongson_freqctrl[1] = 0x900020001fe001d0;
> loongson_freqctrl[2] = 0x900040001fe001d0;
> loongson_freqctrl[3] = 0x900060001fe001d0;
> - loongson_sysconf.ht_control_base = 0x90001EFDFB000000;
> loongson_sysconf.workarounds = WORKAROUND_CPUHOTPLUG;
> break;
> default:
> @@ -136,9 +134,6 @@ void __init prom_init_env(void)
> loongson_sysconf.cores_per_node - 1) /
> loongson_sysconf.cores_per_node;
>
> - loongson_sysconf.pci_mem_start_addr = eirq_source->pci_mem_start_addr;
> - loongson_sysconf.pci_mem_end_addr = eirq_source->pci_mem_end_addr;
> - loongson_sysconf.pci_io_base = eirq_source->pci_io_start_addr;
> loongson_sysconf.dma_mask_bits = eirq_source->dma_mask_bits;
> if (loongson_sysconf.dma_mask_bits < 32 ||
> loongson_sysconf.dma_mask_bits > 64)
> @@ -153,23 +148,8 @@ void __init prom_init_env(void)
> loongson_sysconf.poweroff_addr, loongson_sysconf.restart_addr,
> loongson_sysconf.vgabios_addr);
>
> - memset(loongson_sysconf.ecname, 0, 32);
> - if (esys->has_ec)
> - memcpy(loongson_sysconf.ecname, esys->ec_name, 32);
> loongson_sysconf.workarounds |= esys->workarounds;
>
> - loongson_sysconf.nr_uarts = esys->nr_uarts;
> - if (esys->nr_uarts < 1 || esys->nr_uarts > MAX_UARTS)
> - loongson_sysconf.nr_uarts = 1;
> - memcpy(loongson_sysconf.uarts, esys->uarts,
> - sizeof(struct uart_device) * loongson_sysconf.nr_uarts);
> -
> - loongson_sysconf.nr_sensors = esys->nr_sensors;
> - if (loongson_sysconf.nr_sensors > MAX_SENSORS)
> - loongson_sysconf.nr_sensors = 0;
> - if (loongson_sysconf.nr_sensors)
> - memcpy(loongson_sysconf.sensors, esys->sensors,
> - sizeof(struct sensor_device) * loongson_sysconf.nr_sensors);
> pr_info("CpuClock = %u\n", cpu_clock_freq);
>
> /* Read the ID of PCI host bridge to detect bridge type */
> diff --git a/arch/mips/loongson64/platform.c b/arch/mips/loongson64/platform.c
> deleted file mode 100644
> index 9674ae1361a8..000000000000
> --- a/arch/mips/loongson64/platform.c
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> - * Copyright (C) 2009 Lemote Inc.
> - * Author: Wu Zhangjin, [email protected]
> - * Xiang Yu, [email protected]
> - * Chen Huacai, [email protected]
> - */
> -
> -#include <linux/err.h>
> -#include <linux/slab.h>
> -#include <linux/platform_device.h>
> -#include <asm/bootinfo.h>
> -#include <boot_param.h>
> -#include <loongson_hwmon.h>
> -#include <workarounds.h>
> -
> -static int __init loongson3_platform_init(void)
> -{
> - int i;
> - struct platform_device *pdev;
> -
> - if (loongson_sysconf.ecname[0] != '\0')
> - platform_device_register_simple(loongson_sysconf.ecname, -1, NULL, 0);
> -
> - for (i = 0; i < loongson_sysconf.nr_sensors; i++) {
> - if (loongson_sysconf.sensors[i].type > SENSOR_FAN)
> - continue;
> -
> - pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
> - if (!pdev)
> - return -ENOMEM;
> -
> - pdev->name = loongson_sysconf.sensors[i].name;
> - pdev->id = loongson_sysconf.sensors[i].id;
> - pdev->dev.platform_data = &loongson_sysconf.sensors[i];
> - platform_device_register(pdev);
> - }
> -
> - return 0;
> -}
> -
> -arch_initcall(loongson3_platform_init);
>

2021-03-06 03:25:16

by Qing Zhang

[permalink] [raw]
Subject: Re: [PATCH 1/2] MIPS: Loongson64: Remove unused sysconf members



On 03/05/2021 10:32 AM, Jiaxun Yang wrote:
>
>
> 在 2021/3/4 下午7:00, Qing Zhang 写道:
>> We don't need them anymore, They are uniform on all Loongson64 systems
>> and have been fixed in DeviceTree.loongson3_platform_init is replaced
>> with DTS + driver.
>>
>> Signed-off-by: Jiaxun Yang <[email protected]>
>> Signed-off-by: Qing Zhang <[email protected]>
>
> Acked-by: Jiaxun Yang <[email protected]>
>
> Hmm, why it comes with my sign-off?
> I assue it's my patch somewhere off the tree?
Hi, Jiaxun

Thank you very much for your reply.

Yes, it is like this.out of tree provides good ideas, and clean up
others by the way.

Thanks,
Qing

>
> Thanks.
>
> - Jiaxun
>

2021-03-12 10:36:07

by Thomas Bogendoerfer

[permalink] [raw]
Subject: Re: [PATCH 1/2] MIPS: Loongson64: Remove unused sysconf members

On Thu, Mar 04, 2021 at 07:00:56PM +0800, Qing Zhang wrote:
> We don't need them anymore, They are uniform on all Loongson64 systems
> and have been fixed in DeviceTree.loongson3_platform_init is replaced
> with DTS + driver.
>
> Signed-off-by: Jiaxun Yang <[email protected]>
> Signed-off-by: Qing Zhang <[email protected]>
> ---
> .../include/asm/mach-loongson64/boot_param.h | 9 ----
> arch/mips/loongson64/Makefile | 2 +-
> arch/mips/loongson64/env.c | 20 ---------
> arch/mips/loongson64/platform.c | 42 -------------------
> 4 files changed, 1 insertion(+), 72 deletions(-)
> delete mode 100644 arch/mips/loongson64/platform.c

applied to mips-next.

Thomas.

--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]