MIPS: Loongson-3: Add CPU Hwmon platform driver
Subsystems (2)
PATCH v7 6/8 MIPS: Loongson-3: Add CPU Hwmon platform driver
This add CPU Hwmon (temperature sensor) platform driver for Loongson-3.
Signed-off-by Huacai Chen <[email protected]>
--- arch/mips/include/asm/mach-loongson/loongson.h | 4 + arch/mips/loongson/common/env.c | 9 + drivers/platform/Kconfig | 3 + drivers/platform/Makefile | 1 + drivers/platform/mips/Kconfig | 26 +++ drivers/platform/mips/Makefile | 1 + drivers/platform/mips/cpu_hwmon.c | 206 ++++++++++++++++++++++++ 7 files changed, 250 insertions(+), 0 deletions(-) create mode 100644 drivers/platform/mips/Kconfig create mode 100644 drivers/platform/mips/Makefile create mode 100644 drivers/platform/mips/cpu_hwmon.c
arch/mips/include/asm/mach-loongson/loongson.h +4 -0
@@ -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]))
arch/mips/loongson/common/env.c +9 -0
@@ -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 ;
drivers/platform/Kconfig +3 -0
@@ -4,5 +4,8 @@ endif if GOLDFISH source "drivers/platform/goldfish/Kconfig" endif +if MIPS +source "drivers/platform/mips/Kconfig" +endif source "drivers/platform/chrome/Kconfig"
drivers/platform/Makefile +1 -0
@@ -5,4 +5,5 @@ obj-$(CONFIG_X86) += x86/ obj-$(CONFIG_OLPC) += olpc/ obj-$(CONFIG_GOLDFISH) += goldfish/ +obj-$(CONFIG_CPU_LOONGSON3) += mips/ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/
drivers/platform/mips/Kconfig new file +26 -0
@@ -0,0 +1,26 @@ +# +# 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
drivers/platform/mips/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_CPU_HWMON) += cpu_hwmon.o
drivers/platform/mips/cpu_hwmon.c new file +206 -0
206 lines not on this page · raw message
Signature · 1 line
1.7.7.3
PATCH v7 7/8 MIPS: Loongson-3: Add chipset ACPI platform driver
This add south-bridge (SB700/SB710/SB800 chipset) ACPI platform driver for Loongson-3. This will be used by EC (Embedded Controller, used by laptops) driver and STR (Suspend To RAM).
Signed-off-by Huacai Chen <[email protected]>
--- arch/mips/loongson/common/pci.c | 6 ++ drivers/platform/mips/Makefile | 1 + drivers/platform/mips/acpi_init.c | 131 +++++++++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 0 deletions(-) create mode 100644 drivers/platform/mips/acpi_init.c
arch/mips/loongson/common/pci.c +6 -0
@@ -78,6 +78,8 @@ static void __init setup_pcimap(void)#endif } +extern int sbx00_acpi_init (void ); +static int __init pcibios_init (void ) {setup_pcimap ();
@@ -89,6 +91,10 @@ static int __init pcibios_init(void)#endif register_pci_controller (&loongson_pci_controller); +#ifdef CONFIG_CPU_LOONGSON3 +sbx00_acpi_init (); +#endif +return 0 ; }
drivers/platform/mips/Makefile +1 -0
@@ -1 +1,2 @@ +obj-y += acpi_init.o obj-$(CONFIG_CPU_HWMON) += cpu_hwmon.o
drivers/platform/mips/acpi_init.c new file +131 -0
131 lines not on this page · raw message
Signature · 1 line
1.7.7.3