powerspan.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /**
  2. * @file powerspan.h Header file for PowerSpan II code.
  3. */
  4. /*
  5. * (C) Copyright 2005
  6. * AMIRIX Systems Inc.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef POWERSPAN_H
  24. #define POWERSPAN_H
  25. #define CLEAR_MASTER_ABORT 0xdeadbeef
  26. #define NO_DEVICE_FOUND -1
  27. #define ILLEGAL_REG_OFFSET -2
  28. #define I2C_BUSY -3
  29. #define I2C_ERR -4
  30. #define REG_P1_CSR 0x004
  31. #define REGS_P1_BST 0x018
  32. #define REG_P1_ERR_CSR 0x150
  33. #define REG_P1_MISC_CSR 0x160
  34. #define REGS_P1_TGT_CSR 0x100
  35. #define REGS_P1_TGT_TADDR 0x104
  36. #define REGS_PB_SLAVE_CSR 0x200
  37. #define REGS_PB_SLAVE_TADDR 0x204
  38. #define REGS_PB_SLAVE_BADDR 0x208
  39. #define REG_CONFIG_ADDRESS 0x290
  40. #define REG_CONFIG_DATA 0x294
  41. #define REG_PB_ERR_CSR 0x2B0
  42. #define REG_PB_MISC_CSR 0x2C0
  43. #define REG_MISC_CSR 0x400
  44. #define REG_I2C_CSR 0x408
  45. #define REG_RESET_CSR 0x40C
  46. #define REG_ISR0 0x410
  47. #define REG_ISR1 0x414
  48. #define REG_IER0 0x418
  49. #define REG_MBOX_MAP 0x420
  50. #define REG_HW_MAP 0x42C
  51. #define REG_IDR 0x444
  52. #define CSR_MEMORY_SPACE_ENABLE 0x00000002
  53. #define CSR_PCI_MASTER_ENABLE 0x00000004
  54. #define P1_BST_OFF 0x04
  55. #define PX_ERR_ERR_STATUS 0x01000000
  56. #define PX_MISC_CSR_MAX_RETRY_MASK 0x00000F00
  57. #define PX_MISC_CSR_MAX_RETRY 0x00000F00
  58. #define PX_MISC_REG_BAR_ENABLE 0x00008000
  59. #define PB_MISC_TEA_ENABLE 0x00000010
  60. #define PB_MISC_MAC_TEA 0x00000040
  61. #define P1_TGT_IMAGE_OFF 0x010
  62. #define PX_TGT_CSR_IMG_EN 0x80000000
  63. #define PX_TGT_CSR_TA_EN 0x40000000
  64. #define PX_TGT_CSR_BAR_EN 0x20000000
  65. #define PX_TGT_CSR_MD_EN 0x10000000
  66. #define PX_TGT_CSR_MODE 0x00800000
  67. #define PX_TGT_CSR_DEST 0x00400000
  68. #define PX_TGT_CSR_MEM_IO 0x00200000
  69. #define PX_TGT_CSR_GBL 0x00080000
  70. #define PX_TGT_CSR_CL 0x00040000
  71. #define PX_TGT_CSR_PRKEEP 0x00000080
  72. #define PX_TGT_CSR_BS_MASK 0x0F000000
  73. #define PX_TGT_MEM_IO 0x00200000
  74. #define PX_TGT_CSR_RTT_MASK 0x001F0000
  75. #define PX_TGT_CSR_RTT_READ 0x000A0000
  76. #define PX_TGT_CSR_WTT_MASK 0x00001F00
  77. #define PX_TGT_CSR_WTT_WFLUSH 0x00000200
  78. #define PX_TGT_CSR_END_MASK 0x00000060
  79. #define PX_TGT_CSR_BIG_END 0x00000040
  80. #define PX_TGT_CSR_TRUE_LEND 0x00000060
  81. #define PX_TGT_CSR_RDAMT_MASK 0x00000007
  82. #define PX_TGT_CSR_BS_64MB 0xa
  83. #define PX_TGT_CSR_BS_16MB 0x8
  84. #define PX_TGT_USE_MEM_IO 1
  85. #define PX_TGT_NOT_MEM_IO 0
  86. #define PB_SLAVE_IMAGE_OFF 0x010
  87. #define PB_SLAVE_CSR_IMG_EN 0x80000000
  88. #define PB_SLAVE_CSR_TA_EN 0x40000000
  89. #define PB_SLAVE_CSR_MD_EN 0x20000000
  90. #define PB_SLAVE_CSR_MODE 0x00800000
  91. #define PB_SLAVE_CSR_DEST 0x00400000
  92. #define PB_SLAVE_CSR_MEM_IO 0x00200000
  93. #define PB_SLAVE_CSR_PRKEEP 0x00000080
  94. #define PB_SLAVE_CSR_BS_MASK 0x1F000000
  95. #define PB_SLAVE_CSR_END_MASK 0x00000060
  96. #define PB_SLAVE_CSR_BIG_END 0x00000040
  97. #define PB_SLAVE_CSR_TRUE_LEND 0x00000060
  98. #define PB_SLAVE_CSR_RDAMT_MASK 0x00000007
  99. #define PB_SLAVE_USE_MEM_IO 1
  100. #define PB_SLAVE_NOT_MEM_IO 0
  101. #define MISC_CSR_PCI1_LOCK 0x00000080
  102. #define I2C_CSR_ADDR 0xFF000000 /* Specifies I2C Device Address to be Accessed */
  103. #define I2C_CSR_DATA 0x00FF0000 /* Specifies the Required Data for a Write */
  104. #define I2C_CSR_DEV_CODE 0x0000F000 /* Device Select. I2C 4-bit Device Code */
  105. #define I2C_CSR_CS 0x00000E00 /* Chip Select */
  106. #define I2C_CSR_RW 0x00000100 /* Read/Write */
  107. #define I2C_CSR_ACT 0x00000080 /* I2C Interface Active */
  108. #define I2C_CSR_ERR 0x00000040 /* Error */
  109. #define I2C_EEPROM_DEV 0xa
  110. #define I2C_EEPROM_CHIP_SEL 0
  111. #define I2C_READ 0
  112. #define I2C_WRITE 1
  113. #define RESET_CSR_EEPROM_LOAD 0x00000010
  114. #define ISR_CLEAR_ALL 0xFFFFFFFF
  115. #define IER0_DMA_INTS_EN 0x0F000000
  116. #define IER0_PCI_1_EN 0x00400000
  117. #define IER0_HW_INTS_EN 0x003F0000
  118. #define IER0_MB_INTS_EN 0x000000FF
  119. #define IER0_DEFAULT (IER0_DMA_INTS_EN | IER0_PCI_1_EN | IER0_HW_INTS_EN | IER0_MB_INTS_EN)
  120. #define MBOX_MAP_TO_INT4 0xCCCCCCCC
  121. #define HW_MAP_HW4_TO_INT4 0x000C0000
  122. #define IDR_PCI_A_OUT 0x40000000
  123. #define IDR_MBOX_OUT 0x10000000
  124. int pci_read_config_byte(int bus, int dev, int fn, int reg, unsigned char* val);
  125. int pci_write_config_byte(int bus, int dev, int fn, int reg, unsigned char val);
  126. int pci_read_config_word(int bus, int dev, int fn, int reg, unsigned short* val);
  127. int pci_write_config_word(int bus, int dev, int fn, int reg, unsigned short val);
  128. int pci_read_config_dword(int bus, int dev, int fn, int reg, unsigned long* val);
  129. int pci_write_config_dword(int bus, int dev, int fn, int reg, unsigned long val);
  130. unsigned int PowerSpanRead(unsigned int theOffset);
  131. void PowerSpanWrite(unsigned int theOffset, unsigned int theValue);
  132. int I2CAccess(unsigned char theI2CAddress, unsigned char theDevCode, unsigned char theChipSel, unsigned char* theValue, int RWFlag);
  133. int PCIWriteConfig(int bus, int dev, int fn, int reg, int width, unsigned long val);
  134. int PCIReadConfig(int bus, int dev, int fn, int reg, int width, unsigned long* val);
  135. int SetSlaveImage(int theImageIndex, unsigned int theBlockSize, int theMemIOFlag, int theEndianness, unsigned int theLocalBaseAddr, unsigned int thePCIBaseAddr);
  136. int SetTargetImage(int theImageIndex, unsigned int theBlockSize, int theMemIOFlag, int theEndianness, unsigned int theLocalBaseAddr, unsigned int thePCIBaseAddr);
  137. #endif