summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2500/recipes-bsp/u-boot/files/0038-Increase-default-fan-speed-for-cooper-city.patch
blob: 53cdd763ebcf0e30b49c09d5d1badca3ec760caf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
From e465945672408b632d5e3c2cf7f08ade1268419e Mon Sep 17 00:00:00 2001
From: James Feist <james.feist@linux.intel.com>
Date: Thu, 24 Oct 2019 14:39:22 -0700
Subject: [PATCH 1/1] Increase default fan speed for cooper city

This increases the uboot fan speed for cooper city
as it has high core count CPUS.

Tested: In uboot fans appeared to run faster

Signed-off-by: James Feist <james.feist@linux.intel.com>
---
 board/aspeed/ast-g5/ast-g5-gpio.h  |  6 ++++
 board/aspeed/ast-g5/ast-g5-intel.c | 46 ++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/board/aspeed/ast-g5/ast-g5-gpio.h b/board/aspeed/ast-g5/ast-g5-gpio.h
index ed2499f5cc..9088cdd3e3 100644
--- a/board/aspeed/ast-g5/ast-g5-gpio.h
+++ b/board/aspeed/ast-g5/ast-g5-gpio.h
@@ -70,9 +70,15 @@
 #define ID_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_6)
 #define GRN_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_4)
 #define AMB_LED_PORT_PIN PORT_PIN(GPIO_PORT_S, GPIO_PIN_5)
+#define PLATFORM_ID0_PORT_PIN PORT_PIN(GPIO_PORT_B, GPIO_PIN_0)
+#define PLATFORM_ID1_PORT_PIN PORT_PIN(GPIO_PORT_B, GPIO_PIN_1)
+#define PLATFORM_ID2_PORT_PIN PORT_PIN(GPIO_PORT_B, GPIO_PIN_2)
+#define PLATFORM_ID3_PORT_PIN PORT_PIN(GPIO_PORT_B, GPIO_PIN_3)
+#define PLATFORM_ID4_PORT_PIN PORT_PIN(GPIO_PORT_B, GPIO_PIN_4)
 #define FORCE_BMC_UPDATE_PORT_PIN PORT_PIN(GPIO_PORT_D, GPIO_PIN_0)
 #define TPM_EN_PULSE_PORT_PIN PORT_PIN(GPIO_PORT_D, GPIO_PIN_6)
 #define FP_PWR_BTN_PORT_PIN PORT_PIN(GPIO_PORT_E, GPIO_PIN_2)
+#define PLATFORM_ID5_PORT_PIN PORT_PIN(GPIO_PORT_G, GPIO_PIN_5)
 
 // GPIO Configuration Register bits
 #define GPCFG_EVENT_TO_SMI (1 << 7) // 1 == enabled
diff --git a/board/aspeed/ast-g5/ast-g5-intel.c b/board/aspeed/ast-g5/ast-g5-intel.c
index c58fd3591b..9d5db68b7e 100644
--- a/board/aspeed/ast-g5/ast-g5-intel.c
+++ b/board/aspeed/ast-g5/ast-g5-intel.c
@@ -25,6 +25,12 @@ enum gpio_names {
 	GPIO_FF_UPD_JUMPER,
 	GPIO_ENABLE_TPM_PULSE,
 	GPIO_FP_PWR_BTN,
+	GPIO_PLATFORM_ID_0,
+	GPIO_PLATFORM_ID_1,
+	GPIO_PLATFORM_ID_2,
+	GPIO_PLATFORM_ID_3,
+	GPIO_PLATFORM_ID_4,
+	GPIO_PLATFORM_ID_5,
 };
 
 #define GPIO_CFG_DEFAULT (GPCFG_ACTIVE_HIGH | GPCFG_LEVEL_TRIG)
@@ -60,6 +66,21 @@ static const GPIOValue gpio_table[] = {
 	[GPIO_FP_PWR_BTN] = {FP_PWR_BTN_PORT_PIN, GPIO_CFG_DEFAULT, 0,
 				   GPIO_DEBOUNCE_8MS},
 
+	/* Platform ID Pins */
+	[GPIO_PLATFORM_ID_0] = {PLATFORM_ID0_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+	[GPIO_PLATFORM_ID_1] = {PLATFORM_ID1_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+	[GPIO_PLATFORM_ID_2] = {PLATFORM_ID2_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+	[GPIO_PLATFORM_ID_3] = {PLATFORM_ID3_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+	[GPIO_PLATFORM_ID_4] = {PLATFORM_ID4_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+	[GPIO_PLATFORM_ID_5] = {PLATFORM_ID5_PORT_PIN, GPIO_CFG_DEFAULT, 0,
+					GPIO_DEBOUNCE_8MS},
+
+
 };
 
 #define LPC_SNOOP_ADDR 0x80
@@ -114,6 +135,8 @@ static const GPIOValue gpio_table[] = {
 #define WATCHDOG_RESET_BIT 0x8
 #define BOOT_FAILURE_LIMIT 0x3
 
+#define COOPER_CITY_BOARD_ID 40
+
 static int get_boot_failures(void)
 {
 	return getenv_ulong("bootfailures", 10, 0);
@@ -295,6 +318,26 @@ int intel_failed_boot(void)
 	return get_boot_failures() >= BOOT_FAILURE_LIMIT;
 }
 
+int intel_get_platform_id(void)
+{
+	int id = 0;
+	int temp = 0;
+	int gpios[] = {GPIO_PLATFORM_ID_0,
+				   GPIO_PLATFORM_ID_1,
+				   GPIO_PLATFORM_ID_2,
+				   GPIO_PLATFORM_ID_3,
+				   GPIO_PLATFORM_ID_4,
+				   GPIO_PLATFORM_ID_5};
+	int ii;
+	for (ii = 0; ii < ARRAY_SIZE(gpios); ii++){
+		temp = gpio_get_value(gpios[ii]);
+		if(temp < 0)
+			return temp;
+		id |= temp << ii;
+	}
+	return id;
+}
+
 void arch_preboot_os(void)
 {
 	// last second before booting... set the LEDs
@@ -322,6 +365,7 @@ void arch_preboot_os(void)
 #define PWM_CLK_ENABLE BIT(0)
 #define PWM_DUTY(PCT) (((PCT) * 128) / 100)
 #define DEFAULT_PWM_DUTY_VALUE PWM_DUTY(57)
+#define ELEVATED_PWM_DUTY_VALUE PWM_DUTY(80)
 
 
 static inline uint32_t ast_scu_read(uint32_t reg)
@@ -595,6 +639,8 @@ void ast_g5_intel(void)
 		id_led_control(GPIO_GREEN_LED, EIDLED_Off);
 		id_led_control(GPIO_AMBER_LED, EIDLED_On);
 		kcs_init();
+		if (intel_get_platform_id() == COOPER_CITY_BOARD_ID)
+			set_pwm_duty_cycle(ELEVATED_PWM_DUTY_VALUE);
 		/* TODO: need to stop the booting here. */
 	}
 }
-- 
2.17.1