1 // SPDX-License-Identifier: GPL-2.0+
4 * David Feng <fenghua@phytium.com.cn>
5 * Sharma Bhupesh <bhupesh.sharma@freescale.com>
15 #include <linux/compiler.h>
16 #include <dm/platform_data/serial_pl01x.h>
18 #include <asm/armv8/mmu.h>
20 DECLARE_GLOBAL_DATA_PTR;
22 static const struct pl01x_serial_platdata serial_platdata = {
25 .clock = CONFIG_PL011_CLOCK,
28 U_BOOT_DEVICE(vexpress_serials) = {
29 .name = "serial_pl01x",
30 .platdata = &serial_platdata,
33 static struct mm_region vexpress64_mem_map[] = {
38 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
40 PTE_BLOCK_PXN | PTE_BLOCK_UXN
44 .size = 0xff80000000UL,
45 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
53 struct mm_region *mem_map = vexpress64_mem_map;
55 /* This function gets replaced by platforms supporting PCIe.
56 * The replacement function, eg. on Juno, initialises the PCIe bus.
58 __weak void vexpress64_pcie_init(void)
64 vexpress64_pcie_init();
70 gd->ram_size = PHYS_SDRAM_1_SIZE;
74 int dram_init_banksize(void)
76 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
77 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
79 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
80 gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
86 #ifdef CONFIG_OF_BOARD
87 #define JUNO_FLASH_SEC_SIZE (256 * 1024)
88 static phys_addr_t find_dtb_in_nor_flash(const char *partname)
90 phys_addr_t sector = CONFIG_SYS_FLASH_BASE;
94 i < CONFIG_SYS_MAX_FLASH_SECT;
95 i++, sector += JUNO_FLASH_SEC_SIZE) {
96 int len = strlen(partname) + 1;
101 reg = readl(sector + JUNO_FLASH_SEC_SIZE - 0x04);
102 /* This makes up the string "HSLFTOOF" flash footer */
103 if (reg != 0x464F4F54U)
105 reg = readl(sector + JUNO_FLASH_SEC_SIZE - 0x08);
106 if (reg != 0x464C5348U)
109 for (offs = 0; offs < 32; offs += 4, len -= 4) {
110 reg = readl(sector + JUNO_FLASH_SEC_SIZE - 0x30 + offs);
111 if (strncmp(partname + offs, (char *)®,
118 reg = readl(sector + JUNO_FLASH_SEC_SIZE - 0x10);
119 imginfo = sector + JUNO_FLASH_SEC_SIZE - 0x30 - reg;
120 reg = readl(imginfo + 0x54);
122 return CONFIG_SYS_FLASH_BASE +
123 reg * JUNO_FLASH_SEC_SIZE;
127 printf("No DTB found\n");
132 void *board_fdt_blob_setup(void)
134 phys_addr_t fdt_rom_addr = find_dtb_in_nor_flash(CONFIG_JUNO_DTB_PART);
136 if (fdt_rom_addr == ~0UL)
139 return (void *)fdt_rom_addr;
143 /* Actual reset is done via PSCI. */
144 void reset_cpu(ulong addr)
149 * Board specific ethernet initialization routine.
151 int board_eth_init(bd_t *bis)
154 #ifdef CONFIG_SMC91111
155 rc = smc91111_initialize(0, CONFIG_SMC91111_BASE);
157 #ifdef CONFIG_SMC911X
158 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);