[U-Boot] [PATCH 1/2] 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 --- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 6 +++++ board/freescale/common/Makefile | 2 ++ board/freescale/common/emc2305.c | 41 +++++++++++++++++++++++++++++++ board/freescale/common/emc2305.h | 23 +++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 board/freescale/common/emc2305.c create mode 100644 board/freescale/common/emc2305.h
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 5dba2af..b0e779d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -346,6 +346,12 @@ config MAX_CPUS cores, count the reserved ports. This will allocate enough memory 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 bool "Secure Boot" help diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index e3c5eae..a9d61a8 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -64,6 +64,8 @@ obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.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 obj-$(CONFIG_TARGET_P2041RDB) += p_corenet/ obj-$(CONFIG_TARGET_P3041DS) += p_corenet/ diff --git a/board/freescale/common/emc2305.c b/board/freescale/common/emc2305.c new file mode 100644 index 0000000..8523084 --- /dev/null +++ b/board/freescale/common/emc2305.c @@ -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"); +} diff --git a/board/freescale/common/emc2305.h b/board/freescale/common/emc2305.h new file mode 100644 index 0000000..eddf537 --- /dev/null +++ b/board/freescale/common/emc2305.h @@ -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_ */

Enable support for FAN controller EMC2305 for LX2160A RDB board.
Signed-off-by: Sriram Dash sriram.dash@nxp.com Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com --- board/freescale/lx2160a/lx2160a.c | 11 +++++++++++ include/configs/lx2160ardb.h | 6 ++++++ 2 files changed, 17 insertions(+)
diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 530f658..07ca58e 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -26,6 +26,10 @@ #include "../common/vid.h" #include <fsl_immap.h>
+#ifdef CONFIG_EMC2305 +#include "../common/emc2305.h" +#endif + #ifdef CONFIG_TARGET_LX2160AQDS #define CFG_MUX_I2C_SDHC(reg, value) ((reg & 0x3f) | value) #define SET_CFG_MUX1_SDHC1_SDHC(reg) (reg & 0x3f) @@ -93,6 +97,13 @@ int board_early_init_f(void) /* get required clock for UART IP */ uart_get_clock();
+#ifdef CONFIG_EMC2305 + select_i2c_ch_pca9547(I2C_MUX_CH_EMC2305); + emc2305_init(); + set_fan_speed(I2C_EMC2305_PWM); + select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); +#endif + fsl_lsch3_early_init_f(); return 0; } diff --git a/include/configs/lx2160ardb.h b/include/configs/lx2160ardb.h index 67d214d..818aa38 100644 --- a/include/configs/lx2160ardb.h +++ b/include/configs/lx2160ardb.h @@ -70,6 +70,12 @@
#endif
+/* EMC2305 */ +#define I2C_MUX_CH_EMC2305 0x09 +#define I2C_EMC2305_ADDR 0x4D +#define I2C_EMC2305_CMD 0x40 +#define I2C_EMC2305_PWM 0x80 + /* EEPROM */ #define CONFIG_ID_EEPROM #define CONFIG_SYS_I2C_EEPROM_NXID

-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Meenakshi Aggarwal Sent: Friday, November 30, 2018 10:32 PM To: u-boot@lists.denx.de; York Sun york.sun@nxp.com Subject: [U-Boot] [PATCH 2/2] lx2160: Enable support of EMC2305
Enable support for FAN controller EMC2305 for LX2160A RDB board.
Signed-off-by: Sriram Dash sriram.dash@nxp.com Signed-off-by: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com
This patch been applied to fsl-qoriq master, awaiting upstream.
--pk

Gentle reminter
-----Original Message----- From: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Sent: Friday, November 30, 2018 10:32 PM To: u-boot@lists.denx.de; York Sun york.sun@nxp.com Cc: Meenakshi Aggarwal meenakshi.aggarwal@nxp.com Subject: [PATCH 1/2] 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
arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 6 +++++ board/freescale/common/Makefile | 2 ++ board/freescale/common/emc2305.c | 41 +++++++++++++++++++++++++++++++ board/freescale/common/emc2305.h | 23 +++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 board/freescale/common/emc2305.c create mode 100644 board/freescale/common/emc2305.h
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 5dba2af..b0e779d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -346,6 +346,12 @@ config MAX_CPUS cores, count the reserved ports. This will allocate enough memory 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 bool "Secure Boot" help diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index e3c5eae..a9d61a8 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -64,6 +64,8 @@ obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.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 obj-$(CONFIG_TARGET_P2041RDB) += p_corenet/ obj-$(CONFIG_TARGET_P3041DS) += p_corenet/ diff --git a/board/freescale/common/emc2305.c b/board/freescale/common/emc2305.c new file mode 100644 index 0000000..8523084 --- /dev/null +++ b/board/freescale/common/emc2305.c @@ -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) !=
printf("Error: failed to configure EMC2305\n"); }
diff --git a/board/freescale/common/emc2305.h b/board/freescale/common/emc2305.h new file mode 100644 index 0000000..eddf537 --- /dev/null +++ b/board/freescale/common/emc2305.h @@ -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_ */
1.9.1

-----Original Message----- From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Meenakshi Aggarwal Sent: Friday, November 30, 2018 10:32 PM To: u-boot@lists.denx.de; York Sun york.sun@nxp.com Subject: [U-Boot] [PATCH 1/2] 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
This patch been applied to fsl-qoriq master, awaiting upstream.
--pk
arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 6 +++++ board/freescale/common/Makefile | 2 ++ board/freescale/common/emc2305.c | 41 +++++++++++++++++++++++++++++++ board/freescale/common/emc2305.h | 23 +++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 board/freescale/common/emc2305.c create mode 100644 board/freescale/common/emc2305.h
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 5dba2af..b0e779d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -346,6 +346,12 @@ config MAX_CPUS cores, count the reserved ports. This will allocate enough memory 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 bool "Secure Boot" help diff --git a/board/freescale/common/Makefile b/board/freescale/common/Makefile index e3c5eae..a9d61a8 100644 --- a/board/freescale/common/Makefile +++ b/board/freescale/common/Makefile @@ -64,6 +64,8 @@ obj-$(CONFIG_POWER_MC34VR500) += mc34vr500.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 obj-$(CONFIG_TARGET_P2041RDB) += p_corenet/ obj-$(CONFIG_TARGET_P3041DS) += p_corenet/ diff --git a/board/freescale/common/emc2305.c b/board/freescale/common/emc2305.c new file mode 100644 index 0000000..8523084 --- /dev/null +++ b/board/freescale/common/emc2305.c @@ -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) !=
- {
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"); }
diff --git a/board/freescale/common/emc2305.h b/board/freescale/common/emc2305.h new file mode 100644 index 0000000..eddf537 --- /dev/null +++ b/board/freescale/common/emc2305.h @@ -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_ */
1.9.1
U-Boot mailing list U-Boot@lists.denx.de https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist s.denx.de%2Flistinfo%2Fu- boot&data=02%7C01%7Cprabhakar.kushwaha%40nxp.com%7C852de48 ff3054484af5008d656b5433a%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C636791733851930824&sdata=ks6iNJrjqSMfP8nHjlu%2BMpYqUKZ6 JxzXrXnef4zPj%2FA%3D&reserved=0
participants (2)
-
Meenakshi Aggarwal
-
Prabhakar Kushwaha