/*1*2* 3780i.h -- declarations for 3780i.c3*4*5* Written By: Mike Sullivan IBM Corporation6*7* Copyright (C) 1999 IBM Corporation8*9* This program is free software; you can redistribute it and/or modify10* it under the terms of the GNU General Public License as published by11* the Free Software Foundation; either version 2 of the License, or12* (at your option) any later version.13*14* This program is distributed in the hope that it will be useful,15* but WITHOUT ANY WARRANTY; without even the implied warranty of16* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17* GNU General Public License for more details.18*19* NO WARRANTY20* THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR21* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT22* LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,23* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is24* solely responsible for determining the appropriateness of using and25* distributing the Program and assumes all risks associated with its26* exercise of rights under this Agreement, including but not limited to27* the risks and costs of program errors, damage to or loss of data,28* programs or equipment, and unavailability or interruption of operations.29*30* DISCLAIMER OF LIABILITY31* NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY32* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL33* DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND34* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR35* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE36* USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED37* HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES38*39* You should have received a copy of the GNU General Public License40* along with this program; if not, write to the Free Software41* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA42*43*44* 10/23/2000 - Alpha Release45* First release to the public46*/4748#ifndef _LINUX_3780I_H49#define _LINUX_3780I_H5051#include <asm/io.h>5253/* DSP I/O port offsets and definitions */54#define DSP_IsaSlaveControl 0x0000 /* ISA slave control register */55#define DSP_IsaSlaveStatus 0x0001 /* ISA slave status register */56#define DSP_ConfigAddress 0x0002 /* General config address register */57#define DSP_ConfigData 0x0003 /* General config data register */58#define DSP_HBridgeControl 0x0002 /* HBridge control register */59#define DSP_MsaAddrLow 0x0004 /* MSP System Address, low word */60#define DSP_MsaAddrHigh 0x0006 /* MSP System Address, high word */61#define DSP_MsaDataDSISHigh 0x0008 /* MSA data register: d-store word or high byte of i-store */62#define DSP_MsaDataISLow 0x000A /* MSA data register: low word of i-store */63#define DSP_ReadAndClear 0x000C /* MSA read and clear data register */64#define DSP_Interrupt 0x000E /* Interrupt register (IPC source) */6566typedef struct {67unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */68unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */69unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */70unsigned short Reserved:13; /* 0: Reserved */71} DSP_ISA_SLAVE_CONTROL;727374typedef struct {75unsigned short EnableDspInt:1; /* RW: Enable DSP to X86 ISA interrupt 0=mask it, 1=enable it */76unsigned short MemAutoInc:1; /* RW: Memory address auto increment, 0=disable, 1=enable */77unsigned short IoAutoInc:1; /* RW: I/O address auto increment, 0=disable, 1=enable */78unsigned short DiagnosticMode:1; /* RW: Disgnostic mode 0=nromal, 1=diagnostic mode */79unsigned short IsaPacingTimer:12; /* R: ISA access pacing timer: count of core cycles stolen */80} DSP_HBRIDGE_CONTROL;818283/* DSP register indexes used with the configuration register address (index) register */84#define DSP_UartCfg1Index 0x0003 /* UART config register 1 */85#define DSP_UartCfg2Index 0x0004 /* UART config register 2 */86#define DSP_HBridgeCfg1Index 0x0007 /* HBridge config register 1 */87#define DSP_HBridgeCfg2Index 0x0008 /* HBridge config register 2 */88#define DSP_BusMasterCfg1Index 0x0009 /* ISA bus master config register 1 */89#define DSP_BusMasterCfg2Index 0x000A /* ISA bus master config register 2 */90#define DSP_IsaProtCfgIndex 0x000F /* ISA protocol control register */91#define DSP_PowerMgCfgIndex 0x0010 /* Low poser suspend/resume enable */92#define DSP_HBusTimerCfgIndex 0x0011 /* HBUS timer load value */9394typedef struct {95unsigned char IrqActiveLow:1; /* RW: IRQ active high or low: 0=high, 1=low */96unsigned char IrqPulse:1; /* RW: IRQ pulse or level: 0=level, 1=pulse */97unsigned char Irq:3; /* RW: IRQ selection */98unsigned char BaseIO:2; /* RW: Base I/O selection */99unsigned char Reserved:1; /* 0: Reserved */100} DSP_UART_CFG_1;101102typedef struct {103unsigned char Enable:1; /* RW: Enable I/O and IRQ: 0=false, 1=true */104unsigned char Reserved:7; /* 0: Reserved */105} DSP_UART_CFG_2;106107typedef struct {108unsigned char IrqActiveLow:1; /* RW: IRQ active high=0 or low=1 */109unsigned char IrqPulse:1; /* RW: IRQ pulse=1 or level=0 */110unsigned char Irq:3; /* RW: IRQ selection */111unsigned char AccessMode:1; /* RW: 16-bit register access method 0=byte, 1=word */112unsigned char Reserved:2; /* 0: Reserved */113} DSP_HBRIDGE_CFG_1;114115typedef struct {116unsigned char Enable:1; /* RW: enable I/O and IRQ: 0=false, 1=true */117unsigned char Reserved:7; /* 0: Reserved */118} DSP_HBRIDGE_CFG_2;119120121typedef struct {122unsigned char Dma:3; /* RW: DMA channel selection */123unsigned char NumTransfers:2; /* RW: Maximum # of transfers once being granted the ISA bus */124unsigned char ReRequest:2; /* RW: Minimum delay between releasing the ISA bus and requesting it again */125unsigned char MEMCS16:1; /* RW: ISA signal MEMCS16: 0=disabled, 1=enabled */126} DSP_BUSMASTER_CFG_1;127128typedef struct {129unsigned char IsaMemCmdWidth:2; /* RW: ISA memory command width */130unsigned char Reserved:6; /* 0: Reserved */131} DSP_BUSMASTER_CFG_2;132133134typedef struct {135unsigned char GateIOCHRDY:1; /* RW: Enable IOCHRDY gating: 0=false, 1=true */136unsigned char Reserved:7; /* 0: Reserved */137} DSP_ISA_PROT_CFG;138139typedef struct {140unsigned char Enable:1; /* RW: Enable low power suspend/resume 0=false, 1=true */141unsigned char Reserved:7; /* 0: Reserved */142} DSP_POWER_MGMT_CFG;143144typedef struct {145unsigned char LoadValue:8; /* RW: HBUS timer load value */146} DSP_HBUS_TIMER_CFG;147148149150/* DSP registers that exist in MSA I/O space */151#define DSP_ChipID 0x80000000152#define DSP_MspBootDomain 0x80000580153#define DSP_LBusTimeoutDisable 0x80000580154#define DSP_ClockControl_1 0x8000058A155#define DSP_ClockControl_2 0x8000058C156#define DSP_ChipReset 0x80000588157#define DSP_GpioModeControl_15_8 0x80000082158#define DSP_GpioDriverEnable_15_8 0x80000076159#define DSP_GpioOutputData_15_8 0x80000072160161typedef struct {162unsigned short NMI:1; /* RW: non maskable interrupt */163unsigned short Halt:1; /* RW: Halt MSP clock */164unsigned short ResetCore:1; /* RW: Reset MSP core interface */165unsigned short Reserved:13; /* 0: Reserved */166} DSP_BOOT_DOMAIN;167168typedef struct {169unsigned short DisableTimeout:1; /* RW: Disable LBus timeout */170unsigned short Reserved:15; /* 0: Reserved */171} DSP_LBUS_TIMEOUT_DISABLE;172173typedef struct {174unsigned short Memory:1; /* RW: Reset memory interface */175unsigned short SerialPort1:1; /* RW: Reset serial port 1 interface */176unsigned short SerialPort2:1; /* RW: Reset serial port 2 interface */177unsigned short SerialPort3:1; /* RW: Reset serial port 3 interface */178unsigned short Gpio:1; /* RW: Reset GPIO interface */179unsigned short Dma:1; /* RW: Reset DMA interface */180unsigned short SoundBlaster:1; /* RW: Reset soundblaster interface */181unsigned short Uart:1; /* RW: Reset UART interface */182unsigned short Midi:1; /* RW: Reset MIDI interface */183unsigned short IsaMaster:1; /* RW: Reset ISA master interface */184unsigned short Reserved:6; /* 0: Reserved */185} DSP_CHIP_RESET;186187typedef struct {188unsigned short N_Divisor:6; /* RW: (N) PLL output clock divisor */189unsigned short Reserved1:2; /* 0: reserved */190unsigned short M_Multiplier:6; /* RW: (M) PLL feedback clock multiplier */191unsigned short Reserved2:2; /* 0: reserved */192} DSP_CLOCK_CONTROL_1;193194typedef struct {195unsigned short PllBypass:1; /* RW: PLL Bypass */196unsigned short Reserved:15; /* 0: Reserved */197} DSP_CLOCK_CONTROL_2;198199typedef struct {200unsigned short Latch8:1;201unsigned short Latch9:1;202unsigned short Latch10:1;203unsigned short Latch11:1;204unsigned short Latch12:1;205unsigned short Latch13:1;206unsigned short Latch14:1;207unsigned short Latch15:1;208unsigned short Mask8:1;209unsigned short Mask9:1;210unsigned short Mask10:1;211unsigned short Mask11:1;212unsigned short Mask12:1;213unsigned short Mask13:1;214unsigned short Mask14:1;215unsigned short Mask15:1;216} DSP_GPIO_OUTPUT_DATA_15_8;217218typedef struct {219unsigned short Enable8:1;220unsigned short Enable9:1;221unsigned short Enable10:1;222unsigned short Enable11:1;223unsigned short Enable12:1;224unsigned short Enable13:1;225unsigned short Enable14:1;226unsigned short Enable15:1;227unsigned short Mask8:1;228unsigned short Mask9:1;229unsigned short Mask10:1;230unsigned short Mask11:1;231unsigned short Mask12:1;232unsigned short Mask13:1;233unsigned short Mask14:1;234unsigned short Mask15:1;235} DSP_GPIO_DRIVER_ENABLE_15_8;236237typedef struct {238unsigned short GpioMode8:2;239unsigned short GpioMode9:2;240unsigned short GpioMode10:2;241unsigned short GpioMode11:2;242unsigned short GpioMode12:2;243unsigned short GpioMode13:2;244unsigned short GpioMode14:2;245unsigned short GpioMode15:2;246} DSP_GPIO_MODE_15_8;247248/* Component masks that are defined in dspmgr.h */249#define MW_ADC_MASK 0x0001250#define MW_AIC2_MASK 0x0006251#define MW_MIDI_MASK 0x0008252#define MW_CDDAC_MASK 0x8001253#define MW_AIC1_MASK 0xE006254#define MW_UART_MASK 0xE00A255#define MW_ACI_MASK 0xE00B256257/*258* Definition of 3780i configuration structure. Unless otherwise stated,259* these values are provided as input to the 3780i support layer. At present,260* the only values maintained by the 3780i support layer are the saved UART261* registers.262*/263typedef struct _DSP_3780I_CONFIG_SETTINGS {264265/* Location of base configuration register */266unsigned short usBaseConfigIO;267268/* Enables for various DSP components */269int bDSPEnabled;270int bModemEnabled;271int bInterruptClaimed;272273/* IRQ, DMA, and Base I/O addresses for various DSP components */274unsigned short usDspIrq;275unsigned short usDspDma;276unsigned short usDspBaseIO;277unsigned short usUartIrq;278unsigned short usUartBaseIO;279280/* IRQ modes for various DSP components */281int bDspIrqActiveLow;282int bUartIrqActiveLow;283int bDspIrqPulse;284int bUartIrqPulse;285286/* Card abilities */287unsigned uIps;288unsigned uDStoreSize;289unsigned uIStoreSize;290unsigned uDmaBandwidth;291292/* Adapter specific 3780i settings */293unsigned short usNumTransfers;294unsigned short usReRequest;295int bEnableMEMCS16;296unsigned short usIsaMemCmdWidth;297int bGateIOCHRDY;298int bEnablePwrMgmt;299unsigned short usHBusTimerLoadValue;300int bDisableLBusTimeout;301unsigned short usN_Divisor;302unsigned short usM_Multiplier;303int bPllBypass;304unsigned short usChipletEnable; /* Used with the chip reset register to enable specific chiplets */305306/* Saved UART registers. These are maintained by the 3780i support layer. */307int bUartSaved; /* True after a successful save of the UART registers */308unsigned char ucIER; /* Interrupt enable register */309unsigned char ucFCR; /* FIFO control register */310unsigned char ucLCR; /* Line control register */311unsigned char ucMCR; /* Modem control register */312unsigned char ucSCR; /* Scratch register */313unsigned char ucDLL; /* Divisor latch, low byte */314unsigned char ucDLM; /* Divisor latch, high byte */315} DSP_3780I_CONFIG_SETTINGS;316317318/* 3780i support functions */319int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,320unsigned short *pIrqMap,321unsigned short *pDmaMap);322int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings);323int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings);324int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings);325int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,326unsigned uCount, unsigned long ulDSPAddr);327int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,328void __user *pvBuffer, unsigned uCount,329unsigned long ulDSPAddr);330int dsp3780I_WriteDStore(unsigned short usDspBaseIO, void __user *pvBuffer,331unsigned uCount, unsigned long ulDSPAddr);332int dsp3780I_ReadIStore(unsigned short usDspBaseIO, void __user *pvBuffer,333unsigned uCount, unsigned long ulDSPAddr);334int dsp3780I_WriteIStore(unsigned short usDspBaseIO, void __user *pvBuffer,335unsigned uCount, unsigned long ulDSPAddr);336unsigned short dsp3780I_ReadMsaCfg(unsigned short usDspBaseIO,337unsigned long ulMsaAddr);338void dsp3780I_WriteMsaCfg(unsigned short usDspBaseIO,339unsigned long ulMsaAddr, unsigned short usValue);340int dsp3780I_GetIPCSource(unsigned short usDspBaseIO,341unsigned short *pusIPCSource);342343/* I/O port access macros */344#define MKWORD(var) (*((unsigned short *)(&var)))345#define MKBYTE(var) (*((unsigned char *)(&var)))346347#define WriteMsaCfg(addr,value) dsp3780I_WriteMsaCfg(usDspBaseIO,addr,value)348#define ReadMsaCfg(addr) dsp3780I_ReadMsaCfg(usDspBaseIO,addr)349#define WriteGenCfg(index,value) dsp3780I_WriteGenCfg(usDspBaseIO,index,value)350#define ReadGenCfg(index) dsp3780I_ReadGenCfg(usDspBaseIO,index)351352#define InWordDsp(index) inw(usDspBaseIO+index)353#define InByteDsp(index) inb(usDspBaseIO+index)354#define OutWordDsp(index,value) outw(value,usDspBaseIO+index)355#define OutByteDsp(index,value) outb(value,usDspBaseIO+index)356357#endif358359360