calculationAnalysisOfLeakageCurrentConsumption.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright(c) 2006, Intel Corporation.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms and conditions of the GNU General Public License,
  6. * version 2, as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  16. *
  17. */
  18. #ifndef _ADMA_H
  19. #define _ADMA_H
  20. #include <linux/types.h>
  21. #include <linux/io.h>
  22. #include <mach/hardware.h>
  23. #include <asm/hardware/iop_adma.h>
  24. #define ADMA_ACCR(chan) (chan->mmr_base + 0x0)
  25. #define ADMA_ACSR(chan) (chan->mmr_base + 0x4)
  26. #define ADMA_ADAR(chan) (chan->mmr_base + 0x8)
  27. #define ADMA_IIPCR(chan) (chan->mmr_base + 0x18)
  28. #define ADMA_IIPAR(chan) (chan->mmr_base + 0x1c)
  29. #define ADMA_IIPUAR(chan) (chan->mmr_base + 0x20)
  30. #define ADMA_ANDAR(chan) (chan->mmr_base + 0x24)
  31. #define ADMA_ADCR(chan) (chan->mmr_base + 0x28)
  32. #define ADMA_CARMD(chan) (chan->mmr_base + 0x2c)
  33. #define ADMA_ABCR(chan) (chan->mmr_base + 0x30)
  34. #define ADMA_DLADR(chan) (chan->mmr_base + 0x34)
  35. #define ADMA_DUADR(chan) (chan->mmr_base + 0x38)
  36. #define ADMA_SLAR(src, chan) (chan->mmr_base + (0x3c + (src << 3)))
  37. #define ADMA_SUAR(src, chan) (chan->mmr_base + (0x40 + (src << 3)))
  38. struct iop13xx_adma_src {
  39. u32 src_addr;
  40. union {
  41. u32 upper_src_addr;
  42. struct {
  43. unsigned int pq_upper_src_addr:24;
  44. unsigned int pq_dmlt:8;
  45. };
  46. };
  47. };
  48. struct iop13xx_adma_desc_ctrl {
  49. unsigned int int_en:1;
  50. unsigned int xfer_dir:2;
  51. unsigned int src_select:4;
  52. unsigned int zero_result:1;
  53. unsigned int block_fill_en:1;
  54. unsigned int crc_gen_en:1;
  55. unsigned int crc_xfer_dis:1;
  56. unsigned int crc_seed_fetch_dis:1;
  57. unsigned int status_write_back_en:1;
  58. unsigned int endian_swap_en:1;
  59. unsigned int reserved0:2;
  60. unsigned int pq_update_xfer_en:1;
  61. unsigned int dual_xor_en:1;
  62. unsigned int pq_xfer_en:1;
  63. unsigned int p_xfer_dis:1;
  64. unsigned int reserved1:10;
  65. unsigned int relax_order_en:1;
  66. unsigned int no_snoop_en:1;
  67. };
  68. struct iop13xx_adma_byte_count {
  69. unsigned int byte_count:24;
  70. unsigned int host_if:3;
  71. unsigned int reserved:2;
  72. unsigned int zero_result_err_q:1;
  73. unsigned int zero_result_err:1;
  74. unsigned int tx_complete:1;
  75. };
  76. struct iop13xx_adma_desc_hw {
  77. u32 next_desc;
  78. union {
  79. u32 desc_ctrl;
  80. struct iop13xx_adma_desc_ctrl desc_ctrl_field;
  81. };
  82. union {
  83. u32 crc_addr;
  84. u32 block_fill_data;
  85. u32 q_dest_addr;
  86. };
  87. union {
  88. u32 byte_count;
  89. struct iop13xx_adma_byte_count byte_count_field;
  90. };
  91. union {
  92. u32 dest_addr;
  93. u32 p_dest_addr;
  94. };
  95. union {
  96. u32 upper_dest_addr;
  97. u32 pq_upper_dest_addr;
  98. };
  99. struct iop13xx_adma_src src[1];
  100. };
  101. struct iop13xx_adma_desc_dual_xor {
  102. u32 next_desc;
  103. u32 desc_ctrl;
  104. u32 reserved;
  105. u32 byte_count;
  106. u32 h_dest_addr;
  107. u32 h_upper_dest_addr;
  108. u32 src0_addr;
  109. u32 upper_src0_addr;
  110. u32 src1_addr;
  111. u32 upper_src1_addr;
  112. u32 h_src_addr;
  113. u32 h_upper_src_addr;
  114. u32 d_src_addr;
  115. u32 d_upper_src_addr;
  116. u32 d_dest_addr;
  117. u32 d_upper_dest_addr;
  118. };
  119. struct iop13xx_adma_desc_pq_update {
  120. u32 next_desc;
  121. u32 desc_ctrl;
  122. u32 reserved;
  123. u32 byte_count;
  124. u32 p_dest_addr;
  125. u32 p_upper_dest_addr;
  126. u32 src0_addr;
  127. u32 upper_src0_addr;
  128. u32 src1_addr;
  129. u32 upper_src1_addr;
  130. u32 p_src_addr;
  131. u32 p_upper_src_addr;
  132. u32 q_src_addr;
  133. struct {
  134. unsigned int q_upper_src_addr:24;
  135. unsigned int q_dmlt:8;
  136. };
  137. u32 q_dest_addr;
  138. u32 q_upper_dest_addr;
  139. };
  140. static inline int iop_adma_get_max_xor(void)
  141. {
  142. return 16;
  143. }
  144. #define iop_adma_get_max_pq iop_adma_get_max_xor
  145. static inline u32 iop_chan_get_current_descriptor(struct iop_adma_chan *chan)
  146. {
  147. return __raw_readl(ADMA_ADAR(chan));
  148. }
  149. static inline void iop_chan_set_next_descriptor(struct iop_adma_chan *chan,
  150. u32 next_desc_addr)
  151. {
  152. __raw_writel(next_desc_addr, ADMA_ANDAR(chan));
  153. }
  154. #define ADMA_STATUS_BUSY (1 << 13)
  155. static inline char iop_chan_is_busy(struct iop_adma_chan *chan)
  156. {
  157. if (__raw_readl(ADMA_ACSR(chan)) &
  158. ADMA_STATUS_BUSY)
  159. return 1;
  160. else
  161. return 0;
  162. }
  163. static inline int
  164. iop_chan_get_desc_align(struct iop_adma_chan *chan, int num_slots)
  165. {
  166. return 1;
  167. }
  168. #define iop_desc_is_aligned(x, y) 1
  169. static inline int
  170. iop_chan_memcpy_slot_count(size_t len, int *slots_per_op)
  171. {
  172. *slots_per_op = 1;
  173. return 1;
  174. }
  175. #define iop_chan_interrupt_slot_count(s, c) iop_chan_memcpy_slot_count(0, s)
  176. static inline int
  177. iop_chan_memset_slot_count(size_t len, int *slots_per_op)
  178. {
  179. *slots_per_op = 1;