[U-Boot] [PATCH 0/3] 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"
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 | 34 ++++++++++++++++++++++++---- include/fdtdec.h | 1 + lib/fdtdec.c | 1 + 4 files changed, 38 insertions(+), 5 deletions(-)

Add required compatible information for PMIC
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- 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..976e6af 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..3a6b679 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)

On Mon, Dec 3, 2012 at 4:12 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
Add required compatible information for PMIC
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
Acked-by: Simon Glass sjg@chromium.org
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..976e6af 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..3a6b679 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)
1.7.4.4

Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- 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 4d51d98..6072a6a 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -70,4 +70,11 @@ compatible = "wolfson,wm8994-codec"; }; }; + + i2c@12c60000 { + pmic@06 { + reg = <0x06>; + compatible = "maxim,MAX77686_PMIC"; + }; + }; };

On Mon, Dec 3, 2012 at 4:12 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
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 4d51d98..6072a6a 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -70,4 +70,11 @@ compatible = "wolfson,wm8994-codec"; }; };
i2c@12c60000 {
pmic@06 {
I think 6 instead of 06
reg = <0x06>;
I presume this is different from snow (which I think is 9)?
compatible = "maxim,MAX77686_PMIC";
};
};
};
1.7.4.4
Regards, Simon

On Tue, Dec 4, 2012 at 6:45 AM, Simon Glass sjg@chromium.org wrote:
On Mon, Dec 3, 2012 at 4:12 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
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 4d51d98..6072a6a 100644 --- a/board/samsung/dts/exynos5250-smdk5250.dts +++ b/board/samsung/dts/exynos5250-smdk5250.dts @@ -70,4 +70,11 @@ compatible = "wolfson,wm8994-codec"; }; };
i2c@12c60000 {
pmic@06 {
I think 6 instead of 06
Will do this.
reg = <0x06>;
I presume this is different from snow (which I think is 9)?
Yes, because of that we are adding it in dts file for SMDK5250.
compatible = "maxim,MAX77686_PMIC";
};
};
};
1.7.4.4
Regards, Simon _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

This patch adds fdt support to MAX77686.
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com --- drivers/misc/pmic_max77686.c | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c index 36f7f4d..113d038 100644 --- a/drivers/misc/pmic_max77686.c +++ b/drivers/misc/pmic_max77686.c @@ -22,21 +22,45 @@ */
#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("EXYNOS_SOUND: No node for codec 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; }

Hi Rajeshwari,
On Mon, Dec 3, 2012 at 4:12 AM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
This patch adds fdt support to MAX77686.
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
drivers/misc/pmic_max77686.c | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/drivers/misc/pmic_max77686.c b/drivers/misc/pmic_max77686.c index 36f7f4d..113d038 100644 --- a/drivers/misc/pmic_max77686.c +++ b/drivers/misc/pmic_max77686.c @@ -22,21 +22,45 @@ */
#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
Should outdent this I think.
const void *blob = gd->fdt_blob;
int node, parent;
node = fdtdec_next_compatible(blob, 0, COMPAT_MAXIM_MAX77686_PMIC);
if (node <= 0) {
< 0 is enough I think, although it isn't very important.
debug("EXYNOS_SOUND: No node for codec 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);
Could join on to previous line
#else
outdent, and #endif below
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;
}
1.7.4.4
I suggest if you don't already that you use patman to create patches.
Regards, Simon
participants (3)
-
Rajeshwari Birje
-
Rajeshwari Shinde
-
Simon Glass