blob: c9266890cede13c7d591aacf70dc3ac7d8329d6d [file] [log] [blame]
Heiko Schocher7816f2c2011-07-16 00:06:42 +00001/*
2 * (C) Copyright 2011
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
4 *
5 * Vased on:
6 * (C) Copyright 2009
7 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
8 *
9 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 * MA 02111-1307 USA
26 */
27
28#ifndef _UBLIMAGE_H_
29#define _UBLIMAGE_H_
30
31#include <config.h>
32
33#if !defined(CONFIG_SYS_UBL_BLOCK)
34#define CONFIG_SYS_UBL_BLOCK 512
35#endif
36
37enum ublimage_cmd {
38 CMD_INVALID,
39 CMD_BOOT_MODE,
40 CMD_ENTRY,
41 CMD_PAGE,
42 CMD_ST_BLOCK,
43 CMD_ST_PAGE,
44 CMD_LD_ADDR
45};
46
47enum ublimage_fld_types {
48 CFG_INVALID = -1,
49 CFG_COMMAND,
50 CFG_REG_VALUE
51};
52
53/*
54 * from sprufg5a.pdf Table 110
55 * Used by RBL when doing NAND boot
56 */
57#define UBL_MAGIC_BASE (0xA1ACED00)
58/* Safe boot mode */
59#define UBL_MAGIC_SAFE (0x00)
60/* DMA boot mode */
61#define UBL_MAGIC_DMA (0x11)
62/* I Cache boot mode */
63#define UBL_MAGIC_IC (0x22)
64/* Fast EMIF boot mode */
65#define UBL_MAGIC_FAST (0x33)
66/* DMA + ICache boot mode */
67#define UBL_MAGIC_DMA_IC (0x44)
68/* DMA + ICache + Fast EMIF boot mode */
69#define UBL_MAGIC_DMA_IC_FAST (0x55)
70
71/* Define max UBL image size */
72#define UBL_IMAGE_SIZE (0x00003800u)
73
74/* from sprufg5a.pdf Table 109 */
75struct ubl_header {
76 uint32_t magic; /* Magic Number, see UBL_* defines */
77 uint32_t entry; /* entry point address for bootloader */
78 uint32_t pages; /* number of pages (size of bootloader) */
79 uint32_t block; /*
80 * blocknumber where user bootloader is
81 * present
82 */
83 uint32_t page; /*
84 * page number where user bootloader is
85 * present.
86 */
87 uint32_t pll_m; /*
88 * PLL setting -Multiplier (only valid if
89 * Magic Number indicates PLL enable).
90 */
91 uint32_t pll_n; /*
92 * PLL setting -Divider (only valid if
93 * Magic Number indicates PLL enable).
94 */
95 uint32_t emif; /*
96 * fast EMIF setting (only valid if
97 * Magic Number indicates fast EMIF boot).
98 */
99 /* to fit in one nand block */
100 unsigned char res[CONFIG_SYS_UBL_BLOCK - 8 * 4];
101};
102
103#endif /* _UBLIMAGE_H_ */