fjes_regs.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * FUJITSU Extended Socket Network Device driver
  3. * Copyright (c) 2015 FUJITSU LIMITED
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, see <http://www.gnu.org/licenses/>.
  16. *
  17. * The full GNU General Public License is included in this distribution in
  18. * the file called "COPYING".
  19. *
  20. */
  21. #ifndef FJES_REGS_H_
  22. #define FJES_REGS_H_
  23. #include <linux/bitops.h>
  24. #define XSCT_DEVICE_REGISTER_SIZE 0x1000
  25. /* register offset */
  26. /* Information registers */
  27. #define XSCT_OWNER_EPID 0x0000 /* Owner EPID */
  28. #define XSCT_MAX_EP 0x0004 /* Maximum EP */
  29. /* Device Control registers */
  30. #define XSCT_DCTL 0x0010 /* Device Control */
  31. /* Command Control registers */
  32. #define XSCT_CR 0x0020 /* Command request */
  33. #define XSCT_CS 0x0024 /* Command status */
  34. #define XSCT_SHSTSAL 0x0028 /* Share status address Low */
  35. #define XSCT_SHSTSAH 0x002C /* Share status address High */
  36. #define XSCT_REQBL 0x0034 /* Request Buffer length */
  37. #define XSCT_REQBAL 0x0038 /* Request Buffer Address Low */
  38. #define XSCT_REQBAH 0x003C /* Request Buffer Address High */
  39. #define XSCT_RESPBL 0x0044 /* Response Buffer Length */
  40. #define XSCT_RESPBAL 0x0048 /* Response Buffer Address Low */
  41. #define XSCT_RESPBAH 0x004C /* Response Buffer Address High */
  42. /* Interrupt Control registers */
  43. #define XSCT_IS 0x0080 /* Interrupt status */
  44. #define XSCT_IMS 0x0084 /* Interrupt mask set */
  45. #define XSCT_IMC 0x0088 /* Interrupt mask clear */
  46. #define XSCT_IG 0x008C /* Interrupt generator */
  47. #define XSCT_ICTL 0x0090 /* Interrupt control */
  48. /* register structure */
  49. /* Information registers */
  50. union REG_OWNER_EPID {
  51. struct {
  52. __le32 epid:16;
  53. __le32:16;
  54. } bits;
  55. __le32 reg;
  56. };
  57. union REG_MAX_EP {
  58. struct {
  59. __le32 maxep:16;
  60. __le32:16;
  61. } bits;
  62. __le32 reg;
  63. };
  64. /* Device Control registers */
  65. union REG_DCTL {
  66. struct {
  67. __le32 reset:1;
  68. __le32 rsv0:15;
  69. __le32 rsv1:16;
  70. } bits;
  71. __le32 reg;
  72. };
  73. /* Command Control registers */
  74. union REG_CR {
  75. struct {
  76. __le32 req_code:16;
  77. __le32 err_info:14;
  78. __le32 error:1;
  79. __le32 req_start:1;
  80. } bits;
  81. __le32 reg;
  82. };
  83. union REG_CS {
  84. struct {
  85. __le32 req_code:16;
  86. __le32 rsv0:14;
  87. __le32 busy:1;
  88. __le32 complete:1;
  89. } bits;
  90. __le32 reg;
  91. };
  92. /* Interrupt Control registers */
  93. union REG_ICTL {
  94. struct {
  95. __le32 automak:1;
  96. __le32 rsv0:31;
  97. } bits;
  98. __le32 reg;
  99. };
  100. enum REG_ICTL_MASK {
  101. REG_ICTL_MASK_INFO_UPDATE = 1 << 20,
  102. REG_ICTL_MASK_DEV_STOP_REQ = 1 << 19,
  103. REG_ICTL_MASK_TXRX_STOP_REQ = 1 << 18,
  104. REG_ICTL_MASK_TXRX_STOP_DONE = 1 << 17,
  105. REG_ICTL_MASK_RX_DATA = 1 << 16,
  106. REG_ICTL_MASK_ALL = GENMASK(20, 16),
  107. };
  108. enum REG_IS_MASK {
  109. REG_IS_MASK_IS_ASSERT = 1 << 31,
  110. REG_IS_MASK_EPID = GENMASK(15, 0),
  111. };
  112. struct fjes_hw;
  113. u32 fjes_hw_rd32(struct fjes_hw *hw, u32 reg);
  114. #define wr32(reg, val) \
  115. do { \
  116. u8 *base = hw->base; \
  117. writel((val), &base[(reg)]); \
  118. } while (0)
  119. #define rd32(reg) (fjes_hw_rd32(hw, reg))
  120. #endif /* FJES_REGS_H_ */