From 5861b964317bb52defb30215efff52fab5e11df4 Mon Sep 17 00:00:00 2001 From: James Feist Date: Thu, 24 Oct 2019 14:39:22 -0700 Subject: [PATCH] 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 --- 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 8ccf4373460b..7f0c06d88f5a 100644 --- a/board/aspeed/ast-g5/ast-g5-gpio.h +++ b/board/aspeed/ast-g5/ast-g5-gpio.h @@ -71,9 +71,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 5536efde1d43..3a0e15eaac82 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) @@ -63,6 +69,21 @@ static const GPIOValue gpio_table[] = { [GPIO_FP_PWR_BTN] = {FP_PWR_BTN_PORT_PIN, GPIO_CFG_LOW_INPUT, 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 @@ -118,6 +139,8 @@ static const GPIOValue gpio_table[] = { #define POWERON_RESET_BIT BIT(0) #define BOOT_FAILURE_LIMIT 0x3 +#define COOPER_CITY_BOARD_ID 40 + static int get_boot_failures(void) { return getenv_ulong("bootfailures", 10, 0); @@ -298,6 +321,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 @@ -325,6 +368,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) @@ -626,6 +670,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