mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Stefan Riedmueller <s.riedmueller@phytec.de>
Subject: [PATCH 07/16] ARM: i.MX: phytec-som-imx6: phycore: Set BUCK mode to SYNC
Date: Thu, 12 Apr 2018 09:30:08 +0200	[thread overview]
Message-ID: <20180412073017.6750-8-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20180412073017.6750-1-s.hauer@pengutronix.de>

From: Christian Hemp <c.hemp@phytec.de>

Set the BUCK mode for all BUCKS (1-4) from BUCK_MODE_AUTO to
BUCK_MODE_SYNC.  If the BUCKs are in BUCK_MODE_AUTO in very rare cases
it is possible that the BUCK goes in power down mode.

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Stefan Riedmueller <s.riedmueller@phytec.de>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
---
 arch/arm/boards/phytec-som-imx6/board.c | 51 +++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c
index 7b63ee0e0c..f9b6cf55cd 100644
--- a/arch/arm/boards/phytec-som-imx6/board.c
+++ b/arch/arm/boards/phytec-som-imx6/board.c
@@ -28,6 +28,7 @@
 #include <gpio.h>
 #include <init.h>
 #include <of.h>
+#include <i2c/i2c.h>
 #include <mach/bbu.h>
 #include <platform_data/eth-fec.h>
 #include <mfd/imx6q-iomuxc-gpr.h>
@@ -51,6 +52,14 @@
 
 #define MX6_PHYFLEX_ERR006282	IMX_GPIO_NR(2, 11)
 
+#define DA9062_I2C_ADDRESS		0x58
+
+#define DA9062_BUCK1_CFG		0x9e
+#define DA9062_BUCK2_CFG		0x9d
+#define DA9062_BUCK3_CFG		0xa0
+#define DA9062_BUCK4_CFG		0x9f
+#define DA9062_BUCKx_MODE_SYNCHRONOUS	(2 << 6)
+
 static void phyflex_err006282_workaround(void)
 {
 	/*
@@ -96,6 +105,45 @@ int ksz8081_phy_fixup(struct phy_device *phydev)
 	return 0;
 }
 
+static int phycore_da9062_setup_buck_mode(void)
+{
+	struct i2c_adapter *adapter = NULL;
+	struct i2c_client client;
+	unsigned char value;
+	int bus = 0;
+	int ret;
+
+	adapter = i2c_get_adapter(bus);
+	if (!adapter)
+		return -ENODEV;
+
+	client.adapter = adapter;
+	client.addr = DA9062_I2C_ADDRESS;
+
+	value = DA9062_BUCKx_MODE_SYNCHRONOUS;
+
+	ret = i2c_write_reg(&client, DA9062_BUCK1_CFG, &value, 1);
+	if (ret != 1)
+		goto err_out;
+
+	ret = i2c_write_reg(&client, DA9062_BUCK2_CFG, &value, 1);
+	if (ret != 1)
+		goto err_out;
+
+	ret = i2c_write_reg(&client, DA9062_BUCK3_CFG, &value, 1);
+	if (ret != 1)
+		goto err_out;
+
+	ret = i2c_write_reg(&client, DA9062_BUCK4_CFG, &value, 1);
+	if (ret != 1)
+		goto err_out;
+
+	return 0;
+
+err_out:
+	return ret;
+}
+
 static int physom_imx6_devices_init(void)
 {
 	int ret;
@@ -127,6 +175,9 @@ static int physom_imx6_devices_init(void)
 		|| of_machine_is_compatible("phytec,imx6dl-pcm058-nand")
 		|| of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) {
 
+		if (phycore_da9062_setup_buck_mode())
+			pr_err("Setting PMIC BUCK mode failed\n");
+
 		barebox_set_hostname("phyCORE-i.MX6");
 		default_environment_path = "/chosen/environment-spinor";
 		default_envdev = "SPI NOR flash";
-- 
2.16.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-04-12  7:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  7:30 [PATCH 00/16] ARM: i.MX: phyCORE/phyFLEX i.MX6 updates Sascha Hauer
2018-04-12  7:30 ` [PATCH 01/16] ARM: i.MX: phytec-som-imx: Remove kernel and oftree partiton in NAND Sascha Hauer
2018-04-12  7:30 ` [PATCH 02/16] ARM: i.MX: phytec-som-imx: env: automount emmc if available Sascha Hauer
2018-04-12  7:30 ` [PATCH 03/16] ARM: i.MX: phytec-som-imx: env: add boot script for emmc Sascha Hauer
2018-04-12  7:30 ` [PATCH 04/16] ARM: i.MX: phytec-som-imx: env: add android boot options Sascha Hauer
2018-04-12  7:30 ` [PATCH 05/16] ARM: dts: imx6qdl: phycore: Sync muxing with kernel Sascha Hauer
2018-04-12  7:30 ` [PATCH 06/16] ARM: i.MX: phytec-som-imx6: add boot device emmc Sascha Hauer
2018-04-12  7:30 ` Sascha Hauer [this message]
2018-04-12  7:30 ` [PATCH 08/16] ARM: i.MX: phyFLEX: Change Ram Timing for i.MX6 DualLite\Solo (400 MHz) Sascha Hauer
2018-04-12  7:30 ` [PATCH 09/16] ARM: dts: phyCORE-imx6: Add SPINOR env node Sascha Hauer
2018-04-12  7:30 ` [PATCH 10/16] ARM: i.MX: phytec-som-imx6: add phyCORE-i.MX6 QuadPlus with 1GiB RAM Sascha Hauer
2018-04-12  7:30 ` [PATCH 11/16] ARM: i.MX: phytec-som-imx6: add phyCORE-i.MX6 Solo " Sascha Hauer
2018-04-12  7:30 ` [PATCH 12/16] ARM: dts: imx6: phyboard-mira: Add usb support Sascha Hauer
2018-04-12  7:30 ` [PATCH 13/16] ARM: dts: imx6: phyboard-mira: Enable usb host and usb otg port Sascha Hauer
2018-04-12  7:30 ` [PATCH 14/16] ARM: dts: imx6: phyboard-mira: Remove unecessary iomuxc subnode Sascha Hauer
2018-04-12  7:30 ` [PATCH 15/16] ARM: dts: phycore-imx6: Use generic jedec spi nor compatible Sascha Hauer
2018-04-12  7:30 ` [PATCH 16/16] ARM: i.MX: phytec-som-imx6: Change kernel boot image to zImage Sascha Hauer

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=20180412073017.6750-8-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.riedmueller@phytec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox