sata_sil3114.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Copyright (C) Excito Elektronik i Skåne AB, All rights reserved.
  3. * Author: Tor Krill <tor@excito.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  18. * MA 02111-1307 USA
  19. */
  20. #ifndef SATA_SIL3114_H
  21. #define SATA_SIL3114_H
  22. struct sata_ioports {
  23. unsigned long cmd_addr;
  24. unsigned long data_addr;
  25. unsigned long error_addr;
  26. unsigned long feature_addr;
  27. unsigned long nsect_addr;
  28. unsigned long lbal_addr;
  29. unsigned long lbam_addr;
  30. unsigned long lbah_addr;
  31. unsigned long device_addr;
  32. unsigned long status_addr;
  33. unsigned long command_addr;
  34. unsigned long altstatus_addr;
  35. unsigned long ctl_addr;
  36. unsigned long bmdma_addr;
  37. unsigned long scr_addr;
  38. };
  39. struct sata_port {
  40. unsigned char port_no; /* primary=0, secondary=1 */
  41. struct sata_ioports ioaddr; /* ATA cmd/ctl/dma reg blks */
  42. unsigned char ctl_reg;
  43. unsigned char last_ctl;
  44. unsigned char port_state; /* 1-port is available and */
  45. /* 0-port is not available */
  46. unsigned char dev_mask;
  47. };
  48. /* Missing ata defines */
  49. #define ATA_CMD_STANDBY 0xE2
  50. #define ATA_CMD_STANDBYNOW1 0xE0
  51. #define ATA_CMD_IDLE 0xE3
  52. #define ATA_CMD_IDLEIMMEDIATE 0xE1
  53. /* Defines for SIL3114 chip */
  54. /* PCI defines */
  55. #define SIL_VEND_ID 0x1095
  56. #define SIL3114_DEVICE_ID 0x3114
  57. /* some vendor specific registers */
  58. #define VND_SYSCONFSTAT 0x88 /* System Configuration Status and Command */
  59. #define VND_SYSCONFSTAT_CHN_0_INTBLOCK (1<<22)
  60. #define VND_SYSCONFSTAT_CHN_1_INTBLOCK (1<<23)
  61. #define VND_SYSCONFSTAT_CHN_2_INTBLOCK (1<<24)
  62. #define VND_SYSCONFSTAT_CHN_3_INTBLOCK (1<<25)
  63. /* internal registers mapped by BAR5 */
  64. /* SATA Control*/
  65. #define VND_SCONTROL_CH0 0x100
  66. #define VND_SCONTROL_CH1 0x180
  67. #define VND_SCONTROL_CH2 0x300
  68. #define VND_SCONTROL_CH3 0x380
  69. #define SATA_SC_IPM_T2P (1<<16)
  70. #define SATA_SC_IPM_T2S (2<<16)
  71. #define SATA_SC_SPD_1_5 (1<<4)
  72. #define SATA_SC_SPD_3_0 (2<<4)
  73. #define SATA_SC_DET_RST (1) /* ATA Reset sequence */
  74. #define SATA_SC_DET_PDIS (4) /* PHY Disable */
  75. /* SATA Status */
  76. #define VND_SSTATUS_CH0 0x104
  77. #define VND_SSTATUS_CH1 0x184
  78. #define VND_SSTATUS_CH2 0x304
  79. #define VND_SSTATUS_CH3 0x384
  80. #define SATA_SS_IPM_ACTIVE (1<<8)
  81. #define SATA_SS_IPM_PARTIAL (2<<8)
  82. #define SATA_SS_IPM_SLUMBER (6<<8)
  83. #define SATA_SS_SPD_1_5 (1<<4)
  84. #define SATA_SS_SPD_3_0 (2<<4)
  85. #define SATA_DET_P_NOPHY (1) /* Device presence but no PHY connection established */
  86. #define SATA_DET_PRES (3) /* Device presence and active PHY */
  87. #define SATA_DET_OFFLINE (4) /* Device offline or in loopback mode */
  88. /* Task file registers in BAR5 mapping */
  89. #define VND_TF0_CH0 0x80
  90. #define VND_TF0_CH1 0xc0
  91. #define VND_TF0_CH2 0x280
  92. #define VND_TF0_CH3 0x2c0
  93. #define VND_TF1_CH0 0x88
  94. #define VND_TF1_CH1 0xc8
  95. #define VND_TF1_CH2 0x288
  96. #define VND_TF1_CH3 0x2c8
  97. #define VND_TF2_CH0 0x88
  98. #define VND_TF2_CH1 0xc8
  99. #define VND_TF2_CH2 0x288
  100. #define VND_TF2_CH3 0x2c8
  101. #define VND_BMDMA_CH0 0x00
  102. #define VND_BMDMA_CH1 0x08
  103. #define VND_BMDMA_CH2 0x200
  104. #define VND_BMDMA_CH3 0x208
  105. #define VND_BMDMA2_CH0 0x10
  106. #define VND_BMDMA2_CH1 0x18
  107. #define VND_BMDMA2_CH2 0x210
  108. #define VND_BMDMA2_CH3 0x218
  109. /* FIFO control */
  110. #define VND_FIFOCFG_CH0 0x40
  111. #define VND_FIFOCFG_CH1 0x44
  112. #define VND_FIFOCFG_CH2 0x240
  113. #define VND_FIFOCFG_CH3 0x244
  114. /* Task File configuration and status */
  115. #define VND_TF_CNST_CH0 0xa0
  116. #define VND_TF_CNST_CH1 0xe0
  117. #define VND_TF_CNST_CH2 0x2a0
  118. #define VND_TF_CNST_CH3 0x2e0
  119. #define VND_TF_CNST_BFCMD (1<<1)
  120. #define VND_TF_CNST_CHNRST (1<<2)
  121. #define VND_TF_CNST_VDMA (1<<10)
  122. #define VND_TF_CNST_INTST (1<<11)
  123. #define VND_TF_CNST_WDTO (1<<12)
  124. #define VND_TF_CNST_WDEN (1<<13)
  125. #define VND_TF_CNST_WDIEN (1<<14)
  126. /* for testing */
  127. #define VND_SSDR 0x04c /* System Software Data Register */
  128. #define VND_FMACS 0x050 /* Flash Memory Address control and status */
  129. #endif