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

Add FDT support to PMIC MAX77686 chip.
This patch set is based on top of: "EXYNOS5: Add FDT support to SPI"
Changes in V2: - Changed chip address from 06 to 6. - Corrected indentation errors.
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/misc/pmic_max77686.c | 35 ++++++++++++++++++++++++---- include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 4 files changed, 39 insertions(+), 5 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 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 d1279f4..5934af1 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -73,6 +73,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 1dbb892..6bc57c5 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -50,6 +50,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. 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 be57fde..923a189 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -72,4 +72,11 @@ compatible = "wolfson,wm8994-codec"; }; }; + + i2c@12c60000 { + pmic@6 { + reg = <0x6>; + compatible = "maxim,MAX77686_PMIC"; + }; + }; };

On Wed, Dec 5, 2012 at 4:50 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
Changes in V2: - Changed reg value from 06 to 6. 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 be57fde..923a189 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -72,4 +72,11 @@ compatible = "wolfson,wm8994-codec"; }; };
i2c@12c60000 {
pmic@6 {
reg = <0x6>;
compatible = "maxim,MAX77686_PMIC";
Shouldn't this be lower case? Sorry I missed this before.
};
};
};
1.7.4.4
Regards, Simon

This patch adds fdt support to MAX77686.
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- Changes in V2: - Corrected indentation errors. drivers/misc/pmic_max77686.c | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c index 36f7f4d..a370d35 100644 --- a/drivers/misc/pmic_max77686.c +++ b/drivers/misc/pmic_max77686.c @@ -22,21 +22,46 @@ */
#include <common.h> +#include <fdtdec.h> +#include <i2c.h> #include <pmic.h> #include <max77686_pmic.h>
+DECLARE_GLOBAL_DATA_PTR; + int pmic_init(void) { struct pmic *p = get_pmic(); static const char name[] = "MAX77686_PMIC";
- 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); + p->hw.i2c.addr = fdtdec_get_int(blob, node, "reg", 0); +#else + p->bus = I2C_PMIC; + p->hw.i2c.addr = MAX77686_I2C_ADDR; +#endif + p->name = name; + p->hw.i2c.tx_num = 1; 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 = I2C_PMIC; - + puts("Board PMIC init MAX77686\n"); return 0; }

On Wed, Dec 5, 2012 at 4:51 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
This patch adds fdt support to MAX77686.
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
Acked-by: Simon Glass sjg@chromium.org
Changes in V2: - Corrected indentation errors. drivers/misc/pmic_max77686.c | 35 ++++++++++++++++++++++++++++++----- 1 files changed, 30 insertions(+), 5 deletions(-)
participants (2)
-
Rajeshwari Shinde
-
Simon Glass