uboot/board/xilinx/microblaze-generic/microblaze-generic.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * (C) Copyright 2007-2018 Michal Simek
   4 *
   5 * Michal SIMEK <monstr@monstr.eu>
   6 */
   7
   8/*
   9 * This is a board specific file.  It's OK to include board specific
  10 * header files
  11 */
  12
  13#include <common.h>
  14#include <config.h>
  15#include <init.h>
  16#include <dm/lists.h>
  17#include <fdtdec.h>
  18#include <linux/sizes.h>
  19
  20DECLARE_GLOBAL_DATA_PTR;
  21
  22int dram_init_banksize(void)
  23{
  24        return fdtdec_setup_memory_banksize();
  25}
  26
  27int dram_init(void)
  28{
  29        if (fdtdec_setup_mem_size_base() != 0)
  30                return -EINVAL;
  31
  32        return 0;
  33};
  34
  35int board_late_init(void)
  36{
  37        ulong max_size, lowmem_size;
  38
  39#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYSRESET_MICROBLAZE)
  40        int ret;
  41
  42        ret = device_bind_driver(gd->dm_root, "mb_soft_reset",
  43                                 "reset_soft", NULL);
  44        if (ret)
  45                printf("Warning: No reset driver: ret=%d\n", ret);
  46#endif
  47
  48        if (!(gd->flags & GD_FLG_ENV_DEFAULT)) {
  49                debug("Saved variables - Skipping\n");
  50                return 0;
  51        }
  52
  53        max_size = gd->start_addr_sp - CONFIG_STACK_SIZE;
  54        max_size = round_down(max_size, SZ_16M);
  55
  56        /* Linux default LOWMEM_SIZE is 0x30000000 = 768MB */
  57        lowmem_size = gd->ram_base + 768 * 1024 * 1024;
  58
  59        env_set_addr("initrd_high", (void *)min_t(ulong, max_size,
  60                                                  lowmem_size));
  61        env_set_addr("fdt_high", (void *)min_t(ulong, max_size, lowmem_size));
  62
  63        return 0;
  64}
  65