blob: 32cc5822cab36a07cd9c2eef669d847c77e28946 [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 *
Wolfgang Denk3765b3e2013-10-07 13:07:26 +02009 * SPDX-License-Identifier: GPL-2.0+
Heiko Schocher7816f2c2011-07-16 00:06:42 +000010 */
11
12#ifndef _UBLIMAGE_H_
13#define _UBLIMAGE_H_
14
Heiko Schocher7816f2c2011-07-16 00:06:42 +000015enum ublimage_cmd {
16 CMD_INVALID,
17 CMD_BOOT_MODE,
18 CMD_ENTRY,
19 CMD_PAGE,
20 CMD_ST_BLOCK,
21 CMD_ST_PAGE,
22 CMD_LD_ADDR
23};
24
25enum ublimage_fld_types {
26 CFG_INVALID = -1,
27 CFG_COMMAND,
28 CFG_REG_VALUE
29};
30
31/*
32 * from sprufg5a.pdf Table 110
33 * Used by RBL when doing NAND boot
34 */
35#define UBL_MAGIC_BASE (0xA1ACED00)
36/* Safe boot mode */
37#define UBL_MAGIC_SAFE (0x00)
38/* DMA boot mode */
39#define UBL_MAGIC_DMA (0x11)
40/* I Cache boot mode */
41#define UBL_MAGIC_IC (0x22)
42/* Fast EMIF boot mode */
43#define UBL_MAGIC_FAST (0x33)
44/* DMA + ICache boot mode */
45#define UBL_MAGIC_DMA_IC (0x44)
46/* DMA + ICache + Fast EMIF boot mode */
47#define UBL_MAGIC_DMA_IC_FAST (0x55)
48
49/* Define max UBL image size */
50#define UBL_IMAGE_SIZE (0x00003800u)
51
Loïc Minier9f876582011-10-03 11:57:12 +020052/* one NAND block */
Heiko Schocher4dd83492011-11-01 20:00:35 +000053#define UBL_BLOCK_SIZE 2048
Loïc Minier9f876582011-10-03 11:57:12 +020054
Heiko Schocher7816f2c2011-07-16 00:06:42 +000055/* from sprufg5a.pdf Table 109 */
56struct ubl_header {
57 uint32_t magic; /* Magic Number, see UBL_* defines */
58 uint32_t entry; /* entry point address for bootloader */
59 uint32_t pages; /* number of pages (size of bootloader) */
60 uint32_t block; /*
61 * blocknumber where user bootloader is
62 * present
63 */
64 uint32_t page; /*
65 * page number where user bootloader is
66 * present.
67 */
68 uint32_t pll_m; /*
69 * PLL setting -Multiplier (only valid if
70 * Magic Number indicates PLL enable).
71 */
72 uint32_t pll_n; /*
73 * PLL setting -Divider (only valid if
74 * Magic Number indicates PLL enable).
75 */
76 uint32_t emif; /*
77 * fast EMIF setting (only valid if
78 * Magic Number indicates fast EMIF boot).
79 */
80 /* to fit in one nand block */
Loïc Minier9f876582011-10-03 11:57:12 +020081 unsigned char res[UBL_BLOCK_SIZE - 8 * 4];
Heiko Schocher7816f2c2011-07-16 00:06:42 +000082};
83
84#endif /* _UBLIMAGE_H_ */