All of lore.kernel.org
 help / color / mirror / Atom feed
From: Piotr Wilczek <p.wilczek@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V3 07/12] board:samsung:common: move max77686 init function
Date: Tue, 25 Feb 2014 15:33:22 +0100	[thread overview]
Message-ID: <1393338807-6146-8-git-send-email-p.wilczek@samsung.com> (raw)
In-Reply-To: <1393338807-6146-1-git-send-email-p.wilczek@samsung.com>

This patch moves board specific max77686 init function from
common board to smdk5250 board file.

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Rajeshwari S Shinde <rajeshwari.s@samsung.com>
Cc: Rajeshwari Birje <rajeshwari.birje@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes for v3:
 - max77686 init function is moved to smdk5250 board file

Changes for v2:
 - new patch

 board/samsung/common/board.c      | 120 ------------------------------------
 board/samsung/smdk5250/smdk5250.c | 125 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 120 deletions(-)

diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index cf78d36..a74b044 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -22,7 +22,6 @@
 #include <asm/arch/power.h>
 #include <power/pmic.h>
 #include <asm/arch/sromc.h>
-#include <power/max77686_pmic.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -175,129 +174,10 @@ static int board_init_cros_ec_devices(const void *blob)
 #endif
 
 #if defined(CONFIG_POWER)
-#ifdef CONFIG_POWER_MAX77686
-static int pmic_reg_update(struct pmic *p, int reg, uint regval)
-{
-	u32 val;
-	int ret = 0;
-
-	ret = pmic_reg_read(p, reg, &val);
-	if (ret) {
-		debug("%s: PMIC %d register read failed\n", __func__, reg);
-		return -1;
-	}
-	val |= regval;
-	ret = pmic_reg_write(p, reg, val);
-	if (ret) {
-		debug("%s: PMIC %d register write failed\n", __func__, reg);
-		return -1;
-	}
-	return 0;
-}
-
-static int max77686_init(void)
-{
-	struct pmic *p;
-
-	if (pmic_init(I2C_PMIC))
-		return -1;
-
-	p = pmic_get("MAX77686_PMIC");
-	if (!p)
-		return -ENODEV;
-
-	if (pmic_probe(p))
-		return -1;
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_32KHZ, MAX77686_32KHCP_EN))
-		return -1;
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_BBAT,
-			    MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V))
-		return -1;
-
-	/* VDD_MIF */
-	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1OUT,
-			   MAX77686_BUCK1OUT_1V)) {
-		debug("%s: PMIC %d register write failed\n", __func__,
-		      MAX77686_REG_PMIC_BUCK1OUT);
-		return -1;
-	}
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK1CRTL,
-			    MAX77686_BUCK1CTRL_EN))
-		return -1;
-
-	/* VDD_ARM */
-	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2DVS1,
-			   MAX77686_BUCK2DVS1_1_3V)) {
-		debug("%s: PMIC %d register write failed\n", __func__,
-		      MAX77686_REG_PMIC_BUCK2DVS1);
-		return -1;
-	}
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK2CTRL1,
-			    MAX77686_BUCK2CTRL_ON))
-		return -1;
-
-	/* VDD_INT */
-	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3DVS1,
-			   MAX77686_BUCK3DVS1_1_0125V)) {
-		debug("%s: PMIC %d register write failed\n", __func__,
-		      MAX77686_REG_PMIC_BUCK3DVS1);
-		return -1;
-	}
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK3CTRL,
-			    MAX77686_BUCK3CTRL_ON))
-		return -1;
-
-	/* VDD_G3D */
-	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4DVS1,
-			   MAX77686_BUCK4DVS1_1_2V)) {
-		debug("%s: PMIC %d register write failed\n", __func__,
-		      MAX77686_REG_PMIC_BUCK4DVS1);
-		return -1;
-	}
-
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK4CTRL1,
-			    MAX77686_BUCK3CTRL_ON))
-		return -1;
-
-	/* VDD_LDO2 */
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO2CTRL1,
-			    MAX77686_LD02CTRL1_1_5V | EN_LDO))
-		return -1;
-
-	/* VDD_LDO3 */
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO3CTRL1,
-			    MAX77686_LD03CTRL1_1_8V | EN_LDO))
-		return -1;
-
-	/* VDD_LDO5 */
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO5CTRL1,
-			    MAX77686_LD05CTRL1_1_8V | EN_LDO))
-		return -1;
-
-	/* VDD_LDO10 */
-	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO10CTRL1,
-			    MAX77686_LD10CTRL1_1_8V | EN_LDO))
-		return -1;
-
-	return 0;
-}
-#endif
-
 int power_init_board(void)
 {
-	int ret = 0;
-
 	set_ps_hold_ctrl();
 
-#ifdef CONFIG_POWER_MAX77686
-	ret = max77686_init();
-#endif
-
 	return exynos_power_init();
 }
 #endif
diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index a69f73d..28a6d9e 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -147,6 +147,131 @@ void board_i2c_init(const void *blob)
 	}
 }
 
+#if defined(CONFIG_POWER)
+#ifdef CONFIG_POWER_MAX77686
+static int pmic_reg_update(struct pmic *p, int reg, uint regval)
+{
+	u32 val;
+	int ret = 0;
+
+	ret = pmic_reg_read(p, reg, &val);
+	if (ret) {
+		debug("%s: PMIC %d register read failed\n", __func__, reg);
+		return -1;
+	}
+	val |= regval;
+	ret = pmic_reg_write(p, reg, val);
+	if (ret) {
+		debug("%s: PMIC %d register write failed\n", __func__, reg);
+		return -1;
+	}
+	return 0;
+}
+
+static int max77686_init(void)
+{
+	struct pmic *p;
+
+	if (pmic_init(I2C_PMIC))
+		return -1;
+
+	p = pmic_get("MAX77686_PMIC");
+	if (!p)
+		return -ENODEV;
+
+	if (pmic_probe(p))
+		return -1;
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_32KHZ, MAX77686_32KHCP_EN))
+		return -1;
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_BBAT,
+			    MAX77686_BBCHOSTEN | MAX77686_BBCVS_3_5V))
+		return -1;
+
+	/* VDD_MIF */
+	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK1OUT,
+			   MAX77686_BUCK1OUT_1V)) {
+		debug("%s: PMIC %d register write failed\n", __func__,
+		      MAX77686_REG_PMIC_BUCK1OUT);
+		return -1;
+	}
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK1CRTL,
+			    MAX77686_BUCK1CTRL_EN))
+		return -1;
+
+	/* VDD_ARM */
+	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK2DVS1,
+			   MAX77686_BUCK2DVS1_1_3V)) {
+		debug("%s: PMIC %d register write failed\n", __func__,
+		      MAX77686_REG_PMIC_BUCK2DVS1);
+		return -1;
+	}
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK2CTRL1,
+			    MAX77686_BUCK2CTRL_ON))
+		return -1;
+
+	/* VDD_INT */
+	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK3DVS1,
+			   MAX77686_BUCK3DVS1_1_0125V)) {
+		debug("%s: PMIC %d register write failed\n", __func__,
+		      MAX77686_REG_PMIC_BUCK3DVS1);
+		return -1;
+	}
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK3CTRL,
+			    MAX77686_BUCK3CTRL_ON))
+		return -1;
+
+	/* VDD_G3D */
+	if (pmic_reg_write(p, MAX77686_REG_PMIC_BUCK4DVS1,
+			   MAX77686_BUCK4DVS1_1_2V)) {
+		debug("%s: PMIC %d register write failed\n", __func__,
+		      MAX77686_REG_PMIC_BUCK4DVS1);
+		return -1;
+	}
+
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_BUCK4CTRL1,
+			    MAX77686_BUCK3CTRL_ON))
+		return -1;
+
+	/* VDD_LDO2 */
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO2CTRL1,
+			    MAX77686_LD02CTRL1_1_5V | EN_LDO))
+		return -1;
+
+	/* VDD_LDO3 */
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO3CTRL1,
+			    MAX77686_LD03CTRL1_1_8V | EN_LDO))
+		return -1;
+
+	/* VDD_LDO5 */
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO5CTRL1,
+			    MAX77686_LD05CTRL1_1_8V | EN_LDO))
+		return -1;
+
+	/* VDD_LDO10 */
+	if (pmic_reg_update(p, MAX77686_REG_PMIC_LDO10CTRL1,
+			    MAX77686_LD10CTRL1_1_8V | EN_LDO))
+		return -1;
+
+	return 0;
+}
+#endif	/* CONFIG_POWER_MAX77686 */
+
+int exynos_power_init(void)
+{
+	int ret = 0;
+
+#ifdef CONFIG_POWER_MAX77686
+	ret = max77686_init();
+#endif
+	return ret;
+}
+#endif	/* CONFIG_POWER */
+
 #ifdef CONFIG_LCD
 void exynos_cfg_lcd_gpio(void)
 {
-- 
1.8.3.2

  parent reply	other threads:[~2014-02-25 14:33 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 14:15 [U-Boot] [PATCH 0/9] Exynos4: add support for device tree Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 1/9] exynos4:pinmux:fdt: decode peripheral id Piotr Wilczek
2014-01-28  8:54   ` Jaehoon Chung
2014-01-28 12:13     ` Piotr Wilczek
2014-01-29  8:03       ` Minkyu Kang
2014-01-27 14:15 ` [U-Boot] [PATCH 2/9] video:mipidsim:fdt: Add DT support for mipi dsim driver Piotr Wilczek
2014-02-07  7:53   ` Minkyu Kang
2014-02-07  8:43     ` Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 3/9] video:exynos_fb:fdt: add additional fdt data Piotr Wilczek
2014-02-07  7:53   ` Minkyu Kang
2014-02-07  8:19     ` Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 4/9] drivers:mmc:sdhci: enable support for DT Piotr Wilczek
2014-01-28  9:42   ` Jaehoon Chung
2014-01-28 12:31     ` Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 5/9] arm:exynos: add common board file for exynos 4 Piotr Wilczek
2014-02-07  7:52   ` Minkyu Kang
2014-02-07  8:40     ` Piotr Wilczek
2014-02-07  9:47       ` Minkyu Kang
2014-02-10  8:52         ` Piotr Wilczek
2014-02-10  9:09           ` Minkyu Kang
2014-01-27 14:15 ` [U-Boot] [PATCH 6/9] board:origen:fdt: Enable device tree on Origen Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 7/9] board:universal:fdt: Enable device tree on Universal Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 8/9] trats:fdt: Enable device tree on Trats Piotr Wilczek
2014-01-27 14:15 ` [U-Boot] [PATCH 9/9] board:trats2:fdt: Enable device tree on Trats2 Piotr Wilczek
2014-01-28  9:47   ` Jaehoon Chung
2014-01-28 12:41     ` Piotr Wilczek
2014-02-13 14:10 ` [U-Boot] [PATCH V2 00/12] Exynos4: add support for device tree Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 01/12] exynos4:pinmux:fdt: decode peripheral id Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 02/12] video:mipidsim:fdt: Add DT support for mipi dsim driver Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 03/12] video:exynos_fb:fdt: add additional fdt data Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 04/12] drivers:mmc:sdhci: enable support for DT Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 05/12] board:samsung:common: remove unused max77686 init function Piotr Wilczek
2014-02-14  5:32     ` Rajeshwari Birje
2014-02-14  9:48       ` Piotr Wilczek
2014-02-14 11:40         ` Rajeshwari Birje
2014-02-22  7:37           ` Minkyu Kang
2014-02-24  6:39             ` Piotr Wilczek
2014-02-24 10:05               ` Minkyu Kang
2014-02-13 14:10   ` [U-Boot] [PATCH V2 06/12] board:samsung: move checkboard to common file Piotr Wilczek
2014-02-14  5:35     ` Rajeshwari Birje
2014-02-13 14:10   ` [U-Boot] [PATCH V2 07/12] arm:exynos: add common DTS file for exynos 4 Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 08/12] arm:exynos: enble sdhci and misc_init to common board Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 09/12] board:origen: Enable device tree on Origen Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 10/12] board:universal: Enable device tree on Universal Piotr Wilczek
2014-02-14  8:53     ` Przemyslaw Marczak
2014-02-13 14:10   ` [U-Boot] [PATCH V2 11/12] board:trats: Enable device tree on Trats Piotr Wilczek
2014-02-13 14:10   ` [U-Boot] [PATCH V2 12/12] board:trats2: Enable device tree on Trats2 Piotr Wilczek
2014-02-25 14:33 ` [U-Boot] [PATCH V3 00/12] Exynos4: add support for device tree Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 01/12] exynos4:pinmux:fdt: decode peripheral id Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 02/12] video:mipidsim:fdt: Add DT support for mipi dsim driver Piotr Wilczek
2014-02-27 14:59     ` Ajay kumar
2014-02-28  7:48       ` Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 03/12] video:exynos_fb:fdt: add additional fdt data Piotr Wilczek
2014-02-27 13:50     ` Ajay kumar
2014-02-27 14:10       ` Ajay kumar
2014-02-28  8:54         ` Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 04/12] drivers:mmc:sdhci: enable support for DT Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 05/12] board:samsung: move checkboard to common file Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 06/12] arm:exynos: add common DTS file for exynos 4 Piotr Wilczek
2014-02-25 14:33   ` Piotr Wilczek [this message]
2014-02-25 14:33   ` [U-Boot] [PATCH V3 08/12] arm:exynos: enable sdhci and misc_init to common board Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 09/12] board:origen: Enable device tree on Origen Piotr Wilczek
2014-02-26  2:47     ` Minkyu Kang
2014-02-25 14:33   ` [U-Boot] [PATCH V3 10/12] board:universal: Enable device tree on Universal Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 11/12] board:trats: Enable device tree on Trats Piotr Wilczek
2014-02-25 14:33   ` [U-Boot] [PATCH V3 12/12] board:trats2: Enable device tree on Trats2 Piotr Wilczek
2014-03-04 13:55 ` [U-Boot] [PATCH V4 00/12] Exynos4: add support for device tree Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 01/12] exynos4:pinmux:fdt: decode peripheral id Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 02/12] video:mipidsim:fdt: Add DT support for mipi dsim driver Piotr Wilczek
2014-03-05  6:16     ` Ajay kumar
2014-03-05  6:57       ` Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 03/12] video:exynos_fb:fdt: add additional fdt data Piotr Wilczek
2014-03-05  6:06     ` Ajay kumar
2014-03-05  7:11       ` Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 04/12] drivers:mmc:sdhci: enable support for DT Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 05/12] board:samsung: move checkboard to common file Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 06/12] arm:exynos: add common DTS file for exynos 4 Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 07/12] board:samsung:common: move max77686 init function Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 08/12] arm:exynos: enable sdhci and misc_init to common board Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 09/12] board:origen: Enable device tree on Origen Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 10/12] board:universal: Enable device tree on Universal Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 11/12] board:trats: Enable device tree on Trats Piotr Wilczek
2014-03-04 13:55   ` [U-Boot] [PATCH V4 12/12] board:trats2: Enable device tree on Trats2 Piotr Wilczek
2014-03-07 13:59 ` [U-Boot] [PATCH V5 00/12] Exynos4: add support for device tree Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 01/12] exynos4:pinmux:fdt: decode peripheral id Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 02/12] video:mipidsim:fdt: Add DT support for mipi dsim driver Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 03/12] video:exynos_fb:fdt: add additional fdt data Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 04/12] drivers:mmc:sdhci: enable support for DT Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 05/12] board:samsung: move checkboard to common file Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 06/12] arm:exynos: add common DTS file for exynos 4 Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 07/12] board:samsung:common: move max77686 init function Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 08/12] arm:exynos: enable sdhci and misc_init to common board Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 09/12] board:origen: Enable device tree on Origen Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 10/12] board:universal: Enable device tree on Universal Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 11/12] board:trats: Enable device tree on Trats Piotr Wilczek
2014-03-07 13:59   ` [U-Boot] [PATCH V5 12/12] board:trats2: Enable device tree on Trats2 Piotr Wilczek
2014-03-12 11:59   ` [U-Boot] [PATCH V5 00/12] Exynos4: add support for device tree Minkyu Kang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393338807-6146-8-git-send-email-p.wilczek@samsung.com \
    --to=p.wilczek@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.