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