]> Git Repo - J-u-boot.git/blobdiff - arch/nios2/cpu/cpu.c
Merge tag 'v2023.10-rc4' into next
[J-u-boot.git] / arch / nios2 / cpu / cpu.c
index f6d5cd399a3acea273007dfe0a28b6ff44c5aebb..79a54d1bc2590b845c0a6938ae07da84d5b786c3 100644 (file)
@@ -1,15 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2004, Psyent Corporation <www.psyent.com>
  * Scott McNutt <[email protected]>
- *
- * 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;
 
@@ -21,7 +27,15 @@ int print_cpuinfo(void)
 }
 #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 */
@@ -50,26 +64,26 @@ static void copy_exception_trampoline(void)
 }
 #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";
 
@@ -80,7 +94,8 @@ static int altera_nios2_get_desc(struct udevice *dev, char *buf, int size)
        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) |
@@ -89,7 +104,7 @@ static int altera_nios2_get_info(struct udevice *dev, struct cpu_info *info)
        return 0;
 }
 
-static int altera_nios2_get_count(struct udevice *dev)
+static int altera_nios2_get_count(const struct udevice *dev)
 {
        return 1;
 }
@@ -97,7 +112,7 @@ static int altera_nios2_get_count(struct udevice *dev)
 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);
@@ -144,3 +159,9 @@ U_BOOT_DRIVER(altera_nios2) = {
        .ops            = &altera_nios2_ops,
        .flags          = DM_FLAG_PRE_RELOC,
 };
+
+/* This is a dummy function on nios2 */
+int dram_init(void)
+{
+       return 0;
+}
This page took 0.03049 seconds and 4 git commands to generate.