* [U-Boot] [PATCH 1/2] power/pmic.h: Add prototype for power_init_board.
@ 2014-06-23 20:06 Tom Rini
2014-06-23 20:06 ` [U-Boot] [PATCH 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218 Tom Rini
2014-07-26 1:25 ` [U-Boot] [U-Boot, 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
0 siblings, 2 replies; 4+ messages in thread
From: Tom Rini @ 2014-06-23 20:06 UTC (permalink / raw)
To: u-boot
As this is a weak function that we may override, provide a prototype for
it.
Cc: ?ukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
include/power/pmic.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/power/pmic.h b/include/power/pmic.h
index a62e6c9..afbc5aa 100644
--- a/include/power/pmic.h
+++ b/include/power/pmic.h
@@ -79,6 +79,7 @@ struct pmic {
};
int pmic_init(unsigned char bus);
+int power_init_board(void);
int pmic_dialog_init(unsigned char bus);
int check_reg(struct pmic *p, u32 reg);
struct pmic *pmic_alloc(void);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218
2014-06-23 20:06 [U-Boot] [PATCH 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
@ 2014-06-23 20:06 ` Tom Rini
2014-07-26 1:25 ` [U-Boot] [U-Boot, " Tom Rini
2014-07-26 1:25 ` [U-Boot] [U-Boot, 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
1 sibling, 1 reply; 4+ messages in thread
From: Tom Rini @ 2014-06-23 20:06 UTC (permalink / raw)
To: u-boot
Add in an init function for the drivers/power framework so we can dump
and read the registers via i2c.
Cc: ?ukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
This is as far as we can take the framework on this family as in order
to make use of the pmic struct we need malloc. We need to talk with the
PMIC before we have DDR setup so we don't have a malloc pool. We can
address this later possibly once an "early malloc" patch is in as part
of device model support.
---
board/ti/am43xx/board.c | 14 ++++++++++++++
drivers/power/pmic/pmic_tps65218.c | 22 ++++++++++++++++++++++
include/configs/am43xx_evm.h | 2 ++
include/power/tps65218.h | 1 +
4 files changed, 39 insertions(+)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 71af1ae..eb4e52f 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -19,6 +19,7 @@
#include <asm/arch/gpio.h>
#include <asm/emif.h>
#include "board.h"
+#include <power/pmic.h>
#include <power/tps65218.h>
#include <miiphy.h>
#include <cpsw.h>
@@ -414,6 +415,19 @@ void sdram_init(void)
}
#endif
+/* setup board specific PMIC */
+int power_init_board(void)
+{
+ struct pmic *p;
+
+ power_tps65218_init(I2C_PMIC);
+ p = pmic_get("TPS65218_PMIC");
+ if (p && !pmic_probe(p))
+ puts("PMIC: TPS65218\n");
+
+ return 0;
+}
+
int board_init(void)
{
gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
diff --git a/drivers/power/pmic/pmic_tps65218.c b/drivers/power/pmic/pmic_tps65218.c
index 0952456..dbc7a73 100644
--- a/drivers/power/pmic/pmic_tps65218.c
+++ b/drivers/power/pmic/pmic_tps65218.c
@@ -7,6 +7,8 @@
#include <common.h>
#include <i2c.h>
+#include <asm/errno.h>
+#include <power/pmic.h>
#include <power/tps65218.h>
/**
@@ -95,3 +97,23 @@ int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel)
return 0;
}
+
+int power_tps65218_init(unsigned char bus)
+{
+ static const char name[] = "TPS65218_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 = TPS65218_PMIC_NUM_OF_REGS;
+ p->hw.i2c.addr = TPS65218_CHIP_PM;
+ p->hw.i2c.tx_num = 1;
+ p->bus = bus;
+
+ return 0;
+}
diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index 823cba6..71f13e6 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -33,6 +33,8 @@
#define CONFIG_SYS_I2C_MULTI_EEPROMS
/* Power */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
#define CONFIG_POWER_TPS65218
/* SPL defines. */
diff --git a/include/power/tps65218.h b/include/power/tps65218.h
index 67aa2f8..f8f33b8 100644
--- a/include/power/tps65218.h
+++ b/include/power/tps65218.h
@@ -60,4 +60,5 @@ enum {
int tps65218_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val,
uchar mask);
int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel);
+int power_tps65218_init(unsigned char bus);
#endif /* __POWER_TPS65218_H__ */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [U-Boot, 1/2] power/pmic.h: Add prototype for power_init_board.
2014-06-23 20:06 [U-Boot] [PATCH 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
2014-06-23 20:06 ` [U-Boot] [PATCH 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218 Tom Rini
@ 2014-07-26 1:25 ` Tom Rini
1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2014-07-26 1:25 UTC (permalink / raw)
To: u-boot
On Mon, Jun 23, 2014 at 04:06:28PM -0400, Tom Rini wrote:
> As this is a weak function that we may override, provide a prototype for
> it.
>
> Cc: ?ukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tom Rini <trini@ti.com>
Applied to u-boot-ti/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/13e0aa64/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [U-Boot, 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218
2014-06-23 20:06 ` [U-Boot] [PATCH 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218 Tom Rini
@ 2014-07-26 1:25 ` Tom Rini
0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2014-07-26 1:25 UTC (permalink / raw)
To: u-boot
On Mon, Jun 23, 2014 at 04:06:29PM -0400, Tom Rini wrote:
> Add in an init function for the drivers/power framework so we can dump
> and read the registers via i2c.
>
> Cc: ?ukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Tom Rini <trini@ti.com>
Applied to u-boot-ti/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/be30d4a4/attachment.pgp>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-26 1:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-23 20:06 [U-Boot] [PATCH 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
2014-06-23 20:06 ` [U-Boot] [PATCH 2/2] tps65218/am43xx_evm: Add power framework support to TPS65218 Tom Rini
2014-07-26 1:25 ` [U-Boot] [U-Boot, " Tom Rini
2014-07-26 1:25 ` [U-Boot] [U-Boot, 1/2] power/pmic.h: Add prototype for power_init_board Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox