diff options
Diffstat (limited to 'arch/m68k')
| -rw-r--r-- | arch/m68k/Kconfig | 37 | ||||
| -rw-r--r-- | arch/m68k/cpu/mcf5445x/start.S | 3 | ||||
| -rw-r--r-- | arch/m68k/dts/mcf5441x.dtsi | 8 | ||||
| -rw-r--r-- | arch/m68k/dts/stmark2.dts | 4 | ||||
| -rw-r--r-- | arch/m68k/include/asm/arch-mcf5445x/clock.h | 19 | ||||
| -rw-r--r-- | arch/m68k/include/asm/io.h | 31 | ||||
| -rw-r--r-- | arch/m68k/lib/Makefile | 1 | ||||
| -rw-r--r-- | arch/m68k/lib/clock.c | 23 |
8 files changed, 96 insertions, 30 deletions
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 6ce8f577e3a..61a1845c2ee 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -11,57 +11,58 @@ config STATIC_RELA config MCF520x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF52x2 select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF523x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF530x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF5301x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF532x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF537x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE bool config MCF5441x select OF_CONTROL select DM - select DM_SERIAL + select DM_SERIAL select ARCH_COLDFIRE + select CREATE_ARCH_SYMLINK bool config M680x0 @@ -190,17 +191,19 @@ config TARGET_AMCORE select M5307 config TARGET_STMARK2 - bool "Support stmark2" - select CF_DSPI - select M54418 + bool "Support stmark2" + select CF_DSPI + select M54418 config TARGET_QEMU_M68K - bool "Support QEMU m68k virt" - select M68040 - imply CMD_DM - help - This target supports the QEMU m68k virtual machine (-M virt). - It simulates a Motorola 68040 CPU with Goldfish peripherals. + bool "Support QEMU m68k virt" + select M68040 + select BOARD_EARLY_INIT_R + select VIRTIO_MMIO + imply CMD_DM + help + This target supports the QEMU m68k virtual machine (-M virt). + It simulates a Motorola 68040 CPU with Goldfish peripherals. endchoice diff --git a/arch/m68k/cpu/mcf5445x/start.S b/arch/m68k/cpu/mcf5445x/start.S index f0264671d38..ae0e7c35d87 100644 --- a/arch/m68k/cpu/mcf5445x/start.S +++ b/arch/m68k/cpu/mcf5445x/start.S @@ -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 */ diff --git a/arch/m68k/dts/mcf5441x.dtsi b/arch/m68k/dts/mcf5441x.dtsi index dcca36312f5..7cd6072d4a5 100644 --- a/arch/m68k/dts/mcf5441x.dtsi +++ b/arch/m68k/dts/mcf5441x.dtsi @@ -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"; + }; }; }; diff --git a/arch/m68k/dts/stmark2.dts b/arch/m68k/dts/stmark2.dts index 3ba68b77d64..8e196fa65ff 100644 --- a/arch/m68k/dts/stmark2.dts +++ b/arch/m68k/dts/stmark2.dts @@ -45,3 +45,7 @@ &i2c0 { status = "okay"; }; + +&esdhc { + status = "okay"; +}; diff --git a/arch/m68k/include/asm/arch-mcf5445x/clock.h b/arch/m68k/include/asm/arch-mcf5445x/clock.h new file mode 100644 index 00000000000..10ceecafcea --- /dev/null +++ b/arch/m68k/include/asm/arch-mcf5445x/clock.h @@ -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 */ diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h index 35ad4a1c044..2577081d836 100644 --- a/arch/m68k/include/asm/io.h +++ b/arch/m68k/include/asm/io.h @@ -23,18 +23,27 @@ #define __raw_writew(w,addr) ((*(volatile u16 *) (addr)) = (w)) #define __raw_writel(l,addr) ((*(volatile u32 *) (addr)) = (l)) -#define readb(addr) in_8((volatile u8 *)(addr)) -#define writeb(b,addr) out_8((volatile u8 *)(addr), (b)) -#if !defined(__BIG_ENDIAN) -#define readw(addr) (*(volatile u16 *) (addr)) -#define readl(addr) (*(volatile u32 *) (addr)) -#define writew(b,addr) ((*(volatile u16 *) (addr)) = (b)) -#define writel(b,addr) ((*(volatile u32 *) (addr)) = (b)) +#define readb(addr) in_8((volatile u8 *)(addr)) +#define writeb(b, addr) out_8((volatile u8 *)(addr), (b)) +#ifdef CONFIG_M680x0 +/* + * For classic m68k these work the same way as Linux: + * Read a little endian value, swap to the CPU endian. + */ +#define readw(addr) in_le16((volatile u16 *)(addr)) +#define readl(addr) in_le32((volatile u32 *)(addr)) +#define writew(b, addr) out_le16((volatile u16 *)(addr), (b)) +#define writel(b, addr) out_le32((volatile u32 *)(addr), (b)) #else -#define readw(addr) in_be16((volatile u16 *)(addr)) -#define readl(addr) in_be32((volatile u32 *)(addr)) -#define writew(b,addr) out_be16((volatile u16 *)(addr),(b)) -#define writel(b,addr) out_be32((volatile u32 *)(addr),(b)) +/* + * For coldfire these read a big endian value and use it + * as-is. This means that for little endian devices on the + * bus like PCI device these won't work as expected currently. + */ +#define readw(addr) in_be16((volatile u16 *)(addr)) +#define readl(addr) in_be32((volatile u32 *)(addr)) +#define writew(b, addr) out_be16((volatile u16 *)(addr), (b)) +#define writel(b, addr) out_be32((volatile u32 *)(addr), (b)) #endif /* diff --git a/arch/m68k/lib/Makefile b/arch/m68k/lib/Makefile index cf93715637a..9ad67c4272c 100644 --- a/arch/m68k/lib/Makefile +++ b/arch/m68k/lib/Makefile @@ -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 diff --git a/arch/m68k/lib/clock.c b/arch/m68k/lib/clock.c new file mode 100644 index 00000000000..5d9aeed96c3 --- /dev/null +++ b/arch/m68k/lib/clock.c @@ -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; +} |
