* [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
@ 2018-06-19 5:43 Andrey Smirnov
2018-06-19 5:43 ` [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board Andrey Smirnov
2018-06-19 8:51 ` [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Lucas Stach
0 siblings, 2 replies; 10+ messages in thread
From: Andrey Smirnov @ 2018-06-19 5:43 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov
Some board designs copy i.MX51 Babbadge board's PMIC design and so
require exactly the same initialization. Move correspoding code into a
separate file, add new compatiblity string and make appropriate
Kconfig change to allow other boards to share that code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/Makefile | 2 +-
.../boards/freescale-mx51-babbage/Makefile | 5 +-
.../arm/boards/freescale-mx51-babbage/board.c | 110 ---------------
.../arm/boards/freescale-mx51-babbage/power.c | 127 ++++++++++++++++++
arch/arm/mach-imx/Kconfig | 13 +-
5 files changed, 141 insertions(+), 116 deletions(-)
create mode 100644 arch/arm/boards/freescale-mx51-babbage/power.c
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index b2fea4a40..f1dc4c685 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += eukrea_cpuimx51/
obj-$(CONFIG_MACH_ELTEC_HIPERCAM) += eltec-hipercam/
obj-$(CONFIG_MACH_FREESCALE_MX25_3STACK) += freescale-mx25-3ds/
obj-$(CONFIG_MACH_FREESCALE_MX35_3STACK) += freescale-mx35-3ds/
-obj-$(CONFIG_MACH_FREESCALE_MX51_PDK) += freescale-mx51-babbage/
+obj-y += freescale-mx51-babbage/
obj-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += freescale-mx53-qsb/
obj-$(CONFIG_MACH_FREESCALE_MX53_SMD) += freescale-mx53-smd/
obj-$(CONFIG_MACH_FREESCALE_MX53_VMX53) += freescale-mx53-vmx53/
diff --git a/arch/arm/boards/freescale-mx51-babbage/Makefile b/arch/arm/boards/freescale-mx51-babbage/Makefile
index 01c7a259e..b6e085818 100644
--- a/arch/arm/boards/freescale-mx51-babbage/Makefile
+++ b/arch/arm/boards/freescale-mx51-babbage/Makefile
@@ -1,2 +1,3 @@
-obj-y += board.o
-lwl-y += lowlevel.o
+obj-$(CONFIG_MACH_FREESCALE_MX51_PDK_POWER) += power.o
+obj-$(CONFIG_MACH_FREESCALE_MX51_PDK) += board.o
+lwl-$(CONFIG_MACH_FREESCALE_MX51_PDK) += lowlevel.o
diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c b/arch/arm/boards/freescale-mx51-babbage/board.c
index 915748528..fa9b39437 100644
--- a/arch/arm/boards/freescale-mx51-babbage/board.c
+++ b/arch/arm/boards/freescale-mx51-babbage/board.c
@@ -30,8 +30,6 @@
#include <mach/bbu.h>
#include <nand.h>
#include <notifier.h>
-#include <spi/spi.h>
-#include <mfd/mc13xxx.h>
#include <io.h>
#include <asm/mmu.h>
#include <mach/imx5.h>
@@ -44,112 +42,6 @@
#define MX51_CCM_CACRR 0x10
-static void babbage_power_init(struct mc13xxx *mc13xxx)
-{
- u32 val;
-
- /* Write needed to Power Gate 2 register */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_POWER_MISC, &val);
- val &= ~0x10000;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_POWER_MISC, val);
-
- /* Write needed to update Charger 0 */
- mc13xxx_reg_write(mc13xxx, MC13892_REG_CHARGE, 0x0023807F);
-
- /* power up the system first */
- mc13xxx_reg_write(mc13xxx, MC13892_REG_POWER_MISC, 0x00200000);
-
- if (imx_silicon_revision() < IMX_CHIP_REV_3_0) {
- /* Set core voltage to 1.1V */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_0, &val);
- val &= ~0x1f;
- val |= 0x14;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_0, val);
-
- /* Setup VCC (SW2) to 1.25 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_1, &val);
- val &= ~0x1f;
- val |= 0x1a;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_1, val);
-
- /* Setup 1V2_DIG1 (SW3) to 1.25 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_2, &val);
- val &= ~0x1f;
- val |= 0x1a;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_2, val);
- } else {
- /* Setup VCC (SW2) to 1.225 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_1, &val);
- val &= ~0x1f;
- val |= 0x19;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_1, val);
-
- /* Setup 1V2_DIG1 (SW3) to 1.2 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_2, &val);
- val &= ~0x1f;
- val |= 0x18;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_2, val);
- }
-
- if (mc13xxx_revision(mc13xxx) < MC13892_REVISION_2_0) {
- /* Set switchers in PWM mode for Atlas 2.0 and lower */
- /* Setup the switcher mode for SW1 & SW2*/
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_4, &val);
- val &= ~0x3c0f;
- val |= 0x1405;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_4, val);
-
- /* Setup the switcher mode for SW3 & SW4 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_5, &val);
- val &= ~0xf0f;
- val |= 0x505;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_5, val);
- } else {
- /* Set switchers in Auto in NORMAL mode & STANDBY mode for Atlas 2.0a */
- /* Setup the switcher mode for SW1 & SW2*/
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_4, &val);
- val &= ~0x3c0f;
- val |= 0x2008;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_4, val);
-
- /* Setup the switcher mode for SW3 & SW4 */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_5, &val);
- val &= ~0xf0f;
- val |= 0x808;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_5, val);
- }
-
- /* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.5V */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SETTING_0, &val);
- val &= ~0x34030;
- val |= 0x10020;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SETTING_0, val);
-
- /* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
- mc13xxx_reg_read(mc13xxx, MC13892_REG_SETTING_1, &val);
- val &= ~0x1FC;
- val |= 0x1F4;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_SETTING_1, val);
-
- /* Configure VGEN3 and VCAM regulators to use external PNP */
- val = 0x208;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_MODE_1, val);
-
- udelay(200);
-
- /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
- val = 0x49249;
- mc13xxx_reg_write(mc13xxx, MC13892_REG_MODE_1, val);
-
- udelay(200);
-
- pr_info("initialized PMIC\n");
-
- console_flush();
- imx51_init_lowlevel(800);
- clock_notifier_call_chain();
-}
-
static int imx51_babbage_init(void)
{
if (!of_machine_is_compatible("fsl,imx51-babbage"))
@@ -157,8 +49,6 @@ static int imx51_babbage_init(void)
barebox_set_hostname("babbage");
- mc13xxx_register_init_callback(babbage_power_init);
-
armlinux_set_architecture(MACH_TYPE_MX51_BABBAGE);
imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0",
diff --git a/arch/arm/boards/freescale-mx51-babbage/power.c b/arch/arm/boards/freescale-mx51-babbage/power.c
new file mode 100644
index 000000000..35c1a0472
--- /dev/null
+++ b/arch/arm/boards/freescale-mx51-babbage/power.c
@@ -0,0 +1,127 @@
+#define pr_fmt(fmt) "babbage-power: " fmt
+
+#include <common.h>
+#include <init.h>
+#include <notifier.h>
+#include <mach/revision.h>
+#include <mach/imx5.h>
+#include <mfd/mc13xxx.h>
+
+static void babbage_power_init(struct mc13xxx *mc13xxx)
+{
+ u32 val;
+
+ /* Write needed to Power Gate 2 register */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_POWER_MISC, &val);
+ val &= ~0x10000;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_POWER_MISC, val);
+
+ /* Write needed to update Charger 0 */
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_CHARGE, 0x0023807F);
+
+ /* power up the system first */
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_POWER_MISC, 0x00200000);
+
+ if (imx_silicon_revision() < IMX_CHIP_REV_3_0) {
+ /* Set core voltage to 1.1V */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_0, &val);
+ val &= ~0x1f;
+ val |= 0x14;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_0, val);
+
+ /* Setup VCC (SW2) to 1.25 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_1, &val);
+ val &= ~0x1f;
+ val |= 0x1a;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_1, val);
+
+ /* Setup 1V2_DIG1 (SW3) to 1.25 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_2, &val);
+ val &= ~0x1f;
+ val |= 0x1a;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_2, val);
+ } else {
+ /* Setup VCC (SW2) to 1.225 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_1, &val);
+ val &= ~0x1f;
+ val |= 0x19;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_1, val);
+
+ /* Setup 1V2_DIG1 (SW3) to 1.2 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_2, &val);
+ val &= ~0x1f;
+ val |= 0x18;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_2, val);
+ }
+
+ if (mc13xxx_revision(mc13xxx) < MC13892_REVISION_2_0) {
+ /* Set switchers in PWM mode for Atlas 2.0 and lower */
+ /* Setup the switcher mode for SW1 & SW2*/
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_4, &val);
+ val &= ~0x3c0f;
+ val |= 0x1405;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_4, val);
+
+ /* Setup the switcher mode for SW3 & SW4 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_5, &val);
+ val &= ~0xf0f;
+ val |= 0x505;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_5, val);
+ } else {
+ /* Set switchers in Auto in NORMAL mode & STANDBY mode
+ * for Atlas 2.0a */
+ /* Setup the switcher mode for SW1 & SW2*/
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_4, &val);
+ val &= ~0x3c0f;
+ val |= 0x2008;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_4, val);
+
+ /* Setup the switcher mode for SW3 & SW4 */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SW_5, &val);
+ val &= ~0xf0f;
+ val |= 0x808;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SW_5, val);
+ }
+
+ /* Set VDIG to 1.65V, VGEN3 to 1.8V, VCAM to 2.5V */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SETTING_0, &val);
+ val &= ~0x34030;
+ val |= 0x10020;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SETTING_0, val);
+
+ /* Set VVIDEO to 2.775V, VAUDIO to 3V, VSD to 3.15V */
+ mc13xxx_reg_read(mc13xxx, MC13892_REG_SETTING_1, &val);
+ val &= ~0x1FC;
+ val |= 0x1F4;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_SETTING_1, val);
+
+ /* Configure VGEN3 and VCAM regulators to use external PNP */
+ val = 0x208;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_MODE_1, val);
+
+ udelay(200);
+
+ /* Enable VGEN3, VCAM, VAUDIO, VVIDEO, VSD regulators */
+ val = 0x49249;
+ mc13xxx_reg_write(mc13xxx, MC13892_REG_MODE_1, val);
+
+ udelay(200);
+
+ pr_info("initialized PMIC\n");
+
+ console_flush();
+ imx51_init_lowlevel(800);
+ clock_notifier_call_chain();
+}
+
+static int imx51_babbage_power_init(void)
+{
+ if (!of_machine_is_compatible("fsl,imx51-babbage") &&
+ !of_machine_is_compatible("fsl,imx51-babbage-power"))
+ return 0;
+
+ mc13xxx_register_init_callback(babbage_power_init);
+
+ return 0;
+}
+coredevice_initcall(imx51_babbage_power_init);
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index dec5e387e..6a6710c39 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -85,6 +85,15 @@ config RESET_IMX_SRC
def_bool y
depends on ARCH_IMX6 || ARCH_IMX50 || ARCH_IMX51 || ARCH_IMX53
+#
+# PMIC configuration found on i.MX51 Babbadge board
+#
+config MACH_FREESCALE_MX51_PDK_POWER
+ bool
+ select SPI
+ select DRIVER_SPI_IMX
+ select MFD_MC13XXX
+
comment "Freescale i.MX System-on-Chip"
config ARCH_IMX1
@@ -256,9 +265,7 @@ config MACH_EMBEDSKY_E9
config MACH_FREESCALE_MX51_PDK
bool "Freescale i.MX51 PDK"
select ARCH_IMX51
- select SPI
- select DRIVER_SPI_IMX
- select MFD_MC13XXX
+ select MACH_FREESCALE_MX51_PDK_POWER
config MACH_CCMX53
bool "Digi ConnectCore i.MX53"
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board
2018-06-19 5:43 [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Andrey Smirnov
@ 2018-06-19 5:43 ` Andrey Smirnov
2018-06-19 8:51 ` Lucas Stach
2018-06-19 8:51 ` [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Lucas Stach
1 sibling, 1 reply; 10+ messages in thread
From: Andrey Smirnov @ 2018-06-19 5:43 UTC (permalink / raw)
To: barebox; +Cc: Andrey Smirnov, Nikita Yushchenko
ZII RDU1 is a i.MX51 based, Babbade board derivative supported by
upstream kernel. This commit adds support for it to Barebox.
Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/boards/Makefile | 1 +
arch/arm/boards/zii-imx51-rdu1/Makefile | 2 +
arch/arm/boards/zii-imx51-rdu1/board.c | 38 ++++++++++++
.../flash-header-imx51-zii-rdu1.imxcfg | 60 +++++++++++++++++++
arch/arm/boards/zii-imx51-rdu1/lowlevel.c | 46 ++++++++++++++
arch/arm/configs/imx_v7_defconfig | 1 +
arch/arm/dts/Makefile | 1 +
arch/arm/dts/imx51-zii-rdu1.dts | 46 ++++++++++++++
arch/arm/mach-imx/Kconfig | 5 ++
images/Makefile.imx | 5 ++
10 files changed, 205 insertions(+)
create mode 100644 arch/arm/boards/zii-imx51-rdu1/Makefile
create mode 100644 arch/arm/boards/zii-imx51-rdu1/board.c
create mode 100644 arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
create mode 100644 arch/arm/boards/zii-imx51-rdu1/lowlevel.c
create mode 100644 arch/arm/dts/imx51-zii-rdu1.dts
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index f1dc4c685..e5d217f52 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -150,5 +150,6 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS) += vscom-baltos/
obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
obj-$(CONFIG_MACH_WARP7) += element14-warp7/
obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/
+obj-$(CONFIG_MACH_ZII_RDU1) += zii-imx51-rdu1/
obj-$(CONFIG_MACH_ZII_RDU2) += zii-imx6q-rdu2/
obj-$(CONFIG_MACH_ZII_VF610_DEV) += zii-vf610-dev/
diff --git a/arch/arm/boards/zii-imx51-rdu1/Makefile b/arch/arm/boards/zii-imx51-rdu1/Makefile
new file mode 100644
index 000000000..01c7a259e
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/zii-imx51-rdu1/board.c b/arch/arm/boards/zii-imx51-rdu1/board.c
new file mode 100644
index 000000000..5e8f96ebd
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/board.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015 Nikita Yushchenko, CogentEmbedded, Inc
+ * Copyright (C) 2015 Andrey Gusakov, CogentEmbedded, Inc
+ * Copyright (C) 2007 Sascha Hauer, Pengutronix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ *
+ */
+
+#define pr_fmt(fmt) "zii-rdu1: " fmt
+
+#include <common.h>
+#include <init.h>
+#include <mach/bbu.h>
+
+static int zii_rdu1_init(void)
+{
+ if (!of_machine_is_compatible("zii,imx51-rdu1"))
+ return 0;
+
+ barebox_set_hostname("rdu1");
+
+ imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0", 0);
+ imx51_bbu_internal_spi_i2c_register_handler("spi",
+ "/dev/dataflash0.barebox",
+ BBU_HANDLER_FLAG_DEFAULT);
+ return 0;
+}
+coredevice_initcall(zii_rdu1_init);
\ No newline at end of file
diff --git a/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg b/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
new file mode 100644
index 000000000..76f4c6b59
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
@@ -0,0 +1,60 @@
+soc imx51
+loadaddr 0x90000000
+dcdofs 0x400
+
+wm 32 0x73fa88a0 0x00000200
+wm 32 0x73fa850c 0x000020c5
+wm 32 0x73fa8510 0x000020c5
+wm 32 0x73fa883c 0x00000002
+wm 32 0x73fa8848 0x00000002
+wm 32 0x73fa84b8 0x000000e7
+wm 32 0x73fa84bc 0x00000045
+wm 32 0x73fa84c0 0x00000045
+wm 32 0x73fa84c4 0x00000045
+wm 32 0x73fa84c8 0x00000045
+wm 32 0x73fa8820 0x00000000
+wm 32 0x73fa84a4 0x00000003
+wm 32 0x73fa84a8 0x00000003
+wm 32 0x73fa84ac 0x000000e3
+wm 32 0x73fa84b0 0x000000e3
+wm 32 0x73fa84b4 0x000000e3
+wm 32 0x73fa84cc 0x000000e3
+wm 32 0x73fa84d0 0x000000e2
+wm 32 0x73fa882c 0x00000004
+wm 32 0x73fa88a4 0x00000004
+wm 32 0x73fa88ac 0x00000004
+wm 32 0x73fa88b8 0x00000004
+wm 32 0x83fd9000 0x82a20000
+wm 32 0x83fd9008 0x82a20000
+wm 32 0x83fd9010 0x000ad0d0
+wm 32 0x83fd9004 0x3f3584ab
+wm 32 0x83fd900c 0x3f3584ab
+wm 32 0x83fd9014 0x04008008
+wm 32 0x83fd9014 0x0000801a
+wm 32 0x83fd9014 0x0000801b
+wm 32 0x83fd9014 0x00448019
+wm 32 0x83fd9014 0x07328018
+wm 32 0x83fd9014 0x04008008
+wm 32 0x83fd9014 0x00008010
+wm 32 0x83fd9014 0x00008010
+wm 32 0x83fd9014 0x06328018
+wm 32 0x83fd9014 0x03808019
+wm 32 0x83fd9014 0x00408019
+wm 32 0x83fd9014 0x00008000
+wm 32 0x83fd9014 0x0400800c
+wm 32 0x83fd9014 0x0000801e
+wm 32 0x83fd9014 0x0000801f
+wm 32 0x83fd9014 0x0000801d
+wm 32 0x83fd9014 0x0732801c
+wm 32 0x83fd9014 0x0400800c
+wm 32 0x83fd9014 0x00008014
+wm 32 0x83fd9014 0x00008014
+wm 32 0x83fd9014 0x0632801c
+wm 32 0x83fd9014 0x0380801d
+wm 32 0x83fd9014 0x0040801d
+wm 32 0x83fd9014 0x00008004
+wm 32 0x83fd9000 0xb2a20000
+wm 32 0x83fd9008 0xb2a20000
+wm 32 0x83fd9010 0x000ad6d0
+wm 32 0x83fd9034 0x90000000
+wm 32 0x83fd9014 0x00000000
diff --git a/arch/arm/boards/zii-imx51-rdu1/lowlevel.c b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
new file mode 100644
index 000000000..c28ca8653
--- /dev/null
+++ b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
@@ -0,0 +1,46 @@
+#include <debug_ll.h>
+#include <mach/clock-imx51_53.h>
+#include <mach/iomux-mx51.h>
+#include <common.h>
+#include <mach/esdctl.h>
+#include <mach/generic.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+
+static inline void setup_uart(void)
+{
+ void __iomem *iomuxbase = IOMEM(MX51_IOMUXC_BASE_ADDR);
+ void __iomem *ccmbase = IOMEM(MX51_CCM_BASE_ADDR);
+
+ /*
+ * Restore CCM values that might be changed by the Mask ROM
+ * code.
+ *
+ * Source: RealView debug scripts provided by Freescale
+ */
+ writel(MX5_CCM_CBCDR_RESET_VALUE, ccmbase + MX5_CCM_CBCDR);
+ writel(MX5_CCM_CSCMR1_RESET_VALUE, ccmbase + MX5_CCM_CSCMR1);
+ writel(MX5_CCM_CSCDR1_RESET_VALUE, ccmbase + MX5_CCM_CSCDR1);
+
+ imx_setup_pad(iomuxbase, MX51_PAD_UART1_TXD__UART1_TXD);
+
+ imx51_uart_setup_ll();
+
+ putc_ll('>');
+}
+
+extern char __dtb_imx51_zii_rdu1_start[];
+
+ENTRY_FUNCTION(start_imx51_zii_rdu1, r0, r1, r2)
+{
+ void *fdt;
+
+ imx5_cpu_lowlevel_init();
+
+ if (IS_ENABLED(CONFIG_DEBUG_LL))
+ setup_uart();
+
+ fdt = __dtb_imx51_zii_rdu1_start + get_runtime_offset();
+
+ imx51_barebox_entry(fdt);
+}
\ No newline at end of file
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index 8aef9d6ef..0fc3c9c50 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -35,6 +35,7 @@ CONFIG_MACH_CM_FX6=y
CONFIG_MACH_ADVANTECH_ROM_742X=y
CONFIG_MACH_WARP7=y
CONFIG_MACH_VF610_TWR=y
+CONFIG_MACH_ZII_RDU1=y
CONFIG_MACH_ZII_RDU2=y
CONFIG_MACH_ZII_VF610_DEV=y
CONFIG_MACH_PHYTEC_PHYCORE_IMX7=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b69592e64..1c94193d1 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -102,6 +102,7 @@ pbl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca15.dtb.o
pbl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o
pbl-dtb-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o
pbl-dtb-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
+pbl-dtb-$(CONFIG_MACH_ZII_RDU1) += imx51-zii-rdu1.dtb.o
pbl-dtb-$(CONFIG_MACH_ZII_RDU2) += imx6q-zii-rdu2.dtb.o imx6qp-zii-rdu2.dtb.o
pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
vf610-zii-dev-rev-b.dtb.o \
diff --git a/arch/arm/dts/imx51-zii-rdu1.dts b/arch/arm/dts/imx51-zii-rdu1.dts
new file mode 100644
index 000000000..e7b0bc743
--- /dev/null
+++ b/arch/arm/dts/imx51-zii-rdu1.dts
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2018 CogentEmbedded, Inc.
+ * Copyright 2011 Freescale Semiconductor, Inc.
+ * Copyright 2011 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <arm/imx51-zii-rdu1.dts>
+
+/ {
+ compatible = "zii,imx51-rdu1", "fsl,imx51-babbage-power", "fsl,imx51";
+
+ chosen {
+ stdout-path = &uart1;
+
+ environment-spi {
+ compatible = "barebox,environment";
+ device-path = &spinor, "partname:barebox-environment";
+ };
+ };
+};
+
+&ecspi1 {
+ spinor: flash@1 {
+ partition@0 {
+ label = "config";
+ reg = <0x0 0x400>;
+ };
+
+ partition@400 {
+ label = "barebox";
+ reg = <0x400 0xdfc00>;
+ };
+
+ partition@e0000 {
+ label = "barebox-environment";
+ reg = <0xe0000 0x20000>;
+ };
+ };
+};
\ No newline at end of file
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 6a6710c39..83d32f30c 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -423,6 +423,11 @@ config MACH_VF610_TWR
bool "Freescale VF610 Tower Board"
select ARCH_VF610
+config MACH_ZII_RDU1
+ bool "ZII i.MX51 RDU1"
+ select ARCH_IMX51
+ select MACH_FREESCALE_MX51_PDK_POWER
+
config MACH_ZII_RDU2
bool "ZII i.MX6Q(+) RDU2"
select ARCH_IMX6
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 43505b1ff..e3f3b2c8c 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -76,6 +76,11 @@ CFG_start_imx51_babbage_xload.pblx.imximg = $(board)/freescale-mx51-babbage/flas
FILE_barebox-freescale-imx51-babbage-xload.img = start_imx51_babbage_xload.pblx.imximg
imx-xload-$(CONFIG_MACH_FREESCALE_MX51_PDK) += barebox-freescale-imx51-babbage-xload.img
+pblx-$(CONFIG_MACH_ZII_RDU1) += start_imx51_zii_rdu1
+CFG_start_imx51_zii_rdu1.pblx.imximg = $(board)/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
+FILE_barebox-zii-imx51-rdu1.img = start_imx51_zii_rdu1.pblx.imximg
+imx-barebox-$(CONFIG_MACH_ZII_RDU1) += barebox-zii-imx51-rdu1.img
+
ifdef CONFIG_ARCH_IMX_XLOAD
image-y += $(imx-xload-y)
else
--
2.17.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
2018-06-19 5:43 [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Andrey Smirnov
2018-06-19 5:43 ` [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board Andrey Smirnov
@ 2018-06-19 8:51 ` Lucas Stach
2018-06-19 16:55 ` Andrey Smirnov
1 sibling, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2018-06-19 8:51 UTC (permalink / raw)
To: Andrey Smirnov, barebox
Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> Some board designs copy i.MX51 Babbadge board's PMIC design and so
> require exactly the same initialization. Move correspoding code into a
> separate file, add new compatiblity string and make appropriate
> Kconfig change to allow other boards to share that code.
>
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
[...]
> +static int imx51_babbage_power_init(void)
> +{
> > + if (!of_machine_is_compatible("fsl,imx51-babbage") &&
> > + !of_machine_is_compatible("fsl,imx51-babbage-power"))
> > + return 0;
> +
> > + mc13xxx_register_init_callback(babbage_power_init);
I think it would be better for the board code to explicitly call this
setup function. Gating this by DT compatible is a bit too much magic.
Regards,
Lucas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board
2018-06-19 5:43 ` [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board Andrey Smirnov
@ 2018-06-19 8:51 ` Lucas Stach
2018-06-19 11:34 ` Nikita Yushchenko
2018-06-19 16:24 ` Andrey Smirnov
0 siblings, 2 replies; 10+ messages in thread
From: Lucas Stach @ 2018-06-19 8:51 UTC (permalink / raw)
To: Andrey Smirnov, barebox; +Cc: Nikita Yushchenko
Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> ZII RDU1 is a i.MX51 based, Babbade board derivative supported by
> upstream kernel. This commit adds support for it to Barebox.
>
> > Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> arch/arm/boards/Makefile | 1 +
> arch/arm/boards/zii-imx51-rdu1/Makefile | 2 +
> arch/arm/boards/zii-imx51-rdu1/board.c | 38 ++++++++++++
> .../flash-header-imx51-zii-rdu1.imxcfg | 60 +++++++++++++++++++
> arch/arm/boards/zii-imx51-rdu1/lowlevel.c | 46 ++++++++++++++
> arch/arm/configs/imx_v7_defconfig | 1 +
> arch/arm/dts/Makefile | 1 +
> arch/arm/dts/imx51-zii-rdu1.dts | 46 ++++++++++++++
> arch/arm/mach-imx/Kconfig | 5 ++
> images/Makefile.imx | 5 ++
> 10 files changed, 205 insertions(+)
> create mode 100644 arch/arm/boards/zii-imx51-rdu1/Makefile
> create mode 100644 arch/arm/boards/zii-imx51-rdu1/board.c
> create mode 100644 arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
> create mode 100644 arch/arm/boards/zii-imx51-rdu1/lowlevel.c
> create mode 100644 arch/arm/dts/imx51-zii-rdu1.dts
>
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index f1dc4c685..e5d217f52 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> > @@ -150,5 +150,6 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS) += vscom-baltos/
> > obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
> > obj-$(CONFIG_MACH_WARP7) += element14-warp7/
> > obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/
> > +obj-$(CONFIG_MACH_ZII_RDU1) += zii-imx51-rdu1/
> > obj-$(CONFIG_MACH_ZII_RDU2) += zii-imx6q-rdu2/
> > obj-$(CONFIG_MACH_ZII_VF610_DEV) += zii-vf610-dev/
> diff --git a/arch/arm/boards/zii-imx51-rdu1/Makefile b/arch/arm/boards/zii-imx51-rdu1/Makefile
> new file mode 100644
> index 000000000..01c7a259e
> --- /dev/null
> +++ b/arch/arm/boards/zii-imx51-rdu1/Makefile
> @@ -0,0 +1,2 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o
> diff --git a/arch/arm/boards/zii-imx51-rdu1/board.c b/arch/arm/boards/zii-imx51-rdu1/board.c
> new file mode 100644
> index 000000000..5e8f96ebd
> --- /dev/null
> +++ b/arch/arm/boards/zii-imx51-rdu1/board.c
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright (C) 2015 Nikita Yushchenko, CogentEmbedded, Inc
> + * Copyright (C) 2015 Andrey Gusakov, CogentEmbedded, Inc
> + * Copyright (C) 2007 Sascha Hauer, Pengutronix
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + *
> + */
> +
> +#define pr_fmt(fmt) "zii-rdu1: " fmt
> +
> +#include <common.h>
> +#include <init.h>
> +#include <mach/bbu.h>
> +
> +static int zii_rdu1_init(void)
> +{
> > + if (!of_machine_is_compatible("zii,imx51-rdu1"))
> > + return 0;
> +
> > + barebox_set_hostname("rdu1");
> +
> > + imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0", 0);
> > + imx51_bbu_internal_spi_i2c_register_handler("spi",
> > + "/dev/dataflash0.barebox",
> + BBU_HANDLER_FLAG_DEFAULT);
Did you test that this works? The Barebox partition has an offset and
according the RM the BootROM looks at a specific location for the image
header, so I think the Barebox image needs to be truncated for this to
work.
Regards,
Lucas
> + return 0;
> +}
> +coredevice_initcall(zii_rdu1_init);
> \ No newline at end of file
Please add the newline.
> diff --git a/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg b/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
> new file mode 100644
> index 000000000..76f4c6b59
> --- /dev/null
> +++ b/arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
> @@ -0,0 +1,60 @@
> +soc imx51
> +loadaddr 0x90000000
> +dcdofs 0x400
> +
> +wm 32 0x73fa88a0 0x00000200
> +wm 32 0x73fa850c 0x000020c5
> +wm 32 0x73fa8510 0x000020c5
> +wm 32 0x73fa883c 0x00000002
> +wm 32 0x73fa8848 0x00000002
> +wm 32 0x73fa84b8 0x000000e7
> +wm 32 0x73fa84bc 0x00000045
> +wm 32 0x73fa84c0 0x00000045
> +wm 32 0x73fa84c4 0x00000045
> +wm 32 0x73fa84c8 0x00000045
> +wm 32 0x73fa8820 0x00000000
> +wm 32 0x73fa84a4 0x00000003
> +wm 32 0x73fa84a8 0x00000003
> +wm 32 0x73fa84ac 0x000000e3
> +wm 32 0x73fa84b0 0x000000e3
> +wm 32 0x73fa84b4 0x000000e3
> +wm 32 0x73fa84cc 0x000000e3
> +wm 32 0x73fa84d0 0x000000e2
> +wm 32 0x73fa882c 0x00000004
> +wm 32 0x73fa88a4 0x00000004
> +wm 32 0x73fa88ac 0x00000004
> +wm 32 0x73fa88b8 0x00000004
> +wm 32 0x83fd9000 0x82a20000
> +wm 32 0x83fd9008 0x82a20000
> +wm 32 0x83fd9010 0x000ad0d0
> +wm 32 0x83fd9004 0x3f3584ab
> +wm 32 0x83fd900c 0x3f3584ab
> +wm 32 0x83fd9014 0x04008008
> +wm 32 0x83fd9014 0x0000801a
> +wm 32 0x83fd9014 0x0000801b
> +wm 32 0x83fd9014 0x00448019
> +wm 32 0x83fd9014 0x07328018
> +wm 32 0x83fd9014 0x04008008
> +wm 32 0x83fd9014 0x00008010
> +wm 32 0x83fd9014 0x00008010
> +wm 32 0x83fd9014 0x06328018
> +wm 32 0x83fd9014 0x03808019
> +wm 32 0x83fd9014 0x00408019
> +wm 32 0x83fd9014 0x00008000
> +wm 32 0x83fd9014 0x0400800c
> +wm 32 0x83fd9014 0x0000801e
> +wm 32 0x83fd9014 0x0000801f
> +wm 32 0x83fd9014 0x0000801d
> +wm 32 0x83fd9014 0x0732801c
> +wm 32 0x83fd9014 0x0400800c
> +wm 32 0x83fd9014 0x00008014
> +wm 32 0x83fd9014 0x00008014
> +wm 32 0x83fd9014 0x0632801c
> +wm 32 0x83fd9014 0x0380801d
> +wm 32 0x83fd9014 0x0040801d
> +wm 32 0x83fd9014 0x00008004
> +wm 32 0x83fd9000 0xb2a20000
> +wm 32 0x83fd9008 0xb2a20000
> +wm 32 0x83fd9010 0x000ad6d0
> +wm 32 0x83fd9034 0x90000000
> +wm 32 0x83fd9014 0x00000000
> diff --git a/arch/arm/boards/zii-imx51-rdu1/lowlevel.c b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
> new file mode 100644
> index 000000000..c28ca8653
> --- /dev/null
> +++ b/arch/arm/boards/zii-imx51-rdu1/lowlevel.c
> @@ -0,0 +1,46 @@
> +#include <debug_ll.h>
> +#include <mach/clock-imx51_53.h>
> +#include <mach/iomux-mx51.h>
> +#include <common.h>
> +#include <mach/esdctl.h>
> +#include <mach/generic.h>
> +#include <asm/barebox-arm-head.h>
> +#include <asm/barebox-arm.h>
> +
> +static inline void setup_uart(void)
> +{
> > + void __iomem *iomuxbase = IOMEM(MX51_IOMUXC_BASE_ADDR);
> > + void __iomem *ccmbase = IOMEM(MX51_CCM_BASE_ADDR);
> +
> > + /*
> > + * Restore CCM values that might be changed by the Mask ROM
> > + * code.
> > + *
> > + * Source: RealView debug scripts provided by Freescale
> > + */
> > + writel(MX5_CCM_CBCDR_RESET_VALUE, ccmbase + MX5_CCM_CBCDR);
> > + writel(MX5_CCM_CSCMR1_RESET_VALUE, ccmbase + MX5_CCM_CSCMR1);
> > + writel(MX5_CCM_CSCDR1_RESET_VALUE, ccmbase + MX5_CCM_CSCDR1);
> +
> > + imx_setup_pad(iomuxbase, MX51_PAD_UART1_TXD__UART1_TXD);
> +
> > + imx51_uart_setup_ll();
> +
> > + putc_ll('>');
> +}
> +
> +extern char __dtb_imx51_zii_rdu1_start[];
> +
> +ENTRY_FUNCTION(start_imx51_zii_rdu1, r0, r1, r2)
> +{
> > + void *fdt;
> +
> > + imx5_cpu_lowlevel_init();
> +
> > + if (IS_ENABLED(CONFIG_DEBUG_LL))
> > + setup_uart();
> +
> > + fdt = __dtb_imx51_zii_rdu1_start + get_runtime_offset();
> +
> > + imx51_barebox_entry(fdt);
> +}
> \ No newline at end of file
> diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
> index 8aef9d6ef..0fc3c9c50 100644
> --- a/arch/arm/configs/imx_v7_defconfig
> +++ b/arch/arm/configs/imx_v7_defconfig
> @@ -35,6 +35,7 @@ CONFIG_MACH_CM_FX6=y
> CONFIG_MACH_ADVANTECH_ROM_742X=y
> CONFIG_MACH_WARP7=y
> CONFIG_MACH_VF610_TWR=y
> +CONFIG_MACH_ZII_RDU1=y
> CONFIG_MACH_ZII_RDU2=y
> CONFIG_MACH_ZII_VF610_DEV=y
> CONFIG_MACH_PHYTEC_PHYCORE_IMX7=y
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index b69592e64..1c94193d1 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -102,6 +102,7 @@ pbl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca15.dtb.o
> pbl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o
> pbl-dtb-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o
> pbl-dtb-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
> +pbl-dtb-$(CONFIG_MACH_ZII_RDU1) += imx51-zii-rdu1.dtb.o
> pbl-dtb-$(CONFIG_MACH_ZII_RDU2) += imx6q-zii-rdu2.dtb.o imx6qp-zii-rdu2.dtb.o
> pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
> > > vf610-zii-dev-rev-b.dtb.o \
> diff --git a/arch/arm/dts/imx51-zii-rdu1.dts b/arch/arm/dts/imx51-zii-rdu1.dts
> new file mode 100644
> index 000000000..e7b0bc743
> --- /dev/null
> +++ b/arch/arm/dts/imx51-zii-rdu1.dts
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright 2018 CogentEmbedded, Inc.
> + * Copyright 2011 Freescale Semiconductor, Inc.
> + * Copyright 2011 Linaro Ltd.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include <arm/imx51-zii-rdu1.dts>
> +
> +/ {
> > + compatible = "zii,imx51-rdu1", "fsl,imx51-babbage-power", "fsl,imx51";
> +
> > + chosen {
> > + stdout-path = &uart1;
> +
> > + environment-spi {
> > + compatible = "barebox,environment";
> > + device-path = &spinor, "partname:barebox-environment";
> > + };
> > + };
> +};
> +
> +&ecspi1 {
> > > + spinor: flash@1 {
> > + partition@0 {
> > + label = "config";
> > + reg = <0x0 0x400>;
> > + };
> +
> > + partition@400 {
> > + label = "barebox";
> > + reg = <0x400 0xdfc00>;
> > + };
> +
> > + partition@e0000 {
> > + label = "barebox-environment";
> > + reg = <0xe0000 0x20000>;
> > + };
> > + };
> +};
> \ No newline at end of file
> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> index 6a6710c39..83d32f30c 100644
> --- a/arch/arm/mach-imx/Kconfig
> +++ b/arch/arm/mach-imx/Kconfig
> @@ -423,6 +423,11 @@ config MACH_VF610_TWR
> > bool "Freescale VF610 Tower Board"
> > select ARCH_VF610
>
> +config MACH_ZII_RDU1
> > + bool "ZII i.MX51 RDU1"
> > + select ARCH_IMX51
> > + select MACH_FREESCALE_MX51_PDK_POWER
> +
> config MACH_ZII_RDU2
> > bool "ZII i.MX6Q(+) RDU2"
> > select ARCH_IMX6
> diff --git a/images/Makefile.imx b/images/Makefile.imx
> index 43505b1ff..e3f3b2c8c 100644
> --- a/images/Makefile.imx
> +++ b/images/Makefile.imx
> @@ -76,6 +76,11 @@ CFG_start_imx51_babbage_xload.pblx.imximg = $(board)/freescale-mx51-babbage/flas
> FILE_barebox-freescale-imx51-babbage-xload.img = start_imx51_babbage_xload.pblx.imximg
> imx-xload-$(CONFIG_MACH_FREESCALE_MX51_PDK) += barebox-freescale-imx51-babbage-xload.img
>
> +pblx-$(CONFIG_MACH_ZII_RDU1) += start_imx51_zii_rdu1
> +CFG_start_imx51_zii_rdu1.pblx.imximg = $(board)/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
> +FILE_barebox-zii-imx51-rdu1.img = start_imx51_zii_rdu1.pblx.imximg
> +imx-barebox-$(CONFIG_MACH_ZII_RDU1) += barebox-zii-imx51-rdu1.img
> +
> ifdef CONFIG_ARCH_IMX_XLOAD
> image-y += $(imx-xload-y)
> else
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board
2018-06-19 8:51 ` Lucas Stach
@ 2018-06-19 11:34 ` Nikita Yushchenko
2018-06-19 12:42 ` Lucas Stach
2018-06-19 16:24 ` Andrey Smirnov
1 sibling, 1 reply; 10+ messages in thread
From: Nikita Yushchenko @ 2018-06-19 11:34 UTC (permalink / raw)
To: Lucas Stach, Andrey Smirnov, barebox, Andrey Gusakov
>> + imx51_bbu_internal_spi_i2c_register_handler("spi",
>> + "/dev/dataflash0.barebox",
>> + BBU_HANDLER_FLAG_DEFAULT);
>
> Did you test that this works? The Barebox partition has an offset and
> according the RM the BootROM looks at a specific location for the image
> header, so I think the Barebox image needs to be truncated for this to
> work.
Yes, this works, together with this patch:
https://github.com/CogentEmbedded/barebox-zodiac/commit/9b523e459e198960b94594b7185baa0dd2649feb
I've copied this code from earlier version developed by Andrey Gusakov [CCed].
I did not try to change anything there, to ensure board stays bootable ;).
Nikita
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board
2018-06-19 11:34 ` Nikita Yushchenko
@ 2018-06-19 12:42 ` Lucas Stach
0 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2018-06-19 12:42 UTC (permalink / raw)
To: Nikita Yushchenko, Andrey Smirnov, barebox, Andrey Gusakov
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Am Dienstag, den 19.06.2018, 14:34 +0300 schrieb Nikita Yushchenko:
> > > > > > + imx51_bbu_internal_spi_i2c_register_handler("spi",
> > > > > > + "/dev/dataflash0.barebox",
> > > + BBU_HANDLER_FLAG_DEFAULT);
> >
> > Did you test that this works? The Barebox partition has an offset and
> > according the RM the BootROM looks at a specific location for the image
> > header, so I think the Barebox image needs to be truncated for this to
> > work.
>
> Yes, this works, together with this patch:
>
> https://github.com/CogentEmbedded/barebox-zodiac/commit/9b523e459e198960b94594b7185baa0dd2649feb
>
> I've copied this code from earlier version developed by Andrey Gusakov [CCed].
>
> I did not try to change anything there, to ensure board stays bootable ;).
But this isn't a generic fix that can be applied upstream. Nothing in
the i.MX51 boot specification says that the first 1024 bytes of flash
shouldn't be written and in fact this is cutting the Barebox image
signature from the image written to flash, which is generally
undesirable.
And it probably also doesn't work with the barebox partition having an
offset on the flash, as is done with this patch.
I've added a ugly workaround in the BSP patchstack, which _might_ be
acceptable upstream. See attached patch.
Regards,
Lucas
[-- Attachment #2: 0001-bbu-add-flag-to-skip-writing-the-padding-before-the-.patch --]
[-- Type: text/x-patch, Size: 2152 bytes --]
From 5231a7ba250634ca09fdba160b71eb4491d9ff8d Mon Sep 17 00:00:00 2001
From: Lucas Stach <l.stach@pengutronix.de>
Date: Mon, 7 May 2018 12:54:15 +0200
Subject: [PATCH] bbu: add flag to skip writing the padding before the flash
header
This is ugly, but needed as on the ZII RDU1 board the flash holds some
important data in the first 1024 bytes, so we need to avoid writing
anything into this. This is implemented by having the barebox partition
start at this offset, but BBU needs to truncate the image accordingly.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/mach-imx/imx-bbu-internal.c | 11 ++++++++++-
include/bbu.h | 1 +
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index c7375ff52aee..45610f0ef9ac 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -160,15 +160,24 @@ static int imx_bbu_internal_v1_update(struct bbu_handler *handler, struct bbu_da
{
struct imx_internal_bbu_handler *imx_handler =
container_of(handler, struct imx_internal_bbu_handler, handler);
+ const void *databuf = data->image;
+ int len = data->len;
int ret;
ret = imx_bbu_check_prereq(data->devicefile, data);
if (ret)
return ret;
+ if (handler->flags & BBU_HANDLER_SKIP_HEADER_OFFSET)
+ {
+ databuf += imx_handler->flash_header_offset;
+ len -= imx_handler->flash_header_offset;
+ }
+
printf("updating to %s\n", data->devicefile);
- ret = imx_bbu_write_device(imx_handler, data->devicefile, data, data->image, data->len);
+ ret = imx_bbu_write_device(imx_handler, data->devicefile, data,
+ databuf, len);
return ret;
}
diff --git a/include/bbu.h b/include/bbu.h
index def568e498d4..16f498e5724a 100644
--- a/include/bbu.h
+++ b/include/bbu.h
@@ -25,6 +25,7 @@ struct bbu_handler {
struct list_head list;
#define BBU_HANDLER_FLAG_DEFAULT (1 << 0)
#define BBU_HANDLER_CAN_REFRESH (1 << 1)
+#define BBU_HANDLER_SKIP_HEADER_OFFSET (1 << 2)
unsigned long flags;
/* default device file, can be overwritten on the command line */
--
2.17.1
[-- Attachment #3: Type: text/plain, Size: 149 bytes --]
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board
2018-06-19 8:51 ` Lucas Stach
2018-06-19 11:34 ` Nikita Yushchenko
@ 2018-06-19 16:24 ` Andrey Smirnov
1 sibling, 0 replies; 10+ messages in thread
From: Andrey Smirnov @ 2018-06-19 16:24 UTC (permalink / raw)
To: Lucas Stach; +Cc: Nikita Yushchenko, Barebox List
On Tue, Jun 19, 2018 at 1:51 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> > ZII RDU1 is a i.MX51 based, Babbade board derivative supported by
> > upstream kernel. This commit adds support for it to Barebox.
> >
> > > Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> > arch/arm/boards/Makefile | 1 +
> > arch/arm/boards/zii-imx51-rdu1/Makefile | 2 +
> > arch/arm/boards/zii-imx51-rdu1/board.c | 38 ++++++++++++
> > .../flash-header-imx51-zii-rdu1.imxcfg | 60 +++++++++++++++++++
> > arch/arm/boards/zii-imx51-rdu1/lowlevel.c | 46 ++++++++++++++
> > arch/arm/configs/imx_v7_defconfig | 1 +
> > arch/arm/dts/Makefile | 1 +
> > arch/arm/dts/imx51-zii-rdu1.dts | 46 ++++++++++++++
> > arch/arm/mach-imx/Kconfig | 5 ++
> > images/Makefile.imx | 5 ++
> > 10 files changed, 205 insertions(+)
> > create mode 100644 arch/arm/boards/zii-imx51-rdu1/Makefile
> > create mode 100644 arch/arm/boards/zii-imx51-rdu1/board.c
> > create mode 100644 arch/arm/boards/zii-imx51-rdu1/flash-header-imx51-zii-rdu1.imxcfg
> > create mode 100644 arch/arm/boards/zii-imx51-rdu1/lowlevel.c
> > create mode 100644 arch/arm/dts/imx51-zii-rdu1.dts
> >
> > diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> > index f1dc4c685..e5d217f52 100644
> > --- a/arch/arm/boards/Makefile
> > +++ b/arch/arm/boards/Makefile
> > > @@ -150,5 +150,6 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS) += vscom-baltos/
> > > obj-$(CONFIG_MACH_QEMU_VIRT64) += qemu-virt64/
> > > obj-$(CONFIG_MACH_WARP7) += element14-warp7/
> > > obj-$(CONFIG_MACH_VF610_TWR) += freescale-vf610-twr/
> > > +obj-$(CONFIG_MACH_ZII_RDU1) += zii-imx51-rdu1/
> > > obj-$(CONFIG_MACH_ZII_RDU2) += zii-imx6q-rdu2/
> > > obj-$(CONFIG_MACH_ZII_VF610_DEV) += zii-vf610-dev/
> > diff --git a/arch/arm/boards/zii-imx51-rdu1/Makefile b/arch/arm/boards/zii-imx51-rdu1/Makefile
> > new file mode 100644
> > index 000000000..01c7a259e
> > --- /dev/null
> > +++ b/arch/arm/boards/zii-imx51-rdu1/Makefile
> > @@ -0,0 +1,2 @@
> > +obj-y += board.o
> > +lwl-y += lowlevel.o
> > diff --git a/arch/arm/boards/zii-imx51-rdu1/board.c b/arch/arm/boards/zii-imx51-rdu1/board.c
> > new file mode 100644
> > index 000000000..5e8f96ebd
> > --- /dev/null
> > +++ b/arch/arm/boards/zii-imx51-rdu1/board.c
> > @@ -0,0 +1,38 @@
> > +/*
> > + * Copyright (C) 2015 Nikita Yushchenko, CogentEmbedded, Inc
> > + * Copyright (C) 2015 Andrey Gusakov, CogentEmbedded, Inc
> > + * Copyright (C) 2007 Sascha Hauer, Pengutronix
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License as
> > + * published by the Free Software Foundation; either version 2 of
> > + * the License, or (at your option) any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + *
> > + */
> > +
> > +#define pr_fmt(fmt) "zii-rdu1: " fmt
> > +
> > +#include <common.h>
> > +#include <init.h>
> > +#include <mach/bbu.h>
> > +
> > +static int zii_rdu1_init(void)
> > +{
> > > + if (!of_machine_is_compatible("zii,imx51-rdu1"))
> > > + return 0;
> > +
> > > + barebox_set_hostname("rdu1");
> > +
> > > + imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc0", 0);
> > > + imx51_bbu_internal_spi_i2c_register_handler("spi",
> > > + "/dev/dataflash0.barebox",
> > + BBU_HANDLER_FLAG_DEFAULT);
>
> Did you test that this works? The Barebox partition has an offset and
> according the RM the BootROM looks at a specific location for the image
> header, so I think the Barebox image needs to be truncated for this to
> work.
>
No, missed this one, sorry. I'll drop this code until we figure out a
way to make it work with the least amount of hacks.
> Regards,
> Lucas
>
> > + return 0;
> > +}
> > +coredevice_initcall(zii_rdu1_init);
> > \ No newline at end of file
>
> Please add the newline.
Sure.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
2018-06-19 8:51 ` [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Lucas Stach
@ 2018-06-19 16:55 ` Andrey Smirnov
2018-06-20 7:16 ` Sascha Hauer
0 siblings, 1 reply; 10+ messages in thread
From: Andrey Smirnov @ 2018-06-19 16:55 UTC (permalink / raw)
To: Lucas Stach; +Cc: Barebox List
On Tue, Jun 19, 2018 at 1:51 AM Lucas Stach <l.stach@pengutronix.de> wrote:
>
> Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> > Some board designs copy i.MX51 Babbadge board's PMIC design and so
> > require exactly the same initialization. Move correspoding code into a
> > separate file, add new compatiblity string and make appropriate
> > Kconfig change to allow other boards to share that code.
> >
> > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
>
> [...]
>
> > +static int imx51_babbage_power_init(void)
> > +{
> > > + if (!of_machine_is_compatible("fsl,imx51-babbage") &&
> > > + !of_machine_is_compatible("fsl,imx51-babbage-power"))
> > > + return 0;
> > +
> > > + mc13xxx_register_init_callback(babbage_power_init);
>
> I think it would be better for the board code to explicitly call this
> setup function. Gating this by DT compatible is a bit too much magic.
>
Where do you see magic here? There's nothing unusual in gating board
initialization code on "compatible", it's used all over the place. And
having multiple level of compatibility one of the intended use-cases
of "compatible" property.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
2018-06-19 16:55 ` Andrey Smirnov
@ 2018-06-20 7:16 ` Sascha Hauer
2018-06-20 18:13 ` Andrey Smirnov
0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2018-06-20 7:16 UTC (permalink / raw)
To: Andrey Smirnov; +Cc: Barebox List
On Tue, Jun 19, 2018 at 09:55:02AM -0700, Andrey Smirnov wrote:
> On Tue, Jun 19, 2018 at 1:51 AM Lucas Stach <l.stach@pengutronix.de> wrote:
> >
> > Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> > > Some board designs copy i.MX51 Babbadge board's PMIC design and so
> > > require exactly the same initialization. Move correspoding code into a
> > > separate file, add new compatiblity string and make appropriate
> > > Kconfig change to allow other boards to share that code.
> > >
> > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > > ---
> >
> > [...]
> >
> > > +static int imx51_babbage_power_init(void)
> > > +{
> > > > + if (!of_machine_is_compatible("fsl,imx51-babbage") &&
> > > > + !of_machine_is_compatible("fsl,imx51-babbage-power"))
> > > > + return 0;
> > > +
> > > > + mc13xxx_register_init_callback(babbage_power_init);
> >
> > I think it would be better for the board code to explicitly call this
> > setup function. Gating this by DT compatible is a bit too much magic.
> >
>
> Where do you see magic here? There's nothing unusual in gating board
> initialization code on "compatible", it's used all over the place. And
> having multiple level of compatibility one of the intended use-cases
> of "compatible" property.
Better just export imx51_babbage_power_init (maybe with a better name)
and call it from your board code after having checked the compatible
strings. Putting "fsl,imx51-babbage-power" in your board dts in order to
run some hardware init code for hardware that happens to be the same as
parts of the babbage board, that's indeed magic.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable
2018-06-20 7:16 ` Sascha Hauer
@ 2018-06-20 18:13 ` Andrey Smirnov
0 siblings, 0 replies; 10+ messages in thread
From: Andrey Smirnov @ 2018-06-20 18:13 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
On Wed, Jun 20, 2018 at 12:16 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> On Tue, Jun 19, 2018 at 09:55:02AM -0700, Andrey Smirnov wrote:
> > On Tue, Jun 19, 2018 at 1:51 AM Lucas Stach <l.stach@pengutronix.de> wrote:
> > >
> > > Am Montag, den 18.06.2018, 22:43 -0700 schrieb Andrey Smirnov:
> > > > Some board designs copy i.MX51 Babbadge board's PMIC design and so
> > > > require exactly the same initialization. Move correspoding code into a
> > > > separate file, add new compatiblity string and make appropriate
> > > > Kconfig change to allow other boards to share that code.
> > > >
> > > > > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > > > ---
> > >
> > > [...]
> > >
> > > > +static int imx51_babbage_power_init(void)
> > > > +{
> > > > > + if (!of_machine_is_compatible("fsl,imx51-babbage") &&
> > > > > + !of_machine_is_compatible("fsl,imx51-babbage-power"))
> > > > > + return 0;
> > > > +
> > > > > + mc13xxx_register_init_callback(babbage_power_init);
> > >
> > > I think it would be better for the board code to explicitly call this
> > > setup function. Gating this by DT compatible is a bit too much magic.
> > >
> >
> > Where do you see magic here? There's nothing unusual in gating board
> > initialization code on "compatible", it's used all over the place. And
> > having multiple level of compatibility one of the intended use-cases
> > of "compatible" property.
>
> Better just export imx51_babbage_power_init (maybe with a better name)
> and call it from your board code after having checked the compatible
> strings. Putting "fsl,imx51-babbage-power" in your board dts in order to
> run some hardware init code for hardware that happens to be the same as
> parts of the babbage board, that's indeed magic.
>
OK, I rest my case. Will change in v2.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-06-20 18:14 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 5:43 [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Andrey Smirnov
2018-06-19 5:43 ` [PATCH 2/2] ARM: i.MX: Add support for ZII RDU1 board Andrey Smirnov
2018-06-19 8:51 ` Lucas Stach
2018-06-19 11:34 ` Nikita Yushchenko
2018-06-19 12:42 ` Lucas Stach
2018-06-19 16:24 ` Andrey Smirnov
2018-06-19 8:51 ` [PATCH 1/2] ARM: babbage: Make PMIC initialization shareable Lucas Stach
2018-06-19 16:55 ` Andrey Smirnov
2018-06-20 7:16 ` Sascha Hauer
2018-06-20 18:13 ` Andrey Smirnov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox