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