pciide_pdc202xx_reg.h revision 1.3.6.2 1 1.3.6.2 he /* $NetBSD: pciide_pdc202xx_reg.h,v 1.3.6.2 2000/07/07 17:33:50 he Exp $ */
2 1.3.6.2 he
3 1.3.6.2 he /*
4 1.3.6.2 he * Copyright (c) 1999 Manuel Bouyer.
5 1.3.6.2 he *
6 1.3.6.2 he * Redistribution and use in source and binary forms, with or without
7 1.3.6.2 he * modification, are permitted provided that the following conditions
8 1.3.6.2 he * are met:
9 1.3.6.2 he * 1. Redistributions of source code must retain the above copyright
10 1.3.6.2 he * notice, this list of conditions and the following disclaimer.
11 1.3.6.2 he * 2. Redistributions in binary form must reproduce the above copyright
12 1.3.6.2 he * notice, this list of conditions and the following disclaimer in the
13 1.3.6.2 he * documentation and/or other materials provided with the distribution.
14 1.3.6.2 he * 3. All advertising materials mentioning features or use of this software
15 1.3.6.2 he * must display the following acknowledgement:
16 1.3.6.2 he * This product includes software developed by the University of
17 1.3.6.2 he * California, Berkeley and its contributors.
18 1.3.6.2 he * 4. Neither the name of the University nor the names of its contributors
19 1.3.6.2 he * may be used to endorse or promote products derived from this software
20 1.3.6.2 he * without specific prior written permission.
21 1.3.6.2 he *
22 1.3.6.2 he * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.3.6.2 he * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.3.6.2 he * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.3.6.2 he * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.3.6.2 he * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.3.6.2 he * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.3.6.2 he * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.3.6.2 he * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.3.6.2 he * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.3.6.2 he * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.3.6.2 he *
33 1.3.6.2 he */
34 1.3.6.2 he
35 1.3.6.2 he /*
36 1.3.6.2 he * Registers definitions for PROMISE PDC20246/PDC20262 PCI IDE controller.
37 1.3.6.2 he * Unfortunably the HW docs are not publically available. I've been able
38 1.3.6.2 he * to get a partial one for the PDC20246, and a better one for the PDC20262
39 1.3.6.2 he * from Promise.
40 1.3.6.2 he */
41 1.3.6.2 he
42 1.3.6.2 he #define PDC2xx_STATE 0x50
43 1.3.6.2 he #define PDC2xx_STATE_IDERAID 0x0001
44 1.3.6.2 he #define PDC2xx_STATE_NATIVE 0x0080
45 1.3.6.2 he /* controller initial state values(PDC20246 only) */
46 1.3.6.2 he #define PDC246_STATE_SHIPID 0x8000
47 1.3.6.2 he #define PDC246_STATE_IOCHRDY 0x0400
48 1.3.6.2 he #define PDC246_STATE_LBA(channel) (0x0100 << (channel))
49 1.3.6.2 he #define PDC246_STATE_ISAIRQ 0x0008
50 1.3.6.2 he #define PDC246_STATE_EN(channel) (0x0002 << (channel))
51 1.3.6.2 he /* controller initial state values(PDC20262 only) */
52 1.3.6.2 he #define PDC262_STATE_EN(chan) (0x1000 << (chan))
53 1.3.6.2 he #define PDC262_STATE_80P(chan) (0x0400 << (chan))
54 1.3.6.2 he
55 1.3.6.2 he /* per-drive timings */
56 1.3.6.2 he #define PDC2xx_TIM(channel, drive) (0x60 + 4 * (drive) + 8 * (channel))
57 1.3.6.2 he #define PDC2xx_TIM_SET_PA(r, x) (((r) & 0xfffffff0) | ((x) & 0xf))
58 1.3.6.2 he #define PDC2xx_TIM_SET_PB(r, x) (((r) & 0xffffe0ff) | (((x) & 0x1f) << 8))
59 1.3.6.2 he #define PDC2xx_TIM_SET_MB(r, x) (((r) & 0xffff1fff) | (((x) & 0x7) << 13))
60 1.3.6.2 he #define PDC2xx_TIM_SET_MC(r, x) (((r) & 0xfff0ffff) | (((x) & 0xf) << 16))
61 1.3.6.2 he #define PDC2xx_TIM_PRE 0x00000010
62 1.3.6.2 he #define PDC2xx_TIM_IORDY 0x00000020
63 1.3.6.2 he #define PDC2xx_TIM_ERRDY 0x00000040
64 1.3.6.2 he #define PDC2xx_TIM_SYNC 0x00000080
65 1.3.6.2 he #define PDC2xx_TIM_DMAW 0x00100000
66 1.3.6.2 he #define PDC2xx_TIM_DMAR 0x00200000
67 1.3.6.2 he #define PDC2xx_TIM_IORDYp 0x00400000
68 1.3.6.2 he #define PDC2xx_TIM_DMARQp 0x00800000
69 1.3.6.2 he
70 1.3.6.2 he /* The following are extentions of the DMA registers */
71 1.3.6.2 he
72 1.3.6.2 he /* Ultra-DMA mode 3/4 control (PDC20262 only, 1 byte) */
73 1.3.6.2 he #define PDC262_U66 0x11
74 1.3.6.2 he #define PDC262_U66_EN(chan) (0x1 << ((chan) *2))
75 1.3.6.2 he /* primary mode (1 byte) */
76 1.3.6.2 he #define PDC2xx_PM 0x1a
77 1.3.6.2 he /* secondary mode (1 byte) */
78 1.3.6.2 he #define PDC2xx_SM 0x1b
79 1.3.6.2 he /* System control register (4 bytes) */
80 1.3.6.2 he #define PDC2xx_SCR 0x1c
81 1.3.6.2 he #define PDC2xx_SCR_SET_GEN(r,x) (((r) & 0xffffff00) | ((x) & 0xff))
82 1.3.6.2 he #define PDC2xx_SCR_EMPTY(channel) (0x00000100 << (4 * channel))
83 1.3.6.2 he #define PDC2xx_SCR_FULL(channel) (0x00000200 << (4 * channel))
84 1.3.6.2 he #define PDC2xx_SCR_INT(channel) (0x00000400 << (4 * channel))
85 1.3.6.2 he #define PDC2xx_SCR_ERR(channel) (0x00000800 << (4 * channel))
86 1.3.6.2 he #define PDC2xx_SCR_SET_I2C(r,x) (((r) & 0xfff0ffff) | (((x) & 0xf) << 16))
87 1.3.6.2 he #define PDC2xx_SCR_SET_POLL(r,x) (((r) & 0xff0fffff) | (((x) & 0xf) << 20))
88 1.3.6.2 he #define PDC2xx_SCR_DMA 0x01000000
89 1.3.6.2 he #define PDC2xx_SCR_IORDY 0x02000000
90 1.3.6.2 he #define PDC2xx_SCR_G2FD 0x04000000
91 1.3.6.2 he #define PDC2xx_SCR_FLOAT 0x08000000
92 1.3.6.2 he #define PDC2xx_SCR_RSET 0x10000000
93 1.3.6.2 he #define PDC2xx_SCR_TST 0x20000000
94 1.3.6.2 he /* Values for "General Purpose Register" (PDC20262 only) */
95 1.3.6.2 he #define PDC262_SCR_GEN_LAT 0x20
96 1.3.6.2 he
97 1.3.6.2 he /* ATAPI port ((PDC20262 only) (4 bytes) */
98 1.3.6.2 he #define PDC262_ATAPI(chan) (0x20 + (4 * (chan)))
99 1.3.6.2 he #define PDC262_ATAPI_WC_MASK 0x00000fff
100 1.3.6.2 he #define PDC262_ATAPI_DMA_READ 0x00001000
101 1.3.6.2 he #define PDC262_ATAPI_DMA_WRITE 0x00002000
102 1.3.6.2 he #define PDC262_ATAPI_UDMA 0x00004000
103 1.3.6.2 he
104 1.3.6.2 he /*
105 1.3.6.2 he * The timings provided here cmoes from the PDC20262 docs. I hope they are
106 1.3.6.2 he * rigth for the PDC20246 too ...
107 1.3.6.2 he */
108 1.3.6.2 he
109 1.3.6.2 he static int8_t pdc2xx_pa[] = {0x9, 0x5, 0x3, 0x2, 0x1};
110 1.3.6.2 he static int8_t pdc2xx_pb[] = {0x13, 0xc, 0x8, 0x6, 0x4};
111 1.3.6.2 he static int8_t pdc2xx_dma_mb[] = {0x7, 0x3, 0x3};
112 1.3.6.2 he static int8_t pdc2xx_dma_mc[] = {0xf, 0x4, 0x3};
113 1.3.6.2 he static int8_t pdc2xx_udma_mb[] = {0x3, 0x2, 0x1, 0x2, 0x1};
114 1.3.6.2 he static int8_t pdc2xx_udma_mc[] = {0x3, 0x2, 0x1, 0x2, 0x1};
115