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 | * |
| 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 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 31 | enum ublimage_cmd { |
| 32 | CMD_INVALID, |
| 33 | CMD_BOOT_MODE, |
| 34 | CMD_ENTRY, |
| 35 | CMD_PAGE, |
| 36 | CMD_ST_BLOCK, |
| 37 | CMD_ST_PAGE, |
| 38 | CMD_LD_ADDR |
| 39 | }; |
| 40 | |
| 41 | enum ublimage_fld_types { |
| 42 | CFG_INVALID = -1, |
| 43 | CFG_COMMAND, |
| 44 | CFG_REG_VALUE |
| 45 | }; |
| 46 | |
| 47 | /* |
| 48 | * from sprufg5a.pdf Table 110 |
| 49 | * Used by RBL when doing NAND boot |
| 50 | */ |
| 51 | #define UBL_MAGIC_BASE (0xA1ACED00) |
| 52 | /* Safe boot mode */ |
| 53 | #define UBL_MAGIC_SAFE (0x00) |
| 54 | /* DMA boot mode */ |
| 55 | #define UBL_MAGIC_DMA (0x11) |
| 56 | /* I Cache boot mode */ |
| 57 | #define UBL_MAGIC_IC (0x22) |
| 58 | /* Fast EMIF boot mode */ |
| 59 | #define UBL_MAGIC_FAST (0x33) |
| 60 | /* DMA + ICache boot mode */ |
| 61 | #define UBL_MAGIC_DMA_IC (0x44) |
| 62 | /* DMA + ICache + Fast EMIF boot mode */ |
| 63 | #define UBL_MAGIC_DMA_IC_FAST (0x55) |
| 64 | |
| 65 | /* Define max UBL image size */ |
| 66 | #define UBL_IMAGE_SIZE (0x00003800u) |
| 67 | |
Loïc Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 68 | /* one NAND block */ |
Heiko Schocher | 4dd8349 | 2011-11-01 20:00:35 +0000 | [diff] [blame] | 69 | #define UBL_BLOCK_SIZE 2048 |
Loïc Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 70 | |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 71 | /* from sprufg5a.pdf Table 109 */ |
| 72 | struct ubl_header { |
| 73 | uint32_t magic; /* Magic Number, see UBL_* defines */ |
| 74 | uint32_t entry; /* entry point address for bootloader */ |
| 75 | uint32_t pages; /* number of pages (size of bootloader) */ |
| 76 | uint32_t block; /* |
| 77 | * blocknumber where user bootloader is |
| 78 | * present |
| 79 | */ |
| 80 | uint32_t page; /* |
| 81 | * page number where user bootloader is |
| 82 | * present. |
| 83 | */ |
| 84 | uint32_t pll_m; /* |
| 85 | * PLL setting -Multiplier (only valid if |
| 86 | * Magic Number indicates PLL enable). |
| 87 | */ |
| 88 | uint32_t pll_n; /* |
| 89 | * PLL setting -Divider (only valid if |
| 90 | * Magic Number indicates PLL enable). |
| 91 | */ |
| 92 | uint32_t emif; /* |
| 93 | * fast EMIF setting (only valid if |
| 94 | * Magic Number indicates fast EMIF boot). |
| 95 | */ |
| 96 | /* to fit in one nand block */ |
Loïc Minier | 9f87658 | 2011-10-03 11:57:12 +0200 | [diff] [blame] | 97 | unsigned char res[UBL_BLOCK_SIZE - 8 * 4]; |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 98 | }; |
| 99 | |
| 100 | #endif /* _UBLIMAGE_H_ */ |