qixis.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright 2011 Freescale Semiconductor
  3. * Author: Shengzhou Liu <Shengzhou.Liu@freescale.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the Free
  7. * Software Foundation; either version 2 of the License, or (at your option)
  8. * any later version.
  9. *
  10. * This file provides support for the QIXIS of some Freescale reference boards.
  11. */
  12. #ifndef __QIXIS_H_
  13. #define __QIXIS_H_
  14. struct qixis {
  15. u8 id; /* ID value uniquely identifying each QDS board type */
  16. u8 arch; /* Board version information */
  17. u8 scver; /* QIXIS Version Register */
  18. u8 model; /* Information of software programming model version */
  19. u8 tagdata;
  20. u8 ctl_sys;
  21. u8 aux; /* Auxiliary Register,0x06 */
  22. u8 clk_spd;
  23. u8 stat_dut;
  24. u8 stat_sys;
  25. u8 stat_alrm;
  26. u8 present;
  27. u8 present2; /* Presence Status Register 2,0x0c */
  28. u8 rcw_ctl;
  29. u8 ctl_led;
  30. u8 i2cblk;
  31. u8 rcfg_ctl; /* Reconfig Control Register,0x10 */
  32. u8 rcfg_st;
  33. u8 dcm_ad;
  34. u8 dcm_da;
  35. u8 dcmd;
  36. u8 dmsg;
  37. u8 gdc;
  38. u8 gdd; /* DCM Debug Data Register,0x17 */
  39. u8 dmack;
  40. u8 res1[6];
  41. u8 watch; /* Watchdog Register,0x1F */
  42. u8 pwr_ctl[2]; /* Power Control Register,0x20 */
  43. u8 res2[2];
  44. u8 pwr_stat[4]; /* Power Status Register,0x24 */
  45. u8 res3[8];
  46. u8 clk_spd2[2]; /* SYSCLK clock Speed Register,0x30 */
  47. u8 res4[2];
  48. u8 sclk[3]; /* Clock Configuration Registers,0x34 */
  49. u8 res5;
  50. u8 dclk[3];
  51. u8 res6;
  52. u8 clk_dspd[3];
  53. u8 res7;
  54. u8 rst_ctl; /* Reset Control Register,0x40 */
  55. u8 rst_stat; /* Reset Status Register */
  56. u8 rst_rsn; /* Reset Reason Register */
  57. u8 rst_frc[2]; /* Reset Force Registers,0x43 */
  58. u8 res8[11];
  59. u8 brdcfg[16]; /* Board Configuration Register,0x50 */
  60. u8 dutcfg[16];
  61. u8 rcw_ad[2]; /* RCW SRAM Address Registers,0x70 */
  62. u8 rcw_data;
  63. u8 res9[5];
  64. u8 post_ctl;
  65. u8 post_stat;
  66. u8 post_dat[2];
  67. u8 pi_d[4];
  68. u8 gpio_io[4];
  69. u8 gpio_dir[4];
  70. u8 res10[20];
  71. u8 rjtag_ctl;
  72. u8 rjtag_dat;
  73. u8 res11[2];
  74. u8 trig_src[4];
  75. u8 trig_dst[4];
  76. u8 trig_stat;
  77. u8 res12[3];
  78. u8 trig_ctr[4];
  79. u8 res13[16];
  80. u8 clk_freq[6]; /* Clock Measurement Registers */
  81. u8 res_c6[8];
  82. u8 clk_base[2]; /* Clock Frequency Base Reg */
  83. u8 res_d0[16];
  84. u8 aux2[4]; /* Auxiliary Registers,0xE0 */
  85. u8 res14[10];
  86. u8 aux_ad;
  87. u8 aux_da;
  88. u8 res15[16];
  89. };
  90. u8 qixis_read(unsigned int reg);
  91. void qixis_write(unsigned int reg, u8 value);
  92. u16 qixis_read_minor(void);
  93. char *qixis_read_time(char *result);
  94. char *qixis_read_tag(char *buf);
  95. const char *byte_to_binary_mask(u8 val, u8 mask, char *buf);
  96. #ifdef CONFIG_SYS_I2C_FPGA_ADDR
  97. u8 qixis_read_i2c(unsigned int reg);
  98. void qixis_write_i2c(unsigned int reg, u8 value);
  99. #endif
  100. #define QIXIS_READ(reg) qixis_read(offsetof(struct qixis, reg))
  101. #define QIXIS_WRITE(reg, value) qixis_write(offsetof(struct qixis, reg), value)
  102. #ifdef CONFIG_SYS_I2C_FPGA_ADDR
  103. #define QIXIS_READ_I2C(reg) qixis_read_i2c(offsetof(struct qixis, reg))
  104. #define QIXIS_WRITE_I2C(reg, value) \
  105. qixis_write_i2c(offsetof(struct qixis, reg), value)
  106. #endif
  107. #endif