2 * (C) Copyright 2007 Michal Simek
4 * Michal SIMEK <monstr@monstr.eu>
6 * SPDX-License-Identifier: GPL-2.0+
9 /* This is a board specific file. It's OK to include board specific
16 #include <asm/processor.h>
17 #include <asm/microblaze_intc.h>
21 DECLARE_GLOBAL_DATA_PTR;
23 #ifdef CONFIG_XILINX_GPIO
24 static int reset_pin = -1;
27 #if CONFIG_IS_ENABLED(OF_CONTROL)
30 void dram_init_banksize(void)
32 gd->bd->bi_dram[0].start = ram_base;
33 gd->bd->bi_dram[0].size = get_effective_memsize();
41 const void *blob = gd->fdt_blob;
43 node = fdt_node_offset_by_prop_value(blob, -1, "device_type",
45 if (node == -FDT_ERR_NOTFOUND) {
46 debug("DRAM: Can't get memory node\n");
49 addr = fdtdec_get_addr_size(blob, node, "reg", &size);
50 if (addr == FDT_ADDR_T_NONE || size == 0) {
51 debug("DRAM: Can't get base address or size\n");
56 gd->ram_top = addr; /* In setup_dest_addr() is done +ram_size */
64 gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
70 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
72 #ifndef CONFIG_SPL_BUILD
73 #ifdef CONFIG_XILINX_GPIO
75 gpio_direction_output(reset_pin, 1);
78 #ifdef CONFIG_XILINX_TB_WATCHDOG
79 hw_watchdog_disable();
82 puts ("Reseting board\n");
83 __asm__ __volatile__ (" mts rmsr, r0;" \
91 #ifdef CONFIG_XILINX_GPIO
92 reset_pin = gpio_alloc(CONFIG_SYS_GPIO_0_ADDR, "reset", 1);
94 gpio_request(reset_pin, "reset_pin");
104 int board_eth_init(bd_t *bis)
108 #ifdef CONFIG_XILINX_AXIEMAC
109 ret |= xilinx_axiemac_initialize(bis, XILINX_AXIEMAC_BASEADDR,
110 XILINX_AXIDMA_BASEADDR);
113 #if defined(CONFIG_XILINX_EMACLITE) && defined(XILINX_EMACLITE_BASEADDR)
116 # ifdef CONFIG_XILINX_EMACLITE_TX_PING_PONG
119 # ifdef CONFIG_XILINX_EMACLITE_RX_PING_PONG
122 ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,