-
Notifications
You must be signed in to change notification settings - Fork 54.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MIPS: Loongson: Improve LEFI firmware interface
Machtypes of Loongson-3 machines become more and more, but there are only small differences among different machtypes. Keeping a large table of machtypes is very ugly and hard to extend. We found that the major machtype differences are UARTs information (number of UARTs, UART IRQs, UART clocks, etc.), platform devices (EC, temperature sensors, fan controllers, etc.) and some workarounds (because of some CPU bugs or mainboard bugs). In this patch we improve the UEFI-like (LEFI) interface to make all Loongson-3 machines use a same machtype "generic-loongson-machine". Signed-off-by: Huacai Chen <chenhc@lemote.com> Cc: John Crispin <john@phrozen.org> 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/8324/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
- Loading branch information
1 parent
ec0f8d3
commit 3adeb25
Showing
14 changed files
with
234 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#ifndef __LOONGSON_HWMON_H_ | ||
#define __LOONGSON_HWMON_H_ | ||
|
||
#include <linux/types.h> | ||
|
||
#define MIN_TEMP 0 | ||
#define MAX_TEMP 255 | ||
#define NOT_VALID_TEMP 999 | ||
|
||
typedef int (*get_temp_fun)(int); | ||
extern int loongson3_cpu_temp(int); | ||
|
||
/* 0:Max speed, 1:Manual, 2:Auto */ | ||
enum fan_control_mode { | ||
FAN_FULL_MODE = 0, | ||
FAN_MANUAL_MODE = 1, | ||
FAN_AUTO_MODE = 2, | ||
FAN_MODE_END | ||
}; | ||
|
||
struct temp_range { | ||
u8 low; | ||
u8 high; | ||
u8 level; | ||
}; | ||
|
||
#define CONSTANT_SPEED_POLICY 0 /* at constent speed */ | ||
#define STEP_SPEED_POLICY 1 /* use up/down arrays to describe policy */ | ||
#define KERNEL_HELPER_POLICY 2 /* kernel as a helper to fan control */ | ||
|
||
#define MAX_STEP_NUM 16 | ||
#define MAX_FAN_LEVEL 255 | ||
|
||
/* loongson_fan_policy works when fan work at FAN_AUTO_MODE */ | ||
struct loongson_fan_policy { | ||
u8 type; | ||
|
||
/* percent only used when type is CONSTANT_SPEED_POLICY */ | ||
u8 percent; | ||
|
||
/* period between two check. (Unit: S) */ | ||
u8 adjust_period; | ||
|
||
/* fan adjust usually depend on a temprature input */ | ||
get_temp_fun depend_temp; | ||
|
||
/* up_step/down_step used when type is STEP_SPEED_POLICY */ | ||
u8 up_step_num; | ||
u8 down_step_num; | ||
struct temp_range up_step[MAX_STEP_NUM]; | ||
struct temp_range down_step[MAX_STEP_NUM]; | ||
struct delayed_work work; | ||
}; | ||
|
||
#endif /* __LOONGSON_HWMON_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef __ASM_MACH_LOONGSON_WORKAROUNDS_H_ | ||
#define __ASM_MACH_LOONGSON_WORKAROUNDS_H_ | ||
|
||
#define WORKAROUND_CPUFREQ 0x00000001 | ||
#define WORKAROUND_CPUHOTPLUG 0x00000002 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.