Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64f09aa9 authored by Huacai Chen's avatar Huacai Chen Committed by Ralf Baechle
Browse files

MIPS: Loongson-3: Add CPU Hwmon platform driver



This add CPU Hwmon (temperature sensor) platform driver for Loongson-3.

Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/9617/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent f14ceff7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -255,6 +255,10 @@ static inline void do_perfcnt_IRQ(void)
extern u64 loongson_chipcfg[MAX_PACKAGES];
#define LOONGSON_CHIPCFG(id) (*(volatile u32 *)(loongson_chipcfg[id]))

/* Chip Temperature registor of each physical cpu package, PRid >= Loongson-3A */
extern u64 loongson_chiptemp[MAX_PACKAGES];
#define LOONGSON_CHIPTEMP(id) (*(volatile u32 *)(loongson_chiptemp[id]))

/* Freq Control register of each physical cpu package, PRid >= Loongson-3B */
extern u64 loongson_freqctrl[MAX_PACKAGES];
#define LOONGSON_FREQCTRL(id) (*(volatile u32 *)(loongson_freqctrl[id]))
+9 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ struct efi_memory_map_loongson *loongson_memmap;
struct loongson_system_configuration loongson_sysconf;

u64 loongson_chipcfg[MAX_PACKAGES] = {0xffffffffbfc00180};
u64 loongson_chiptemp[MAX_PACKAGES];
u64 loongson_freqctrl[MAX_PACKAGES];

unsigned long long smp_group[4];
@@ -97,6 +98,10 @@ void __init prom_init_env(void)
		loongson_chipcfg[1] = 0x900010001fe00180;
		loongson_chipcfg[2] = 0x900020001fe00180;
		loongson_chipcfg[3] = 0x900030001fe00180;
		loongson_chiptemp[0] = 0x900000001fe0019c;
		loongson_chiptemp[1] = 0x900010001fe0019c;
		loongson_chiptemp[2] = 0x900020001fe0019c;
		loongson_chiptemp[3] = 0x900030001fe0019c;
		loongson_sysconf.ht_control_base = 0x90000EFDFB000000;
		loongson_sysconf.workarounds = WORKAROUND_CPUFREQ;
	} else if (ecpu->cputype == Loongson_3B) {
@@ -110,6 +115,10 @@ void __init prom_init_env(void)
		loongson_chipcfg[1] = 0x900020001fe00180;
		loongson_chipcfg[2] = 0x900040001fe00180;
		loongson_chipcfg[3] = 0x900060001fe00180;
		loongson_chiptemp[0] = 0x900000001fe0019c;
		loongson_chiptemp[1] = 0x900020001fe0019c;
		loongson_chiptemp[2] = 0x900040001fe0019c;
		loongson_chiptemp[3] = 0x900060001fe0019c;
		loongson_freqctrl[0] = 0x900000001fe001d0;
		loongson_freqctrl[1] = 0x900020001fe001d0;
		loongson_freqctrl[2] = 0x900040001fe001d0;
+3 −0
Original line number Diff line number Diff line
if X86
source "drivers/platform/x86/Kconfig"
endif
if MIPS
source "drivers/platform/mips/Kconfig"
endif
if GOLDFISH
source "drivers/platform/goldfish/Kconfig"
endif
+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#

obj-$(CONFIG_X86)		+= x86/
obj-$(CONFIG_MIPS)		+= mips/
obj-$(CONFIG_OLPC)		+= olpc/
obj-$(CONFIG_GOLDFISH)		+= goldfish/
obj-$(CONFIG_CHROME_PLATFORMS)	+= chrome/
+26 −0
Original line number Diff line number Diff line
#
# MIPS Platform Specific Drivers
#

menuconfig MIPS_PLATFORM_DEVICES
	bool "MIPS Platform Specific Device Drivers"
	default y
	help
	  Say Y here to get to see options for device drivers of various
	  MIPS platforms, including vendor-specific netbook/laptop/desktop
	  extension and hardware monitor drivers. This option itself does
	  not add any kernel code.

	  If you say N, all options in this submenu will be skipped and disabled.

if MIPS_PLATFORM_DEVICES

config CPU_HWMON
	tristate "Loongson CPU HWMon Driver"
	depends on LOONGSON_MACH3X
	select HWMON
	default y
	help
	  Loongson-3A/3B CPU Hwmon (temperature sensor) driver.

endif # MIPS_PLATFORM_DEVICES
Loading