提交 6def0ea3 编写于 作者: L liuyun 提交者: Hongchen Zhang

cpufreq: Add cpufreq driver for LoongArch

LoongArch inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I6BWFP

--------------------------------
Signed-off-by: Nzhangtianyang <zhangtianyang@loongson.cn>
Change-Id: Ic9390a1c78e1670422be1b03d35e3f0fdec1367f
上级 f3b12c25
...@@ -514,4 +514,10 @@ source "drivers/acpi/Kconfig" ...@@ -514,4 +514,10 @@ source "drivers/acpi/Kconfig"
endmenu endmenu
menu "CPU Power Management"
source "drivers/cpufreq/Kconfig"
endmenu
source "drivers/firmware/Kconfig" source "drivers/firmware/Kconfig"
...@@ -43,6 +43,10 @@ CONFIG_ACPI_SPCR_TABLE=y ...@@ -43,6 +43,10 @@ CONFIG_ACPI_SPCR_TABLE=y
CONFIG_ACPI_DOCK=y CONFIG_ACPI_DOCK=y
CONFIG_ACPI_IPMI=m CONFIG_ACPI_IPMI=m
CONFIG_ACPI_PCI_SLOT=y CONFIG_ACPI_PCI_SLOT=y
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_STAT=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_LOONGSON3_ACPI_CPUFREQ=y
CONFIG_EFI_CAPSULE_LOADER=m CONFIG_EFI_CAPSULE_LOADER=m
CONFIG_EFI_TEST=m CONFIG_EFI_TEST=m
CONFIG_MODULES=y CONFIG_MODULES=y
......
...@@ -45,6 +45,10 @@ static inline void disable_lasx(void); ...@@ -45,6 +45,10 @@ static inline void disable_lasx(void);
static inline void save_lasx(struct task_struct *t); static inline void save_lasx(struct task_struct *t);
static inline void restore_lasx(struct task_struct *t); static inline void restore_lasx(struct task_struct *t);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
DECLARE_PER_CPU(unsigned long, msa_count);
DECLARE_PER_CPU(unsigned long, lasx_count);
#endif
/* /*
* Mask the FCSR Cause bits according to the Enable bits, observing * Mask the FCSR Cause bits according to the Enable bits, observing
* that Unimplemented is always enabled. * that Unimplemented is always enabled.
...@@ -198,6 +202,9 @@ static inline void enable_lsx(void) ...@@ -198,6 +202,9 @@ static inline void enable_lsx(void)
{ {
if (cpu_has_lsx) if (cpu_has_lsx)
csr_xchg32(CSR_EUEN_LSXEN, CSR_EUEN_LSXEN, LOONGARCH_CSR_EUEN); csr_xchg32(CSR_EUEN_LSXEN, CSR_EUEN_LSXEN, LOONGARCH_CSR_EUEN);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
per_cpu(msa_count, raw_smp_processor_id())++;
#endif
} }
static inline void disable_lsx(void) static inline void disable_lsx(void)
...@@ -251,8 +258,12 @@ static inline void restore_lsx_upper(struct task_struct *t) {} ...@@ -251,8 +258,12 @@ static inline void restore_lsx_upper(struct task_struct *t) {}
static inline void enable_lasx(void) static inline void enable_lasx(void)
{ {
if (cpu_has_lasx) if (cpu_has_lasx) {
csr_xchg32(CSR_EUEN_LASXEN, CSR_EUEN_LASXEN, LOONGARCH_CSR_EUEN); csr_xchg32(CSR_EUEN_LASXEN, CSR_EUEN_LASXEN, LOONGARCH_CSR_EUEN);
#ifdef CONFIG_LOONGSON3_ACPI_CPUFREQ
per_cpu(lasx_count, raw_smp_processor_id())++;
#endif
}
} }
static inline void disable_lasx(void) static inline void disable_lasx(void)
......
...@@ -287,6 +287,17 @@ config LOONGSON1_CPUFREQ ...@@ -287,6 +287,17 @@ config LOONGSON1_CPUFREQ
If in doubt, say N. If in doubt, say N.
endif endif
if LOONGARCH
config LOONGSON3_ACPI_CPUFREQ
bool "Loongson3 ACPI cpufreq driver"
depends on ACPI_PROCESSOR
help
This driver adds a CPUFreq driver which utilizes the ACPI
Processor Performance States.
This driver supports Loongson 3A5000 compatible CPUs.
If in doubt, say N.
endif
if SPARC64 if SPARC64
config SPARC_US3_CPUFREQ config SPARC_US3_CPUFREQ
tristate "UltraSPARC-III CPU Frequency driver" tristate "UltraSPARC-III CPU Frequency driver"
......
...@@ -106,6 +106,7 @@ obj-$(CONFIG_BMIPS_CPUFREQ) += bmips-cpufreq.o ...@@ -106,6 +106,7 @@ obj-$(CONFIG_BMIPS_CPUFREQ) += bmips-cpufreq.o
obj-$(CONFIG_IA64_ACPI_CPUFREQ) += ia64-acpi-cpufreq.o obj-$(CONFIG_IA64_ACPI_CPUFREQ) += ia64-acpi-cpufreq.o
obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o obj-$(CONFIG_LOONGSON2_CPUFREQ) += loongson2_cpufreq.o
obj-$(CONFIG_LOONGSON1_CPUFREQ) += loongson1-cpufreq.o obj-$(CONFIG_LOONGSON1_CPUFREQ) += loongson1-cpufreq.o
obj-$(CONFIG_LOONGSON3_ACPI_CPUFREQ) += loongson3-acpi-cpufreq.o
obj-$(CONFIG_SH_CPU_FREQ) += sh-cpufreq.o obj-$(CONFIG_SH_CPU_FREQ) += sh-cpufreq.o
obj-$(CONFIG_SPARC_US2E_CPUFREQ) += sparc-us2e-cpufreq.o obj-$(CONFIG_SPARC_US2E_CPUFREQ) += sparc-us2e-cpufreq.o
obj-$(CONFIG_SPARC_US3_CPUFREQ) += sparc-us3-cpufreq.o obj-$(CONFIG_SPARC_US3_CPUFREQ) += sparc-us3-cpufreq.o
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册