Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 2 | /* |
| 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 Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #ifndef _UBLIMAGE_H_ |
| 12 | #define _UBLIMAGE_H_ |
| 13 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 14 | enum 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 | |
| 24 | enum 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 Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 51 | /* one NAND block */ |
Heiko Schocher | 4dd8349 | 2011-11-01 20:00:35 +0000 | [diff] [blame] | 52 | #define UBL_BLOCK_SIZE 2048 |
Loïc Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 53 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 54 | /* from sprufg5a.pdf Table 109 */ |
| 55 | struct 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 Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 80 | unsigned char res[UBL_BLOCK_SIZE - 8 * 4]; |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 81 | }; |
| 82 | |
| 83 | #endif /* _UBLIMAGE_H_ */ |