All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joris Offouga <offougajoris@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot]  [RFC 7/9] pico-imx7d: Convert to DM PMIC
Date: Sun, 20 Jan 2019 22:18:56 +0100	[thread overview]
Message-ID: <1548019138-11133-8-git-send-email-offougajoris@gmail.com> (raw)
In-Reply-To: <1548019138-11133-1-git-send-email-offougajoris@gmail.com>

This patch converts the pico-pi-imx7d to use the DM PMIC model.

Signed-off-by: Joris Offouga <offougajoris@gmail.com>
---
 board/technexion/pico-imx7d/pico-imx7d.c | 44 ++++++++++++--------------------
 configs/pico-pi-imx7d_defconfig          |  6 +++++
 include/configs/pico-imx7d.h             |  6 -----
 3 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c
index cd7d5b1..095242d 100644
--- a/board/technexion/pico-imx7d/pico-imx7d.c
+++ b/board/technexion/pico-imx7d/pico-imx7d.c
@@ -40,47 +40,37 @@ int dram_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_POWER
-#define I2C_PMIC	3
+#ifdef CONFIG_DM_PMIC
 int power_init_board(void)
 {
-	struct pmic *p;
-	int ret;
-	unsigned int reg, rev_id;
+	struct udevice *dev;
+	int ret=0, dev_id=0, rev_id=0, reg=0;
 
-	ret = power_pfuze3000_init(I2C_PMIC);
-	if (ret)
-		return ret;
+	ret = pmic_get("pfuze3000", &dev);
+	if (ret == -ENODEV)
+		return 0;
+	if (ret != 0)
 
-	p = pmic_get("PFUZE3000");
-	ret = pmic_probe(p);
-	if (ret)
-		return ret;
-
-	pmic_reg_read(p, PFUZE3000_DEVICEID, &reg);
-	pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
-	printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
+	dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+	rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
+	printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id);
 
 	/* disable Low Power Mode during standby mode */
-	pmic_reg_read(p, PFUZE3000_LDOGCTL, &reg);
-	reg |= 0x1;
-	pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
+	pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
 
 	/* SW1A/1B mode set to APS/APS */
-	reg = 0x8;
-	pmic_reg_write(p, PFUZE3000_SW1AMODE, reg);
-	pmic_reg_write(p, PFUZE3000_SW1BMODE, reg);
+	pmic_reg_write(dev, PFUZE3000_SW1AMODE, 0x8);
+	pmic_reg_write(dev, PFUZE3000_SW1BMODE, 0x8);
 
 	/* SW1A/1B standby voltage set to 1.025V */
-	reg = 0xd;
-	pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg);
-	pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg);
+	pmic_reg_write(dev, PFUZE3000_SW1ASTBY, 0xd);
+	pmic_reg_write(dev, PFUZE3000_SW1BSTBY, 0xd);
 
 	/* decrease SW1B normal voltage to 0.975V */
-	pmic_reg_read(p, PFUZE3000_SW1BVOLT, &reg);
+	reg = pmic_reg_read(dev, PFUZE3000_SW1BVOLT);
 	reg &= ~0x1f;
 	reg |= PFUZE3000_SW1AB_SETP(975);
-	pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg);
+	pmic_reg_write(dev, PFUZE3000_SW1BVOLT, reg);
 
 	return 0;
 }
diff --git a/configs/pico-pi-imx7d_defconfig b/configs/pico-pi-imx7d_defconfig
index 868abb0..24467bd 100644
--- a/configs/pico-pi-imx7d_defconfig
+++ b/configs/pico-pi-imx7d_defconfig
@@ -29,6 +29,12 @@ CONFIG_PINCTRL_IMX7=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_DM_SERIAL=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
 # CONFIG_CMD_BOOTD is not set
 CONFIG_CMD_BOOTMENU=y
 # CONFIG_CMD_IMI is not set
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 82c105b..577cd13 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -120,12 +120,6 @@
 #define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_I2C_SPEED		100000
 
-/* PMIC */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_PFUZE3000
-#define CONFIG_POWER_PFUZE3000_I2C_ADDR	0x08
-
 /* FLASH and environment organization */
 #define CONFIG_ENV_SIZE			SZ_8K
 
-- 
2.7.4

  parent reply	other threads:[~2019-01-20 21:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-20 21:18 [U-Boot] [RFC 0/9] Convert Pico-Pi i.MX7D to DM Joris Offouga
2019-01-20 21:18 ` [U-Boot] [RFC 1/9] Arm: dts: imx7d-pico: Import Linux pico-pi dts Joris Offouga
2019-01-21  9:52   ` Bryan O'Donoghue
2019-01-21 10:34     ` jorisoffouga
2019-01-21 10:58       ` Bryan O'Donoghue
2019-01-21 12:02         ` Offouga Joris
2019-01-23  9:52           ` Bryan O'Donoghue
     [not found]             ` <607bb985-9974-2a92-0016-4c1c1c0d5552@gmail.com>
     [not found]               ` <ffadab1c-6227-2f5f-ef3a-627f166e976b@linaro.org>
     [not found]                 ` <CABymUCNVGCJEQ-fxOYdp-deKLyP9nknfhYNrGZe8R_4wUQf3jg@mail.gmail.com>
     [not found]                   ` <86f6ef94-e40d-cef0-9b5c-06b960c679af@gmail.com>
     [not found]                     ` <CABymUCNaiAcb0uiVfcCfBkSVv7zbQiEnF1XXbnENgL7J9uO+yg@mail.gmail.com>
     [not found]                       ` <ec0fcbc1-cc2e-13f8-6a50-2cd73ffa6cb4@gmail.com>
     [not found]                         ` <CABymUCOuXMYEvOaxsCe--5+WL4A_TC6jNUHYMqpxJ7k-8Y8AdA@mail.gmail.com>
     [not found]                           ` <9d47c97b-2a98-a828-f473-08b8ba7a9aa7@gmail.com>
     [not found]                             ` <CABymUCNyko5QP__=Og77uk2_3R9CEVkcGPKsbjbX_S1VF5BXJA@mail.gmail.com>
2019-01-29  5:50                               ` Offouga Joris
2019-01-31  1:16             ` Fabio Estevam
2019-01-31  3:59               ` Offouga Joris
2019-01-31 11:36                 ` Otavio Salvador
2019-01-31 11:54                   ` Offouga Joris
2019-01-31 12:39                     ` Otavio Salvador
2019-01-31 15:20                       ` Joris Offouga
2019-02-11 20:09                         ` Fabio Estevam
2019-01-20 21:18 ` [U-Boot] [RFC 2/9] Arm: imx7d-pico: Add DT file hooks Joris Offouga
2019-01-20 21:18 ` [U-Boot] [RFC 3/9] pico-pi-imx7d: defconfig Enable DM gpio pinctrl and pinctrl_imx7 Joris Offouga
2019-02-14 12:12   ` Fabio Estevam
2019-01-20 21:18 ` [U-Boot] [RFC 4/9] arm: imx7d-pico-pi: Convert to DM MMC initialization Joris Offouga
2019-02-14 12:14   ` Fabio Estevam
2019-02-14 12:15     ` Offouga Joris
2019-02-14 12:58       ` Fabio Estevam
2019-02-14 16:42         ` Joris Offouga
2019-02-14 16:48           ` Fabio Estevam
2019-02-14 22:45             ` Joris Offouga
2019-02-14 23:08               ` Fabio Estevam
2019-02-14 23:27                 ` Joris Offouga
2019-01-20 21:18 ` [U-Boot] [RFC 5/9] pico-pi-imx7d: defconfig: Switch to DM for I2C Joris Offouga
2019-02-14 12:16   ` Fabio Estevam
2019-01-20 21:18 ` [U-Boot] [RFC 6/9] pico-imx7d-pico: defconfig: Switch to DM for UART Joris Offouga
2019-02-14 12:17   ` Fabio Estevam
2019-01-20 21:18 ` Joris Offouga [this message]
2019-02-14 12:20   ` [U-Boot] [RFC 7/9] pico-imx7d: Convert to DM PMIC Fabio Estevam
2019-01-20 21:18 ` [U-Boot] [RFC 8/9] arm: pico-pi-imx7d: Convert to DM USB Joris Offouga
2019-01-20 21:18 ` [U-Boot] [RFC 9/9] pico-imx7d: Convert to DM Ethernet Joris Offouga

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=1548019138-11133-8-git-send-email-offougajoris@gmail.com \
    --to=offougajoris@gmail.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.