ublimage.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #ifndef _UBLIMAGE_H_
  28. #define _UBLIMAGE_H_
  29. #include <config.h>
  30. #if !defined(CONFIG_SYS_UBL_BLOCK)
  31. #define CONFIG_SYS_UBL_BLOCK 512
  32. #endif
  33. enum ublimage_cmd {
  34. CMD_INVALID,
  35. CMD_BOOT_MODE,
  36. CMD_ENTRY,
  37. CMD_PAGE,
  38. CMD_ST_BLOCK,
  39. CMD_ST_PAGE,
  40. CMD_LD_ADDR
  41. };
  42. enum ublimage_fld_types {
  43. CFG_INVALID = -1,
  44. CFG_COMMAND,
  45. CFG_REG_VALUE
  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. /* Define max UBL image size */
  65. #define UBL_IMAGE_SIZE (0x00003800u)
  66. /* from sprufg5a.pdf Table 109 */
  67. struct ubl_header {
  68. uint32_t magic; /* Magic Number, see UBL_* defines */
  69. uint32_t entry; /* entry point address for bootloader */
  70. uint32_t pages; /* number of pages (size of bootloader) */
  71. uint32_t block; /*
  72. * blocknumber where user bootloader is
  73. * present
  74. */
  75. uint32_t page; /*
  76. * page number where user bootloader is
  77. * present.
  78. */
  79. uint32_t pll_m; /*
  80. * PLL setting -Multiplier (only valid if
  81. * Magic Number indicates PLL enable).
  82. */
  83. uint32_t pll_n; /*
  84. * PLL setting -Divider (only valid if
  85. * Magic Number indicates PLL enable).
  86. */
  87. uint32_t emif; /*
  88. * fast EMIF setting (only valid if
  89. * Magic Number indicates fast EMIF boot).
  90. */
  91. /* to fit in one nand block */
  92. unsigned char res[CONFIG_SYS_UBL_BLOCK - 8 * 4];
  93. };
  94. #endif /* _UBLIMAGE_H_ */