]> git.ipfire.org Git - thirdparty/u-boot.git/blob - arch/mips/mach-jz47xx/jz4780/jz4780.c
common: Drop image.h from common header
[thirdparty/u-boot.git] / arch / mips / mach-jz47xx / jz4780 / jz4780.c
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 <hang.h>
13 #include <image.h>
14 #include <init.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 */
24 DECLARE_GLOBAL_DATA_PTR;
25 gd_t gdata __attribute__ ((section(".bss")));
26
27 void 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 image_header *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, (char *)&__bss_end - __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 image_header *)(CONFIG_SYS_TEXT_BASE -
61 sizeof(struct image_header));
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_SYS_TEXT_BASE;
71
72 image_entry();
73
74 hang();
75 }
76 #endif /* CONFIG_SPL_BUILD */
77
78 ulong board_get_usable_ram_top(ulong total_size)
79 {
80 return CONFIG_SYS_SDRAM_BASE + (256 * 1024 * 1024);
81 }
82
83 int print_cpuinfo(void)
84 {
85 printf("CPU: Ingenic JZ4780\n");
86 return 0;
87 }