Skip to contentSkip to conversation

EXYNOS5: MAX77686 add FDT support

PATCH New Rajeshwari Shinde 4 participants 8 messages Jan 9, 2013 – Jan 11, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v5 cover 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(-)
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH v5 1/3 EXYNOS5: FDT: Add compatible strings for PMIC

Add required compatible information for PMIC

---
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(-)
include/fdtdec.h +1 -0
index 0d3417b..f77d195 100644
@@ -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,
 };
lib/fdtdec.c +1 -0
index 4416670..16921e1 100644
@@ -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)
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH v5 2/3 EXYNOS5: Add device node for PMIC

In reply to Rajeshwari Shinde

Add device node for MAX77686

---
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(-)
board/samsung/dts/exynos5250-smdk5250.dts +7 -0
index a8e62da..cbfab6f 100644
@@ -59,4 +59,11 @@
 			compatible = "wolfson,wm8994-codec";
 		};
 	};
+
+	i2c at 12c60000 {
+		pmic at 9 {
+			reg = <0x9>;
+			compatible = "maxim,max77686_pmic";
+		};
+	};
 };
Signature · 1 line
1.7.4.4
#3 lore raw

PATCH v5 2/3 EXYNOS5: Add device node for PMIC

Quoted 3 lines · Rajeshwari Shinde

Add device node for MAX77686

Quoted 31 lines

---
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(-)
board/samsung/dts/exynos5250-smdk5250.dts +7 -1
index a8e62da..cbfab6f 100644
@@ -59,4 +59,11 @@
                        compatible = "wolfson,wm8994-codec";
                };
        };
+
+       i2c at 12c60000 {
+               pmic at 9 {
+                       reg = <0x9>;
+                       compatible = "maxim,max77686_pmic";
+               };
+       };
 };
--

1.7.4.4

#4 lore raw

PATCH v5 3/3 PMIC: MAX77686: Add FDT Support

In reply to Rajeshwari Shinde

This patch adds fdt support to MAX77686.

---
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(-)
drivers/power/pmic/pmic_max77686.c +34 -3
index fce0183..7fcb4c0 100644
@@ -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;
 }
Signature · 1 line
1.7.4.4
#5 lore raw

PATCH v5 3/3 PMIC: MAX77686: Add FDT Support

Hi Rajeshwari,

Quoted 66 lines · Rajeshwari Shinde

This patch adds fdt support to MAX77686.

---
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(-)
drivers/power/pmic/pmic_max77686.c +30 -1
index fce0183..7fcb4c0 100644
@@ -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;

drivers/power/pmic/pmic_max77686.c int pmic_init(unsigned char bus) · line 76

Quoted 10 lines
drivers/power/pmic/pmic_max77686.c +4 -2
+#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.

Quoted 6 lines
drivers/power/pmic/pmic_max77686.c +0 -1
        return 0;
 }
--

1.7.4.4

Regards
Simon

#6 lore raw

v5 cover EXYNOS5: MAX77686 add FDT support

In reply to Rajeshwari Shinde
Quoted 18 lines · Rajeshwari Shinde

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

Quoted 6 lines
 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.

#7 lore raw

v5 cover EXYNOS5: MAX77686 add FDT support

Hi Minkyu Kang,

Thank you for applying the patches.

Regards,
Rajeshwari Shinde

Quoted 34 lines · Minkyu Kang
Quoted 18 lines · Rajeshwari Shinde

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

Quoted 6 lines
 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 at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
Regards,
Rajeshwari Shinde