[U-Boot] [PATCH 0/3 V3] EXYNOS5: MAX77686 add FDT support

Add FDT support to PMIC MAX77686 chip.
This patch set is based on top of: "[U-Boot] [PATCH 00/16 V2] SMDK5250: Add FDT support" link for same: "http://comments.gmane.org/gmane.comp.boot-loaders.u-boot/149991"
Changes in V2: - Changed chip address from 06 to 6. - Corrected indentation errors. Changes in V3: - Rebased on top of the latest implementation of PMIC
Rajeshwari Shinde (3): EXYNOS5: FDT: Add compatible strings for PMIC EXYNOS5: Add device node for PMIC PMIC: MAX77686: Add FDT Support
board/samsung/dts/exynos5250-smdk5250.dts | 7 +++++ drivers/power/pmic/pmic_max77686.c | 37 ++++++++++++++++++++++++++-- include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 4 files changed, 43 insertions(+), 3 deletions(-)

Add required compatible information for PMIC
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com Acked-by: Simon Glass sjg@chromium.org --- Changes in V2: - None Chnages in V3: - converted the pmic name to small letters. include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h index ce10bf4..505afb3 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -76,6 +76,7 @@ enum fdt_compat_id { COMPAT_SAMSUNG_EXYNOS5_SOUND, /* Exynos Sound */ COMPAT_WOLFSON_WM8994_CODEC, /* Wolfson WM8994 Sound Codec */ COMPAT_SAMSUNG_EXYNOS_SPI, /* Exynos SPI */ + COMPAT_MAXIM_MAX77686_PMIC, /* MAX77686 PMIC */
COMPAT_COUNT, }; diff --git a/lib/fdtdec.c b/lib/fdtdec.c index aa75710..4865d23 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -51,6 +51,7 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(SAMSUNG_EXYNOS5_SOUND, "samsung,exynos-sound"), COMPAT(WOLFSON_WM8994_CODEC, "wolfson,wm8994-codec"), COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"), + COMPAT(MAXIM_MAX77686_PMIC, "maxim,max77686_pmic"), };
const char *fdtdec_get_compatible(enum fdt_compat_id id)

Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- Changes in V2: - Changed reg value from 06 to 6. Chnages in V3: - converted the pmic name to small letters. board/samsung/dts/exynos5250-smdk5250.dts | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/board/samsung/dts/exynos5250-smdk5250.dts b/board/samsung/dts/exynos5250-smdk5250.dts index a8e62da..f168a17 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -59,4 +59,11 @@ compatible = "wolfson,wm8994-codec"; }; }; + + i2c@12c60000 { + pmic@6 { + reg = <0x6>; + compatible = "maxim,max77686_pmic"; + }; + }; };

This patch adds fdt support to MAX77686.
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- Changes in V2: - Corrected indentation errors. Changes in V3: - Rebased on top of the latest implementation of PMIC drivers/power/pmic/pmic_max77686.c | 37 +++++++++++++++++++++++++++++++++-- 1 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/drivers/power/pmic/pmic_max77686.c b/drivers/power/pmic/pmic_max77686.c index fce0183..a1ee04e 100644 --- a/drivers/power/pmic/pmic_max77686.c +++ b/drivers/power/pmic/pmic_max77686.c @@ -22,10 +22,14 @@ */
#include <common.h> +#include <fdtdec.h> +#include <i2c.h> #include <power/pmic.h> #include <power/max77686_pmic.h> #include <errno.h>
+DECLARE_GLOBAL_DATA_PTR; + int pmic_init(unsigned char bus) { static const char name[] = "MAX77686_PMIC"; @@ -36,13 +40,40 @@ int pmic_init(unsigned char bus) return -ENOMEM; }
- puts("Board PMIC init\n"); +#ifdef CONFIG_OF_CONTROL + const void *blob = gd->fdt_blob; + int node, parent; + + node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC); + if (node < 0) { + debug("PMIC: No node for PMIC Chip in device tree\n"); + debug("node = %d\n", node); + return -1; + } + + parent = fdt_parent_offset(blob, node); + if (parent < 0) { + debug("%s: Cannot find node parent\n", __func__); + return -1; + } + + p->bus = i2c_get_bus_num_fdt(parent); + if (p->bus < 0) { + debug("%s: Cannot find I2C bus\n", __func__); + return -1; + } + p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 6); +#else + p->bus = bus; + p->hw.i2c.addr = MAX77686_I2C_ADDR; +#endif + p->name = name; p->interface = PMIC_I2C; p->number_of_regs = PMIC_NUM_OF_REGS; - p->hw.i2c.addr = MAX77686_I2C_ADDR; p->hw.i2c.tx_num = 1; - p->bus = bus; + + puts("Board PMIC init\n");
return 0; }
participants (1)
-
Rajeshwari Shinde