1 // SPDX-License-Identifier: GPL-2.0+ 2 /* 3 * JZ4780 common routines 4 * 5 * Copyright (c) 2013 Imagination Technologies 6 * Author: Paul Burton <paul.burton@imgtec.com> 7 */ 8 9 #include <config.h> 10 #include <common.h> 11 #include <asm/io.h> 12 #include <asm/sections.h> 13 #include <mach/jz4780.h> 14 #include <mach/jz4780_dram.h> 15 #include <mmc.h> 16 #include <spl.h> 17 18 #ifdef CONFIG_SPL_BUILD 19 /* Pointer to the global data structure for SPL */ 20 DECLARE_GLOBAL_DATA_PTR; 21 gd_t gdata __attribute__ ((section(".bss"))); 22 23 void board_init_f(ulong dummy) 24 { 25 typedef void __noreturn (*image_entry_noargs_t)(void); 26 struct mmc *mmc; 27 unsigned long count; 28 struct image_header *header; 29 int ret; 30 31 /* Set global data pointer */ 32 gd = &gdata; 33 34 timer_init(); 35 pll_init(); 36 sdram_init(); 37 enable_caches(); 38 39 /* Clear the BSS */ 40 memset(__bss_start, 0, (char *)&__bss_end - __bss_start); 41 42 gd->flags |= GD_FLG_SPL_INIT; 43 44 ret = mmc_initialize(NULL); 45 if (ret) 46 hang(); 47 48 mmc = find_mmc_device(BOOT_DEVICE_MMC1); 49 if (ret) 50 hang(); 51 52 ret = mmc_init(mmc); 53 if (ret) 54 hang(); 55 56 header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - 57 sizeof(struct image_header)); 58 59 count = blk_dread(mmc_get_blk_desc(mmc), 60 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, 61 0x800, header); 62 if (count == 0) 63 hang(); 64 65 image_entry_noargs_t image_entry = 66 (image_entry_noargs_t)CONFIG_SYS_TEXT_BASE; 67 68 image_entry(); 69 70 hang(); 71 } 72 #endif /* CONFIG_SPL_BUILD */ 73 74 ulong board_get_usable_ram_top(ulong total_size) 75 { 76 return CONFIG_SYS_SDRAM_BASE + (256 * 1024 * 1024); 77 } 78 79 int print_cpuinfo(void) 80 { 81 printf("CPU: Ingenic JZ4780\n"); 82 return 0; 83 } 84