Skip to contentSkip to conversation

m68k: dts: mcf5441x: add mmc device for mcf5441x

PATCH New Angelo Dureghello 1 participant 9 messages Apr 27

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/9 m68k: dts: mcf5441x: add mmc device for mcf5441x

Add mmc support for the mcf5441x family. There is only one esdhc controller for this cpu family.

---
 arch/m68k/dts/mcf5441x.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/m68k/dts/mcf5441x.dtsi +8 -0
index dcca36312f5..7cd6072d4a5 100644
@@ -163,5 +163,13 @@
 			clock-frequency = <100000>;
 			status = "disabled";
 		};
+
+		esdhc: mmc@0xfc0cc000 {
+			compatible = "fsl,esdhc";
+			reg = <0xfc0cc000 0x8000>;
+			non-removable;
+			bus-width = <4>;
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.54.0
#1 lore raw

PATCH v2 2/9 m68k: dts: stmark2: enable esdhc

Enable esdhc device.

---
 arch/m68k/dts/stmark2.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/m68k/dts/stmark2.dts +4 -0
index 3ba68b77d64..8e196fa65ff 100644
@@ -45,3 +45,7 @@
 &i2c0 {
 	status = "okay";
 };
+
+&esdhc {
+	status = "okay";
+};
Signature · 1 line
2.54.0
#2 lore raw

PATCH v2 3/9 board: stmark2: add sd boot command

In reply to Angelo Dureghello

Add command to boot from sd.

---
 include/configs/stmark2.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/configs/stmark2.h +4 -1
index c8a39e191a2..a7afbb3be1f 100644
@@ -14,9 +14,12 @@
 	board/sysam/stmark2/sbf_dram_init.o (.text*)
 
 #define CFG_EXTRA_ENV_SETTINGS				\
+	"boot_sd=load mmc 0:1 ${loadaddr} uImage; "		\
+		"load mmc 0:1 ${loadaddr_ramfs} uRamfs\0"	\
 	"kern_size=0x700000\0"					\
-	"loadaddr=0x40001000\0"					\
+	"loadaddr=0x42000000\0"					\
 		"-(rootfs)\0"					\
+	"loadaddr_ramfs=0x43000000\0"				\
 	"update_uboot=loady ${loadaddr}; "			\
 		"sf probe 0:1 50000000; "			\
 		"sf erase 0 0x80000; "				\
Signature · 1 line
2.54.0
#3 lore raw

PATCH v2 4/9 board: stmark2: remove old garbage

In reply to Angelo Dureghello

Remove old erroneous garbage.

---
 include/configs/stmark2.h | 1 -
 1 file changed, 1 deletion(-)
include/configs/stmark2.h +0 -1
index a7afbb3be1f..c1096398359 100644
@@ -18,7 +18,6 @@
 		"load mmc 0:1 ${loadaddr_ramfs} uRamfs\0"	\
 	"kern_size=0x700000\0"					\
 	"loadaddr=0x42000000\0"					\
-		"-(rootfs)\0"					\
 	"loadaddr_ramfs=0x43000000\0"				\
 	"update_uboot=loady ${loadaddr}; "			\
 		"sf probe 0:1 50000000; "			\
Signature · 1 line
2.54.0
#4 lore raw

PATCH v2 5/9 mmc: Kconfig: allows m68k to use esdhc imx driver

In reply to Angelo Dureghello

Allow cpu families as mcf5441x (m68k) to use the fsl_esdhc_imx driver since the hardware ip module is the same.

---
Changes in v2:
- moved before menuconfig changes

---
 drivers/mmc/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/Kconfig +1 -1
index 22bd3a972bd..24bd16ad5f3 100644
@@ -924,7 +924,7 @@ config ESDHCI_QUIRK_BROKEN_TIMEOUT_VALUE
 
 config FSL_ESDHC_IMX
 	bool "Freescale/NXP i.MX eSDHC controller support"
-	depends on MACH_IMX
+	depends on MACH_IMX || M68K
 	help
 	  This selects support for the i.MX eSDHC (Enhanced Secure Digital Host
 	  Controller) found on numerous Freescale/NXP SoCs.
Signature · 1 line
2.54.0
#5 lore raw

PATCH v2 6/9 configs: stmark2: add support for mmc

In reply to Angelo Dureghello

Add support for mmc.

---
Changes in v2:
- recreated by make menuconfig

---
 configs/stmark2_defconfig | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
configs/stmark2_defconfig +13 -5
index ae1fa34df2a..4617cb19dfe 100644
@@ -3,19 +3,19 @@ CONFIG_TEXT_BASE=0x47E00000
 CONFIG_SYS_MALLOC_LEN=0x40000
 CONFIG_SF_DEFAULT_SPEED=50000000
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0x40000
+CONFIG_ENV_OFFSET=0x80000
 CONFIG_ENV_SECT_SIZE=0x10000
 CONFIG_DEFAULT_DEVICE_TREE="stmark2"
-CONFIG_SYS_MONITOR_LEN=262144
-CONFIG_SYS_LOAD_ADDR=0x40010000
+CONFIG_SYS_MONITOR_LEN=327680
+CONFIG_SYS_LOAD_ADDR=0x42000000
 CONFIG_TARGET_STMARK2=y
 CONFIG_SYS_BARGSIZE=256
 CONFIG_SYS_MONITOR_BASE=0x47E00400
 CONFIG_TIMESTAMP=y
 CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs rdinit=/bin/init devtmpfs.mount=1"
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/ram0 rw rootfstype=ramfs rdinit=/sbin/init devtmpfs.mount=1"
 CONFIG_USE_BOOTCOMMAND=y
-CONFIG_BOOTCOMMAND="sf probe 0:1 50000000; sf read ${loadaddr} 0x100000 ${kern_size}; bootm ${loadaddr}"
+CONFIG_BOOTCOMMAND="run boot_sd; bootm ${loadaddr} ${loadaddr_ramfs}"
 CONFIG_SYS_PBSIZE=283
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_SYS_MALLOC_BOOTPARAMS=y
@@ -28,9 +28,14 @@ CONFIG_SYS_PROMPT="stmark2 $ "
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_I2C=y
 # CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
 CONFIG_CMD_SPI=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_MTDIDS_DEFAULT="nor0=spi-flash.0"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=spi-flash.0:1m(u-boot),7m(kernel),-(rootfs)"
@@ -42,6 +47,9 @@ CONFIG_HOSTNAME="stmark2"
 CONFIG_NO_NET=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_FSL=y
+CONFIG_MMC=y
+CONFIG_FSL_ESDHC_IMX=y
+CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE=y
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_ISSI=y
Signature · 1 line
2.54.0
#6 lore raw

PATCH v2 7/9 configs: stmark2: add bdinfo command

In reply to Angelo Dureghello

Enable bdinfo command.

---
Changes in v2:
- recreated by make menuconfig

---
 configs/stmark2_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/stmark2_defconfig +0 -1
index 4617cb19dfe..42629ad5d5f 100644
@@ -22,7 +22,6 @@ CONFIG_SYS_MALLOC_BOOTPARAMS=y
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMDLINE_EDITING is not set
 CONFIG_SYS_PROMPT="stmark2 $ "
-# CONFIG_CMD_BDI is not set
 # CONFIG_CMD_CONSOLE is not set
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
Signature · 1 line
2.54.0
#7 lore raw

PATCH v2 8/9 m68k: mcf5441x: create stub to use imx drivers

In reply to Angelo Dureghello

Some NXP imx hardware ip module as the esdhc controller are exactly the same in some new ColdFire cpus. For the specific case, mcf5441x needs to use the existing fsl_esdhc_imx.c driver for the esdhc device.

Create a stub to be able to use NXP "imx" serie drivers as the fsl_esdhc_imx in the ColdFire architecture.

---
 arch/m68k/Kconfig                           |  1 +
 arch/m68k/include/asm/arch-mcf5445x/clock.h | 19 +++++++++++++++++
 arch/m68k/lib/Makefile                      |  1 +
 arch/m68k/lib/clock.c                       | 23 +++++++++++++++++++++
 4 files changed, 44 insertions(+)
 create mode 100644 arch/m68k/include/asm/arch-mcf5445x/clock.h
 create mode 100644 arch/m68k/lib/clock.c
arch/m68k/Kconfig +1 -0
index 6ce8f577e3a..00e89bd0a62 100644
@@ -62,6 +62,7 @@ config MCF5441x
 	select DM
         select DM_SERIAL
 	select ARCH_COLDFIRE
+	select CREATE_ARCH_SYMLINK
 	bool
 
 config M680x0
arch/m68k/include/asm/arch-mcf5445x/clock.h new file +19 -0
new file mode 100644
index 00000000000..10ceecafcea
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * ColdFire clock support
+ *
+ * Copyright 2026 Kernelspace.
+ * Angelo Dureghello <[email protected]>
+ */
+
+#ifndef __CLOCK_H
+#define __CLOCK_H
+
+/* Stub to use fsl/nxp drivers. */
+enum mxc_clock {
+	MXC_ESDHC_CLK,
+};
+
+int mxc_get_clock(enum mxc_clock clk);
+
+#endif /* __CLOCK_H */
arch/m68k/lib/Makefile +1 -0
index cf93715637a..9ad67c4272c 100644
@@ -9,3 +9,4 @@ lib-$(CONFIG_USE_PRIVATE_LIBGCC) += lshrdi3.o muldi3.o ashldi3.o ashrdi3.o
 
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 obj-$(CONFIG_ARCH_COLDFIRE) += cache.o interrupts.o time.o traps.o bdinfo.o fec.o
+obj-$(CONFIG_MCF5441x) += clock.o
arch/m68k/lib/clock.c new file +23 -0
new file mode 100644
index 00000000000..5d9aeed96c3
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2026 Kernelspace
+ * Angelo Dureghello <[email protected]>
+ */
+
+#include <config.h>
+#include <asm/arch/clock.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+/*
+ * Stub to use existing nxp/fsl drivers.
+ */
+int mxc_get_clock(enum mxc_clock clk)
+{
+	if (clk == MXC_ESDHC_CLK)
+		return gd->arch.sdhc_clk;
+
+	printf("Unsupported MXC CLK: %d\n", clk);
+
+	return 0;
+}
Signature · 1 line
2.54.0
#8 lore raw

PATCH v2 9/9 m68k: set proper u-boot image size for initial boot

In reply to Angelo Dureghello

There is a value of 256K hardcoded as u-boot image size. This produce bank tty as soon as the image size grows over the limit. Fix it by using value preset by CONFIG_SYS_MONITOR_LEN.

---
 arch/m68k/cpu/mcf5445x/start.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/m68k/cpu/mcf5445x/start.S +1 -2
index f0264671d38..ae0e7c35d87 100644
@@ -114,7 +114,7 @@ vector192_255:
 	/* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */
 asm_sbf_img_hdr:
 	.long	0x00000000		/* checksum, not yet implemented */
-	.long	0x00040000		/* image length */
+	.long	CONFIG_SYS_MONITOR_LEN	/* image length */
 	.long	CONFIG_TEXT_BASE	/* image to be relocated at */
 
 asm_dram_init:
@@ -292,7 +292,6 @@ asm_dspi_rd_status:
 	move.b	(%a3), %d1
 	rts
 #endif /* CONFIG_CF_SBF */
-
 #ifdef CONFIG_SYS_NAND_BOOT
 	/* copy 4 boot pages to dram as soon as possible */
 	/* each page is 996 bytes (1056 total with 60 ECC bytes */
Signature · 1 line
2.54.0