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 <cpu_func.h> 11#include <hang.h> 12#include <image.h> 13#include <init.h> 14#include <asm/global_data.h> 15#include <asm/io.h> 16#include <asm/sections.h> 17#include <mach/jz4780.h> 18#include <mach/jz4780_dram.h> 19#include <mmc.h> 20#include <spl.h> 21 22#ifdef CONFIG_SPL_BUILD 23/* Pointer to the global data structure for SPL */ 24DECLARE_GLOBAL_DATA_PTR; 25gd_t gdata __section(".bss"); 26 27void board_init_f(ulong dummy) 28{ 29 typedef void __noreturn (*image_entry_noargs_t)(void); 30 struct mmc *mmc; 31 unsigned long count; 32 struct legacy_img_hdr *header; 33 int ret; 34 35 /* Set global data pointer */ 36 gd = &gdata; 37 38 timer_init(); 39 pll_init(); 40 sdram_init(); 41 enable_caches(); 42 43 /* Clear the BSS */ 44 memset(__bss_start, 0, (size_t)__bss_end - (size_t)__bss_start); 45 46 gd->flags |= GD_FLG_SPL_INIT; 47 48 ret = mmc_initialize(NULL); 49 if (ret) 50 hang(); 51 52 mmc = find_mmc_device(BOOT_DEVICE_MMC1); 53 if (ret) 54 hang(); 55 56 ret = mmc_init(mmc); 57 if (ret) 58 hang(); 59 60 header = (struct legacy_img_hdr *)(CONFIG_TEXT_BASE - 61 sizeof(struct legacy_img_hdr)); 62 63 count = blk_dread(mmc_get_blk_desc(mmc), 64 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, 65 0x800, header); 66 if (count == 0) 67 hang(); 68 69 image_entry_noargs_t image_entry = 70 (image_entry_noargs_t)CONFIG_TEXT_BASE; 71 72 image_entry(); 73 74 hang(); 75} 76#endif /* CONFIG_SPL_BUILD */ 77 78phys_addr_t board_get_usable_ram_top(phys_size_t total_size) 79{ 80 return CFG_SYS_SDRAM_BASE + (256 * 1024 * 1024); 81} 82 83int print_cpuinfo(void) 84{ 85 printf("CPU: Ingenic JZ4780\n"); 86 return 0; 87} 88