blob: 65d6aa1ff07bc2bdb11f0bad3a18e65084b31198 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Heiko Schocher7816f2c2011-07-16 00:06:42 +00002/*
3 * (C) Copyright 2011
4 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5 *
6 * Vased on:
7 * (C) Copyright 2009
8 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
Heiko Schocher7816f2c2011-07-16 00:06:42 +00009 */
10
11#ifndef _UBLIMAGE_H_
12#define _UBLIMAGE_H_
13
Heiko Schocher7816f2c2011-07-16 00:06:42 +000014enum ublimage_cmd {
15 CMD_INVALID,
16 CMD_BOOT_MODE,
17 CMD_ENTRY,
18 CMD_PAGE,
19 CMD_ST_BLOCK,
20 CMD_ST_PAGE,
21 CMD_LD_ADDR
22};
23
24enum ublimage_fld_types {
25 CFG_INVALID = -1,
26 CFG_COMMAND,
27 CFG_REG_VALUE
28};
29
30/*
31 * from sprufg5a.pdf Table 110
32 * Used by RBL when doing NAND boot
33 */
34#define UBL_MAGIC_BASE (0xA1ACED00)
35/* Safe boot mode */
36#define UBL_MAGIC_SAFE (0x00)
37/* DMA boot mode */
38#define UBL_MAGIC_DMA (0x11)
39/* I Cache boot mode */
40#define UBL_MAGIC_IC (0x22)
41/* Fast EMIF boot mode */
42#define UBL_MAGIC_FAST (0x33)
43/* DMA + ICache boot mode */
44#define UBL_MAGIC_DMA_IC (0x44)
45/* DMA + ICache + Fast EMIF boot mode */
46#define UBL_MAGIC_DMA_IC_FAST (0x55)
47
48/* Define max UBL image size */
49#define UBL_IMAGE_SIZE (0x00003800u)
50
Loïc Minier9f876582011-10-03 11:57:12 +020051/* one NAND block */
Heiko Schocher4dd83492011-11-01 20:00:35 +000052#define UBL_BLOCK_SIZE 2048
Loïc Minier9f876582011-10-03 11:57:12 +020053
Heiko Schocher7816f2c2011-07-16 00:06:42 +000054/* from sprufg5a.pdf Table 109 */
55struct ubl_header {
56 uint32_t magic; /* Magic Number, see UBL_* defines */
57 uint32_t entry; /* entry point address for bootloader */
58 uint32_t pages; /* number of pages (size of bootloader) */
59 uint32_t block; /*
60 * blocknumber where user bootloader is
61 * present
62 */
63 uint32_t page; /*
64 * page number where user bootloader is
65 * present.
66 */
67 uint32_t pll_m; /*
68 * PLL setting -Multiplier (only valid if
69 * Magic Number indicates PLL enable).
70 */
71 uint32_t pll_n; /*
72 * PLL setting -Divider (only valid if
73 * Magic Number indicates PLL enable).
74 */
75 uint32_t emif; /*
76 * fast EMIF setting (only valid if
77 * Magic Number indicates fast EMIF boot).
78 */
79 /* to fit in one nand block */
Loïc Minier9f876582011-10-03 11:57:12 +020080 unsigned char res[UBL_BLOCK_SIZE - 8 * 4];
Heiko Schocher7816f2c2011-07-16 00:06:42 +000081};
82
83#endif /* _UBLIMAGE_H_ */