[U-Boot] [PATCH 3/4] SMDK5250: Add PMIC voltage settings
Rajeshwari Shinde
rajeshwari.s at samsung.com
Fri Dec 28 13:08:44 CET 2012
This patch adds required pmic voltage settings for SMDK5250.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s at samsung.com>
---
board/samsung/smdk5250/smdk5250.c | 68 +++++++++++++++++++++++++++++++++++-
include/power/max77686_pmic.h | 15 ++++++++
2 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index 73c3ec0..fe353a1 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -24,14 +24,17 @@
#include <fdtdec.h>
#include <asm/io.h>
#include <i2c.h>
+#include <errno.h>
#include <netdev.h>
#include <spi.h>
#include <asm/arch/cpu.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mmc.h>
#include <asm/arch/pinmux.h>
+#include <asm/arch/power.h>
#include <asm/arch/sromc.h>
#include <power/pmic.h>
+#include <power/max77686_pmic.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -60,10 +63,71 @@ int dram_init(void)
#if defined(CONFIG_POWER)
int power_init_board(void)
{
+ struct pmic *p;
+ u32 val;
+
+ ps_hold_setup();
+
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
if (pmic_init(I2C_PMIC))
return -1;
- else
- return 0;
+
+ p = pmic_get("MAX77686_PMIC");
+ if (!p)
+ return -ENODEV;
+
+ if (pmic_probe(p))
+ return -1;
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_32KHZ, &val);
+ val |= MAX77686_32KHCP_EN;
+ pmic_reg_write(p, MAX77686_REG_PMIC_32KHZ, val);
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_BBAT, &val);
+ val |= (MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V);
+ pmic_reg_write(p, MAX77686_REG_PMIC_BBAT, val);
+
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1OUT, MAX77686_BUCK1OUT_1V);
+ pmic_reg_read(p, MAX77686_REG_PMIC_BUCK1CRTL, &val);
+ val |= MAX77686_BUCK1CTRL_EN;
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1CRTL, val);
+
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2DVS1,
+ MAX77686_BUCK2DVS1_1_3V);
+ pmic_reg_read(p, MAX77686_REG_PMIC_BUCK2CTRL1, &val);
+ val |= MAX77686_BUCK2CTRL_ON;
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2CTRL1, val);
+
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3DVS1,
+ MAX77686_BUCK3DVS1_1_0125V);
+ pmic_reg_read(p, MAX77686_REG_PMIC_BUCK3CTRL, &val);
+ val |= MAX77686_BUCK3CTRL_ON;
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3CTRL, val);
+
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4DVS1,
+ MAX77686_BUCK4DVS1_1_2V);
+ pmic_reg_read(p, MAX77686_REG_PMIC_BUCK4CTRL1, &val);
+ val |= MAX77686_BUCK4CTRL_ON;
+ pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4CTRL1, val);
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_LDO2CTRL1, &val);
+ val |= (MAX77686_LD02CTRL1_1_5V | EN_LDO);
+ pmic_reg_write(p, MAX77686_REG_PMIC_LDO2CTRL1, val);
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_LDO3CTRL1, &val);
+ val |= (MAX77686_LD03CTRL1_1_8V | EN_LDO);
+ pmic_reg_write(p, MAX77686_REG_PMIC_LDO3CTRL1, val);
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_LDO5CTRL1, &val);
+ val |= (MAX77686_LD05CTRL1_1_8V | EN_LDO);
+ pmic_reg_write(p, MAX77686_REG_PMIC_LDO5CTRL1, val);
+
+ pmic_reg_read(p, MAX77686_REG_PMIC_LDO10CTRL1, &val);
+ val |= (MAX77686_LD10CTRL1_1_8V | EN_LDO);
+ pmic_reg_write(p, MAX77686_REG_PMIC_LDO10CTRL1, val);
+
+ return 0;
}
#endif
diff --git a/include/power/max77686_pmic.h b/include/power/max77686_pmic.h
index d949ace..fb3a8fb 100644
--- a/include/power/max77686_pmic.h
+++ b/include/power/max77686_pmic.h
@@ -155,4 +155,19 @@ enum {
EN_LDO = (0x3 << 6),
};
+#define MAX77686_BUCK1OUT_1V 0x5
+#define MAX77686_BUCK1CTRL_EN (3<<0)
+#define MAX77686_BUCK2DVS1_1_3V 0x38
+#define MAX77686_BUCK2CTRL_ON (1<<4)
+#define MAX77686_BUCK3DVS1_1_0125V 0x21
+#define MAX77686_BUCK3CTRL_ON (1<<4)
+#define MAX77686_BUCK4DVS1_1_2V 0x30
+#define MAX77686_BUCK4CTRL_ON (1<<4)
+#define MAX77686_LD02CTRL1_1_5V 0x1c
+#define MAX77686_LD03CTRL1_1_8V 0x14
+#define MAX77686_LD05CTRL1_1_8V 0x14
+#define MAX77686_LD10CTRL1_1_8V 0x14
+#define MAX77686_32KHCP_EN (1<<1)
+#define MAX77686_BBCHOSTEN (1<<0)
+#define MAX77686_BBCVS_3_5V (3<<3)
#endif /* __MAX77686_PMIC_H_ */
--
1.7.4.4
More information about the U-Boot
mailing list