diff options
author | Tom Rini <trini@konsulko.com> | 2017-01-18 07:21:12 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-01-18 07:21:12 -0500 |
commit | 2c45f8040ea1152d2ff0960f96905ca42ac089cd (patch) | |
tree | a673b269a864c106ce729213593c62cbe9c1299d /board | |
parent | bfd07670a48d9fbf22646c93e07dcd8cbc8d0864 (diff) | |
parent | 3296eeff8ae064a788d52325fcd4ce1fdf52ee06 (diff) |
Merge git://git.denx.de/u-boot-samsung
Diffstat (limited to 'board')
-rw-r--r-- | board/samsung/common/exynos5-dt.c | 8 | ||||
-rw-r--r-- | board/samsung/goni/goni.c | 61 | ||||
-rw-r--r-- | board/samsung/universal_c210/universal.c | 180 |
3 files changed, 125 insertions, 124 deletions
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 2e3b16df45d..aec1f396b09 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -123,13 +123,7 @@ int exynos_power_init(void) if (ret) return ret; - /* - * This would normally be 1.3V, but since we are running slowly 1.1V - * is enough. For spring it helps reduce CPU temperature and avoid - * hangs with the case open. 1.1V is minimum voltage borderline for - * chained bootloaders. - */ - ret = exynos_set_regulator("vdd_arm", 1100000); + ret = exynos_set_regulator("vdd_arm", 1300000); if (ret) return ret; ret = exynos_set_regulator("vdd_int", 1012500); diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c index b066832e5fa..9c48d71a674 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; } diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index c3946ee8910..feb8a341bef 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -27,33 +27,21 @@ DECLARE_GLOBAL_DATA_PTR; unsigned int board_rev; +static int init_pmic_lcd(void); u32 get_board_rev(void) { return board_rev; } -static int get_hwrev(void) +int exynos_power_init(void) { - return board_rev & 0xFF; + return init_pmic_lcd(); } -int exynos_power_init(void) +static int get_hwrev(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - int ret; - - /* - * For PMIC the I2C bus is named as I2C5, but it is connected - * to logical I2C adapter 0 - */ - ret = pmic_init(I2C_0); - if (ret) - return ret; - - init_pmic_lcd(); -#endif - return 0; + return board_rev & 0xFF; } static unsigned short get_adc_value(int channel) @@ -83,23 +71,29 @@ static unsigned short get_adc_value(int channel) static int adc_power_control(int on) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ + struct udevice *dev; int ret; - struct pmic *p = pmic_get("MAX8998_PMIC"); - if (!p) - return -ENODEV; + u8 reg; - if (pmic_probe(p)) - return -1; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); + return ret; + } - ret = pmic_set_output(p, - MAX8998_REG_ONOFF1, - MAX8998_LDO4, !!on); + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + if (on) + reg |= MAX8998_LDO4; + else + reg &= ~MAX8998_LDO4; + + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); + return -EINVAL; + } - return ret; -#else return 0; -#endif } static unsigned int get_hw_revision(void) @@ -147,39 +141,50 @@ static void check_hw_revision(void) #ifdef CONFIG_USB_GADGET static int s5pc210_phy_control(int on) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - int ret = 0; - struct pmic *p = pmic_get("MAX8998_PMIC"); - if (!p) - return -ENODEV; + struct udevice *dev; + int ret; + u8 reg; - if (pmic_probe(p)) - return -1; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); + return ret; + } if (on) { - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_ON); - 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_BUCK_ACTIVE_DISCHARGE3); + reg |= MAX8998_SAFEOUT1; + ret |= pmic_reg_write(dev, + MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + reg |= MAX8998_LDO3; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg |= MAX8998_LDO8; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); } else { - ret |= pmic_set_output(p, MAX8998_REG_ONOFF2, - MAX8998_LDO8, LDO_OFF); - ret |= pmic_set_output(p, MAX8998_REG_ONOFF1, - MAX8998_LDO3, LDO_OFF); - ret |= pmic_set_output(p, - MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, - MAX8998_SAFEOUT1, LDO_OFF); + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg &= ~MAX8998_LDO8; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF1); + reg &= ~MAX8998_LDO3; + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, reg); + + reg = pmic_reg_read(dev, MAX8998_REG_BUCK_ACTIVE_DISCHARGE3); + reg &= ~MAX8998_SAFEOUT1; + ret |= pmic_reg_write(dev, + MAX8998_REG_BUCK_ACTIVE_DISCHARGE3, reg); } if (ret) { puts("MAX8998 LDO setting error!\n"); - return -1; + return -EINVAL; } -#endif + return 0; } @@ -205,27 +210,25 @@ int exynos_early_init_f(void) return 0; } -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ -static void init_pmic_lcd(void) +static int init_pmic_lcd(void) { + struct udevice *dev; unsigned char val; int ret = 0; - struct pmic *p = pmic_get("MAX8998_PMIC"); - - if (!p) - return; - - if (pmic_probe(p)) - return; + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998 for init_pmic_lcd()!\n"); + return ret; + } /* LDO7 1.8V */ val = 0x02; /* (1800 - 1600) / 100; */ - ret |= pmic_reg_write(p, MAX8998_REG_LDO7, val); + ret |= pmic_reg_write(dev, MAX8998_REG_LDO7, val); /* LDO17 3.0V */ val = 0xe; /* (3000 - 1600) / 100; */ - ret |= pmic_reg_write(p, MAX8998_REG_LDO17, val); + ret |= pmic_reg_write(dev, MAX8998_REG_LDO17, val); /* Disable unneeded regulators */ /* @@ -234,26 +237,29 @@ static void init_pmic_lcd(void) * LDO2 ON, LDO3 OFF, LDO4 OFF, LDO5 ON */ val = 0xB9; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF1, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF1, val); /* ONOFF2 * LDO6 OFF, LDO7 ON, LDO8 OFF, LDO9 ON, * LDO10 OFF, LDO11 OFF, LDO12 OFF, LDO13 OFF */ val = 0x50; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF2, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF2, val); /* ONOFF3 * LDO14 OFF, LDO15 OFF, LGO16 OFF, LDO17 OFF * EPWRHOLD OFF, EBATTMON OFF, ELBCNFG2 OFF, ELBCNFG1 OFF */ val = 0x00; - ret |= pmic_reg_write(p, MAX8998_REG_ONOFF3, val); + ret |= pmic_reg_write(dev, MAX8998_REG_ONOFF3, val); - if (ret) + if (ret) { puts("LCD pmic initialisation error!\n"); + return -EINVAL; + } + + return 0; } -#endif void exynos_cfg_lcd_gpio(void) { @@ -310,18 +316,31 @@ void exynos_reset_lcd(void) void exynos_lcd_power_on(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - struct pmic *p = pmic_get("MAX8998_PMIC"); + struct udevice *dev; + int ret; + u8 reg; - if (!p) + ret = pmic_get("max8998-pmic", &dev); + if (ret) { + puts("Failed to get MAX8998!\n"); return; + } - if (pmic_probe(p)) + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF3); + reg |= MAX8998_LDO17; + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF3, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); return; + } - pmic_set_output(p, MAX8998_REG_ONOFF3, MAX8998_LDO17, LDO_ON); - pmic_set_output(p, MAX8998_REG_ONOFF2, MAX8998_LDO7, LDO_ON); -#endif + reg = pmic_reg_read(dev, MAX8998_REG_ONOFF2); + reg |= MAX8998_LDO7; + ret = pmic_reg_write(dev, MAX8998_REG_ONOFF2, reg); + if (ret) { + puts("MAX8998 LDO setting error\n"); + return; + } } void exynos_cfg_ldo(void) @@ -336,9 +355,6 @@ void exynos_enable_ldo(unsigned int onoff) int exynos_init(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - char buf[16]; -#endif gd->bd->bi_arch_number = MACH_TYPE_UNIVERSAL_C210; switch (get_hwrev()) { @@ -363,14 +379,6 @@ int exynos_init(void) break; } -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ - /* Request soft I2C gpios */ - strcpy(buf, "soft_i2c_scl"); - gpio_request(CONFIG_SOFT_I2C_GPIO_SCL, buf); - - strcpy(buf, "soft_i2c_sda"); - gpio_request(CONFIG_SOFT_I2C_GPIO_SDA, buf); -#endif check_hw_revision(); printf("HW Revision:\t0x%x\n", board_rev); |