1 /* All information is from the intel 82365sl PC Card Interface 2 Controller (PCIC) data sheet, marked "preliminary". Order number 3 290423-002, January 1993. */ 4 5 #define PCIC_IOSIZE 2 6 7 #define PCIC_REG_INDEX 0 8 #define PCIC_REG_DATA 1 9 10 /* The PCIC allows two chips to share the same address. In order not 11 to run afoul of the netbsd device model, this driver will treat those 12 chips as the same device. */ 13 14 #define PCIC_CHIP0_BASE 0x00 15 #define PCIC_CHIP1_BASE 0x80 16 17 /* Each PCIC chip can drive two sockets */ 18 19 #define PCIC_SOCKETA_INDEX 0x00 20 #define PCIC_SOCKETB_INDEX 0x40 21 22 /* general setup registers */ 23 24 #define PCIC_IDENT 0x00 /* RO */ 25 #define PCIC_IDENT_IFTYPE_MASK 0xC0 26 #define PCIC_IDENT_IFTYPE_IO_ONLY 0x00 27 #define PCIC_IDENT_IFTYPE_MEM_ONLY 0x40 28 #define PCIC_IDENT_IFTYPE_MEM_AND_IO 0x80 29 #define PCIC_IDENT_IFTYPE_RESERVED 0xC0 30 #define PCIC_IDENT_ZERO 0x30 31 #define PCIC_IDENT_REV_MASK 0x0F 32 #define PCIC_IDENT_REV_I82365SLR0 0x02 33 #define PCIC_IDENT_REV_I82365SLR1 0x03 34 35 #define PCIC_IF_STATUS 0x01 /* RO */ 36 #define PCIC_IF_STATUS_GPI 0x80 /* General Purpose Input */ 37 #define PCIC_IF_STATUS_POWERACTIVE 0x40 38 #define PCIC_IF_STATUS_READY 0x20 /* really READY/!BUSY */ 39 #define PCIC_IF_STATUS_MEM_WP 0x10 40 #define PCIC_IF_STATUS_CARDDETECT_MASK 0x0C 41 #define PCIC_IF_STATUS_CARDDETECT_PRESENT 0x0C 42 #define PCIC_IF_STATUS_BATTERY_MASK 0x03 43 #define PCIC_IF_STATUS_BATTERY_DEAD1 0x00 44 #define PCIC_IF_STATUS_BATTERY_DEAD2 0x01 45 #define PCIC_IF_STATUS_BATTERY_WARNING 0x02 46 #define PCIC_IF_STATUS_BATTERY_GOOD 0x03 47 48 #define PCIC_PWRCTL 0x02 /* RW */ 49 #define PCIC_PWRCTL_OE 0x80 /* output enable */ 50 #define PCIC_PWRCTL_DISABLE_RESETDRV 0x40 51 #define PCIC_PWRCTL_AUTOSWITCH_ENABLE 0x20 52 #define PCIC_PWRCTL_PWR_ENABLE 0x10 53 #define PCIC_PWRCTL_VPP2_MASK 0x0C 54 /* XXX these are a little unclear from the data sheet */ 55 #define PCIC_PWRCTL_VPP2_RESERVED 0x0C 56 #define PCIC_PWRCTL_VPP2_EN1 0x08 57 #define PCIC_PWRCTL_VPP2_EN0 0x04 58 #define PCIC_PWRCTL_VPP2_ENX 0x00 59 #define PCIC_PWRCTL_VPP1_MASK 0x03 60 /* XXX these are a little unclear from the data sheet */ 61 #define PCIC_PWRCTL_VPP1_RESERVED 0x03 62 #define PCIC_PWRCTL_VPP1_EN1 0x02 63 #define PCIC_PWRCTL_VPP1_EN0 0x01 64 #define PCIC_PWRCTL_VPP1_ENX 0x00 65 66 #define PCIC_CSC 0x04 /* RW */ 67 #define PCIC_CSC_ZERO 0xE0 68 #define PCIC_CSC_GPI 0x10 69 #define PCIC_CSC_CD 0x08 /* Card Detect Change */ 70 #define PCIC_CSC_READY 0x04 71 #define PCIC_CSC_BATTWARN 0x02 72 #define PCIC_CSC_BATTDEAD 0x01 /* for memory cards */ 73 #define PCIC_CSC_RI 0x01 /* for i/o cards */ 74 75 #define PCIC_ADDRWIN_ENABLE 0x06 /* RW */ 76 #define PCIC_ADDRWIN_ENABLE_IO1 0x80 77 #define PCIC_ADDRWIN_ENABLE_IO0 0x40 78 #define PCIC_ADDRWIN_ENABLE_MEMCS16 0x20 /* rtfds if you care */ 79 #define PCIC_ADDRWIN_ENABLE_MEM4 0x10 80 #define PCIC_ADDRWIN_ENABLE_MEM3 0x08 81 #define PCIC_ADDRWIN_ENABLE_MEM2 0x04 82 #define PCIC_ADDRWIN_ENABLE_MEM1 0x02 83 #define PCIC_ADDRWIN_ENABLE_MEM0 0x01 84 85 #define PCIC_CARD_DETECT 0x16 /* RW */ 86 #define PCIC_CARD_DETECT_RESERVED 0xC0 87 #define PCIC_CARD_DETECT_SW_INTR 0x20 88 #define PCIC_CARD_DETECT_RESUME_ENABLE 0x10 89 #define PCIC_CARD_DETECT_GPI_TRANSCTL 0x08 90 #define PCIC_CARD_DETECT_GPI_ENABLE 0x04 91 #define PCIC_CARD_DETECT_CFGRST_ENABLE 0x02 92 #define PCIC_CARD_DETECT_MEMDLY_INHIBIT 0x01 93 94 /* interrupt registers */ 95 96 #define PCIC_INTR 0x03 /* RW */ 97 #define PCIC_INTR_RI_ENABLE 0x80 98 #define PCIC_INTR_RESET 0x40 /* active low (zero) */ 99 #define PCIC_INTR_CARDTYPE_MASK 0x20 100 #define PCIC_INTR_CARDTYPE_IO 0x20 101 #define PCIC_INTR_CARDTYPE_MEM 0x00 102 #define PCIC_INTR_ENABLE 0x10 103 #define PCIC_INTR_IRQ_MASK 0x0F 104 #define PCIC_INTR_IRQ_SHIFT 0 105 #define PCIC_INTR_IRQ_NONE 0x00 106 #define PCIC_INTR_IRQ_RESERVED1 0x01 107 #define PCIC_INTR_IRQ_RESERVED2 0x02 108 #define PCIC_INTR_IRQ3 0x03 109 #define PCIC_INTR_IRQ4 0x04 110 #define PCIC_INTR_IRQ5 0x05 111 #define PCIC_INTR_IRQ_RESERVED6 0x06 112 #define PCIC_INTR_IRQ7 0x07 113 #define PCIC_INTR_IRQ_RESERVED8 0x08 114 #define PCIC_INTR_IRQ9 0x09 115 #define PCIC_INTR_IRQ10 0x0A 116 #define PCIC_INTR_IRQ11 0x0B 117 #define PCIC_INTR_IRQ12 0x0C 118 #define PCIC_INTR_IRQ_RESERVED13 0x0D 119 #define PCIC_INTR_IRQ14 0x0E 120 #define PCIC_INTR_IRQ15 0x0F 121 122 #define PCIC_INTR_IRQ_VALIDMASK 0xDEB8 /* 1101 1110 1011 1000 */ 123 124 #define PCIC_CSC_INTR 0x05 /* RW */ 125 #define PCIC_CSC_INTR_IRQ_MASK 0xF0 126 #define PCIC_CSC_INTR_IRQ_SHIFT 4 127 #define PCIC_CSC_INTR_IRQ_NONE 0x00 128 #define PCIC_CSC_INTR_IRQ_RESERVED1 0x10 129 #define PCIC_CSC_INTR_IRQ_RESERVED2 0x20 130 #define PCIC_CSC_INTR_IRQ3 0x30 131 #define PCIC_CSC_INTR_IRQ4 0x40 132 #define PCIC_CSC_INTR_IRQ5 0x50 133 #define PCIC_CSC_INTR_IRQ_RESERVED6 0x60 134 #define PCIC_CSC_INTR_IRQ7 0x70 135 #define PCIC_CSC_INTR_IRQ_RESERVED8 0x80 136 #define PCIC_CSC_INTR_IRQ9 0x90 137 #define PCIC_CSC_INTR_IRQ10 0xA0 138 #define PCIC_CSC_INTR_IRQ11 0xB0 139 #define PCIC_CSC_INTR_IRQ12 0xC0 140 #define PCIC_CSC_INTR_IRQ_RESERVED13 0xD0 141 #define PCIC_CSC_INTR_IRQ14 0xE0 142 #define PCIC_CSC_INTR_IRQ15 0xF0 143 #define PCIC_CSC_INTR_CD_ENABLE 0x08 144 #define PCIC_CSC_INTR_READY_ENABLE 0x04 145 #define PCIC_CSC_INTR_BATTWARN_ENABLE 0x02 146 #define PCIC_CSC_INTR_BATTDEAD_ENABLE 0x01 /* for memory cards */ 147 #define PCIC_CSC_INTR_RI_ENABLE 0x01 /* for I/O cards */ 148 149 #define PCIC_CSC_INTR_IRQ_VALIDMASK 0xDEB8 /* 1101 1110 1011 1000 */ 150 151 /* I/O registers */ 152 153 #define PCIC_IOCTL 0x07 /* RW */ 154 #define PCIC_IOCTL_IO1_WAITSTATE 0x80 155 #define PCIC_IOCTL_IO1_ZEROWAIT 0x40 156 #define PCIC_IOCTL_IO1_IOCS16SRC_MASK 0x20 157 #define PCIC_IOCTL_IO1_IOCS16SRC_CARD 0x20 158 #define PCIC_IOCTL_IO1_IOCS16SRC_DATASIZE 0x00 159 #define PCIC_IOCTL_IO1_DATASIZE_MASK 0x10 160 #define PCIC_IOCTL_IO1_DATASIZE_16BIT 0x10 161 #define PCIC_IOCTL_IO1_DATASIZE_8BIT 0x00 162 #define PCIC_IOCTL_IO0_WAITSTATE 0x08 163 #define PCIC_IOCTL_IO0_ZEROWAIT 0x04 164 #define PCIC_IOCTL_IO0_IOCS16SRC_MASK 0x02 165 #define PCIC_IOCTL_IO0_IOCS16SRC_CARD 0x02 166 #define PCIC_IOCTL_IO0_IOCS16SRC_DATASIZE 0x00 167 #define PCIC_IOCTL_IO0_DATASIZE_MASK 0x01 168 #define PCIC_IOCTL_IO0_DATASIZE_16BIT 0x01 169 #define PCIC_IOCTL_IO0_DATASIZE_8BIT 0x00 170 171 #define PCIC_IOADDR0_START_LSB 0x08 172 #define PCIC_IOADDR0_START_MSB 0x09 173 #define PCIC_IOADDR0_STOP_LSB 0x0A 174 #define PCIC_IOADDR0_STOP_MSB 0x0B 175 #define PCIC_IOADDR1_START_LSB 0x0C 176 #define PCIC_IOADDR1_START_MSB 0x0D 177 #define PCIC_IOADDR1_STOP_LSB 0x0E 178 #define PCIC_IOADDR1_STOP_MSB 0x0F 179 180 /* memory registers */ 181 182 /* memory window addresses refer to bits A23-A12 of the ISA system 183 memory address. This is a shift of 12 bits. The LSB contains 184 A19-A12, and the MSB contains A23-A20, plus some other bits. */ 185 186 #define PCIC_MEM_SHIFT 12 187 #define PCIC_MEM_PAGESIZE (1<<PCIC_MEM_SHIFT) 188 189 #define PCIC_SYSMEM_ADDRX_SHIFT PCIC_MEM_SHIFT 190 #define PCIC_SYSMEM_ADDRX_START_MSB_DATASIZE_MASK 0x80 191 #define PCIC_SYSMEM_ADDRX_START_MSB_DATASIZE_16BIT 0x80 192 #define PCIC_SYSMEM_ADDRX_START_MSB_DATASIZE_8BIT 0x00 193 #define PCIC_SYSMEM_ADDRX_START_MSB_ZEROWAIT 0x40 194 #define PCIC_SYSMEM_ADDRX_START_MSB_SCRATCH_MASK 0x30 195 #define PCIC_SYSMEM_ADDRX_START_MSB_ADDR_MASK 0x0F 196 197 #define PCIC_SYSMEM_ADDRX_STOP_MSB_WAIT_MASK 0xC0 198 #define PCIC_SYSMEM_ADDRX_STOP_MSB_WAIT0 0x00 199 #define PCIC_SYSMEM_ADDRX_STOP_MSB_WAIT1 0x40 200 #define PCIC_SYSMEM_ADDRX_STOP_MSB_WAIT2 0x80 201 #define PCIC_SYSMEM_ADDRX_STOP_MSB_WAIT3 0xC0 202 #define PCIC_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK 0x0F 203 204 /* The card side of a memory mapping consists of bits A19-A12 of the 205 card memory address in the LSB, and A25-A20 plus some other bits in 206 the MSB. Again, the shift is 12 bits. */ 207 208 #define PCIC_CARDMEM_ADDRX_SHIFT PCIC_MEM_SHIFT 209 #define PCIC_CARDMEM_ADDRX_MSB_WP 0x80 210 #define PCIC_CARDMEM_ADDRX_MSB_REGACTIVE_MASK 0x40 211 #define PCIC_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR 0x40 212 #define PCIC_CARDMEM_ADDRX_MSB_REGACTIVE_COMMON 0x00 213 #define PCIC_CARDMEM_ADDRX_MSB_ADDR_MASK 0x3F 214 215 #define PCIC_SYSMEM_ADDR0_START_LSB 0x10 216 #define PCIC_SYSMEM_ADDR0_START_MSB 0x11 217 #define PCIC_SYSMEM_ADDR0_STOP_LSB 0x12 218 #define PCIC_SYSMEM_ADDR0_STOP_MSB 0x13 219 220 #define PCIC_CARDMEM_ADDR0_LSB 0x14 221 #define PCIC_CARDMEM_ADDR0_MSB 0x15 222 223 /* #define PCIC_RESERVED 0x17 */ 224 225 #define PCIC_SYSMEM_ADDR1_START_LSB 0x18 226 #define PCIC_SYSMEM_ADDR1_START_MSB 0x19 227 #define PCIC_SYSMEM_ADDR1_STOP_LSB 0x1A 228 #define PCIC_SYSMEM_ADDR1_STOP_MSB 0x1B 229 230 #define PCIC_CARDMEM_ADDR1_LSB 0x1C 231 #define PCIC_CARDMEM_ADDR1_MSB 0x1D 232 233 #define PCIC_SYSMEM_ADDR2_START_LSB 0x20 234 #define PCIC_SYSMEM_ADDR2_START_MSB 0x21 235 #define PCIC_SYSMEM_ADDR2_STOP_LSB 0x22 236 #define PCIC_SYSMEM_ADDR2_STOP_MSB 0x23 237 238 #define PCIC_CARDMEM_ADDR2_LSB 0x24 239 #define PCIC_CARDMEM_ADDR2_MSB 0x25 240 241 /* #define PCIC_RESERVED 0x26 */ 242 /* #define PCIC_RESERVED 0x27 */ 243 244 #define PCIC_SYSMEM_ADDR3_START_LSB 0x28 245 #define PCIC_SYSMEM_ADDR3_START_MSB 0x29 246 #define PCIC_SYSMEM_ADDR3_STOP_LSB 0x2A 247 #define PCIC_SYSMEM_ADDR3_STOP_MSB 0x2B 248 249 #define PCIC_CARDMEM_ADDR3_LSB 0x2C 250 #define PCIC_CARDMEM_ADDR3_MSB 0x2D 251 252 /* #define PCIC_RESERVED 0x2E */ 253 /* #define PCIC_RESERVED 0x2F */ 254 255 #define PCIC_SYSMEM_ADDR4_START_LSB 0x30 256 #define PCIC_SYSMEM_ADDR4_START_MSB 0x31 257 #define PCIC_SYSMEM_ADDR4_STOP_LSB 0x32 258 #define PCIC_SYSMEM_ADDR4_STOP_MSB 0x33 259 260 #define PCIC_CARDMEM_ADDR4_LSB 0x34 261 #define PCIC_CARDMEM_ADDR4_MSB 0x35 262 263 /* #define PCIC_RESERVED 0x36 */ 264 /* #define PCIC_RESERVED 0x37 */ 265 /* #define PCIC_RESERVED 0x38 */ 266 /* #define PCIC_RESERVED 0x39 */ 267 /* #define PCIC_RESERVED 0x3A */ 268 /* #define PCIC_RESERVED 0x3B */ 269 /* #define PCIC_RESERVED 0x3C */ 270 /* #define PCIC_RESERVED 0x3D */ 271 /* #define PCIC_RESERVED 0x3E */ 272 /* #define PCIC_RESERVED 0x3F */ 273 274 /* vendor-specific registers */ 275 276 #define PCIC_INTEL_GLOBAL_CTL 0x1E /* RW */ 277 #define PCIC_INTEL_GLOBAL_CTL_RESERVED 0xF0 278 #define PCIC_INTEL_GLOBAL_CTL_IRQ14PULSE_ENABLE 0x08 279 #define PCIC_INTEL_GLOBAL_CTL_EXPLICIT_CSC_ACK 0x04 280 #define PCIC_INTEL_GLOBAL_CTL_IRQLEVEL_ENABLE 0x02 281 #define PCIC_INTEL_GLOBAL_CTL_POWERDOWN 0x01 282 283 #define PCIC_CIRRUS_MISC_CTL_2 0x1E 284 #define PCIC_CIRRUS_MISC_CTL_2_SUSPEND 0x04 285 286 #define PCIC_CIRRUS_CHIP_INFO 0x1F 287 #define PCIC_CIRRUS_CHIP_INFO_CHIP_ID 0xC0 288 #define PCIC_CIRRUS_CHIP_INFO_SLOTS 0x20 289 #define PCIC_CIRRUS_CHIP_INFO_REV 0x1F 290