3780i.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. /*
  2. *
  3. * 3780i.h -- declarations for 3780i.c
  4. *
  5. *
  6. * Written By: Mike Sullivan IBM Corporation
  7. *
  8. * Copyright (C) 1999 IBM Corporation
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * NO WARRANTY
  21. * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
  22. * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
  23. * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
  24. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
  25. * solely responsible for determining the appropriateness of using and
  26. * distributing the Program and assumes all risks associated with its
  27. * exercise of rights under this Agreement, including but not limited to
  28. * the risks and costs of program errors, damage to or loss of data,
  29. * programs or equipment, and unavailability or interruption of operations.
  30. *
  31. * DISCLAIMER OF LIABILITY
  32. * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
  33. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  34. * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
  35. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
  36. * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  37. * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
  38. * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
  39. *
  40. * You should have received a copy of the GNU General Public License
  41. * along with this program; if not, write to the Free Software
  42. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  43. *
  44. *
  45. * 10/23/2000 - Alpha Release
  46. * First release to the public
  47. */
  48. #ifndef _LINUX_3780I_H
  49. #define _LINUX_3780I_H
  50. #include <asm/io.h>
  51. /* DSP I/O port offsets and definitions */
  52. #define DSP_IsaSlaveControl 0x0000 /* ISA slave control register */
  53. #define DSP_IsaSlaveStatus 0x0001 /* ISA slave status register */
  54. #define DSP_ConfigAddress 0x0002 /* General config address register */
  55. #define DSP_ConfigData 0x0003 /* General config data register */
  56. #define DSP_HBridgeControl 0x0002 /* HBridge control register */
  57. #define DSP_MsaAddrLow 0x0004 /* MSP System Address, low word */
  58. #define DSP_MsaAddrHigh 0x0006 /* MSP System Address, high word */
  59. #define DSP_MsaDataDSISHigh 0x0008 /* MSA data register: d-store word or high byte of i-store */
  60. #define DSP_MsaDataISLow 0x000A /* MSA data register: low word of i-store */
  61. #define DSP_ReadAndClear 0x000C /* MSA read and clear data register */
  62. #define DSP_Interrupt 0x000E /* Interrupt register (IPC source) */
  63. typedef struct {
  64. unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */
  65. unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */
  66. unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */
  67. unsigned char Reserved:5; /* 0: Reserved */
  68. } DSP_ISA_SLAVE_CONTROL;
  69. typedef struct {
  70. unsigned short EnableDspInt:1; /* RW: Enable DSP to X86 ISA interrupt 0=mask it, 1=enable it */
  71. unsigned short MemAutoInc:1; /* RW: Memory address auto increment, 0=disable, 1=enable */
  72. unsigned short IoAutoInc:1; /* RW: I/O address auto increment, 0=disable, 1=enable */
  73. unsigned short DiagnosticMode:1; /* RW: Disgnostic mode 0=nromal, 1=diagnostic mode */
  74. unsigned short IsaPacingTimer:12; /* R: ISA access pacing timer: count of core cycles stolen */
  75. } DSP_HBRIDGE_CONTROL;
  76. /* DSP register indexes used with the configuration register address (index) register */
  77. #define DSP_UartCfg1Index 0x0003 /* UART config register 1 */
  78. #define DSP_UartCfg2Index 0x0004 /* UART config register 2 */
  79. #define DSP_HBridgeCfg1Index 0x0007 /* HBridge config register 1 */
  80. #define DSP_HBridgeCfg2Index 0x0008 /* HBridge config register 2 */
  81. #define DSP_BusMasterCfg1Index 0x0009 /* ISA bus master config register 1 */
  82. #define DSP_BusMasterCfg2Index 0x000A /* ISA bus master config register 2 */
  83. #define DSP_IsaProtCfgIndex 0x000F /* ISA protocol control register */
  84. #define DSP_PowerMgCfgIndex 0x0010 /* Low poser suspend/resume enable */
  85. #define DSP_HBusTimerCfgIndex 0x0011 /* HBUS timer load value */
  86. typedef struct {
  87. unsigned char IrqActiveLow:1; /* RW: IRQ active high or low: 0=high, 1=low */
  88. unsigned char IrqPulse:1; /* RW: IRQ pulse or level: 0=level, 1=pulse */
  89. unsigned char Irq:3; /* RW: IRQ selection */
  90. unsigned char BaseIO:2; /* RW: Base I/O selection */
  91. unsigned char Reserved:1; /* 0: Reserved */
  92. } DSP_UART_CFG_1;
  93. typedef struct {
  94. unsigned char Enable:1; /* RW: Enable I/O and IRQ: 0=false, 1=true */
  95. unsigned char Reserved:7; /* 0: Reserved */
  96. } DSP_UART_CFG_2;
  97. typedef struct {
  98. unsigned char IrqActiveLow:1; /* RW: IRQ active high=0 or low=1 */
  99. unsigned char IrqPulse:1; /* RW: IRQ pulse=1 or level=0 */
  100. unsigned char Irq:3; /* RW: IRQ selection */
  101. unsigned char AccessMode:1; /* RW: 16-bit register access method 0=byte, 1=word */
  102. unsigned char Reserved:2; /* 0: Reserved */
  103. } DSP_HBRIDGE_CFG_1;
  104. typedef struct {
  105. unsigned char Enable:1; /* RW: enable I/O and IRQ: 0=false, 1=true */
  106. unsigned char Reserved:7; /* 0: Reserved */
  107. } DSP_HBRIDGE_CFG_2;
  108. typedef struct {
  109. unsigned char Dma:3; /* RW: DMA channel selection */
  110. unsigned char NumTransfers:2; /* RW: Maximum # of transfers once being granted the ISA bus */
  111. unsigned char ReRequest:2; /* RW: Minimum delay between releasing the ISA bus and requesting it again */
  112. unsigned char MEMCS16:1; /* RW: ISA signal MEMCS16: 0=disabled, 1=enabled */
  113. } DSP_BUSMASTER_CFG_1;
  114. typedef struct {
  115. unsigned char IsaMemCmdWidth:2; /* RW: ISA memory command width */
  116. unsigned char Reserved:6; /* 0: Reserved */
  117. } DSP_BUSMASTER_CFG_2;
  118. typedef struct {
  119. unsigned char GateIOCHRDY:1; /* RW: Enable IOCHRDY gating: 0=false, 1=true */
  120. unsigned char Reserved:7; /* 0: Reserved */
  121. } DSP_ISA_PROT_CFG;
  122. typedef struct {
  123. unsigned char Enable:1; /* RW: Enable low power suspend/resume 0=false, 1=true */
  124. unsigned char Reserved:7; /* 0: Reserved */
  125. } DSP_POWER_MGMT_CFG;
  126. typedef struct {
  127. unsigned char LoadValue:8; /* RW: HBUS timer load value */
  128. } DSP_HBUS_TIMER_CFG;
  129. /* DSP registers that exist in MSA I/O space */
  130. #define DSP_ChipID 0x80000000
  131. #define DSP_MspBootDomain 0x80000580
  132. #define DSP_LBusTimeoutDisable 0x80000580
  133. #define DSP_ClockControl_1 0x8000058A
  134. #define DSP_ClockControl_2 0x8000058C
  135. #define DSP_ChipReset 0x80000588
  136. #define DSP_GpioModeControl_15_8 0x80000082
  137. #define DSP_GpioDriverEnable_15_8 0x80000076
  138. #define DSP_GpioOutputData_15_8 0x80000072
  139. typedef struct {
  140. unsigned short NMI:1; /* RW: non maskable interrupt */
  141. unsigned short Halt:1; /* RW: Halt MSP clock */
  142. unsigned short ResetCore:1; /* RW: Reset MSP core interface */
  143. unsigned short Reserved:13; /* 0: Reserved */
  144. } DSP_BOOT_DOMAIN;
  145. typedef struct {
  146. unsigned short DisableTimeout:1; /* RW: Disable LBus timeout */
  147. unsigned short Reserved:15; /* 0: Reserved */
  148. } DSP_LBUS_TIMEOUT_DISABLE;
  149. typedef struct {
  150. unsigned short Memory:1; /* RW: Reset memory interface */
  151. unsigned short SerialPort1:1; /* RW: Reset serial port 1 interface */
  152. unsigned short SerialPort2:1; /* RW: Reset serial port 2 interface */
  153. unsigned short SerialPort3:1; /* RW: Reset serial port 3 interface */
  154. unsigned short Gpio:1; /* RW: Reset GPIO interface */
  155. unsigned short Dma:1; /* RW: Reset DMA interface */
  156. unsigned short SoundBlaster:1; /* RW: Reset soundblaster interface */
  157. unsigned short Uart:1; /* RW: Reset UART interface */
  158. unsigned short Midi:1; /* RW: Reset MIDI interface */
  159. unsigned short IsaMaster:1; /* RW: Reset ISA master interface */
  160. unsigned short Reserved:6; /* 0: Reserved */
  161. } DSP_CHIP_RESET;
  162. typedef struct {
  163. unsigned short N_Divisor:6; /* RW: (N) PLL output clock divisor */
  164. unsigned short Reserved1:2; /* 0: reserved */
  165. unsigned short M_Multiplier:6; /* RW: (M) PLL feedback clock multiplier */
  166. unsigned short Reserved2:2; /* 0: reserved */
  167. } DSP_CLOCK_CONTROL_1;
  168. typedef struct {
  169. unsigned short PllBypass:1; /* RW: PLL Bypass */
  170. unsigned short Reserved:15; /* 0: Reserved */
  171. } DSP_CLOCK_CONTROL_2;
  172. typedef struct {
  173. unsigned short Latch8:1;
  174. unsigned short Latch9:1;
  175. unsigned short Latch10:1;
  176. unsigned short Latch11:1;
  177. unsigned short Latch12:1;
  178. unsigned short Latch13:1;
  179. unsigned short Latch14:1;
  180. unsigned short Latch15:1;
  181. unsigned short Mask8:1;
  182. unsigned short Mask9:1;
  183. unsigned short Mask10:1;
  184. unsigned short Mask11:1;
  185. unsigned short Mask12:1;
  186. unsigned short Mask13:1;
  187. unsigned short Mask14:1;
  188. unsigned short Mask15:1;
  189. } DSP_GPIO_OUTPUT_DATA_15_8;
  190. typedef struct {
  191. unsigned short Enable8:1;
  192. unsigned short Enable9:1;
  193. unsigned short Enable10:1;
  194. unsigned short Enable11:1;
  195. unsigned short Enable12:1;
  196. unsigned short Enable13:1;
  197. unsigned short Enable14:1;
  198. unsigned short Enable15:1;
  199. unsigned short Mask8:1;
  200. unsigned short Mask9:1;
  201. unsigned short Mask10:1;
  202. unsigned short Mask11:1;
  203. unsigned short Mask12:1;
  204. unsigned short Mask13:1;
  205. unsigned short Mask14:1;
  206. unsigned short Mask15:1;
  207. } DSP_GPIO_DRIVER_ENABLE_15_8;
  208. typedef struct {
  209. unsigned short GpioMode8:2;
  210. unsigned short GpioMode9:2;
  211. unsigned short GpioMode10:2;
  212. unsigned short GpioMode11:2;
  213. unsigned short GpioMode12:2;
  214. unsigned short GpioMode13:2;
  215. unsigned short GpioMode14:2;
  216. unsigned short GpioMode15:2;
  217. } DSP_GPIO_MODE_15_8;
  218. /* Component masks that are defined in dspmgr.h */
  219. #define MW_ADC_MASK 0x0001
  220. #define MW_AIC2_MASK 0x0006
  221. #define MW_MIDI_MASK 0x0008
  222. #define MW_CDDAC_MASK 0x8001
  223. #define MW_AIC1_MASK 0xE006
  224. #define MW_UART_MASK 0xE00A
  225. #define MW_ACI_MASK 0xE00B
  226. /*
  227. * Definition of 3780i configuration structure. Unless otherwise stated,
  228. * these values are provided as input to the 3780i support layer. At present,
  229. * the only values maintained by the 3780i support layer are the saved UART
  230. * registers.
  231. */
  232. typedef struct _DSP_3780I_CONFIG_SETTINGS {
  233. /* Location of base configuration register */
  234. unsigned short usBaseConfigIO;
  235. /* Enables for various DSP components */
  236. int bDSPEnabled;
  237. int bModemEnabled;
  238. int bInterruptClaimed;
  239. /* IRQ, DMA, and Base I/O addresses for various DSP components */
  240. unsigned short usDspIrq;
  241. unsigned short usDspDma;
  242. unsigned short usDspBaseIO;
  243. unsigned short usUartIrq;
  244. unsigned short usUartBaseIO;
  245. /* IRQ modes for various DSP components */
  246. int bDspIrqActiveLow;
  247. int bUartIrqActiveLow;
  248. int bDspIrqPulse;
  249. int bUartIrqPulse;
  250. /* Card abilities */
  251. unsigned uIps;
  252. unsigned uDStoreSize;
  253. unsigned uIStoreSize;
  254. unsigned uDmaBandwidth;
  255. /* Adapter specific 3780i settings */
  256. unsigned short usNumTransfers;
  257. unsigned short usReRequest;
  258. int bEnableMEMCS16;
  259. unsigned short usIsaMemCmdWidth;
  260. int bGateIOCHRDY;
  261. int bEnablePwrMgmt;
  262. unsigned short usHBusTimerLoadValue;
  263. int bDisableLBusTimeout;
  264. unsigned short usN_Divisor;
  265. unsigned short usM_Multiplier;
  266. int bPllBypass;
  267. unsigned short usChipletEnable; /* Used with the chip reset register to enable specific chiplets */
  268. /* Saved UART registers. These are maintained by the 3780i support layer. */
  269. int bUartSaved; /* True after a successful save of the UART registers */
  270. unsigned char ucIER; /* Interrupt enable register */
  271. unsigned char ucFCR; /* FIFO control register */
  272. unsigned char ucLCR; /* Line control register */
  273. unsigned char ucMCR; /* Modem control register */
  274. unsigned char ucSCR; /* Scratch register */
  275. unsigned char ucDLL; /* Divisor latch, low byte */
  276. unsigned char ucDLM; /* Divisor latch, high byte */
  277. } DSP_3780I_CONFIG_SETTINGS;
  278. /* 3780i support functions */
  279. int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
  280. unsigned short *pIrqMap,
  281. unsigned short *pDmaMap);
  282. int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings);
  283. int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings);
  284. int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings);
  285. int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
  286. unsigned uCount, unsigned long ulDSPAddr);
  287. int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,
  288. void __user *pvBuffer, unsigned uCount,
  289. unsigned long ulDSPAddr);
  290. int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
  291. unsigned uCount, unsigned long ulDSPAddr);
  292. int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
  293. unsigned uCount, unsigned long ulDSPAddr);
  294. int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,
  295. unsigned uCount, unsigned long ulDSPAddr);
  296. unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,
  297. unsigned long ulMsaAddr);
  298. void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,
  299. unsigned long ulMsaAddr, unsigned short usValue);
  300. int dsp3780I_GetIPCSource(unsigned short usDspBaseIO,
  301. unsigned short *pusIPCSource);
  302. /* I/O port access macros */
  303. #define MKWORD(var) (*((unsigned short *)(&var)))
  304. #define MKBYTE(var) (*((unsigned char *)(&var)))
  305. #define WriteMsaCfg(addr,value) dsp3780I_WriteMsaCfg(usDspBaseIO,addr,value)
  306. #define ReadMsaCfg(addr) dsp3780I_ReadMsaCfg(usDspBaseIO,addr)
  307. #define WriteGenCfg(index,value) dsp3780I_WriteGenCfg(usDspBaseIO,index,value)
  308. #define ReadGenCfg(index) dsp3780I_ReadGenCfg(usDspBaseIO,index)
  309. #define InWordDsp(index) inw(usDspBaseIO+index)
  310. #define InByteDsp(index) inb(usDspBaseIO+index)
  311. #define OutWordDsp(index,value) outw(value,usDspBaseIO+index)
  312. #define OutByteDsp(index,value) outb(value,usDspBaseIO+index)
  313. #endif