ventana: Add LTC3676 PMIC support
cover ventana: Add LTC3676 PMIC support
The Gateworks Ventana boards share much in common, but there are two differing PMIC's used on them. This patch series adds a new PMIC driver for the LTC3676 and supports them both within the common board support file.
Tim Harvey (4):
power: make pfuze100 be able to coexist with other pmics
ventana: use non-generic pfuze100 init
power: Add support for LTC3676 PMIC
ventana: Add support for the LTC3676 PMIC
board/gateworks/gw_ventana/gw_ventana.c | 78 ++++++++++++++++++++++++--------- drivers/power/pmic/Makefile | 1 + drivers/power/pmic/pmic_ltc3676.c | 32 ++++++++++++++ drivers/power/pmic/pmic_pfuze100.c | 2 +- include/configs/gw_ventana.h | 2 + include/power/ltc3676_pmic.h | 51 +++++++++++++++++++++ include/power/pfuze100_pmic.h | 1 + 7 files changed, 145 insertions(+), 22 deletions(-) create mode 100644 drivers/power/pmic/pmic_ltc3676.c create mode 100644 include/power/ltc3676_pmic.h
Signature · 1 line
1.8.3.2
PATCH 1/4 power: make pfuze100 be able to coexist with other pmics
Avoid uding pmic_init() as this forces the model of only allowing a single PMIC driver to be built at a time.
--- drivers/power/pmic/pmic_pfuze100.c | 2 +- include/power/pfuze100_pmic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/power/pmic/pmic_pfuze100.c +1 -1
@@ -11,7 +11,7 @@#include <power/pmic.h> #include <power/pfuze100_pmic.h> -int pmic_init (unsigned char bus) +int power_pfuze100_init (unsigned char bus) {static const char name[] ="PFUZE100_PMIC" ;struct pmic *p =pmic_alloc ();
include/power/pfuze100_pmic.h +1 -0
@@ -93,4 +93,5 @@ enum {#define SWBST_MODE_AUTO (2 << 2)#define SWBST_MODE_APS (2 << 3) +int power_pfuze100_init (unsigned char bus);#endif
Signature · 1 line
1.8.3.2
PATCH 1/4 power: make pfuze100 be able to coexist with other pmics
Hi Tim,
Quoted 27 lines · Tim Harvey
Avoid uding
pmic_init()as this forces the model of only allowing a single PMIC driver to be built at a time.Signed-off-by Tim Harvey <[email protected]>--- drivers/power/pmic/pmic_pfuze100.c | 2 +- include/power/pfuze100_pmic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/power/pmic/pmic_pfuze100.c +1
-1@@ -11,7 +11,7 @@#include <power/pmic.h> #include <power/pfuze100_pmic.h> -int pmic_init (unsigned char bus) +int power_pfuze100_init (unsigned char bus) {static const char name[] ="PFUZE100_PMIC" ;struct pmic *p =pmic_alloc ();include/power/pfuze100_pmic.h +0
-0
include/power/pfuze100_pmic.h enum { · line 96
Quoted 4 lines
include/power/pfuze100_pmic.h +1
-0@@ -93,4 +93,5 @@ enum {#define SWBST_MODE_AUTO (2 << 2)#define SWBST_MODE_APS (2 << 3) +int power_pfuze100_init (unsigned char bus);
This is a change in the PMIC framework API and must be documented.
Currently, we support multiple instances of the same PMIC, but not different PMIC on the same board.
We could add a CONFIG_MULTIPLE_PMIC, that must be added to the documentation, and each driver will define pmic_init() if it is not define:
#ifndef CONFIG_MULTIPLE_PMIC
#define pmic_init power_pfuze100_init
#endif
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/4 power: make pfuze100 be able to coexist with other pmics
Quoted 33 lines · Stefano Babic
Hi Tim,
Quoted 30 lines · Tim Harvey
Avoid uding
pmic_init()as this forces the model of only allowing a single PMIC driver to be built at a time.Signed-off-by Tim Harvey <[email protected]>--- drivers/power/pmic/pmic_pfuze100.c | 2 +- include/power/pfuze100_pmic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/power/pmic/pmic_pfuze100.c +1
-1@@ -11,7 +11,7 @@#include <power/pmic.h> #include <power/pfuze100_pmic.h> -int pmic_init (unsigned char bus) +int power_pfuze100_init (unsigned char bus) {static const char name[] ="PFUZE100_PMIC" ;struct pmic *p =pmic_alloc ();include/power/pfuze100_pmic.h +0
-0@@ -93,4 +93,5 @@ enum {#define SWBST_MODE_AUTO (2 << 2)#define SWBST_MODE_APS (2 << 3)
Quoted 7 lines
include/power/pfuze100_pmic.h enum { · line 96
Quoted 1 line
include/power/pfuze100_pmic.h +1
-0+int power_pfuze100_init (unsigned char bus);This is a change in the PMIC framework API and must be documented.
Currently, we support multiple instances of the same PMIC, but not different PMIC on the same board.
Stefano,
Hmm... I see several pmic's that use their own namespace for init:
grep init include/power/*.h shows a few (power_bat_init, power_fg_init, power_muic_init, pmic_init_max77693). And if you look at trats.c or trats2.c boards you will see how they call several of them. Granted, both of those do also call a generic pmic_init() thats implemented by pmic_max77686 'or' pmic_max8977. So in the case of those two boards, they have several pmic's, one that uses the generic pmic_init() namespace, and 2 others that use their own unique namespace.
Regards,
Tim
Quoted 10 lines
We could add a
CONFIG_MULTIPLE_PMIC, that must be added to the documentation, and each driver will definepmic_init()if it is not define:#ifndef
CONFIG_MULTIPLE_PMIC
#definepmic_initpower_pfuze100_init
#endifBest regards,
Stefano Babic
PATCH 1/4 power: make pfuze100 be able to coexist with other pmics
Hi Tim,
Quoted 7 lines · Tim Harvey
Quoted 6 lines
This is a change in the PMIC framework API and must be documented.
Currently, we support multiple instances of the same PMIC, but not different PMIC on the same board.
Quoted 8 lines
Stefano,
Hmm... I see several pmic's that use their own namespace for init:
grep init
include/power/*.hshows a few (power_bat_init,power_fg_init,power_muic_init,pmic_init_max77693). And if you look attrats.cortrats2.cboards you will see how they call several of them.
Thanks for pointing it out, I have missed them.
Quoted 5 lines
Granted, both of those do also call a generic
pmic_init()thats implemented bypmic_max77686'or'pmic_max8977. So in the case of those two boards, they have several pmic's, one that uses the genericpmic_init()namespace, and 2 others that use their own unique namespace.
I see. Please drop my comment.
Best regards,
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/4 power: make pfuze100 be able to coexist with other pmics
In reply to Tim HarveyQuoted 28 lines · Tim Harvey
Avoid uding
pmic_init()as this forces the model of only allowing a single PMIC driver to be built at a time.Signed-off-by Tim Harvey <[email protected]>--- drivers/power/pmic/pmic_pfuze100.c | 2 +- include/power/pfuze100_pmic.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)drivers/power/pmic/pmic_pfuze100.c +1
-1@@ -11,7 +11,7 @@#include <power/pmic.h> #include <power/pfuze100_pmic.h> -int pmic_init (unsigned char bus) +int power_pfuze100_init (unsigned char bus) {static const char name[] ="PFUZE100_PMIC" ;struct pmic *p =pmic_alloc ();include/power/pfuze100_pmic.h +0
-0
include/power/pfuze100_pmic.h enum { · line 97
Quoted 5 lines
include/power/pfuze100_pmic.h +1
-0@@ -93,4 +93,5 @@ enum {#define SWBST_MODE_AUTO (2 << 2)#define SWBST_MODE_APS (2 << 3) +int power_pfuze100_init (unsigned char bus);#endif
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 2/4 ventana: use non-generic pfuze100 init
In reply to Tim Harvey--- board/gateworks/gw_ventana/gw_ventana.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +3 -2
@@ -1077,10 +1077,11 @@ int misc_init_r(void) }/* configure PFUZE100 PMIC (not used on all Ventana baseboards) */ -if ((board_type == GW54xx || board_type == GW54proto) && - !pmic_init (I2C_PMIC )) { +power_pfuze100_init (I2C_PMIC ); +if (board_type == GW54xx || board_type == GW54proto) {struct pmic *p =pmic_get ("PFUZE100_PMIC" );u32 reg; +if (p && !pmic_probe (p)) {pmic_reg_read (p,PFUZE100_DEVICEID , ®);printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg);
Signature · 1 line
1.8.3.2
PATCH 2/4 ventana: use non-generic pfuze100 init
Quoted 14 lines · Tim Harvey
Signed-off-by Tim Harvey <[email protected]>--- board/gateworks/gw_ventana/gw_ventana.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)board/gateworks/gw_ventana/gw_ventana.c +0
-0@@ -1077,10 +1077,11 @@ int misc_init_r(void) }/* configure PFUZE100 PMIC (not used on all Ventana baseboards) */
board/gateworks/gw_ventana/gw_ventana.c int misc_init_r(void) · line 1087
Quoted 10 lines
board/gateworks/gw_ventana/gw_ventana.c +3
-2-if ((board_type == GW54xx || board_type == GW54proto) && - !pmic_init (I2C_PMIC )) { +power_pfuze100_init (I2C_PMIC ); +if (board_type == GW54xx || board_type == GW54proto) {struct pmic *p =pmic_get ("PFUZE100_PMIC" );u32 reg; +if (p && !pmic_probe (p)) {pmic_reg_read (p,PFUZE100_DEVICEID , ®);printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg);
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/4 power: Add support for LTC3676 PMIC
In reply to Tim HarveyThe LTC3676 PMIC includes four DC/DC converters, and three 300mA LDO Regulators (two Adjustable). The DC/DC converters are adjustable based on a resistor devider (board-specific).
This adds support for the LTC3676 by creating a namespace unique init function that uses the PMIC API to allocate a pmic and defines the registers.
--- drivers/power/pmic/Makefile | 1 + drivers/power/pmic/pmic_ltc3676.c | 32 ++++++++++++++++++++++++ include/power/ltc3676_pmic.h | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 drivers/power/pmic/pmic_ltc3676.c create mode 100644 include/power/ltc3676_pmic.h
drivers/power/pmic/Makefile +1 -0
@@ -5,6 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
drivers/power/pmic/pmic_ltc3676.c new file +32 -0
@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2014 Gateworks Corporation +* Tim Harvey <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <i2c.h> +#include <power/pmic.h> +#include <power/ltc3676_pmic.h> + +int power_ltc3676_init (unsigned char bus) +{ +static const char name[] ="LTC3676_PMIC" ; +struct pmic *p =pmic_alloc (); + +if (!p) { +printf ("%s: POWER allocation error!\n" , __func__); +return -ENOMEM ; + } + + p->name = name; + p->interface =PMIC_I2C ; + p->number_of_regs =LTC3676_NUM_OF_REGS ; + p->hw.i2c.addr =CONFIG_POWER_LTC3676_I2C_ADDR ; + p->hw.i2c.tx_num =1 ; + p->bus = bus; + +return 0 ; +}
include/power/ltc3676_pmic.h new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH 3/4 power: Add support for LTC3676 PMIC
Hi Tim,
Quoted 114 lines · Tim Harvey
The LTC3676 PMIC includes four DC/DC converters, and three 300mA LDO Regulators (two Adjustable). The DC/DC converters are adjustable based on a resistor devider (board-specific).
This adds support for the LTC3676 by creating a namespace unique init function that uses the PMIC API to allocate a pmic and defines the registers.
Signed-off-by Tim Harvey <[email protected]>--- drivers/power/pmic/Makefile | 1 + drivers/power/pmic/pmic_ltc3676.c | 32 ++++++++++++++++++++++++ include/power/ltc3676_pmic.h | 51 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 drivers/power/pmic/pmic_ltc3676.c create mode 100644 include/power/ltc3676_pmic.hdrivers/power/pmic/Makefile +1
-0@@ -5,6 +5,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_POWER_LTC3676) += pmic_ltc3676.o obj-$(CONFIG_POWER_MAX8998) += pmic_max8998.o obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.odrivers/power/pmic/pmic_ltc3676.c new file +32
-0@@ -0,0 +1,32 @@ +/* +* Copyright (C) 2014 Gateworks Corporation +* Tim Harvey <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <errno.h> +#include <i2c.h> +#include <power/pmic.h> +#include <power/ltc3676_pmic.h> + +int power_ltc3676_init (unsigned char bus) +{ +static const char name[] ="LTC3676_PMIC" ; +struct pmic *p =pmic_alloc (); + +if (!p) { +printf ("%s: POWER allocation error!\n" , __func__); +return -ENOMEM ; + } + + p->name = name; + p->interface =PMIC_I2C ; + p->number_of_regs =LTC3676_NUM_OF_REGS ; + p->hw.i2c.addr =CONFIG_POWER_LTC3676_I2C_ADDR ; + p->hw.i2c.tx_num =1 ; + p->bus = bus; + +return 0 ; +}include/power/ltc3676_pmic.h new file +41
-0@@ -0,0 +1,51 @@ +/* +* Copyright (C) 2014 Gateworks Corporation +* Tim Harvey <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __LTC3676_PMIC_H_ +#define __LTC3676_PMIC_H_ + +/* LTC3676 registers */ +enum { +LTC3676_BUCK1 =0x01 , +LTC3676_BUCK2 =0x02 , +LTC3676_BUCK3 =0x03 , +LTC3676_BUCK4 =0x04 , +LTC3676_LDOA =0x05 , +LTC3676_LDOB =0x06 , +LTC3676_SQD1 =0x07 , +LTC3676_SQD2 =0x08 , +LTC3676_CNTRL =0x09 , +LTC3676_DVB1A =0x0A , +LTC3676_DVB1B =0x0B , +LTC3676_DVB2A =0x0C , +LTC3676_DVB2B =0x0D , +LTC3676_DVB3A =0x0E , +LTC3676_DVB3B =0x0F , +LTC3676_DVB4A =0x10 , +LTC3676_DVB4B =0x11 , +LTC3676_MSKIRQ =0x12 , +LTC3676_MSKPG =0x13 , +LTC3676_USER =0x14 , +LTC3676_HRST =0x1E , +LTC3676_CLIRQ =0x1F , +LTC3676_IRQSTAT =0x15 , +LTC3676_PGSTATL =0x16 , +LTC3676_PGSTATR =0x17 , +LTC3676_NUM_OF_REGS =0x20 , +}; + +/*
include/power/ltc3676_pmic.h line 51
Quoted 10 lines
include/power/ltc3676_pmic.h new file +10
-0+* SW Configuration +*/ + +#define LTC3676_DVB_MASK 0x1f +#define LTC3676_PGOOD_MASK (1<<5) +#define LTC3676_REF_SELA (0<<5) +#define LTC3676_REF_SELB (1<<5) + +int power_ltc3676_init (unsigned char bus); +#endif
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 3/4 power: Add support for LTC3676 PMIC
In reply to Tim HarveyHi Tim,
Quoted 9 lines · Tim Harvey
The LTC3676 PMIC includes four DC/DC converters, and three 300mA LDO Regulators (two Adjustable). The DC/DC converters are adjustable based on a resistor devider (board-specific).
This adds support for the LTC3676 by creating a namespace unique init function that uses the PMIC API to allocate a pmic and defines the registers.
Signed-off-by Tim Harvey <[email protected]>---
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 4/4 ventana: Add support for the LTC3676 PMIC
In reply to Tim HarveyThe LTC3676 PMIC is used instead of the PFUZE100 PMIC on the GW51xx/GW52xx/GW53xx Ventana baseboards. In order to support the IMX6Q SoC at 1GHz on those baseboards, we need to adjust the voltage scaling for the SW1 and SW3 DC/DC converters on the LTC3676 for 1225mV. Note that the scalar values for the LTC3676 are board-specific as they relate to a resistor devider chosen by the board design.
--- board/gateworks/gw_ventana/gw_ventana.c | 79 ++++++++++++++++++++++++--------- include/configs/gw_ventana.h | 2 + 2 files changed, 59 insertions(+), 22 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +57 -22
@@ -30,6 +30,7 @@#include <mtd_node.h> #include <netdev.h> #include <power/pmic.h> +#include <power/ltc3676_pmic.h> #include <power/pfuze100_pmic.h> #include <i2c.h> #include <fdt_support.h>
@@ -733,6 +734,60 @@ struct ventana gpio_cfg[] = { }, }; +/* setup board specific PMIC */ +static void setup_board_pmic (int board) +{ +struct pmic *p; +u32 reg; + +/* configure PFUZE100 PMIC */ +if (board_type == GW54xx || board_type == GW54proto) { +power_pfuze100_init (I2C_PMIC ); + p =pmic_get ("PFUZE100_PMIC" ); +if (p && !pmic_probe (p)) { +pmic_reg_read (p,PFUZE100_DEVICEID , ®); +printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); + +/* Set VGEN1 to 1.5V and enable */ +pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); + reg &= ~(LDO_VOL_MASK ); + reg |= (LDOA_1_50V |LDO_EN ); +pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); + +/* Set SWBST to 5.0V and enable */ +pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); + reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); + reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); +pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); + } + } + +/* configure LTC3676 PMIC */ +else { +power_ltc3676_init (I2C_PMIC ); + p =pmic_get ("LTC3676_PMIC" ); +if (p && !pmic_probe (p)) { +puts ("PMIC: LTC3676\n" ); +/* set board-specific scalar to 1225mV for IMX6Q at 1GHz */ +if (is_cpu_type (MXC_CPU_MX6Q )) { +/* mask PGOOD during SW1 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB1B , reg); +/* set SW1 (VDD_SOC) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB1A , reg); + +/* mask PGOOD during SW3 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB3B , reg); +/*set SW3 (VDD_ARM) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB3A , reg); + } + } + } +} +/* setup GPIO pinmux and default configuration per baseboard */ static void setup_board_gpio (int board) {
@@ -1076,29 +1131,9 @@ int misc_init_r(void)setenv ("serial#" , str); } -/* configure PFUZE100 PMIC (not used on all Ventana baseboards) */ -power_pfuze100_init (I2C_PMIC ); -if (board_type == GW54xx || board_type == GW54proto) { -struct pmic *p =pmic_get ("PFUZE100_PMIC" ); -u32 reg; - -if (p && !pmic_probe (p)) { -pmic_reg_read (p,PFUZE100_DEVICEID , ®); -printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); - -/* Set VGEN1 to 1.5V and enable */ -pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); - reg &= ~(LDO_VOL_MASK ); - reg |= (LDOA_1_50V |LDO_EN ); -pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); -/* Set SWBST to 5.0V and enable */ -pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); - reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); - reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); -pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); - } - } +/* setup pmic */ +setup_board_pmic (board_type);/* setup baseboard specific GPIO pinmux and config */ setup_board_gpio (board_type);
include/configs/gw_ventana.h +2 -0
@@ -136,6 +136,8 @@#define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#define CONFIG_POWER_LTC3676 +#define CONFIG_POWER_LTC3676_I2C_ADDR 0x3c/* Various command support */ #include <config_cmd_default.h>
Signature · 1 line
1.8.3.2
PATCH 4/4 ventana: Add support for the LTC3676 PMIC
Quoted 72 lines · Tim Harvey
The LTC3676 PMIC is used instead of the PFUZE100 PMIC on the GW51xx/GW52xx/GW53xx Ventana baseboards. In order to support the IMX6Q SoC at 1GHz on those baseboards, we need to adjust the voltage scaling for the SW1 and SW3 DC/DC converters on the LTC3676 for 1225mV. Note that the scalar values for the LTC3676 are board-specific as they relate to a resistor devider chosen by the board design.
Signed-off-by Tim Harvey <[email protected]>--- board/gateworks/gw_ventana/gw_ventana.c | 79 ++++++++++++++++++++++++--------- include/configs/gw_ventana.h | 2 + 2 files changed, 59 insertions(+), 22 deletions(-)board/gateworks/gw_ventana/gw_ventana.c +44
-0@@ -30,6 +30,7 @@#include <mtd_node.h> #include <netdev.h> #include <power/pmic.h> +#include <power/ltc3676_pmic.h> #include <power/pfuze100_pmic.h> #include <i2c.h> #include <fdt_support.h> @@ -733,6 +734,60 @@ struct ventana gpio_cfg[] = { }, }; +/* setup board specific PMIC */ +static void setup_board_pmic (int board) +{ +struct pmic *p; +u32 reg; + +/* configure PFUZE100 PMIC */ +if (board_type == GW54xx || board_type == GW54proto) { +power_pfuze100_init (I2C_PMIC ); + p =pmic_get ("PFUZE100_PMIC" ); +if (p && !pmic_probe (p)) { +pmic_reg_read (p,PFUZE100_DEVICEID , ®); +printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); + +/* Set VGEN1 to 1.5V and enable */ +pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); + reg &= ~(LDO_VOL_MASK ); + reg |= (LDOA_1_50V |LDO_EN ); +pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); + +/* Set SWBST to 5.0V and enable */ +pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); + reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); + reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); +pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); + } + } + +/* configure LTC3676 PMIC */ +else { +power_ltc3676_init (I2C_PMIC ); + p =pmic_get ("LTC3676_PMIC" ); +if (p && !pmic_probe (p)) { +puts ("PMIC: LTC3676\n" ); +/* set board-specific scalar to 1225mV for IMX6Q at 1GHz */ +if (is_cpu_type (MXC_CPU_MX6Q )) { +/* mask PGOOD during SW1 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB1B , reg); +/* set SW1 (VDD_SOC) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB1A , reg); +
board/gateworks/gw_ventana/gw_ventana.c struct ventana gpio_cfg[] = { · line 789
Quoted 10 lines
board/gateworks/gw_ventana/gw_ventana.c +10
-0+/* mask PGOOD during SW3 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB3B , reg); +/*set SW3 (VDD_ARM) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB3A , reg); + } + } + } +}
There is already a power_init_board(), defined as __weak, that you can use here.
Quoted 42 lines
board/gateworks/gw_ventana/gw_ventana.c +3
-22+/* setup GPIO pinmux and default configuration per baseboard */ static void setup_board_gpio (int board) {@@ -1076,29 +1131,9 @@ int misc_init_r(void)setenv ("serial#" , str); } -/* configure PFUZE100 PMIC (not used on all Ventana baseboards) */ -power_pfuze100_init (I2C_PMIC ); -if (board_type == GW54xx || board_type == GW54proto) { -struct pmic *p =pmic_get ("PFUZE100_PMIC" ); -u32 reg; - -if (p && !pmic_probe (p)) { -pmic_reg_read (p,PFUZE100_DEVICEID , ®); -printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); - -/* Set VGEN1 to 1.5V and enable */ -pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); - reg &= ~(LDO_VOL_MASK ); - reg |= (LDOA_1_50V |LDO_EN ); -pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); -/* Set SWBST to 5.0V and enable */ -pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); - reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); - reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); -pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); - } - } +/* setup pmic */ +setup_board_pmic (board_type);/* setup baseboard specific GPIO pinmux and config */ setup_board_gpio (board_type);include/configs/gw_ventana.h +0
-0
include/configs/gw_ventana.h line 143
Quoted 8 lines
include/configs/gw_ventana.h +2
-0@@ -136,6 +136,8 @@#define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#define CONFIG_POWER_LTC3676 +#define CONFIG_POWER_LTC3676_I2C_ADDR 0x3c/* Various command support */ #include <config_cmd_default.h>
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 4/4 ventana: Add support for the LTC3676 PMIC
The LTC3676 PMIC is used instead of the PFUZE100 PMIC on the GW51xx/GW52xx/GW53xx Ventana baseboards. In order to support the IMX6Q SoC at 1GHz on those baseboards, we need to adjust the voltage scaling for the SW1 and SW3 DC/DC converters on the LTC3676 for 1225mV. Note that the scalar values for the LTC3676 are board-specific as they relate to a resistor devider chosen by the board design.
--- board/gateworks/gw_ventana/gw_ventana.c | 78 +++++++++++++++++++++++---------- include/configs/gw_ventana.h | 2 + 2 files changed, 57 insertions(+), 23 deletions(-)
board/gateworks/gw_ventana/gw_ventana.c +55 -23
@@ -30,6 +30,7 @@#include <mtd_node.h> #include <netdev.h> #include <power/pmic.h> +#include <power/ltc3676_pmic.h> #include <power/pfuze100_pmic.h> #include <i2c.h> #include <fdt_support.h>
@@ -733,6 +734,60 @@ struct ventana gpio_cfg[] = { }, }; +/* setup board specific PMIC */ +int power_init_board (void ) +{ +struct pmic *p; +u32 reg; + +/* configure PFUZE100 PMIC */ +if (board_type == GW54xx || board_type == GW54proto) { +power_pfuze100_init (I2C_PMIC ); + p =pmic_get ("PFUZE100_PMIC" ); +if (p && !pmic_probe (p)) { +pmic_reg_read (p,PFUZE100_DEVICEID , ®); +printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); + +/* Set VGEN1 to 1.5V and enable */ +pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); + reg &= ~(LDO_VOL_MASK ); + reg |= (LDOA_1_50V |LDO_EN ); +pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); + +/* Set SWBST to 5.0V and enable */ +pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); + reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); + reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); +pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); + } + } + +/* configure LTC3676 PMIC */ +else { +power_ltc3676_init (I2C_PMIC ); + p =pmic_get ("LTC3676_PMIC" ); +if (p && !pmic_probe (p)) { +puts ("PMIC: LTC3676\n" ); +/* set board-specific scalar to 1225mV for IMX6Q at 1GHz */ +if (is_cpu_type (MXC_CPU_MX6Q )) { +/* mask PGOOD during SW1 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB1B , reg); +/* set SW1 (VDD_SOC) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB1A , reg); + +/* mask PGOOD during SW3 transition */ + reg =0x1d |LTC3676_PGOOD_MASK ; +pmic_reg_write (p,LTC3676_DVB3B , reg); +/*set SW3 (VDD_ARM) to 1259mV */ + reg =0x1d ; +pmic_reg_write (p,LTC3676_DVB3A , reg); + } + } + } +} +/* setup GPIO pinmux and default configuration per baseboard */ static void setup_board_gpio (int board) {
@@ -1076,29 +1131,6 @@ int misc_init_r(void)setenv ("serial#" , str); } -/* configure PFUZE100 PMIC (not used on all Ventana baseboards) */ -power_pfuze100_init (I2C_PMIC ); -if (board_type == GW54xx || board_type == GW54proto) { -struct pmic *p =pmic_get ("PFUZE100_PMIC" ); -u32 reg; - -if (p && !pmic_probe (p)) { -pmic_reg_read (p,PFUZE100_DEVICEID , ®); -printf ("PMIC: PFUZE100 ID=0x%02x\n" , reg); - -/* Set VGEN1 to 1.5V and enable */ -pmic_reg_read (p,PFUZE100_VGEN1VOL , ®); - reg &= ~(LDO_VOL_MASK ); - reg |= (LDOA_1_50V |LDO_EN ); -pmic_reg_write (p,PFUZE100_VGEN1VOL , reg); - -/* Set SWBST to 5.0V and enable */ -pmic_reg_read (p,PFUZE100_SWBSTCON1 , ®); - reg &= ~(SWBST_MODE_MASK |SWBST_VOL_MASK ); - reg |= (SWBST_5_00V |SWBST_MODE_AUTO ); -pmic_reg_write (p,PFUZE100_SWBSTCON1 , reg); - } - }/* setup baseboard specific GPIO pinmux and config */ setup_board_gpio (board_type);
include/configs/gw_ventana.h +2 -0
@@ -136,6 +136,8 @@#define CONFIG_POWER_I2C #define CONFIG_POWER_PFUZE100 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08 +#define CONFIG_POWER_LTC3676 +#define CONFIG_POWER_LTC3676_I2C_ADDR 0x3c/* Various command support */ #include <config_cmd_default.h>
Signature · 1 line
1.8.3.2
PATCH 4/4 ventana: Add support for the LTC3676 PMIC
Quoted 9 lines · Tim Harvey
The LTC3676 PMIC is used instead of the PFUZE100 PMIC on the GW51xx/GW52xx/GW53xx Ventana baseboards. In order to support the IMX6Q SoC at 1GHz on those baseboards, we need to adjust the voltage scaling for the SW1 and SW3 DC/DC converters on the LTC3676 for 1225mV. Note that the scalar values for the LTC3676 are board-specific as they relate to a resistor devider chosen by the board design.
Signed-off-by Tim Harvey <[email protected]>---
Applied after fixing:
board/gateworks/gw_ventana/gw_ventana.c: In function 'power_init_board':board/gateworks/gw_ventana/gw_ventana.c:788:1: warning: control reaches end of non-void function [-Wreturn-type]
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================