1 /*
2  *
3  * Alchemy Semi Au1000 pcmcia driver include file
4  *
5  * Copyright 2001 MontaVista Software Inc.
6  * Author: MontaVista Software, Inc.
7  *         	ppopov@mvista.com or source@mvista.com
8  *
9  * ########################################################################
10  *
11  *  This program is free software; you can distribute it and/or modify it
12  *  under the terms of the GNU General Public License (Version 2) as
13  *  published by the Free Software Foundation.
14  *
15  *  This program is distributed in the hope it will be useful, but WITHOUT
16  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18  *  for more details.
19  *
20  *  You should have received a copy of the GNU General Public License along
21  *  with this program; if not, write to the Free Software Foundation, Inc.,
22  *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
23  *
24  * ########################################################################
25  *
26  *
27  */
28 #ifndef __ASM_AU1000_PCMCIA_H
29 #define __ASM_AU1000_PCMCIA_H
30 
31 
32 #define AU1000_PCMCIA_POLL_PERIOD    (2*HZ)
33 #define AU1000_PCMCIA_IO_SPEED       (255)
34 #define AU1000_PCMCIA_MEM_SPEED      (300)
35 
36 #define AU1X_SOCK0_IO        0xF00000000
37 #define AU1X_SOCK0_PHYS_ATTR 0xF40000000
38 #define AU1X_SOCK0_PHYS_MEM  0xF80000000
39 
40 /* pcmcia socket 1 needs external glue logic so the memory map
41  * differs from board to board.
42  */
43 #if defined(CONFIG_MIPS_PB1000) || defined(CONFIG_MIPS_PB1100) || defined(CONFIG_MIPS_PB1500)
44 #define AU1X_SOCK1_IO        0xF08000000
45 #define AU1X_SOCK1_PHYS_ATTR 0xF48000000
46 #define AU1X_SOCK1_PHYS_MEM  0xF88000000
47 #elif defined(CONFIG_MIPS_DB1000) || defined(CONFIG_MIPS_DB1100) || defined(CONFIG_MIPS_DB1500) || defined(CONFIG_MIPS_PB1550) || defined(CONFIG_MIPS_DB1550)
48 #define AU1X_SOCK1_IO        0xF04000000
49 #define AU1X_SOCK1_PHYS_ATTR 0xF44000000
50 #define AU1X_SOCK1_PHYS_MEM  0xF84000000
51 #endif
52 
53 struct pcmcia_state {
54   unsigned detect: 1,
55             ready: 1,
56            wrprot: 1,
57 	     bvd1: 1,
58 	     bvd2: 1,
59             vs_3v: 1,
60             vs_Xv: 1;
61 };
62 
63 struct pcmcia_configure {
64   unsigned sock: 8,
65             vcc: 8,
66             vpp: 8,
67          output: 1,
68         speaker: 1,
69           reset: 1;
70 };
71 
72 struct pcmcia_irq_info {
73 	unsigned int sock;
74 	unsigned int irq;
75 };
76 
77 
78 struct au1000_pcmcia_socket {
79 	socket_state_t        cs_state;
80 	struct pcmcia_state   k_state;
81 	unsigned int          irq;
82 	void                  (*handler)(void *, unsigned int);
83 	void                  *handler_info;
84 	pccard_io_map         io_map[MAX_IO_WIN];
85 	pccard_mem_map        mem_map[MAX_WIN];
86 	u32                   virt_io;
87 	ioaddr_t              phys_attr, phys_mem;
88 	unsigned short        speed_io, speed_attr, speed_mem;
89 };
90 
91 struct pcmcia_init {
92 	void (*handler)(int irq, void *dev, struct pt_regs *regs);
93 };
94 
95 struct pcmcia_low_level {
96 	int (*init)(struct pcmcia_init *);
97 	int (*shutdown)(void);
98 	int (*socket_state)(unsigned sock, struct pcmcia_state *);
99 	int (*get_irq_info)(struct pcmcia_irq_info *);
100 	int (*configure_socket)(const struct pcmcia_configure *);
101 };
102 
103 extern struct pcmcia_low_level au1x00_pcmcia_ops;
104 #endif /* __ASM_AU1000_PCMCIA_H */
105