mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 08:59:33 +00:00
armv8: emc2305: add support for fan controller
Add support for fan controller emc2305. Signed-off-by: Sriram Dash <sriram.dash@nxp.com> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com> Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
This commit is contained in:
parent
58c3e62040
commit
e088e587ed
4 changed files with 72 additions and 0 deletions
|
@ -346,6 +346,12 @@ config MAX_CPUS
|
||||||
cores, count the reserved ports. This will allocate enough memory
|
cores, count the reserved ports. This will allocate enough memory
|
||||||
in spin table to properly handle all cores.
|
in spin table to properly handle all cores.
|
||||||
|
|
||||||
|
config EMC2305
|
||||||
|
bool "Fan controller"
|
||||||
|
help
|
||||||
|
Enable the EMC2305 fan controller for configuration of fan
|
||||||
|
speed.
|
||||||
|
|
||||||
config SECURE_BOOT
|
config SECURE_BOOT
|
||||||
bool "Secure Boot"
|
bool "Secure Boot"
|
||||||
help
|
help
|
||||||
|
|
|
@ -64,6 +64,8 @@ obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.o
|
||||||
|
|
||||||
obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o
|
obj-$(CONFIG_LS102XA_STREAM_ID) += ls102xa_stream_id.o
|
||||||
|
|
||||||
|
obj-$(CONFIG_EMC2305) += emc2305.o
|
||||||
|
|
||||||
# deal with common files for P-series corenet based devices
|
# deal with common files for P-series corenet based devices
|
||||||
obj-$(CONFIG_TARGET_P2041RDB) += p_corenet/
|
obj-$(CONFIG_TARGET_P2041RDB) += p_corenet/
|
||||||
obj-$(CONFIG_TARGET_P3041DS) += p_corenet/
|
obj-$(CONFIG_TARGET_P3041DS) += p_corenet/
|
||||||
|
|
41
board/freescale/common/emc2305.c
Normal file
41
board/freescale/common/emc2305.c
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
/*
|
||||||
|
* Copyright 2018 NXP.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <common.h>
|
||||||
|
#include <command.h>
|
||||||
|
#include <i2c.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
|
||||||
|
#include "emc2305.h"
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
void set_fan_speed(u8 data)
|
||||||
|
{
|
||||||
|
u8 index;
|
||||||
|
u8 Fan[NUM_OF_FANS] = {I2C_EMC2305_FAN1,
|
||||||
|
I2C_EMC2305_FAN2,
|
||||||
|
I2C_EMC2305_FAN3,
|
||||||
|
I2C_EMC2305_FAN4,
|
||||||
|
I2C_EMC2305_FAN5};
|
||||||
|
|
||||||
|
for (index = 0; index < NUM_OF_FANS; index++) {
|
||||||
|
if (i2c_write(I2C_EMC2305_ADDR, Fan[index], 1, &data, 1) != 0) {
|
||||||
|
printf("Error: failed to change fan speed @%x\n",
|
||||||
|
Fan[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void emc2305_init(void)
|
||||||
|
{
|
||||||
|
u8 data;
|
||||||
|
|
||||||
|
data = I2C_EMC2305_CMD;
|
||||||
|
if (i2c_write(I2C_EMC2305_ADDR, I2C_EMC2305_CONF, 1, &data, 1) != 0)
|
||||||
|
printf("Error: failed to configure EMC2305\n");
|
||||||
|
}
|
23
board/freescale/common/emc2305.h
Normal file
23
board/freescale/common/emc2305.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||||
|
/*
|
||||||
|
* Copyright 2018 NXP
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EMC2305_H_
|
||||||
|
#define __EMC2305_H_
|
||||||
|
|
||||||
|
#define I2C_EMC2305_CONF 0x20
|
||||||
|
#define I2C_EMC2305_FAN1 0x30
|
||||||
|
#define I2C_EMC2305_FAN2 0x40
|
||||||
|
#define I2C_EMC2305_FAN3 0x50
|
||||||
|
#define I2C_EMC2305_FAN4 0x60
|
||||||
|
#define I2C_EMC2305_FAN5 0x70
|
||||||
|
|
||||||
|
#define NUM_OF_FANS 5
|
||||||
|
|
||||||
|
void emc2305_init(void);
|
||||||
|
void set_fan_speed(u8 data);
|
||||||
|
|
||||||
|
#endif /* __EMC2305_H_ */
|
Loading…
Reference in a new issue