Files
u-boot/arch/m68k/cpu/m680x0/cpu.c
Kuan-Wei Chiu c69b6aeaa3 m68k: Add support for M68040 CPU
Add support for the Motorola 68040 architecture. Currently, m68k
support in U-Boot is primarily focused on ColdFire variants. Introduce
the necessary infrastructure to support the classic M680x0 series,
specifically targeting the M68040 as emulated by QEMU.

The implementation includes exception vectors, early startup code, and
minimal CPU initialization and relocation stubs. It also defines the
standard m68k boot information structure used for passing hardware
information to the operating system. To ensure compatibility, ColdFire-
specific library objects such as cache and interrupt handling are
excluded from the build when M68040 is selected.

Additionally, apply a specific workaround during the early memory
reservation stage. Use a manual loop to clear global data instead of
the standard memset() function, as utilizing memset() at this point was
observed to cause a hang on the QEMU platform.

Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Acked-by: Angelo Dureghello <angelo@kernel-space.org>
Reviewed-by: Simon Glass <simon.glass@canonical.com>
2026-02-02 14:24:41 -06:00

74 lines
1.5 KiB
C

// SPDX-License-Identifier: GPL-2.0-or-later
/*
* CPU specific code for m68040
*
* Copyright (C) 2025, Kuan-Wei Chiu <visitorckw@gmail.com>
*/
#include <config.h>
#include <cpu_func.h>
#include <init.h>
#include <stdio.h>
#include <asm/global_data.h>
#include <linux/types.h>
DECLARE_GLOBAL_DATA_PTR;
void m68k_virt_init_reserve(ulong base)
{
struct global_data *gd_ptr = (struct global_data *)base;
char *p = (char *)gd_ptr;
unsigned int i;
/* FIXME: usage of memset() here caused a hang on QEMU m68k virt. */
for (i = 0; i < sizeof(*gd_ptr); i++)
p[i] = 0;
gd = gd_ptr;
gd->malloc_base = base + sizeof(*gd_ptr);
}
int print_cpuinfo(void)
{
puts("CPU: M68040 (QEMU Virt)\n");
return 0;
}
int get_clocks(void)
{
return 0;
}
int cpu_init_r(void)
{
return 0;
}
/*
* Relocation Stub
* We skip actual relocation for this QEMU bring-up and jump directly
* to board_init_r.
*/
void relocate_code(ulong sp, struct global_data *new_gd, ulong relocaddr)
{
board_init_r(new_gd, relocaddr);
}
/* Stubs for Standard Facilities (Cache, Interrupts) */
int disable_interrupts(void) { return 0; }
void enable_interrupts(void) { return; }
int interrupt_init(void) { return 0; }
void icache_enable(void) {}
void icache_disable(void) {}
int icache_status(void) { return 0; }
void dcache_enable(void) {}
void dcache_disable(void) {}
int dcache_status(void) { return 0; }
void flush_cache(unsigned long start, unsigned long size) {}
void flush_dcache_range(unsigned long start, unsigned long stop) {}