upcreg.h revision 1.3
11.3Sbjh21/* $NetBSD: upcreg.h,v 1.3 2003/03/02 00:21:47 bjh21 Exp $ */
21.1Sbjh21
31.1Sbjh21/*
41.3Sbjh21 * Ben Harris, 2000, 2003
51.1Sbjh21 *
61.1Sbjh21 * This file is in the public domain.
71.1Sbjh21 */
81.1Sbjh21
91.1Sbjh21/*
101.1Sbjh21 * upcreg.h - CHIPS and Technologies Universal Peripheral Controllers
111.1Sbjh21 */
121.1Sbjh21
131.1Sbjh21/*
141.1Sbjh21 * This file contains register details for:
151.1Sbjh21 * CHIPS 82C710 Universal Peripheral Controller
161.1Sbjh21 * CHIPS 82C711 Universal Peripheral Controller II
171.1Sbjh21 * CHIPS 82C721 Universal Peripheral Controller III
181.1Sbjh21 */
191.1Sbjh21
201.2Sbjh21#define UPC_BUS_SIZE		0x400 /* Approximate */
211.2Sbjh21
221.1Sbjh21/* Fixed port addresses */
231.1Sbjh21
241.1Sbjh21#define UPC_PORT_IDECMDBASE    	0x1f0 /* IDE primary base */
251.1Sbjh21#define UPC_PORT_IDECTLBASE    	0x3f6 /* IDE secondary base */
261.1Sbjh21#define UPC_PORT_FDCBASE	0x3f4 /* FDC base address (82C721 only) */
271.1Sbjh21#define UPC_PORT_GAME		0x201 /* -GAMECS active */
281.1Sbjh21
291.3Sbjh21/* 82C710 Configuration magic sequences */
301.1Sbjh21
311.3Sbjh21#define UPC1_PORT_CFG1		0x2fa /* First magic config register */
321.3Sbjh21#define UPC1_PORT_CFG2		0x3fa /* Second magic config register */
331.3Sbjh21#define UPC1_CFGMAGIC_1		0x55 /* First magic number */
341.3Sbjh21#define UPC1_CFGMAGIC_2		0xaa /* Second magic number */
351.3Sbjh21#define UPC1_CFGMAGIC_3		0x36 /* Third magic number */
361.3Sbjh21
371.3Sbjh21/* 82C710 configuration registers */
381.3Sbjh21#define UPC1_CFGADDR_CR0	0x00
391.3Sbjh21#define UPC1_CFGADDR_CR1	0x01
401.3Sbjh21#define UPC1_CFGADDR_CR2	0x02
411.3Sbjh21#define UPC1_CFGADDR_UARTBASE	0x04
421.3Sbjh21#define UPC1_CFGADDR_PARBASE	0x06
431.3Sbjh21#define UPC1_CFGADDR_GPCSBASE	0x09
441.3Sbjh21#define UPC1_CFGADDR_CRA	0x0a
451.3Sbjh21#define UPC1_CFGADDR_CRB	0x0b
461.3Sbjh21#define UPC1_CFGADDR_CRC	0x0c
471.3Sbjh21#define UPC1_CFGADDR_MOUSEBASE	0x0d
481.3Sbjh21#define UPC1_CFGADDR_CRE	0x0e
491.3Sbjh21#define UPC1_CFGADDR_CONFBASE	0x0f
501.3Sbjh21#define UPC1_CFGADDR_EXIT	0x0f
511.3Sbjh21
521.3Sbjh21/* 82C710 configuration register 0x00 */
531.3Sbjh21#define UPC1_CR0_VALID		0x80 /* Device has been configured */
541.3Sbjh21#define UPC1_CR0_OSC_MASK	0x60 /* Oscillator control */
551.3Sbjh21#define UPC1_CR0_OSC_ON		0x00 /* Oscillator always on */
561.3Sbjh21#define UPC1_CR0_OSC_PWRGD	0x20 /* Oscillator on when PWRGD */
571.3Sbjh21#define UPC1_CR0_OSC_OFF	0x60 /* Oscillator always off */
581.3Sbjh21#define UPC1_CR0_PEN		0x08 /* Enable parallel port */
591.3Sbjh21#define UPC1_CR0_SEN		0x04 /* Enable UART */
601.3Sbjh21
611.3Sbjh21/* 82C710 configuration register 0x01 */
621.3Sbjh21#define UPC1_CR1_RESET		0x80 /* Reset ignores serial port */
631.3Sbjh21#define UPC1_CR1_PRBI		0x40 /* Bi-directional printer support */
641.3Sbjh21#define UPC1_CR1_FCTS		0x20 /* Force UART CTS* active */
651.3Sbjh21#define UPC1_CR1_FDSR		0x10 /* Force UART DSR* active */
661.3Sbjh21#define UPC1_CR1_FDCD		0x08 /* Force UART DCD* active */
671.3Sbjh21
681.3Sbjh21/* 82C710 configuration register 0x02 */
691.3Sbjh21#define UPC1_CR2_SCLK		0x40 /* Divide UART clock by 4 rather than 2 */
701.3Sbjh21#define UPC1_CR2_RXSRC		0x20 /* Use divider output for Rx clock */
711.3Sbjh21#define UPC1_CR2_TXSRC		0x10 /* Use divider output for Tx clock */
721.3Sbjh21
731.3Sbjh21/* 82C710 configuration register 0x04 */
741.3Sbjh21#define UPC1_UARTBASE_SHIFT	2
751.3Sbjh21
761.3Sbjh21/* 82C710 configuration register 0x06 */
771.3Sbjh21#define UPC1_PARBASE_SHIFT	2
781.3Sbjh21
791.3Sbjh21/* 82C710 configuration register 0x09 */
801.3Sbjh21#define UPC1_GPCSBASE_SHIFT	2
811.3Sbjh21
821.3Sbjh21/* 82C710 configuration register 0x0a */
831.3Sbjh21#define UPC1_CRA_GPCSMASK_MASK	0xe0 /* how many GPCSBASE bits matter */
841.3Sbjh21#define UPC1_CRA_GPCSMASK_SHIFT	1
851.3Sbjh21#define UPC1_CRA_GPCSA1		0x08 /* Extra bit at the bottom of GPCSBASE */
861.3Sbjh21#define UPC1_CRA_IDEBEN		0x04 /* IDEENLO* buffer enable */
871.3Sbjh21#define UPC1_CRA_GPCSEN		0x02 /* GPCS enable */
881.3Sbjh21#define UPC1_CRA_GPCSBEN	0x01 /* GPCS buffer enable */
891.3Sbjh21
901.3Sbjh21/* 82C710 configuration register 0x0b */
911.3Sbjh21#define UPC1_CRB_MINTRP		0x80 /* Mouse interrupt polarity: 1->low */
921.3Sbjh21#define UPC1_CRB_FINTRP		0x40 /* Floppy interrupt polarity */
931.3Sbjh21#define UPC1_CRB_SINTRP		0x20 /* Serial interrupt polarity */
941.3Sbjh21#define UPC1_CRB_PINTRP		0x10 /* Parallel interrupt polarity */
951.3Sbjh21#define UPC1_CRB_SPDWN		0x08 /* Serial port power down */
961.3Sbjh21#define UPC1_CRB_PPWDN		0x02 /* Parallel port power down */
971.3Sbjh21#define UPC1_CRB_GPCSOUT	0x01 /* GPCS*/OUT1 pin function select */
981.3Sbjh21
991.3Sbjh21/* 82C710 configuration register 0x0c */
1001.3Sbjh21#define UPC1_CRC_IDEEN		0x80 /* IDE enable */
1011.3Sbjh21#define UPC1_CRC_IDEATXT	0x40 /* IDE AT/XT select */
1021.3Sbjh21#define UPC1_CRC_FDCEN		0x20 /* FDC enable */
1031.3Sbjh21#define UPC1_CRC_FPWDN		0x10 /* FDC power down */
1041.3Sbjh21#define UPC1_CRC_RTCCSEN	0x08 /* RTCCS* enable */
1051.3Sbjh21#define UPC1_CRC_RTCBEN		0x04 /* RTCCS* buffer enable */
1061.3Sbjh21#define UPC1_CRC_MDDWN		0x01 /* Mouse port power down */
1071.3Sbjh21
1081.3Sbjh21/* 82C710 configuration register 0x0d */
1091.3Sbjh21#define UPC1_MOUSEBASE_SHIFT	2
1101.3Sbjh21
1111.3Sbjh21/* 82C710 configuration register 0x0e */
1121.3Sbjh21#define UPC1_CRE_STEN		0x40 /* Serial port test enabled */
1131.3Sbjh21#define UPC1_CRE_FTEN1		0x10 /* Floppy test bit 1 */
1141.3Sbjh21#define UPC1_CRE_FTEN2		0x80 /* Floppy test bit 2 */
1151.3Sbjh21#define UPC1_CRE_DSTEN		0x40
1161.3Sbjh21
1171.3Sbjh21/* 82C710 configuration register 0x0f */
1181.3Sbjh21#define UPC1_CONFBASE_SHIFT	2
1191.3Sbjh21
1201.3Sbjh21/* 82C711/721 Configuration magic sequences */
1211.3Sbjh21
1221.3Sbjh21#define UPC2_PORT_CFGADDR	0x3f0 /* Configuration register address */
1231.3Sbjh21#define UPC2_PORT_CFGDATA	0x3f1 /* Configuration register value */
1241.3Sbjh21#define UPC2_CFGMAGIC_ENTER	0x55 /* Write twice to enter config mode. */
1251.3Sbjh21#define UPC2_CFGMAGIC_EXIT	0xaa /* Write once to exit config mode. */
1261.1Sbjh21
1271.1Sbjh21/* Configuration registers */
1281.3Sbjh21#define UPC2_CFGADDR_CR0	0x00 /* Configuration Register 0 */
1291.3Sbjh21#define UPC2_CFGADDR_CR1	0x01 /* Configuration Register 1 */
1301.3Sbjh21#define UPC2_CFGADDR_CR2	0x02 /* Configuration Register 2 */
1311.3Sbjh21#define UPC2_CFGADDR_CR3	0x03 /* Configuration Register 3 */
1321.3Sbjh21#define UPC2_CFGADDR_CR4	0x04 /* Configuration Register 4 */
1331.1Sbjh21
1341.1Sbjh21/* Configuration register 0 */
1351.3Sbjh21#define UPC2_CR0_VALID		0x80 /* Device has been configured */
1361.3Sbjh21#define UPC2_CR0_OSC_MASK	0x60 /* Oscillator control */
1371.3Sbjh21#define UPC2_CR0_OSC_ON		0x00 /* Oscillator always on */
1381.3Sbjh21#define UPC2_CR0_OSC_PWRGD	0x20 /* Oscillator on when PWRGD */
1391.3Sbjh21#define UPC2_CR0_OSC_OFF	0x60 /* Oscillator always off */
1401.3Sbjh21#define UPC2_CR0_FDC_ENABLE	0x10 /* FDC enabled */
1411.3Sbjh21#define UPC2_CR0_FDC_ON		0x08 /* FDC powered */
1421.3Sbjh21#define UPC2_CR0_IDE_AT		0x02 /* IDE controller is AT type */
1431.3Sbjh21#define UPC2_CR0_IDE_ENABLE	0x01 /* IDE controller enabled */
1441.1Sbjh21
1451.1Sbjh21/* Configuration register 1 */
1461.3Sbjh21#define UPC2_CR1_READ_ENABLE	0x80 /* Enable reading of config regs */
1471.3Sbjh21#define UPC2_CR1_COM34_MASK	0x60 /* COM3/COM4 addresses */
1481.3Sbjh21#define UPC2_CR1_COM34_338_238	0x00 /* COM3 = 0x338; COM4 = 0x238 */
1491.3Sbjh21#define UPC2_CR1_COM34_3E8_2E8	0x20 /* COM3 = 0x3E8; COM4 = 0x2E8 */
1501.3Sbjh21#define UPC2_CR1_COM34_2E8_2E0	0x40 /* COM3 = 0x2E8; COM4 = 0x2E0 */
1511.3Sbjh21#define UPC2_CR1_COM34_220_228	0x60 /* COM3 = 0x220; COM4 = 0x228 */
1521.3Sbjh21#define UPC2_CR1_IRQ_ACTHIGH	0x10 /* IRQ is active-high */
1531.3Sbjh21#define UPC2_CR1_LPT_BORING	0x08 /* Parallel port is not EPP */
1541.3Sbjh21#define UPC2_CR1_LPT_ON		0x04 /* Parallel port is powered */
1551.3Sbjh21#define UPC2_CR1_LPT_MASK	0x03 /* Parallel port address */
1561.3Sbjh21#define UPC2_CR1_LPT_DISABLE	0x00 /* Parallel port disabled */
1571.3Sbjh21#define UPC2_CR1_LPT_3BC		0x01 /* Parallel port at 0x3BC */
1581.3Sbjh21#define UPC2_CR1_LPT_378		0x02 /* Parallel port at 0x378 */
1591.3Sbjh21#define UPC2_CR1_LPT_278		0x03 /* Parallel port at 0x278 */
1601.1Sbjh21
1611.1Sbjh21/* Configuration register 2 */
1621.3Sbjh21#define UPC2_CR2_UART2_ON	0x80 /* 2ndary serial powered */
1631.3Sbjh21#define UPC2_CR2_UART2_ENABLE	0x40 /* 2ndary serial enabled */
1641.3Sbjh21#define UPC2_CR2_UART2_MASK	0x30 /* 2ndary serial address */
1651.3Sbjh21#define UPC2_CR2_UART2_3F8	0x00 /* 2ndary serial at 0x3F8 */
1661.3Sbjh21#define UPC2_CR2_UART2_2F8	0x10 /* 2ndary serial at 0x2F8 */
1671.3Sbjh21#define UPC2_CR2_UART2_COM3	0x20 /* 2ndary serial at COM3 (see CR1) */
1681.3Sbjh21#define UPC2_CR2_UART2_COM4	0x30 /* 2ndary serial at COM4 (see CR1) */
1691.3Sbjh21#define UPC2_CR2_UART1_ON	0x08 /* primary serial powered */
1701.3Sbjh21#define UPC2_CR2_UART1_ENABLE	0x04 /* primary serial enabled */
1711.3Sbjh21#define UPC2_CR2_UART1_MASK	0x03 /* primary serial address */
1721.3Sbjh21#define UPC2_CR2_UART1_3F8	0x00 /* primary serial at 0x3F8 */
1731.3Sbjh21#define UPC2_CR2_UART1_2F8	0x01 /* primary serial at 0x2F8 */
1741.3Sbjh21#define UPC2_CR2_UART1_COM3	0x02 /* primary serial at COM3 (see CR1) */
1751.3Sbjh21#define UPC2_CR2_UART1_COM4	0x03 /* primary serial at COM4 (see CR1) */
1761.1Sbjh21
1771.1Sbjh21/* Configuration register 3 */
1781.3Sbjh21#define UPC2_CR3_UART2_TEST	0x80 /* 2ndary serial test mode */
1791.3Sbjh21#define UPC2_CR3_UART1_TEST	0x40 /* primary serial test mode */
1801.3Sbjh21#define UPC2_CR3_FDC_TEST_MASK	0x30 /* FDC test modes */
1811.3Sbjh21#define UPC2_CR3_FDC_TEST_NORMAL	0x00 /* FDC normal mode */
1821.1Sbjh21
1831.1Sbjh21/* Configuration register 4 (82C721 only) */
1841.3Sbjh21#define UPC2_CR4_UART2_DIV13	0x01 /* Use normal (cf MIDI) clock for UART2 */
185