kwbimage.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * (C) Copyright 2008
  3. * Marvell Semiconductor <www.marvell.com>
  4. * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef _KWBIMAGE_H_
  25. #define _KWBIMAGE_H_
  26. #include <stdint.h>
  27. #define KWBIMAGE_MAX_CONFIG ((0x1dc - 0x20)/sizeof(struct reg_config))
  28. #define MAX_TEMPBUF_LEN 32
  29. /* NAND ECC Mode */
  30. #define IBR_HDR_ECC_DEFAULT 0x00
  31. #define IBR_HDR_ECC_FORCED_HAMMING 0x01
  32. #define IBR_HDR_ECC_FORCED_RS 0x02
  33. #define IBR_HDR_ECC_DISABLED 0x03
  34. /* Boot Type - block ID */
  35. #define IBR_HDR_I2C_ID 0x4D
  36. #define IBR_HDR_SPI_ID 0x5A
  37. #define IBR_HDR_NAND_ID 0x8B
  38. #define IBR_HDR_SATA_ID 0x78
  39. #define IBR_HDR_PEX_ID 0x9C
  40. #define IBR_HDR_UART_ID 0x69
  41. #define IBR_DEF_ATTRIB 0x00
  42. enum kwbimage_cmd {
  43. CMD_INVALID,
  44. CMD_BOOT_FROM,
  45. CMD_NAND_ECC_MODE,
  46. CMD_NAND_PAGE_SIZE,
  47. CMD_SATA_PIO_MODE,
  48. CMD_DDR_INIT_DELAY,
  49. CMD_DATA
  50. };
  51. enum kwbimage_cmd_types {
  52. CFG_INVALID = -1,
  53. CFG_COMMAND,
  54. CFG_DATA0,
  55. CFG_DATA1
  56. };
  57. /* typedefs */
  58. typedef struct bhr_t {
  59. uint8_t blockid; /*0 */
  60. uint8_t nandeccmode; /*1 */
  61. uint16_t nandpagesize; /*2-3 */
  62. uint32_t blocksize; /*4-7 */
  63. uint32_t rsvd1; /*8-11 */
  64. uint32_t srcaddr; /*12-15 */
  65. uint32_t destaddr; /*16-19 */
  66. uint32_t execaddr; /*20-23 */
  67. uint8_t satapiomode; /*24 */
  68. uint8_t rsvd3; /*25 */
  69. uint16_t ddrinitdelay; /*26-27 */
  70. uint16_t rsvd2; /*28-29 */
  71. uint8_t ext; /*30 */
  72. uint8_t checkSum; /*31 */
  73. } bhr_t, *pbhr_t;
  74. struct reg_config {
  75. uint32_t raddr;
  76. uint32_t rdata;
  77. };
  78. typedef struct extbhr_t {
  79. uint32_t dramregsoffs;
  80. uint8_t rsrvd1[0x20 - sizeof(uint32_t)];
  81. struct reg_config rcfg[KWBIMAGE_MAX_CONFIG];
  82. uint8_t rsrvd2[7];
  83. uint8_t checkSum;
  84. } extbhr_t, *pextbhr_t;
  85. struct kwb_header {
  86. bhr_t kwb_hdr;
  87. extbhr_t kwb_exthdr;
  88. };
  89. /*
  90. * functions
  91. */
  92. void init_kwb_image_type (void);
  93. #endif /* _KWBIMAGE_H_ */