Skip to content

Commit f60d251

Browse files
committed
LoongArch: Add architectural preparation for CPUFreq
Add architectural preparation for CPUFreq driver, including: Kconfig, register definition and platform device registration. Some of LoongArch processors support DVFS, their IOCSR.FEATURES has IOCSRF_FREQSCALE set. And they has a micro-core in the package called SMC (System Management Controller) to scale frequency, voltage, etc. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 8e02c3b commit f60d251

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

arch/loongarch/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,7 @@ config ARCH_HIBERNATION_POSSIBLE
702702

703703
source "kernel/power/Kconfig"
704704
source "drivers/acpi/Kconfig"
705+
source "drivers/cpufreq/Kconfig"
705706

706707
endmenu
707708

arch/loongarch/include/asm/loongarch.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,11 +1061,14 @@
10611061
#define LOONGARCH_IOCSR_NODECNT 0x408
10621062

10631063
#define LOONGARCH_IOCSR_MISC_FUNC 0x420
1064+
#define IOCSR_MISC_FUNC_SOFT_INT BIT_ULL(10)
10641065
#define IOCSR_MISC_FUNC_TIMER_RESET BIT_ULL(21)
10651066
#define IOCSR_MISC_FUNC_EXT_IOI_EN BIT_ULL(48)
10661067

10671068
#define LOONGARCH_IOCSR_CPUTEMP 0x428
10681069

1070+
#define LOONGARCH_IOCSR_SMCMBX 0x51c
1071+
10691072
/* PerCore CSR, only accessible by local cores */
10701073
#define LOONGARCH_IOCSR_IPI_STATUS 0x1000
10711074
#define LOONGARCH_IOCSR_IPI_EN 0x1004

arch/loongarch/power/platform.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ void enable_pci_wakeup(void)
3434
acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, 0);
3535
}
3636

37+
static struct platform_device loongson3_cpufreq_device = {
38+
.name = "loongson3_cpufreq",
39+
.id = -1,
40+
};
41+
42+
static int __init loongson_cpufreq_init(void)
43+
{
44+
if (!cpu_has_scalefreq)
45+
return -ENODEV;
46+
47+
return platform_device_register(&loongson3_cpufreq_device);
48+
}
49+
50+
arch_initcall(loongson_cpufreq_init);
51+
3752
static int __init loongson3_acpi_suspend_init(void)
3853
{
3954
#ifdef CONFIG_ACPI

0 commit comments

Comments
 (0)