mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris
@ 2024-12-13 14:06 Jonas Rebmann
  2024-12-16  8:18 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Rebmann @ 2024-12-13 14:06 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Jonas Rebmann

This patch adds support for the toradex colibri imx6 on the carrier
board toradex iris. Both imx6dl and imx6s variants are supported but
only the imx6dl was available for testing.

Tested was:
 - UART console
 - Boot via USB loader
 - Boot via eMMC
 - Ethernet/tftp/nfs

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 arch/arm/boards/Makefile                           |   1 +
 arch/arm/boards/toradex-colibri-imx6/Makefile      |   4 +
 arch/arm/boards/toradex-colibri-imx6/board.c       |  46 +++++++
 .../flash-header-colibri-imx6dl.imxcfg             | 144 ++++++++++++++++++++
 .../flash-header-colibri-imx6s.imxcfg              | 145 +++++++++++++++++++++
 arch/arm/boards/toradex-colibri-imx6/lowlevel.c    |  60 +++++++++
 arch/arm/configs/imx_v7_defconfig                  |   1 +
 arch/arm/configs/multi_v7_defconfig                |   1 +
 arch/arm/dts/Makefile                              |   1 +
 arch/arm/dts/imx6dl-colibri-iris.dts               |  37 ++++++
 arch/arm/mach-imx/Kconfig                          |   5 +
 images/Makefile.imx                                |   3 +
 12 files changed, 448 insertions(+)

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 67d91616f623be9eddd370485707eeb25d3ebe40..593774d1d80c074899ce2d15b2064c00087c4d2f 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -34,6 +34,7 @@ obj-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK)		+= efika-mx-smartbook/
 obj-$(CONFIG_MACH_EMBEDSKY_E9)			+= embedsky-e9/
 obj-$(CONFIG_MACH_EMBEST_MARSBOARD)		+= embest-marsboard/
 obj-$(CONFIG_MACH_EMBEST_RIOTBOARD)		+= embest-riotboard/
+obj-$(CONFIG_MACH_TORADEX_COLIBRI_IMX6)		+= toradex-colibri-imx6/
 obj-$(CONFIG_MACH_ELTEC_HIPERCAM)		+= eltec-hipercam/
 obj-y						+= freescale-mx51-babbage/
 obj-$(CONFIG_MACH_FREESCALE_MX53_LOCO)		+= freescale-mx53-qsb/
diff --git a/arch/arm/boards/toradex-colibri-imx6/Makefile b/arch/arm/boards/toradex-colibri-imx6/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..da63d2625f7a36f45f32a07d601fb48afd19c978
--- /dev/null
+++ b/arch/arm/boards/toradex-colibri-imx6/Makefile
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/toradex-colibri-imx6/board.c b/arch/arm/boards/toradex-colibri-imx6/board.c
new file mode 100644
index 0000000000000000000000000000000000000000..fc433edce517c82f7c5a48a6eb5edfcc0ca007ef
--- /dev/null
+++ b/arch/arm/boards/toradex-colibri-imx6/board.c
@@ -0,0 +1,46 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <asm/armlinux.h>
+#include <common.h>
+#include <environment.h>
+#include <mach/imx/bbu.h>
+#include <mach/imx/generic.h>
+#include <mach/imx/imx6-regs.h>
+#include <mach/imx/imx6.h>
+#include <mfd/imx6q-iomuxc-gpr.h>
+
+static void eth_init(void)
+{
+        void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
+        uint32_t val;
+
+        val = readl(iomux + IOMUXC_GPR1);
+        val |= IMX6Q_GPR1_ENET_CLK_SEL_ANATOP;
+        writel(val, iomux + IOMUXC_GPR1);
+}
+
+static int colibri_imx6_probe(struct device *dev)
+{
+	imx6_bbu_internal_mmcboot_register_handler("emmc", "/dev/mmc0",
+			BBU_HANDLER_FLAG_DEFAULT);
+	imx6_bbu_internal_mmc_register_handler("sd", "/dev/mmc1", 0);
+
+	barebox_set_hostname("colibri-imx6");
+
+	eth_init();
+
+	return 0;
+}
+
+static const struct of_device_id colibri_imx6_match[] = {
+	{ .compatible = "toradex,colibri_imx6dl"},
+	{ /* sentinel */ },
+};
+BAREBOX_DEEP_PROBE_ENABLE(colibri_imx6_match);
+
+static struct driver colibri_imx6_board_driver = {
+	.name = "board-colibri-imx6",
+	.probe = colibri_imx6_probe,
+	.of_compatible = DRV_OF_COMPAT(colibri_imx6_match),
+};
+device_platform_driver(colibri_imx6_board_driver);
diff --git a/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6dl.imxcfg b/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6dl.imxcfg
new file mode 100644
index 0000000000000000000000000000000000000000..d5ebaec3606864982a4b222370ee7d2f41aefb44
--- /dev/null
+++ b/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6dl.imxcfg
@@ -0,0 +1,144 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013, Boundary Devices <info@boundarydevices.com>
+ * Copyright (C) 2014-2019, Toradex AG
+ */
+
+loadaddr 0x20000000
+soc imx6
+ivtofs 0x400
+
+#include <mach/imx/imx6-ddr-regs.h>
+#include <mach/imx/imx6dl-ddr-regs.h>
+
+/* mx6dl_dcd_table */
+
+/* ddr-setup.cfg */
+
+wm 32 MX6_IOM_DRAM_SDQS0 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS1 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS2 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS3 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS4 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS5 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS6 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS7 0x00000030
+
+wm 32 MX6_IOM_GRP_B0DS 0x00000030
+wm 32 MX6_IOM_GRP_B1DS 0x00000030
+wm 32 MX6_IOM_GRP_B2DS 0x00000030
+wm 32 MX6_IOM_GRP_B3DS 0x00000030
+wm 32 MX6_IOM_GRP_B4DS 0x00000030
+wm 32 MX6_IOM_GRP_B5DS 0x00000030
+wm 32 MX6_IOM_GRP_B6DS 0x00000030
+wm 32 MX6_IOM_GRP_B7DS 0x00000030
+wm 32 MX6_IOM_GRP_ADDDS 0x00000030
+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */
+wm 32 MX6_IOM_GRP_CTLDS 0x00000030
+
+wm 32 MX6_IOM_DRAM_DQM0 0x00020030
+wm 32 MX6_IOM_DRAM_DQM1 0x00020030
+wm 32 MX6_IOM_DRAM_DQM2 0x00020030
+wm 32 MX6_IOM_DRAM_DQM3 0x00020030
+wm 32 MX6_IOM_DRAM_DQM4 0x00020030
+wm 32 MX6_IOM_DRAM_DQM5 0x00020030
+wm 32 MX6_IOM_DRAM_DQM6 0x00020030
+wm 32 MX6_IOM_DRAM_DQM7 0x00020030
+
+wm 32 MX6_IOM_DRAM_CAS 0x00020030
+wm 32 MX6_IOM_DRAM_RAS 0x00020030
+wm 32 MX6_IOM_DRAM_SDCLK_0 0x00020030
+wm 32 MX6_IOM_DRAM_SDCLK_1 0x00020030
+
+wm 32 MX6_IOM_DRAM_RESET 0x00020030
+wm 32 MX6_IOM_DRAM_SDCKE0 0x00003000
+wm 32 MX6_IOM_DRAM_SDCKE1 0x00003000
+
+wm 32 MX6_IOM_DRAM_SDODT0 0x00003030
+wm 32 MX6_IOM_DRAM_SDODT1 0x00003030
+
+/* (differential input) */
+wm 32 MX6_IOM_DDRMODE_CTL 0x00020000
+/* (differential input) */
+wm 32 MX6_IOM_GRP_DDRMODE 0x00020000
+/* disable ddr pullups */
+wm 32 MX6_IOM_GRP_DDRPKE 0x00000000
+wm 32 MX6_IOM_DRAM_SDBA2 0x00000000
+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */
+wm 32 MX6_IOM_GRP_DDR_TYPE 0x000C0000
+
+/* Read data DQ Byte0-3 delay */
+wm 32 MX6_MMDC_P0_MPRDDQBY0DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY1DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY2DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY3DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY0DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY1DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY2DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY3DL 0x33333333
+
+/*
+ * MDMISC	mirroring	interleaved (row/bank/col)
+ */
+wm 32 MX6_MMDC_P0_MDMISC 0x000b17c0
+
+/*
+ * MDSCR	con_req
+ */
+wm 32 MX6_MMDC_P0_MDSCR 0x00008000
+
+/* 800mhz_2x64mx16.cfg */
+
+wm 32 MX6_MMDC_P0_MDPDC 0x0002002D
+wm 32 MX6_MMDC_P0_MDCFG0 0x2C305503
+wm 32 MX6_MMDC_P0_MDCFG1 0xB66D8D63
+wm 32 MX6_MMDC_P0_MDCFG2 0x01FF00DB
+wm 32 MX6_MMDC_P0_MDRWD 0x000026D2
+wm 32 MX6_MMDC_P0_MDOR 0x00301023
+wm 32 MX6_MMDC_P0_MDOTC 0x00333030
+wm 32 MX6_MMDC_P0_MDPDC 0x0002556D
+/* CS0 End: 7MSB of ((0x10000000, + 512M) -1) >> 25 */
+wm 32 MX6_MMDC_P0_MDASP 0x00000017
+/* DDR3 DATA BUS SIZE: 64BIT */
+wm 32 MX6_MMDC_P0_MDCTL 0x821A0000
+/* DDR3 DATA BUS SIZE: 32BIT */
+/* MX6_MMDC_P0_MDCTL, 0x82190000, */
+
+/* Write commands to DDR */
+/* Load Mode Registers */
+/* TODO Use Auto Self-Refresh mode (Extended Temperature)*/
+/* MX6_MMDC_P0_MDSCR, 0x04408032, */
+wm 32 MX6_MMDC_P0_MDSCR 0x04008032
+wm 32 MX6_MMDC_P0_MDSCR 0x00008033
+wm 32 MX6_MMDC_P0_MDSCR 0x00048031
+wm 32 MX6_MMDC_P0_MDSCR 0x13208030
+/* ZQ calibration */
+wm 32 MX6_MMDC_P0_MDSCR 0x04008040
+
+wm 32 MX6_MMDC_P0_MPZQHWCTRL 0xA1390003
+wm 32 MX6_MMDC_P1_MPZQHWCTRL 0xA1390003
+wm 32 MX6_MMDC_P0_MDREF 0x00005800
+
+wm 32 MX6_MMDC_P0_MPODTCTRL 0x00000000
+wm 32 MX6_MMDC_P1_MPODTCTRL 0x00000000
+
+wm 32 MX6_MMDC_P0_MPDGCTRL0 0x42360232
+wm 32 MX6_MMDC_P0_MPDGCTRL1 0x021F022A
+wm 32 MX6_MMDC_P1_MPDGCTRL0 0x421E0224
+wm 32 MX6_MMDC_P1_MPDGCTRL1 0x02110218
+
+wm 32 MX6_MMDC_P0_MPRDDLCTL 0x41434344
+wm 32 MX6_MMDC_P1_MPRDDLCTL 0x4345423E
+wm 32 MX6_MMDC_P0_MPWRDLCTL 0x39383339
+wm 32 MX6_MMDC_P1_MPWRDLCTL 0x3E363930
+
+wm 32 MX6_MMDC_P0_MPWLDECTRL0 0x00340039
+wm 32 MX6_MMDC_P0_MPWLDECTRL1 0x002C002D
+wm 32 MX6_MMDC_P1_MPWLDECTRL0 0x00120019
+wm 32 MX6_MMDC_P1_MPWLDECTRL1 0x0012002D
+
+wm 32 MX6_MMDC_P0_MPMUR0 0x00000800
+wm 32 MX6_MMDC_P1_MPMUR0 0x00000800
+wm 32 MX6_MMDC_P0_MDSCR 0x00000000
+wm 32 MX6_MMDC_P0_MAPSR 0x00011006
diff --git a/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6s.imxcfg b/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6s.imxcfg
new file mode 100644
index 0000000000000000000000000000000000000000..75febb0b7759b02a64522420aafdc7ee1cbd0667
--- /dev/null
+++ b/arch/arm/boards/toradex-colibri-imx6/flash-header-colibri-imx6s.imxcfg
@@ -0,0 +1,145 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013, Boundary Devices <info@boundarydevices.com>
+ * Copyright (C) 2014-2019, Toradex AG
+ */
+
+loadaddr 0x20000000
+soc imx6
+ivtofs 0x400
+
+#include <mach/imx/imx6-ddr-regs.h>
+#include <mach/imx/imx6dl-ddr-regs.h>
+
+/* mx6s_dcd_table */
+
+/* ddr-setup.cfg */
+
+wm 32 MX6_IOM_DRAM_SDQS0 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS1 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS2 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS3 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS4 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS5 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS6 0x00000030
+wm 32 MX6_IOM_DRAM_SDQS7 0x00000030
+
+wm 32 MX6_IOM_GRP_B0DS 0x00000030
+wm 32 MX6_IOM_GRP_B1DS 0x00000030
+wm 32 MX6_IOM_GRP_B2DS 0x00000030
+wm 32 MX6_IOM_GRP_B3DS 0x00000030
+wm 32 MX6_IOM_GRP_B4DS 0x00000030
+wm 32 MX6_IOM_GRP_B5DS 0x00000030
+wm 32 MX6_IOM_GRP_B6DS 0x00000030
+wm 32 MX6_IOM_GRP_B7DS 0x00000030
+wm 32 MX6_IOM_GRP_ADDDS 0x00000030
+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */
+wm 32 MX6_IOM_GRP_CTLDS 0x00000030
+
+wm 32 MX6_IOM_DRAM_DQM0 0x00020030
+wm 32 MX6_IOM_DRAM_DQM1 0x00020030
+wm 32 MX6_IOM_DRAM_DQM2 0x00020030
+wm 32 MX6_IOM_DRAM_DQM3 0x00020030
+wm 32 MX6_IOM_DRAM_DQM4 0x00020030
+wm 32 MX6_IOM_DRAM_DQM5 0x00020030
+wm 32 MX6_IOM_DRAM_DQM6 0x00020030
+wm 32 MX6_IOM_DRAM_DQM7 0x00020030
+
+wm 32 MX6_IOM_DRAM_CAS 0x00020030
+wm 32 MX6_IOM_DRAM_RAS 0x00020030
+wm 32 MX6_IOM_DRAM_SDCLK_0 0x00020030
+wm 32 MX6_IOM_DRAM_SDCLK_1 0x00020030
+
+wm 32 MX6_IOM_DRAM_RESET 0x00020030
+wm 32 MX6_IOM_DRAM_SDCKE0 0x00003000
+wm 32 MX6_IOM_DRAM_SDCKE1 0x00003000
+
+wm 32 MX6_IOM_DRAM_SDODT0 0x00003030
+wm 32 MX6_IOM_DRAM_SDODT1 0x00003030
+
+/* (differential input) */
+wm 32 MX6_IOM_DDRMODE_CTL 0x00020000
+/* (differential input) */
+wm 32 MX6_IOM_GRP_DDRMODE 0x00020000
+/* disable ddr pullups */
+wm 32 MX6_IOM_GRP_DDRPKE 0x00000000
+wm 32 MX6_IOM_DRAM_SDBA2 0x00000000
+/* 40 Ohm drive strength for cs0/1,sdba2,cke0/1,sdwe */
+wm 32 MX6_IOM_GRP_DDR_TYPE 0x000C0000
+
+/* Read data DQ Byte0-3 delay */
+wm 32 MX6_MMDC_P0_MPRDDQBY0DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY1DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY2DL 0x33333333
+wm 32 MX6_MMDC_P0_MPRDDQBY3DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY0DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY1DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY2DL 0x33333333
+wm 32 MX6_MMDC_P1_MPRDDQBY3DL 0x33333333
+
+/*
+ * MDMISC	mirroring	interleaved (row/bank/col)
+ */
+wm 32 MX6_MMDC_P0_MDMISC 0x000b17c0
+
+/*
+ * MDSCR	con_req
+ */
+wm 32 MX6_MMDC_P0_MDSCR 0x00008000
+
+
+/* 800mhz_2x64mx16.cfg */
+
+wm 32 MX6_MMDC_P0_MDPDC 0x0002002D
+wm 32 MX6_MMDC_P0_MDCFG0 0x2C305503
+wm 32 MX6_MMDC_P0_MDCFG1 0xB66D8D63
+wm 32 MX6_MMDC_P0_MDCFG2 0x01FF00DB
+wm 32 MX6_MMDC_P0_MDRWD 0x000026D2
+wm 32 MX6_MMDC_P0_MDOR 0x00301023
+wm 32 MX6_MMDC_P0_MDOTC 0x00333030
+wm 32 MX6_MMDC_P0_MDPDC 0x0002556D
+/* CS0 End: 7MSB of ((0x10000000, + 512M) -1) >> 25 */
+wm 32 MX6_MMDC_P0_MDASP 0x00000017
+/* DDR3 DATA BUS SIZE: 64BIT */
+/* MX6_MMDC_P0_MDCTL, 0x821A0000, */
+/* DDR3 DATA BUS SIZE: 32BIT */
+wm 32 MX6_MMDC_P0_MDCTL 0x82190000
+
+/* Write commands to DDR */
+/* Load Mode Registers */
+/* TODO Use Auto Self-Refresh mode (Extended Temperature)*/
+/* MX6_MMDC_P0_MDSCR, 0x04408032, */
+wm 32 MX6_MMDC_P0_MDSCR 0x04008032
+wm 32 MX6_MMDC_P0_MDSCR 0x00008033
+wm 32 MX6_MMDC_P0_MDSCR 0x00048031
+wm 32 MX6_MMDC_P0_MDSCR 0x13208030
+/* ZQ calibration */
+wm 32 MX6_MMDC_P0_MDSCR 0x04008040
+
+wm 32 MX6_MMDC_P0_MPZQHWCTRL 0xA1390003
+wm 32 MX6_MMDC_P1_MPZQHWCTRL 0xA1390003
+wm 32 MX6_MMDC_P0_MDREF 0x00005800
+
+wm 32 MX6_MMDC_P0_MPODTCTRL 0x00000000
+wm 32 MX6_MMDC_P1_MPODTCTRL 0x00000000
+
+wm 32 MX6_MMDC_P0_MPDGCTRL0 0x42360232
+wm 32 MX6_MMDC_P0_MPDGCTRL1 0x021F022A
+wm 32 MX6_MMDC_P1_MPDGCTRL0 0x421E0224
+wm 32 MX6_MMDC_P1_MPDGCTRL1 0x02110218
+
+wm 32 MX6_MMDC_P0_MPRDDLCTL 0x41434344
+wm 32 MX6_MMDC_P1_MPRDDLCTL 0x4345423E
+wm 32 MX6_MMDC_P0_MPWRDLCTL 0x39383339
+wm 32 MX6_MMDC_P1_MPWRDLCTL 0x3E363930
+
+wm 32 MX6_MMDC_P0_MPWLDECTRL0 0x00340039
+wm 32 MX6_MMDC_P0_MPWLDECTRL1 0x002C002D
+wm 32 MX6_MMDC_P1_MPWLDECTRL0 0x00120019
+wm 32 MX6_MMDC_P1_MPWLDECTRL1 0x0012002D
+
+wm 32 MX6_MMDC_P0_MPMUR0 0x00000800
+wm 32 MX6_MMDC_P1_MPMUR0 0x00000800
+wm 32 MX6_MMDC_P0_MDSCR 0x00000000
+wm 32 MX6_MMDC_P0_MAPSR 0x00011006
diff --git a/arch/arm/boards/toradex-colibri-imx6/lowlevel.c b/arch/arm/boards/toradex-colibri-imx6/lowlevel.c
new file mode 100644
index 0000000000000000000000000000000000000000..5bb4dcd37f637f4703fa959a657fddc81dfff82e
--- /dev/null
+++ b/arch/arm/boards/toradex-colibri-imx6/lowlevel.c
@@ -0,0 +1,60 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <asm/barebox-arm.h>
+#include <debug_ll.h>
+#include <mach/imx/debug_ll.h>
+#include <mach/imx/imx6.h>
+#include <mach/imx/iomux-mx6.h>
+
+#define UART_DT_IOMUX_PAD(_mux_ctrl_ofs, _pad_ctrl_ofs, _sel_input_ofs, _mux_mode, _sel_input) \
+	IOMUX_PAD(_pad_ctrl_ofs, _mux_ctrl_ofs, _mux_mode, _sel_input_ofs, \
+		  _sel_input, MX6Q_UART_PAD_CTRL)
+
+/* We only have C defines for MX6Q_ */
+#define MX6DL_PAD_CSI0_DAT11__UART1_TX_DATA        UART_DT_IOMUX_PAD(0x050, 0x364, 0x000, 0x3, 0x0)
+
+static void setup_uart(void)
+{
+	void __iomem *uart1base = IOMEM(MX6_UART1_BASE_ADDR);
+	void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR);
+
+	if (!IS_ENABLED(CONFIG_DEBUG_LL))
+		return;
+
+	imx6_uart_setup(uart1base);
+	imx_uart_set_dte(uart1base);
+
+	imx_setup_pad(iomuxbase, MX6DL_PAD_CSI0_DAT11__UART1_TX_DATA);
+
+	putc_ll('>');
+}
+
+extern char __dtb_z_imx6dl_colibri_iris_start[];
+
+ENTRY_FUNCTION(start_imx6dl_colibri_iris, r0, r1, r2)
+{
+	void *fdt;
+
+	imx6_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
+		setup_uart();
+	}
+
+	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
+	barebox_arm_entry(0x10000000, SZ_512M, fdt);
+}
+
+ENTRY_FUNCTION(start_imx6s_colibri_iris, r0, r1, r2)
+{
+	void *fdt;
+
+	imx6_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
+		setup_uart();
+	}
+
+	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
+	barebox_arm_entry(0x10000000, SZ_256M, fdt);
+}
diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig
index 72833eb09fe8be4cc14f099c8785d04dc1a100e7..eaddb98319a26648f6901bfa03a0c0168ab1330b 100644
--- a/arch/arm/configs/imx_v7_defconfig
+++ b/arch/arm/configs/imx_v7_defconfig
@@ -20,6 +20,7 @@ CONFIG_MACH_ELTEC_HIPERCAM=y
 CONFIG_MACH_EMBEDSKY_E9=y
 CONFIG_MACH_EMBEST_MARSBOARD=y
 CONFIG_MACH_EMBEST_RIOTBOARD=y
+CONFIG_MACH_TORADEX_COLIBRI_IMX6=y
 CONFIG_MACH_SABRELITE=y
 CONFIG_MACH_SABRESD=y
 CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 8acbb287164bce3449a597a4037b7cc99a2fb4bd..a95342dda6262de51d69119f2a6b59ae5ebf9179 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -30,6 +30,7 @@ CONFIG_MACH_ELTEC_HIPERCAM=y
 CONFIG_MACH_EMBEDSKY_E9=y
 CONFIG_MACH_EMBEST_MARSBOARD=y
 CONFIG_MACH_EMBEST_RIOTBOARD=y
+CONFIG_MACH_TORADEX_COLIBRI_IMX6=y
 CONFIG_MACH_SABRELITE=y
 CONFIG_MACH_SABRESD=y
 CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index fe32b812f6037f382954a84f9ab40cfc8715e367..a7be3262a45023599567ef52653510c3f31cbac2 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -161,6 +161,7 @@ lwl-$(CONFIG_MACH_NXP_IMX8MQ_EVK) += imx8mq-evk.dtb.o
 lwl-$(CONFIG_MACH_INNOCOMM_WB15) += imx8mm-innocomm-wb15-evk.dtb.o
 lwl-$(CONFIG_MACH_TQ_MBA8MPXL) += imx8mp-tqma8mpql-mba8mpxl.dtb.o
 lwl-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
+lwl-$(CONFIG_MACH_TORADEX_COLIBRI_IMX6) += imx6dl-colibri-iris.dtb.o
 lwl-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
 lwl-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
 lwl-$(CONFIG_MACH_TQMA6UL) += imx6ul-tqma6ul2-mba6ulx.dtb.o \
diff --git a/arch/arm/dts/imx6dl-colibri-iris.dts b/arch/arm/dts/imx6dl-colibri-iris.dts
new file mode 100644
index 0000000000000000000000000000000000000000..0e10b34cf71c5014287491f8a40ca5323f64eaa3
--- /dev/null
+++ b/arch/arm/dts/imx6dl-colibri-iris.dts
@@ -0,0 +1,37 @@
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License version 2.
+ */
+
+#include <arm/nxp/imx/imx6dl-colibri-iris.dts>
+#include "imx6qdl.dtsi"
+
+/ {
+	chosen {
+		barebox-environment {
+			compatible = "barebox,environment";
+			device-path = &bbenv_emmc;
+		};
+	};
+};
+
+&usdhc3 {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		bbenv_emmc: partition@e0000 {
+			label = "barebox-environment";
+			reg = <0 0xe0000 0 0x20000>;
+		};
+	};
+};
+
+&clks {
+	fsl,pmic-stby-poweroff;
+};
+
+&pmic {
+	fsl,pmic-stby-poweroff;
+};
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d1f8dc795b578fafd2bd2b4c1e59b85430668af7..ce1c5a80d568ce1076f4dd02161b589f501c7a78 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -389,6 +389,11 @@ config MACH_EMBEST_RIOTBOARD
 	select ARCH_IMX6
 	imply AT803X_PHY
 
+config MACH_TORADEX_COLIBRI_IMX6
+	bool "Toradex Colibri iMX6"
+	select ARCH_IMX6
+	select ARM_USE_COMPRESSED_DTB
+
 config MACH_SABRELITE
 	bool "Freescale i.MX6 Sabre Lite"
 	select ARCH_IMX6
diff --git a/images/Makefile.imx b/images/Makefile.imx
index d0f1f156ea6c9c8ca3298970fa2c3886e9302212..c3f1bd5f05a008321944cf68659c146f8cd25ce1 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -298,6 +298,9 @@ $(call build_imx_habv4img, CONFIG_MACH_EMBEST_MARSBOARD, start_imx6q_marsboard,
 
 $(call build_imx_habv4img, CONFIG_MACH_EMBEST_RIOTBOARD, start_imx6s_riotboard, embest-riotboard/flash-header-embest-riotboard, embest-imx6s-riotboard)
 
+$(call build_imx_habv4img, CONFIG_MACH_TORADEX_COLIBRI_IMX6, start_imx6dl_colibri_iris, toradex-colibri-imx6/flash-header-colibri-imx6dl, toradex-imx6dl-colibri-iris)
+$(call build_imx_habv4img, CONFIG_MACH_TORADEX_COLIBRI_IMX6,  start_imx6s_colibri_iris,  toradex-colibri-imx6/flash-header-colibri-imx6s,  toradex-imx6s-colibri-iris)
+
 $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycard_imx6q_1gib, phytec-som-imx6/flash-header-phytec-pcaaxl3-1gib, phytec-phycard-imx6q-1gib)
 
 $(call build_imx_habv4img, CONFIG_MACH_PHYTEC_SOM_IMX6, start_phytec_phycard_imx6q_1gib_1bank, phytec-som-imx6/flash-header-phytec-pcaaxl3-1gib-1bank, phytec-phycard-imx6q-1gib-1bank)

---
base-commit: a7ae043343c89e8b75904a41174b9b4cf2df35a0
change-id: 20241213-toradex-colibri-imx6-7ae7b917692a

Best regards,
-- 
Jonas Rebmann <jre@pengutronix.de>




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris
  2024-12-13 14:06 [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris Jonas Rebmann
@ 2024-12-16  8:18 ` Sascha Hauer
  2024-12-16  8:55   ` Ahmad Fatoum
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2024-12-16  8:18 UTC (permalink / raw)
  To: Jonas Rebmann; +Cc: BAREBOX

Hi Jonas,

On Fri, Dec 13, 2024 at 03:06:59PM +0100, Jonas Rebmann wrote:
> +static void eth_init(void)
> +{
> +        void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;

IOMEM() instead of casting to void *.

> +ENTRY_FUNCTION(start_imx6dl_colibri_iris, r0, r1, r2)
> +{
> +	void *fdt;
> +
> +	imx6_cpu_lowlevel_init();
> +
> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> +		setup_uart();
> +	}
> +
> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
> +	barebox_arm_entry(0x10000000, SZ_512M, fdt);
> +}

Rather do a:

	relocate_to_current_adr();
	setup_c();

Then jump to a noinline function to continue startup.

Additionally to setting up the UART for _ll access you can do
a

	pbl_set_putc(imx_uart_putc, uart1base);

The advantage is that you no longer have to enable CONFIG_DEBUG_LL to
get early console output, but only CONFIG_PBL_CONSOLE.

You can do the UART setup unconditionally, no need to hide that behind
CONFIG_DEBUG_LL.

> +
> +ENTRY_FUNCTION(start_imx6s_colibri_iris, r0, r1, r2)
> +{
> +	void *fdt;
> +
> +	imx6_cpu_lowlevel_init();
> +
> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> +		setup_uart();
> +	}
> +
> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
> +	barebox_arm_entry(0x10000000, SZ_256M, fdt);
> +}

You should be able to call imx6q_barebox_entry() instead here. This
will read the amount of DRAM back from the controller. No need to
distinguish between both board anymore and you can merge both images
into one.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris
  2024-12-16  8:18 ` Sascha Hauer
@ 2024-12-16  8:55   ` Ahmad Fatoum
  2024-12-16  9:34     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Ahmad Fatoum @ 2024-12-16  8:55 UTC (permalink / raw)
  To: Sascha Hauer, Jonas Rebmann; +Cc: BAREBOX

Hello Sascha,

On 16.12.24 09:18, Sascha Hauer wrote:
> Hi Jonas,
> 
> On Fri, Dec 13, 2024 at 03:06:59PM +0100, Jonas Rebmann wrote:
>> +static void eth_init(void)
>> +{
>> +        void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
> 
> IOMEM() instead of casting to void *.
> 
>> +ENTRY_FUNCTION(start_imx6dl_colibri_iris, r0, r1, r2)
>> +{
>> +	void *fdt;
>> +
>> +	imx6_cpu_lowlevel_init();
>> +
>> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
>> +		setup_uart();
>> +	}
>> +
>> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
>> +	barebox_arm_entry(0x10000000, SZ_512M, fdt);
>> +}
> 
> Rather do a:
> 
> 	relocate_to_current_adr();
> 	setup_c();
> 
> Then jump to a noinline function to continue startup.
> 
> Additionally to setting up the UART for _ll access you can do
> a
> 
> 	pbl_set_putc(imx_uart_putc, uart1base);
> 
> The advantage is that you no longer have to enable CONFIG_DEBUG_LL to
> get early console output, but only CONFIG_PBL_CONSOLE.
> 
> You can do the UART setup unconditionally, no need to hide that behind
> CONFIG_DEBUG_LL.

By using the DCD table, the benefit of the console so early is greatly
reduced, that's why I told Jonas that DEBUG_LL would be enough.

> 
>> +
>> +ENTRY_FUNCTION(start_imx6s_colibri_iris, r0, r1, r2)
>> +{
>> +	void *fdt;
>> +
>> +	imx6_cpu_lowlevel_init();
>> +
>> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
>> +		setup_uart();
>> +	}
>> +
>> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
>> +	barebox_arm_entry(0x10000000, SZ_256M, fdt);
>> +}
> 
> You should be able to call imx6q_barebox_entry() instead here. This
> will read the amount of DRAM back from the controller. No need to
> distinguish between both board anymore and you can merge both images
> into one.

The images have different DCD tables, so combining the entry point
won't work. You can't have different imxcfg files for a single entry point.

Cheers,
Ahmad

> 
> Sascha
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris
  2024-12-16  8:55   ` Ahmad Fatoum
@ 2024-12-16  9:34     ` Sascha Hauer
  2024-12-16  9:36       ` Ahmad Fatoum
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2024-12-16  9:34 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Jonas Rebmann, BAREBOX

On Mon, Dec 16, 2024 at 09:55:47AM +0100, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 16.12.24 09:18, Sascha Hauer wrote:
> > Hi Jonas,
> > 
> > On Fri, Dec 13, 2024 at 03:06:59PM +0100, Jonas Rebmann wrote:
> >> +static void eth_init(void)
> >> +{
> >> +        void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
> > 
> > IOMEM() instead of casting to void *.
> > 
> >> +ENTRY_FUNCTION(start_imx6dl_colibri_iris, r0, r1, r2)
> >> +{
> >> +	void *fdt;
> >> +
> >> +	imx6_cpu_lowlevel_init();
> >> +
> >> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> >> +		setup_uart();
> >> +	}
> >> +
> >> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
> >> +	barebox_arm_entry(0x10000000, SZ_512M, fdt);
> >> +}
> > 
> > Rather do a:
> > 
> > 	relocate_to_current_adr();
> > 	setup_c();
> > 
> > Then jump to a noinline function to continue startup.
> > 
> > Additionally to setting up the UART for _ll access you can do
> > a
> > 
> > 	pbl_set_putc(imx_uart_putc, uart1base);
> > 
> > The advantage is that you no longer have to enable CONFIG_DEBUG_LL to
> > get early console output, but only CONFIG_PBL_CONSOLE.
> > 
> > You can do the UART setup unconditionally, no need to hide that behind
> > CONFIG_DEBUG_LL.
> 
> By using the DCD table, the benefit of the console so early is greatly
> reduced, that's why I told Jonas that DEBUG_LL would be enough.

Ok. Nevertheless the IS_ENABLED(CONFIG_DEBUG_LL) can be removed.

> 
> > 
> >> +
> >> +ENTRY_FUNCTION(start_imx6s_colibri_iris, r0, r1, r2)
> >> +{
> >> +	void *fdt;
> >> +
> >> +	imx6_cpu_lowlevel_init();
> >> +
> >> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> >> +		setup_uart();
> >> +	}
> >> +
> >> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
> >> +	barebox_arm_entry(0x10000000, SZ_256M, fdt);
> >> +}
> > 
> > You should be able to call imx6q_barebox_entry() instead here. This
> > will read the amount of DRAM back from the controller. No need to
> > distinguish between both board anymore and you can merge both images
> > into one.
> 
> The images have different DCD tables, so combining the entry point
> won't work. You can't have different imxcfg files for a single entry point.

Ah, right. Would __alias work for ENTRY_FUNCTION?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris
  2024-12-16  9:34     ` Sascha Hauer
@ 2024-12-16  9:36       ` Ahmad Fatoum
  0 siblings, 0 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2024-12-16  9:36 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Jonas Rebmann, BAREBOX

Hi,

On 16.12.24 10:34, Sascha Hauer wrote:
> On Mon, Dec 16, 2024 at 09:55:47AM +0100, Ahmad Fatoum wrote:
>> On 16.12.24 09:18, Sascha Hauer wrote:
>> By using the DCD table, the benefit of the console so early is greatly
>> reduced, that's why I told Jonas that DEBUG_LL would be enough.
> 
> Ok. Nevertheless the IS_ENABLED(CONFIG_DEBUG_LL) can be removed.

Yes, just once is enough.

>>>> +
>>>> +ENTRY_FUNCTION(start_imx6s_colibri_iris, r0, r1, r2)
>>>> +{
>>>> +	void *fdt;
>>>> +
>>>> +	imx6_cpu_lowlevel_init();
>>>> +
>>>> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
>>>> +		setup_uart();
>>>> +	}
>>>> +
>>>> +	fdt = __dtb_z_imx6dl_colibri_iris_start + get_runtime_offset();
>>>> +	barebox_arm_entry(0x10000000, SZ_256M, fdt);
>>>> +}
>>>
>>> You should be able to call imx6q_barebox_entry() instead here. This
>>> will read the amount of DRAM back from the controller. No need to
>>> distinguish between both board anymore and you can merge both images
>>> into one.
>>
>> The images have different DCD tables, so combining the entry point
>> won't work. You can't have different imxcfg files for a single entry point.
> 
> Ah, right. Would __alias work for ENTRY_FUNCTION?

I don't see why it shouldn't. Jonas can surely give it a try. :-)

Cheers,
Ahmad

> 
> Sascha
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-16  9:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 14:06 [PATCH] ARM: boards: Add support for todarex colibri imx6 on iris Jonas Rebmann
2024-12-16  8:18 ` Sascha Hauer
2024-12-16  8:55   ` Ahmad Fatoum
2024-12-16  9:34     ` Sascha Hauer
2024-12-16  9:36       ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox