From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2 3/3] ARM: phyCORE-i.MX8M SOM: add pmic initialisation for power good
Date: Thu, 30 Jan 2020 19:00:53 +0100 [thread overview]
Message-ID: <20200130180053.30000-3-m.grzeschik@pengutronix.de> (raw)
In-Reply-To: <20200130180053.30000-1-m.grzeschik@pengutronix.de>
This patch is adding the same PMIC handling as the u-boot spl does for
this Board. It ensures sane defaults.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
arch/arm/boards/phytec-som-imx8mq/board.c | 38 +++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/arch/arm/boards/phytec-som-imx8mq/board.c b/arch/arm/boards/phytec-som-imx8mq/board.c
index 4fd098c5f6..7df53a7cfb 100644
--- a/arch/arm/boards/phytec-som-imx8mq/board.c
+++ b/arch/arm/boards/phytec-som-imx8mq/board.c
@@ -10,9 +10,45 @@
#include <init.h>
#include <linux/sizes.h>
#include <mach/bbu.h>
+#include <mfd/pfuze.h>
#include <envfs.h>
+#define PFUZE100_DEVICEID 0x0
+#define PFUZE100_REVID 0x3
+
+#define PFUZE100_SW1ABMODE 0x23
+#define PFUZE100_SW2MODE 0x38
+#define PFUZE100_SW1CMODE 0x31
+#define PFUZE100_SW3AVOL 0x3c
+
+#define APS_PFM 0xc
+
+static void imx8mq_setup_pmic_voltages(struct regmap *map)
+{
+ int offset = PFUZE100_SW1CMODE;
+ int switch_num = 6;
+ int val, i;
+
+ regmap_read(map, PFUZE100_SW3AVOL, &val);
+
+ /* ensure the correct VDD_DRAM_0V9 output voltage */
+ regmap_write_bits(map, PFUZE100_SW3AVOL, 0x3f, 0x18);
+
+ /* pfuze200 */
+ regmap_read(map, PFUZE100_DEVICEID, &val);
+ if (val & 0xf) {
+ offset = PFUZE100_SW2MODE;
+ switch_num = 4;
+ }
+
+ /* set all switches APS in normal and PFM mode in standby */
+ regmap_write(map, PFUZE100_SW1ABMODE, APS_PFM);
+
+ for (i = 0; i < switch_num - 1; i++)
+ regmap_write(map, offset + i * 7, APS_PFM);
+}
+
static int physom_imx8mq_devices_init(void)
{
int flag_emmc = 0;
@@ -23,6 +59,8 @@ static int physom_imx8mq_devices_init(void)
barebox_set_hostname("phycore-imx8mq");
+ pfuze_register_init_callback(imx8mq_setup_pmic_voltages);
+
switch (bootsource_get_instance()) {
case 0:
flag_emmc = BBU_HANDLER_FLAG_DEFAULT;
--
2.25.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
prev parent reply other threads:[~2020-01-30 18:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 18:00 [PATCH v2 1/3] regulator: pfuze: remove unsued define Michael Grzeschik
2020-01-30 18:00 ` [PATCH v2 2/3] regulator: pfuze: add support to other architectures Michael Grzeschik
2020-02-03 8:24 ` Sascha Hauer
2020-01-30 18:00 ` Michael Grzeschik [this message]
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=20200130180053.30000-3-m.grzeschik@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox