]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
odroid: enable driver model pmic/regulator API and MAX77686 drivers
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Wed, 13 May 2015 11:38:25 +0000 (13:38 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:40:25 +0000 (22:40 +0200)
This change enables the configs required to init and setup max77686
regulator driver, using the new driver model pmic and regulator API.
And also changes the old pmic framework calls to the new ones.

This commits enables:
- CONFIG_ERRNO_STR
- CONFIG_DM_PMIC
- CONFIG_DM_PMIC_CMD
- CONFIG_DM_PMIC_MAX77686
- CONFIG_DM_REGULATOR
- CONFIG_DM_REGULATOR_CMD
- CONFIG_DM_REGULATOR_MAX77686

And removes the unused:
- CONFIG_DM_I2C_COMPAT
- CONFIG_POWER
- CONFIG_POWER_I2C
- CONFIG_POWER_MAX77686

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
board/samsung/common/misc.c
board/samsung/odroid/odroid.c
configs/odroid_defconfig
include/configs/odroid.h

index 1a77c820ae97f7604be995faa4a850b7943da230..f0d69d4a48f0472e705f964b2a4522b31e879c95 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/gpio.h>
 #include <linux/input.h>
+#include <dm.h>
 #include <power/pmic.h>
 #include <mmc.h>
 
index ae41c29d9254d162a8ba702c0d4e968eb673a7ec..29de325aff03e752c73c741ab2a7bf3ea6d50feb 100644 (file)
@@ -12,7 +12,9 @@
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
 #include <asm/arch/cpu.h>
+#include <dm.h>
 #include <power/pmic.h>
+#include <power/regulator.h>
 #include <power/max77686_pmic.h>
 #include <errno.h>
 #include <mmc.h>
@@ -31,6 +33,12 @@ enum {
        ODROID_TYPES,
 };
 
+static const char *mmc_regulators[] = {
+       "VDDQ_EMMC_1.8V",
+       "VDDQ_EMMC_2.8V",
+       "TFLASH_2.8V",
+};
+
 void set_board_type(void)
 {
        /* Set GPA1 pin 1 to HI - enable XCL205 output */
@@ -403,21 +411,6 @@ static void board_gpio_init(void)
 #endif
 }
 
-static int pmic_init_max77686(void)
-{
-       struct pmic *p = pmic_get("MAX77686_PMIC");
-
-       if (pmic_probe(p))
-               return -ENODEV;
-
-       /* Set LDO Voltage */
-       max77686_set_ldo_voltage(p, 20, 1800000);       /* LDO20 eMMC */
-       max77686_set_ldo_voltage(p, 21, 2800000);       /* LDO21 SD */
-       max77686_set_ldo_voltage(p, 22, 2800000);       /* LDO22 eMMC */
-
-       return 0;
-}
-
 int exynos_early_init_f(void)
 {
        board_clock_init();
@@ -434,8 +427,10 @@ int exynos_init(void)
 
 int exynos_power_init(void)
 {
-       pmic_init(0);
-       pmic_init_max77686();
+       int list_count = ARRAY_SIZE(mmc_regulators);
+
+       if (regulator_list_autoset(mmc_regulators, list_count, NULL, true))
+               error("Unable to init all mmc regulators");
 
        return 0;
 }
@@ -443,19 +438,20 @@ int exynos_power_init(void)
 #ifdef CONFIG_USB_GADGET
 static int s5pc210_phy_control(int on)
 {
-       struct pmic *p_pmic;
+       struct udevice *dev;
+       int ret;
 
-       p_pmic = pmic_get("MAX77686_PMIC");
-       if (!p_pmic)
-               return -ENODEV;
-
-       if (pmic_probe(p_pmic))
-               return -1;
+       ret = regulator_by_platname("VDD_UOTG_3.0V", &dev);
+       if (ret) {
+               error("Regulator get error: %d", ret);
+               return ret;
+       }
 
        if (on)
-               return max77686_set_ldo_mode(p_pmic, 12, OPMODE_ON);
+               return regulator_set_mode(dev, OPMODE_ON);
        else
-               return max77686_set_ldo_mode(p_pmic, 12, OPMODE_LPM);
+               return regulator_set_mode(dev, OPMODE_LPM);
+
 }
 
 struct s3c_plat_otg_data s5pc210_otg_data = {
@@ -472,7 +468,8 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
 int board_usb_init(int index, enum usb_init_type init)
 {
 #ifdef CONFIG_CMD_USB
-       struct pmic *p_pmic;
+       struct udevice *dev;
+       int ret;
 
        /* Set Ref freq 0 => 24MHz, 1 => 26MHz*/
        /* Odroid Us have it at 24MHz, Odroid Xs at 26MHz */
@@ -490,14 +487,30 @@ int board_usb_init(int index, enum usb_init_type init)
        /* Power off and on BUCK8 for LAN9730 */
        debug("LAN9730 - Turning power buck 8 OFF and ON.\n");
 
-       p_pmic = pmic_get("MAX77686_PMIC");
-       if (p_pmic && !pmic_probe(p_pmic)) {
-               max77686_set_buck_voltage(p_pmic, 8, 750000);
-               max77686_set_buck_voltage(p_pmic, 8, 3300000);
+       ret = regulator_by_platname("VCC_P3V3_2.85V", &dev);
+       if (ret) {
+               error("Regulator get error: %d", ret);
+               return ret;
        }
 
-#endif
+       ret = regulator_set_enable(dev, true);
+       if (ret) {
+               error("Regulator %s enable setting error: %d", dev->name, ret);
+               return ret;
+       }
 
+       ret = regulator_set_value(dev, 750000);
+       if (ret) {
+               error("Regulator %s value setting error: %d", dev->name, ret);
+               return ret;
+       }
+
+       ret = regulator_set_value(dev, 3300000);
+       if (ret) {
+               error("Regulator %s value setting error: %d", dev->name, ret);
+               return ret;
+       }
+#endif
        debug("USB_udc_probe\n");
        return s3c_udc_probe(&s5pc210_otg_data);
 }
index a63fe96790c6e10dc1801084a4f89b0b7b353ffe..a659bfc891a8f191060d79aab94cec1cc64faf08 100644 (file)
@@ -6,3 +6,10 @@ CONFIG_DEFAULT_DEVICE_TREE="exynos4412-odroid"
 CONFIG_OF_CONTROL=y
 CONFIG_DM_I2C=y
 CONFIG_DM_I2C_COMPAT=y
+CONFIG_ERRNO_STR=y
+CONFIG_DM_PMIC=y
+CONFIG_CMD_PMIC=y
+CONFIG_DM_PMIC_MAX77686=y
+CONFIG_DM_REGULATOR=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_DM_REGULATOR_MAX77686=y
index 5ee0abe02a89931bb6b126988df6113068e7b7fd..3874baa940130b5526144b557b32e5d3593abb1b 100644 (file)
 #define CONFIG_SYS_I2C_S3C24X0_SPEED   100000
 #define CONFIG_SYS_I2C_S3C24X0_SLAVE   0
 
-/* POWER */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_MAX77686
-
 /* GPT */
 #define CONFIG_RANDOM_UUID