ublimage.h 2.7 KB

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