[U-Boot] [PATCH] board/ls2088ardb: set rear fan speed to reduce noise

ying.zhang22455 at nxp.com ying.zhang22455 at nxp.com
Thu Nov 17 08:30:29 CET 2016


From: Ying Zhang <ying.zhang22455 at nxp.com>

Fan settings(PWM signal set to ~50% duty cycle for all three rear)
fans provide good thermal air flow with considerable reduction of
fan noise.

Signed-off-by: Ying Zhang <ying.zhang22455 at nxp.com>
---
 board/freescale/ls2080ardb/ls2080ardb.c | 31 +++++++++++++++++++++++++++++++
 include/configs/ls2080ardb.h            |  6 ++++++
 2 files changed, 37 insertions(+)

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 83d9e7e..1703b96 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -151,6 +151,36 @@ int config_board_mux(int ctrl_type)
 	return 0;
 }
 
+void set_fan_speed(void)
+{
+	int ret, i;
+	u8 value;
+
+	select_i2c_ch_pca9547(I2C_MUX_CH_FAN);
+	value = 0x80;
+	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x0, 1, &value, 1);
+	if (ret) {
+		printf("Fan: Failed to set fan speed\n");
+		return;
+	}
+	value = 1;
+	ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, 0x58, 1, &value, 1);
+	if (ret) {
+		printf("Fan: Failed to set fan speed\n");
+		return;
+	}
+
+	/* set PWM = ~50% DCyc for all rear PWM fans */
+	value = 0x20;
+	for (i = 0xb4; i < 0xb9; i++) {
+		ret = i2c_write(I2C_FAN_CONTROLLER_ADDR, i, 1, &value, 1);
+		if (ret) {
+			printf("Fan: Failed to set fan speed\n");
+			return;
+		}
+	}
+}
+
 int board_init(void)
 {
 	char *env_hwconfig;
@@ -175,6 +205,7 @@ int board_init(void)
 #ifdef CONFIG_ENV_IS_NOWHERE
 	gd->env_addr = (ulong)&default_environment[0];
 #endif
+	set_fan_speed();
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
 
 	QIXIS_WRITE(rst_ctl, QIXIS_RST_CTL_RESET_EN);
diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h
index b9cb6d3..05f98c0 100644
--- a/include/configs/ls2080ardb.h
+++ b/include/configs/ls2080ardb.h
@@ -264,6 +264,7 @@ unsigned long get_board_sys_clk(void);
 
 /* I2C bus multiplexer */
 #define I2C_MUX_CH_DEFAULT      0x8
+#define	I2C_MUX_CH_FAN		0xd
 
 /* SPI */
 #ifdef CONFIG_FSL_DSPI
@@ -279,6 +280,11 @@ unsigned long get_board_sys_clk(void);
 #define CONFIG_SYS_I2C_RTC_ADDR         0x68
 #define CONFIG_CMD_DATE
 
+/*
+ * Winbond fan controller
+ */
+#define I2C_FAN_CONTROLLER_ADDR		0x2c
+
 /* EEPROM */
 #define CONFIG_ID_EEPROM
 #define CONFIG_CMD_EEPROM
-- 
2.1.0.27.g96db324



More information about the U-Boot mailing list