1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Andes Technology Corporation
4 * Rick Chen, Andes Technology Corporation <rick@andestech.com>
8 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
12 #include <faraday/ftsmc020.h>
17 DECLARE_GLOBAL_DATA_PTR;
19 extern phys_addr_t prior_stage_fdt_address;
21 * Miscellaneous platform dependent initializations
26 gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
33 unsigned long sdram_base = PHYS_SDRAM_0;
34 unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE;
35 unsigned long actual_size;
37 actual_size = get_ram_size((void *)sdram_base, expected_size);
38 gd->ram_size = actual_size;
40 if (expected_size != actual_size) {
41 printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
42 actual_size >> 20, expected_size >> 20);
48 int dram_init_banksize(void)
50 gd->bd->bi_dram[0].start = PHYS_SDRAM_0;
51 gd->bd->bi_dram[0].size = PHYS_SDRAM_0_SIZE;
52 gd->bd->bi_dram[1].start = PHYS_SDRAM_1;
53 gd->bd->bi_dram[1].size = PHYS_SDRAM_1_SIZE;
58 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
59 int board_eth_init(bd_t *bd)
61 return ftmac100_initialize(bd);
65 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
70 void *board_fdt_blob_setup(void)
72 return (void *)CONFIG_SYS_FDT_BASE;
78 const char *compat = "andestech,atfsmc020";
79 void *blob = (void *)gd->fdt_blob;
81 struct ftsmc020_bank *regs;
83 node = fdt_node_offset_by_compatible(blob, -1, compat);
85 return -FDT_ERR_NOTFOUND;
87 addr = fdtdec_get_addr(blob, node, "reg");
89 if (addr == FDT_ADDR_T_NONE)
92 regs = (struct ftsmc020_bank *)addr;
93 regs->cr &= ~FTSMC020_BANK_WPROT;
98 static void v5l2_init(void)
102 uclass_get_device(UCLASS_CACHE, 0, &dev);
105 #ifdef CONFIG_BOARD_EARLY_INIT_F
106 int board_early_init_f(void)
116 void board_boot_order(u32 *spl_boot_list)
119 u32 boot_devices[] = {
120 #ifdef CONFIG_SPL_RAM_SUPPORT
123 #ifdef CONFIG_SPL_MMC_SUPPORT
128 for (i = 0; i < ARRAY_SIZE(boot_devices); i++)
129 spl_boot_list[i] = boot_devices[i];
133 #ifdef CONFIG_SPL_LOAD_FIT
134 int board_fit_config_name_match(const char *name)
136 /* boot using first FIT config */