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>
16 DECLARE_GLOBAL_DATA_PTR;
18 extern phys_addr_t prior_stage_fdt_address;
20 * Miscellaneous platform dependent initializations
25 gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
32 unsigned long sdram_base = PHYS_SDRAM_0;
33 unsigned long expected_size = PHYS_SDRAM_0_SIZE + PHYS_SDRAM_1_SIZE;
34 unsigned long actual_size;
36 actual_size = get_ram_size((void *)sdram_base, expected_size);
37 gd->ram_size = actual_size;
39 if (expected_size != actual_size) {
40 printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
41 actual_size >> 20, expected_size >> 20);
47 int dram_init_banksize(void)
49 gd->bd->bi_dram[0].start = PHYS_SDRAM_0;
50 gd->bd->bi_dram[0].size = PHYS_SDRAM_0_SIZE;
51 gd->bd->bi_dram[1].start = PHYS_SDRAM_1;
52 gd->bd->bi_dram[1].size = PHYS_SDRAM_1_SIZE;
57 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
58 int board_eth_init(bd_t *bd)
60 return ftmac100_initialize(bd);
64 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
69 void *board_fdt_blob_setup(void)
71 return (void *)CONFIG_SYS_FDT_BASE;
77 const char *compat = "andestech,atfsmc020";
78 void *blob = (void *)gd->fdt_blob;
80 struct ftsmc020_bank *regs;
82 node = fdt_node_offset_by_compatible(blob, -1, compat);
84 return -FDT_ERR_NOTFOUND;
86 addr = fdtdec_get_addr(blob, node, "reg");
88 if (addr == FDT_ADDR_T_NONE)
91 regs = (struct ftsmc020_bank *)addr;
92 regs->cr &= ~FTSMC020_BANK_WPROT;
97 static void v5l2_init(void)
101 uclass_get_device(UCLASS_CACHE, 0, &dev);
104 #ifdef CONFIG_BOARD_EARLY_INIT_F
105 int board_early_init_f(void)