Import 2.3.35pre4
[davej-history.git] / drivers / pcmcia / yenta.h
blobf7a62a5aa6880c2da5401fe6948a0c35e3633d95
1 #ifndef __YENTA_H
2 #define __YENTA_H
4 #include <asm/io.h>
5 #include "pci_socket.h"
7 /*
8 * Generate easy-to-use ways of reading a cardbus sockets
9 * regular memory space ("cb_xxx"), configuration space
10 * ("config_xxx") and compatibility space ("exca_xxxx")
13 #define cb_readb(sock,reg) readb((sock)->base + (reg))
14 #define cb_readw(sock,reg) readw((sock)->base + (reg))
15 #define cb_readl(sock,reg) readl((sock)->base + (reg))
16 #define cb_writeb(sock,reg,val) writeb((val), (sock)->base + (reg))
17 #define cb_writew(sock,reg,val) writew((val), (sock)->base + (reg))
18 #define cb_writel(sock,reg,val) writel((val), (sock)->base + (reg))
20 #define config_readb(sock,offset) ({ __u8 __val; pci_read_config_byte((sock)->dev, (offset), &__val); __val; })
21 #define config_readw(sock,offset) ({ __u16 __val; pci_read_config_word((sock)->dev, (offset), &__val); __val; })
22 #define config_readl(sock,offset) ({ __u32 __val; pci_read_config_dword((sock)->dev, (offset), &__val); __val; })
24 #define config_writeb(sock,offset,val) pci_write_config_byte((sock)->dev, (offset), (val))
25 #define config_writew(sock,offset,val) pci_write_config_word((sock)->dev, (offset), (val))
26 #define config_writel(sock,offset,val) pci_write_config_dword((sock)->dev, (offset), (val))
28 #define exca_readb(sock,reg) cb_readb((sock),(reg)+0x0800)
29 #define exca_readw(sock,reg) cb_readw((sock),(reg)+0x0800)
30 #define exca_readl(sock,reg) cb_readl((sock),(reg)+0x0800)
32 #define exca_writeb(sock,reg,val) cb_writeb((sock),(reg)+0x0800,(val))
33 #define exca_writew(sock,reg,val) cb_writew((sock),(reg)+0x0800,(val))
34 #define exca_writel(sock,reg,val) cb_writel((sock),(reg)+0x0800,(val))
36 #define CB_SOCKET_EVENT 0x00
37 #define CB_CSTSEVENT 0x00000001 /* Card status event */
38 #define CB_CD1EVENT 0x00000002 /* Card detect 1 change event */
39 #define CB_CD2EVENT 0x00000004 /* Card detect 2 change event */
40 #define CB_PWREVENT 0x00000008 /* PWRCYCLE change event */
42 #define CB_SOCKET_MASK 0x04
43 #define CB_CSTSMASK 0x00000001 /* Card status mask */
44 #define CB_CDMASK 0x00000006 /* Card detect 1&2 mask */
45 #define CB_PWRMASK 0x00000008 /* PWRCYCLE change mask */
47 #define CB_SOCKET_STATE 0x08
48 #define CB_CARDSTS 0x00000001 /* CSTSCHG status */
49 #define CB_CDETECT1 0x00000002 /* Card detect status 1 */
50 #define CB_CDETECT2 0x00000004 /* Card detect status 2 */
51 #define CB_PWRCYCLE 0x00000008 /* Socket powered */
52 #define CB_16BITCARD 0x00000010 /* 16-bit card detected */
53 #define CB_CBCARD 0x00000020 /* CardBus card detected */
54 #define CB_IREQCINT 0x00000040 /* READY(xIRQ)/xCINT high */
55 #define CB_NOTACARD 0x00000080 /* Unrecognizable PC card detected */
56 #define CB_DATALOST 0x00000100 /* Potential data loss due to card removal */
57 #define CB_BADVCCREQ 0x00000200 /* Invalid Vcc request by host software */
58 #define CB_5VCARD 0x00000400 /* Card Vcc at 5.0 volts? */
59 #define CB_3VCARD 0x00000800 /* Card Vcc at 3.3 volts? */
60 #define CB_XVCARD 0x00001000 /* Card Vcc at X.X volts? */
61 #define CB_YVCARD 0x00002000 /* Card Vcc at Y.Y volts? */
62 #define CB_5VSOCKET 0x10000000 /* Socket Vcc at 5.0 volts? */
63 #define CB_3VSOCKET 0x20000000 /* Socket Vcc at 3.3 volts? */
64 #define CB_XVSOCKET 0x40000000 /* Socket Vcc at X.X volts? */
65 #define CB_YVSOCKET 0x80000000 /* Socket Vcc at Y.Y volts? */
67 #define CB_SOCKET_FORCE 0x0C
68 #define CB_FCARDSTS 0x00000001 /* Force CSTSCHG */
69 #define CB_FCDETECT1 0x00000002 /* Force CD1EVENT */
70 #define CB_FCDETECT2 0x00000004 /* Force CD2EVENT */
71 #define CB_FPWRCYCLE 0x00000008 /* Force PWREVENT */
72 #define CB_F16BITCARD 0x00000010 /* Force 16-bit PCMCIA card */
73 #define CB_FCBCARD 0x00000020 /* Force CardBus line */
74 #define CB_FNOTACARD 0x00000080 /* Force NOTACARD */
75 #define CB_FDATALOST 0x00000100 /* Force data lost */
76 #define CB_FBADVCCREQ 0x00000200 /* Force bad Vcc request */
77 #define CB_F5VCARD 0x00000400 /* Force 5.0 volt card */
78 #define CB_F3VCARD 0x00000800 /* Force 3.3 volt card */
79 #define CB_FXVCARD 0x00001000 /* Force X.X volt card */
80 #define CB_FYVCARD 0x00002000 /* Force Y.Y volt card */
81 #define CB_CVSTEST 0x00004000 /* Card VS test */
83 #define CB_SOCKET_CONTROL 0x10
84 #define CB_VPPCTRL 0 /* Shift for Vpp */
85 #define CB_VCCCTRL 4 /* Shift for Vcc */
86 #define CB_STOPCLK 0x00000080 /* CLKRUN can slow CB clock when idle */
88 #define CB_PWRBITS 0x7
89 #define CB_PWROFF 0x0
90 #define CB_PWR12V 0x1 /* Only valid for Vpp */
91 #define CB_PWR5V 0x2
92 #define CB_PWR3V 0x3
93 #define CB_PWRXV 0x4
94 #define CB_PWRYV 0x5
96 #define CB_SOCKET_POWER 0x20
97 #define CB_SKTACCES 0x02000000 /* A PC card access has occurred (clear on read) */
98 #define CB_SKTMODE 0x01000000 /* Clock frequency has changed (clear on read) */
99 #define CB_CLKCTRLEN 0x00010000 /* Clock control enabled (RW) */
100 #define CB_CLKCTRL 0x00000001 /* Stop(0) or slow(1) CB clock (RW) */
103 * Cardbus configuration space
105 #define CB_BRIDGE_BASE(m) (0x1c + 8*(m))
106 #define CB_BRIDGE_LIMIT(m) (0x20 + 8*(m))
107 #define CB_BRIDGE_CONTROL 0x3e
108 #define CB_BRIDGE_CPERREN 0x00000001
109 #define CB_BRIDGE_CSERREN 0x00000002
110 #define CB_BRIDGE_ISAEN 0x00000004
111 #define CB_BRIDGE_VGAEN 0x00000008
112 #define CB_BRIDGE_MABTMODE 0x00000020
113 #define CB_BRIDGE_CRST 0x00000040
114 #define CB_BRIDGE_INTR 0x00000080
115 #define CB_BRIDGE_PREFETCH0 0x00000100
116 #define CB_BRIDGE_PREFETCH1 0x00000200
117 #define CB_BRIDGE_POSTEN 0x00000400
120 * ExCA area extensions in Yenta
122 #define CB_MEM_PAGE(map) (0x40 + (map))
124 #endif