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

Add FDT support to PMIC MAX77686 chip.
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 Changes in V4: - Corrected PMIC register address Changes in V5: - Rebased on latest u-boot-samsung tree.
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 Changes in V3: - converted the pmic name to small letters. Changes in V4: - None Changes in V5: - Rebased on latest u-boot-samsung tree. 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 0d3417b..f77d195 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -78,6 +78,7 @@ enum fdt_compat_id { COMPAT_SAMSUNG_EXYNOS_SPI, /* Exynos SPI */ COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */ COMPAT_SAMSUNG_EXYNOS_USB_PHY, /* Exynos phy controller for usb2.0 */ + COMPAT_MAXIM_MAX77686_PMIC, /* MAX77686 PMIC */
COMPAT_COUNT, }; diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 4416670..16921e1 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -53,6 +53,7 @@ static const char * const compat_names[COMPAT_COUNT] = { COMPAT(SAMSUNG_EXYNOS_SPI, "samsung,exynos-spi"), COMPAT(SAMSUNG_EXYNOS_EHCI, "samsung,exynos-ehci"), COMPAT(SAMSUNG_EXYNOS_USB_PHY, "samsung,exynos-usb-phy"), + 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. Changes in V4: - Corrected PMIC register address Changes in V5: - None 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..cbfab6f 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@9 { + reg = <0x9>; + compatible = "maxim,max77686_pmic"; + }; + }; };

On Tue, Jan 8, 2013 at 11:03 PM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
Add device node for MAX77686
Signed-off-by: Rajeshwari Shinde rajeshwari.s@samsung.com
Acked-by: Simon Glass sjg@chromium.org
Changes in V2: - Changed reg value from 06 to 6. Chnages in V3: - converted the pmic name to small letters. Changes in V4: - Corrected PMIC register address Changes in V5: - None 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..cbfab6f 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@9 {
reg = <0x9>;
compatible = "maxim,max77686_pmic";
};
};
};
1.7.4.4

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 Changes in V4: - Corrected PMIC register address Changes in V5: - None. 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..7fcb4c0 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", 9); +#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; }

Hi Rajeshwari,
On Tue, Jan 8, 2013 at 11:03 PM, Rajeshwari Shinde rajeshwari.s@samsung.com wrote:
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 Changes in V4: - Corrected PMIC register address Changes in V5: - None. 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..7fcb4c0 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", 9);
+#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");
Can we remove this message? It doesn't seem very important.
return 0;
}
1.7.4.4
Regards Simon

On 09/01/13 16:03, Rajeshwari Shinde wrote:
Add FDT support to PMIC MAX77686 chip.
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 Changes in V4: - Corrected PMIC register address Changes in V5:
- Rebased on latest u-boot-samsung tree.
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(-)
applied to u-boot-samsung
Thanks, Minkyu Kang.

Hi Minkyu Kang,
Thank you for applying the patches.
Regards, Rajeshwari Shinde
On Thu, Jan 10, 2013 at 6:51 AM, Minkyu Kang mk7.kang@samsung.com wrote:
On 09/01/13 16:03, Rajeshwari Shinde wrote:
Add FDT support to PMIC MAX77686 chip.
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 Changes in V4: - Corrected PMIC register address Changes in V5: - Rebased on latest u-boot-samsung tree.
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(-)
applied to u-boot-samsung
Thanks, Minkyu Kang. _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (4)
-
Minkyu Kang
-
Rajeshwari Birje
-
Rajeshwari Shinde
-
Simon Glass