Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 1 | /* |
| 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 Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame^] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #ifndef _UBLIMAGE_H_ |
| 13 | #define _UBLIMAGE_H_ |
| 14 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 15 | enum 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 | |
| 25 | enum 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 Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 52 | /* one NAND block */ |
Heiko Schocher | 4dd8349 | 2011-11-01 20:00:35 +0000 | [diff] [blame] | 53 | #define UBL_BLOCK_SIZE 2048 |
Loïc Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 54 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 55 | /* from sprufg5a.pdf Table 109 */ |
| 56 | struct 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 Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 81 | unsigned char res[UBL_BLOCK_SIZE - 8 * 4]; |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 82 | }; |
| 83 | |
| 84 | #endif /* _UBLIMAGE_H_ */ |