]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/arm/cpu/armv7/omap-common/boot-common.c
Merge branch 'master' of git://git.denx.de/u-boot-nand-flash
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / omap-common / boot-common.c
1 /*
2  * boot-common.c
3  *
4  * Common bootmode functions for omap based boards
5  *
6  * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
18
19 #include <common.h>
20 #include <spl.h>
21 #include <asm/omap_common.h>
22 #include <asm/arch/omap.h>
23 #include <asm/arch/mmc_host_def.h>
24 #include <asm/arch/sys_proto.h>
25
26 DECLARE_GLOBAL_DATA_PTR;
27
28 #ifdef CONFIG_SPL_BUILD
29 u32 spl_boot_device(void)
30 {
31         return (u32) (gd->arch.omap_boot_params.omap_bootdevice);
32 }
33
34 u32 spl_boot_mode(void)
35 {
36         return gd->arch.omap_boot_params.omap_bootmode;
37 }
38
39 void spl_board_init(void)
40 {
41 #ifdef CONFIG_SPL_NAND_SUPPORT
42         gpmc_init();
43 #endif
44 #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
45         arch_misc_init();
46 #endif
47 }
48
49 int board_mmc_init(bd_t *bis)
50 {
51         switch (spl_boot_device()) {
52         case BOOT_DEVICE_MMC1:
53                 omap_mmc_init(0, 0, 0, -1, -1);
54                 break;
55         case BOOT_DEVICE_MMC2:
56         case BOOT_DEVICE_MMC2_2:
57                 omap_mmc_init(1, 0, 0, -1, -1);
58                 break;
59         }
60         return 0;
61 }
62
63 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
64 {
65         typedef void __noreturn (*image_entry_noargs_t)(u32 *);
66         image_entry_noargs_t image_entry =
67                         (image_entry_noargs_t) spl_image->entry_point;
68
69         debug("image entry point: 0x%X\n", spl_image->entry_point);
70         /* Pass the saved boot_params from rom code */
71         image_entry((u32 *)&gd->arch.omap_boot_params);
72 }
73 #endif