]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tps65218/am43xx_evm: Add power framework support to TPS65218
authorTom Rini <trini@ti.com>
Mon, 23 Jun 2014 20:06:29 +0000 (16:06 -0400)
committerTom Rini <trini@ti.com>
Fri, 25 Jul 2014 19:21:06 +0000 (15:21 -0400)
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>
board/ti/am43xx/board.c
drivers/power/pmic/pmic_tps65218.c
include/configs/am43xx_evm.h
include/power/tps65218.h

index 054a452eac353e79f11a40fa686bf30a20fa1b60..f6577769e7bff15e913eb9e891048ae0914dbaea 100644 (file)
@@ -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>
@@ -484,6 +485,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;
index 095245637995d3f6cf44f35accb468ff1770efd9..dbc7a73a7235eb090efccb350238eebba8f31f3f 100644 (file)
@@ -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;
+}
index 974ce986e9ce8bef0eea7394c5033f114ae5908e..e26204025f80bafd9b8a75994bffe884641badc6 100644 (file)
@@ -33,6 +33,8 @@
 #define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 /* Power */
+#define CONFIG_POWER
+#define CONFIG_POWER_I2C
 #define CONFIG_POWER_TPS65218
 
 /* SPL defines. */
index 67aa2f8c8d46e781c01ad4457b31df5f51b3f848..f8f33b8b16bae0003034e4e64aadf12988370113 100644 (file)
@@ -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__ */