summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorJaehoon Chung <jh80.chung@samsung.com>2017-01-03 09:43:28 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2017-01-05 11:27:36 +0900
commitcf2a693864392afe49d69cfe00557eab23acc055 (patch)
tree4f442e49d3b748e0fe9430dde3753198a2c5bcfa /board
parent87f5f5417fc897df0b05826b408f0f4b7d2ee388 (diff)
downloadu-boot-imx-cf2a693864392afe49d69cfe00557eab23acc055.zip
u-boot-imx-cf2a693864392afe49d69cfe00557eab23acc055.tar.gz
u-boot-imx-cf2a693864392afe49d69cfe00557eab23acc055.tar.bz2
arm: samsung: goni: use the driver model for max8998
Remove the "ifndef CONFIG_DM_I2C". Instead, use the driver model for max8998. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'board')
-rw-r--r--board/samsung/goni/goni.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index b066832..80fd0d4 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <asm/gpio.h>
#include <asm/arch/mmc.h>
+#include <dm.h>
#include <power/pmic.h>
#include <usb/dwc2_udc.h>
#include <asm/arch/cpu.h>
@@ -43,19 +44,6 @@ void i2c_init_board(void)
}
#endif
-int power_init_board(void)
-{
-#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
- /*
- * For PMIC the I2C bus is named as I2C5, but it is connected
- * to logical I2C adapter 0
- */
- return pmic_init(I2C_0);
-#else
- return 0;
-#endif
-}
-
int dram_init(void)
{
gd->ram_size = PHYS_SDRAM_1_SIZE + PHYS_SDRAM_2_SIZE +
@@ -146,39 +134,50 @@ int board_mmc_init(bd_t *bis)
#ifdef CONFIG_USB_GADGET
static int s5pc1xx_phy_control(int on)
{
-#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */
- int ret;
+ struct udevice *dev;
static int status;
- struct pmic *p = pmic_get("MAX8998_PMIC");
- if (!p)
- return -ENODEV;
+ int reg, ret;
- if (pmic_probe(p))
- return -1;
+ ret = pmic_get("max8998_pmic", &dev);
+ if (ret)
+ return ret;
if (on && !status) {
- ret = pmic_set_output(p, MAX8998_REG_ONOFF1,
- MAX8998_LDO3, LDO_ON);
- ret = pmic_set_output(p, MAX8998_REG_ONOFF2,
- MAX8998_LDO8, LDO_ON);
+ reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1);
+ reg |= MAX8998_LDO3;
+ ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg);
if (ret) {
puts("MAX8998 LDO setting error!\n");
- return -1;
+ return -EINVAL;
+ }
+
+ reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2);
+ reg |= MAX8998_LDO8;
+ ret = pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg);
+ if (ret) {
+ puts("MAX8998 LDO setting error!\n");
+ return -EINVAL;
}
status = 1;
} else if (!on && status) {
- ret = pmic_set_output(p, MAX8998_REG_ONOFF1,
- MAX8998_LDO3, LDO_OFF);
- ret = pmic_set_output(p, MAX8998_REG_ONOFF2,
- MAX8998_LDO8, LDO_OFF);
+ reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1);
+ reg &= ~MAX8998_LDO3;
+ ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg);
+ if (ret) {
+ puts("MAX8998 LDO setting error!\n");
+ return -EINVAL;
+ }
+
+ reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2);
+ reg &= ~MAX8998_LDO8;
+ ret = pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg);
if (ret) {
puts("MAX8998 LDO setting error!\n");
- return -1;
+ return -EINVAL;
}
status = 0;
}
udelay(10000);
-#endif
return 0;
}