[PATCH v3 00/14] MXS low-level improvements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While porting barebox onto a new old MX28 board, I had to extend the
low-level code to set up SDRAM and PMIC. Most of those changes are
probably also applicable to MX23 boards since the code paths are the
same, and are only wrapped in mx28_*/mx23_*-specific wrapper functions.

(Also, if anyone wants to port these changes back to U-Boot, feel free
to do so, it's the same code ☺)

Changes in v2 -> v3: (see diff below)
  - 07/14 "ARM: MXS: refactor mx2*_power_init source configuration":
    refactor power_config & __POWER_USE_MASK statments into new
    inline function mxs_power_config_get_use(), as proposed by Andrey
    Smirnov

Changes in v1 -> v2:
  - include cleaner memory size detection by Sascha, also for i.MX23
  - call mxs_mem_init_clock() explicitely from board code instead of
    passing the clock dividers through mx*_mem_init()
  - add parameter documentation for mxs_mem_init_clock()
  - Documentation: back-pedal on the statment that all boards are ported
    to barebox bootlets, there are still some i.MX23 boards that need
    Freescale bootlet code

Roland Hieber (11):
  images: MXS: allow generation of unencrypted bootstreams
  ARM: MXS: i.MX28: allow setup of low-voltage SDRAM
  ARM: MXS: allow configuration of EMI clock prescaler
  ARM: MXS: refactor mx2*_power_init source configuration
  ARM: MXS: allow starting from battery input without 4P2 source enabled
  ARM: MXS: make power levels configurable in mx2*_power_init
  ARM: MXS: fix VDDx brownout setup logic
  ARM: MXS: make VDDx brownout setup more understandable
  ARM: MXS: mxs_power_status: use less magic values
  ARM: MXS: mxs_power_status: align output
  Documentation: MXS: general update and improvements

Sascha Hauer (3):
  scripts: mxsimage: Allow unencrypted images
  ARM: i.MX28: Add memory size detection
  ARM: i.MX23: Add memory size detection

 Documentation/boards/mxs.rst                  |  97 ++++++-----
 .../arm/boards/chumby_falconwing/falconwing.c |   8 -
 .../boards/crystalfontz-cfa10036/cfa10036.c   |  24 ---
 arch/arm/boards/duckbill/lowlevel.c           |   7 +-
 arch/arm/boards/freescale-mx23-evk/mx23-evk.c |   8 -
 arch/arm/boards/freescale-mx28-evk/lowlevel.c |   8 +-
 arch/arm/boards/freescale-mx28-evk/mx28-evk.c |   8 -
 .../boards/imx233-olinuxino/imx23-olinuxino.c |   8 -
 arch/arm/boards/imx233-olinuxino/lowlevel.c   |   4 +-
 arch/arm/boards/karo-tx28/lowlevel.c          |   8 +-
 arch/arm/boards/karo-tx28/tx28.c              |   8 -
 arch/arm/mach-mxs/include/mach/imx23.h        |  29 ++++
 arch/arm/mach-mxs/include/mach/imx28.h        |  30 ++++
 arch/arm/mach-mxs/include/mach/init.h         |  53 +++++-
 arch/arm/mach-mxs/mem-init.c                  |  28 ++-
 arch/arm/mach-mxs/power-init.c                | 162 +++++++++++-------
 arch/arm/mach-mxs/soc-imx23.c                 |   4 +
 arch/arm/mach-mxs/soc-imx28.c                 |   4 +
 images/Makefile.mxs                           |   8 +
 scripts/mxsimage.c                            |  53 +++---
 20 files changed, 336 insertions(+), 223 deletions(-)
 create mode 100644 arch/arm/mach-mxs/include/mach/imx23.h
 create mode 100644 arch/arm/mach-mxs/include/mach/imx28.h

--
Diff v2 -> v3:

diff --git a/arch/arm/mach-mxs/include/mach/init.h b/arch/arm/mach-mxs/include/mach/init.h
index 281e458d97..53c1e05634 100644
--- a/arch/arm/mach-mxs/include/mach/init.h
+++ b/arch/arm/mach-mxs/include/mach/init.h
@@ -24,9 +24,13 @@ 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,
 };
+extern int power_config;
+static inline enum mxs_power_config mxs_power_config_get_use(void) {
+	return (power_config & 0b00000011);
+}
+
 
 struct mxs_power_ctrl {
 	uint32_t target;	/*< target voltage */
diff --git a/arch/arm/mach-mxs/power-init.c b/arch/arm/mach-mxs/power-init.c
index 796d3ae259..ca7c349d7f 100644
--- a/arch/arm/mach-mxs/power-init.c
+++ b/arch/arm/mach-mxs/power-init.c
@@ -24,7 +24,7 @@
 #include <mach/regs-rtc.h>
 #include <mach/regs-lradc.h>
 
-static int power_config;
+int power_config;
 
 static void mxs_power_status(void)
 {
@@ -503,8 +503,8 @@ static void mxs_power_enable_4p2(void)
 		POWER_5VCTRL_HEADROOM_ADJ_MASK,
 		0x4 << POWER_5VCTRL_HEADROOM_ADJ_OFFSET);
 
-	if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY ||
-	    (power_config & __POWER_USE_MASK) == POWER_USE_BATTERY_INPUT)
+	if (mxs_power_config_get_use() == POWER_USE_BATTERY ||
+	    mxs_power_config_get_use() == POWER_USE_BATTERY_INPUT)
 		dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_SEL;
 	else
 		dropout_ctrl = POWER_DCDC4P2_DROPOUT_CTRL_SRC_4P2;
@@ -1210,11 +1210,11 @@ void mx23_power_init(const int config, struct mxs_power_ctrls *ctrls)
 
 	mxs_src_power_init();
 
-	if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY)
+	if (mxs_power_config_get_use() == POWER_USE_BATTERY)
 		mxs_power_configure_power_source();
-	else if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY_INPUT)
+	else if (mxs_power_config_get_use() == POWER_USE_BATTERY_INPUT)
 		mxs_enable_battery_input();
-	else if ((power_config & __POWER_USE_MASK) == POWER_USE_5V)
+	else if (mxs_power_config_get_use() == POWER_USE_5V)
 		mxs_boot_valid_5v();
 
 	mxs_power_clock2pll();
@@ -1285,11 +1285,11 @@ void mx28_power_init(const int config, struct mxs_power_ctrls *ctrls)
 
 	mxs_src_power_init();
 
-	if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY)
+	if (mxs_power_config_get_use() == POWER_USE_BATTERY)
 		mxs_power_configure_power_source();
-	else if ((power_config & __POWER_USE_MASK) == POWER_USE_BATTERY_INPUT)
+	else if (mxs_power_config_get_use() == POWER_USE_BATTERY_INPUT)
 		mxs_enable_battery_input();
-	else if ((power_config & __POWER_USE_MASK) == POWER_USE_5V)
+	else if (mxs_power_config_get_use() == POWER_USE_5V)
 		mxs_boot_valid_5v();
 
 	mxs_power_clock2pll();
-- 
2.18.0

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




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux