1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 Michal Simek
5 * Michal SIMEK <monstr@monstr.eu>
8 /* This is a board specific file. It's OK to include board specific
14 #include <asm/processor.h>
15 #include <asm/microblaze_intc.h>
19 DECLARE_GLOBAL_DATA_PTR;
21 #ifdef CONFIG_XILINX_GPIO
22 static int reset_pin = -1;
27 int dram_init_banksize(void)
29 gd->bd->bi_dram[0].start = ram_base;
30 gd->bd->bi_dram[0].size = get_effective_memsize();
40 const void *blob = gd->fdt_blob;
42 node = fdt_node_offset_by_prop_value(blob, -1, "device_type",
44 if (node == -FDT_ERR_NOTFOUND) {
45 debug("DRAM: Can't get memory node\n");
48 addr = fdtdec_get_addr_size(blob, node, "reg", &size);
49 if (addr == FDT_ADDR_T_NONE || size == 0) {
50 debug("DRAM: Can't get base address or size\n");
55 gd->ram_top = addr; /* In setup_dest_addr() is done +ram_size */
61 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
63 #ifndef CONFIG_SPL_BUILD
64 #ifdef CONFIG_XILINX_GPIO
66 gpio_direction_output(reset_pin, 1);
69 #ifdef CONFIG_XILINX_TB_WATCHDOG
70 hw_watchdog_disable();
73 puts ("Reseting board\n");
74 __asm__ __volatile__ (" mts rmsr, r0;" \
80 static int gpio_init(void)
82 #ifdef CONFIG_XILINX_GPIO
83 reset_pin = gpio_alloc(CONFIG_SYS_GPIO_0_ADDR, "reset", 1);
85 gpio_request(reset_pin, "reset_pin");
90 int board_late_init(void)