mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <r.hieber@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Roland Hieber <r.hieber@pengutronix.de>
Subject: [PATCH v2 08/14] ARM: MXS: allow starting from battery input without 4P2 source enabled
Date: Fri, 10 Aug 2018 18:34:54 +0200	[thread overview]
Message-ID: <20180810163500.12042-9-r.hieber@pengutronix.de> (raw)
In-Reply-To: <20180810163500.12042-1-r.hieber@pengutronix.de>

Some boards don't need the 4.2V power source at all, so allow them to
keep it disabled for efficiency reasons.

For backwards compatibility, don't disable the 4P2 power source on the
existing boards which are supplied from battery input.

The POWER_USE_5V code path however always enables it up as it is needed
to supply the DC-DC converter.

Signed-off-by: Roland Hieber <r.hieber@pengutronix.de>
---
 arch/arm/boards/freescale-mx28-evk/lowlevel.c | 2 +-
 arch/arm/boards/karo-tx28/lowlevel.c          | 2 +-
 arch/arm/mach-mxs/include/mach/init.h         | 2 ++
 arch/arm/mach-mxs/power-init.c                | 3 ++-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/freescale-mx28-evk/lowlevel.c b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
index b6a8793c9e..fdaef959a3 100644
--- a/arch/arm/boards/freescale-mx28-evk/lowlevel.c
+++ b/arch/arm/boards/freescale-mx28-evk/lowlevel.c
@@ -43,7 +43,7 @@ static noinline void freescale_mx28evk_init(void)
 
 	pr_debug("initializing power...\n");
 
-	mx28_power_init(POWER_USE_BATTERY_INPUT);
+	mx28_power_init(POWER_USE_BATTERY_INPUT | POWER_ENABLE_4P2);
 
 	pr_debug("initializing SDRAM...\n");
 
diff --git a/arch/arm/boards/karo-tx28/lowlevel.c b/arch/arm/boards/karo-tx28/lowlevel.c
index 5a6a3e3519..a9b65167cd 100644
--- a/arch/arm/boards/karo-tx28/lowlevel.c
+++ b/arch/arm/boards/karo-tx28/lowlevel.c
@@ -43,7 +43,7 @@ static noinline void karo_tx28_init(void)
 
 	pr_debug("initializing power...\n");
 
-	mx28_power_init(POWER_USE_BATTERY_INPUT);
+	mx28_power_init(POWER_USE_BATTERY_INPUT | POWER_ENABLE_4P2);
 
 	pr_debug("initializing SDRAM...\n");
 
diff --git a/arch/arm/mach-mxs/include/mach/init.h b/arch/arm/mach-mxs/include/mach/init.h
index 46cf514a86..b62fea9657 100644
--- a/arch/arm/mach-mxs/include/mach/init.h
+++ b/arch/arm/mach-mxs/include/mach/init.h
@@ -18,12 +18,14 @@ void mxs_early_delay(int delay);
  * - POWER_USE_BATTERY: use battery input when the system is supplied by a battery
  * - POWER_USE_BATTERY_INPUT: use battery input when the system is supplied by
  *   a DC source (instead of a real battery) on the battery input
+ * - POWER_ENABLE_4P2: power up the 4P2 regulator (implied for POWER_USE_5V)
  */
 enum mxs_power_config {
 	POWER_USE_5V			= 0b00000000,
 	POWER_USE_BATTERY		= 0b00000001,
 	POWER_USE_BATTERY_INPUT		= 0b00000010,
 	__POWER_USE_MASK		= 0b00000011,
+	POWER_ENABLE_4P2		= 0b00000100,
 };
 
 void mx23_power_init(const int config);
diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
index a07ff9d676..2984c0c5ff 100644
--- a/arch/arm/mach-mxs/power-init.c
+++ b/arch/arm/mach-mxs/power-init.c
@@ -717,7 +717,8 @@ static void mxs_enable_battery_input(void)
 		POWER_5VCTRL_CHARGE_4P2_ILIMIT_MASK,
 		0x8 << POWER_5VCTRL_CHARGE_4P2_ILIMIT_OFFSET);
 
-	mxs_power_enable_4p2();
+	if (power_config & POWER_ENABLE_4P2)
+		mxs_power_enable_4p2();
 }
 
 /**
-- 
2.18.0


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

  parent reply	other threads:[~2018-08-10 16:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10 16:34 [PATCH v2 00/14] MXS low-level improvements Roland Hieber
2018-08-10 16:34 ` [PATCH v2 01/14] scripts: mxsimage: Allow unencrypted images Roland Hieber
2018-08-10 16:34 ` [PATCH v2 02/14] images: MXS: allow generation of unencrypted bootstreams Roland Hieber
2018-08-10 16:34 ` [PATCH v2 03/14] ARM: MXS: i.MX28: allow setup of low-voltage SDRAM Roland Hieber
2018-08-10 16:34 ` [PATCH v2 04/14] ARM: MXS: allow configuration of EMI clock prescaler Roland Hieber
2018-08-10 16:34 ` [PATCH v2 05/14] ARM: i.MX28: Add memory size detection Roland Hieber
2018-08-10 16:34 ` [PATCH v2 06/14] ARM: i.MX23: " Roland Hieber
2018-08-10 19:14   ` Andrey Smirnov
2018-08-10 16:34 ` [PATCH v2 07/14] ARM: MXS: refactor mx2*_power_init source configuration Roland Hieber
2018-08-10 19:29   ` Andrey Smirnov
2018-08-13 13:04     ` Roland Hieber
2018-08-10 16:34 ` Roland Hieber [this message]
2018-08-10 16:34 ` [PATCH v2 09/14] ARM: MXS: make power levels configurable in mx2*_power_init Roland Hieber
2018-08-10 16:34 ` [PATCH v2 10/14] ARM: MXS: fix VDDx brownout setup logic Roland Hieber
2018-08-10 16:34 ` [PATCH v2 11/14] ARM: MXS: make VDDx brownout setup more understandable Roland Hieber
2018-08-10 16:34 ` [PATCH v2 12/14] ARM: MXS: mxs_power_status: use less magic values Roland Hieber
2018-08-10 16:34 ` [PATCH v2 13/14] ARM: MXS: mxs_power_status: align output Roland Hieber
2018-08-10 16:35 ` [PATCH v2 14/14] Documentation: MXS: general update and improvements Roland Hieber

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=20180810163500.12042-9-r.hieber@pengutronix.de \
    --to=r.hieber@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