+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2004, Psyent Corporation <www.psyent.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
+#include <command.h>
#include <cpu.h>
+#include <cpu_func.h>
#include <dm.h>
#include <errno.h>
+#include <event.h>
+#include <init.h>
+#include <irq_func.h>
#include <asm/cache.h>
+#include <asm/global_data.h>
+#include <asm/system.h>
DECLARE_GLOBAL_DATA_PTR;
}
#endif /* CONFIG_DISPLAY_CPUINFO */
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+#ifdef CONFIG_ALTERA_SYSID
+int checkboard(void)
+{
+ display_sysid();
+ return 0;
+}
+#endif
+
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
disable_interrupts();
/* indirect call to go beyond 256MB limitation of toolchain */
}
#endif
-int arch_cpu_init_dm(void)
+static int nios_cpu_setup(void)
{
struct udevice *dev;
int ret;
- ret = uclass_first_device(UCLASS_CPU, &dev);
+ ret = uclass_first_device_err(UCLASS_CPU, &dev);
if (ret)
return ret;
- if (!dev)
- return -ENODEV;
- gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+ gd->ram_size = CFG_SYS_SDRAM_SIZE;
#ifndef CONFIG_ROM_STUBS
copy_exception_trampoline();
#endif
return 0;
}
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, nios_cpu_setup);
-static int altera_nios2_get_desc(struct udevice *dev, char *buf, int size)
+static int altera_nios2_get_desc(const struct udevice *dev, char *buf,
+ int size)
{
const char *cpu_name = "Nios-II";
return 0;
}
-static int altera_nios2_get_info(struct udevice *dev, struct cpu_info *info)
+static int altera_nios2_get_info(const struct udevice *dev,
+ struct cpu_info *info)
{
info->cpu_freq = gd->cpu_clk;
info->features = (1 << CPU_FEAT_L1_CACHE) |
return 0;
}
-static int altera_nios2_get_count(struct udevice *dev)
+static int altera_nios2_get_count(const struct udevice *dev)
{
return 1;
}
static int altera_nios2_probe(struct udevice *dev)
{
const void *blob = gd->fdt_blob;
- int node = dev->of_offset;
+ int node = dev_of_offset(dev);
gd->cpu_clk = fdtdec_get_int(blob, node,
"clock-frequency", 0);
.ops = &altera_nios2_ops,
.flags = DM_FLAG_PRE_RELOC,
};
+
+/* This is a dummy function on nios2 */
+int dram_init(void)
+{
+ return 0;
+}