Merge tag 'ti-v2020.07-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-ti
[oweals/u-boot.git] / board / ti / am65x / evm.c
index e01adcd642fb68446b3ad6adeb7e1becd812f18c..a22900dcf97245ae724a20088768cb3b436ea5d7 100644 (file)
@@ -9,6 +9,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <fdt_support.h>
+#include <image.h>
+#include <init.h>
+#include <net.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
@@ -68,11 +72,13 @@ int dram_init_banksize(void)
        /* Bank 0 declares the memory available in the DDR low region */
        gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
        gd->bd->bi_dram[0].size = 0x80000000;
+       gd->ram_size = 0x80000000;
 
 #ifdef CONFIG_PHYS_64BIT
        /* Bank 1 declares the memory available in the DDR high region */
        gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1;
        gd->bd->bi_dram[1].size = 0x80000000;
+       gd->ram_size = 0x100000000;
 #endif
 
        return 0;
@@ -96,10 +102,19 @@ int ft_board_setup(void *blob, bd_t *bd)
        int ret;
 
        ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000", "sram@70000000");
-       if (ret)
+       if (ret) {
                printf("%s: fixing up msmc ram failed %d\n", __func__, ret);
+               return ret;
+       }
 
-       return ret;
+#if defined(CONFIG_TI_SECURE_DEVICE)
+       /* Make HW RNG reserved for secure world use */
+       ret = fdt_disable_node(blob, "/interconnect@100000/trng@4e10000");
+       if (ret)
+               printf("%s: disabling TRGN failed %d\n", __func__, ret);
+#endif
+
+       return 0;
 }
 #endif
 
@@ -116,6 +131,19 @@ int do_board_detect(void)
        return ret;
 }
 
+int checkboard(void)
+{
+       struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+
+       if (do_board_detect())
+               /* EEPROM not populated */
+               printf("Board: %s rev %s\n", "AM6-COMPROCEVM", "E3");
+       else
+               printf("Board: %s rev %s\n", ep->name, ep->version);
+
+       return 0;
+}
+
 static void setup_board_eeprom_env(void)
 {
        char *name = "am65x";
@@ -261,7 +289,7 @@ static int probe_daughtercards(void)
                if (strncmp(ep.name, cards[i].card_name, sizeof(ep.name)))
                        continue;
 
-               printf("detected %s\n", cards[i].card_name);
+               printf("Detected: %s rev %s\n", ep.name, ep.version);
 
                /*
                 * Populate any MAC addresses from daughtercard into the U-Boot