blob: 67530cefcf3c1bfd5d36ea1f93068a841e2d5642 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Alchemy Semi Au1000 pcmcia driver include file
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * ppopov@mvista.com or source@mvista.com
7 *
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
20 */
21#ifndef __ASM_AU1000_PCMCIA_H
22#define __ASM_AU1000_PCMCIA_H
23
24/* include the world */
Ralf Baechle5ab0b372005-11-02 18:08:40 +000025
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <pcmcia/cs.h>
27#include <pcmcia/ss.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028#include <pcmcia/cistpl.h>
29#include "cs_internal.h"
30
31#define AU1000_PCMCIA_POLL_PERIOD (2*HZ)
32#define AU1000_PCMCIA_IO_SPEED (255)
33#define AU1000_PCMCIA_MEM_SPEED (300)
34
Sergei Shtylyovb3363992008-04-14 17:27:30 +040035#define AU1X_SOCK0_IO 0xF00000000ULL
36#define AU1X_SOCK0_PHYS_ATTR 0xF40000000ULL
37#define AU1X_SOCK0_PHYS_MEM 0xF80000000ULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070038
39/* pcmcia socket 1 needs external glue logic so the memory map
40 * differs from board to board.
41 */
Manuel Lauss66213b32009-10-04 14:55:27 +020042#if defined(CONFIG_MIPS_PB1000)
Sergei Shtylyovb3363992008-04-14 17:27:30 +040043#define AU1X_SOCK1_IO 0xF08000000ULL
44#define AU1X_SOCK1_PHYS_ATTR 0xF48000000ULL
45#define AU1X_SOCK1_PHYS_MEM 0xF88000000ULL
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#endif
47
48struct pcmcia_state {
49 unsigned detect: 1,
50 ready: 1,
51 wrprot: 1,
52 bvd1: 1,
53 bvd2: 1,
54 vs_3v: 1,
55 vs_Xv: 1;
56};
57
58struct pcmcia_configure {
59 unsigned sock: 8,
60 vcc: 8,
61 vpp: 8,
62 output: 1,
63 speaker: 1,
64 reset: 1;
65};
66
67struct pcmcia_irqs {
68 int sock;
69 int irq;
70 const char *str;
71};
72
73
74struct au1000_pcmcia_socket {
75 struct pcmcia_socket socket;
76
77 /*
78 * Info from low level handler
79 */
80 struct device *dev;
81 unsigned int nr;
82 unsigned int irq;
83
84 /*
85 * Core PCMCIA state
86 */
87 struct pcmcia_low_level *ops;
88
89 unsigned int status;
90 socket_state_t cs_state;
91
92 unsigned short spd_io[MAX_IO_WIN];
93 unsigned short spd_mem[MAX_WIN];
94 unsigned short spd_attr[MAX_WIN];
95
96 struct resource res_skt;
97 struct resource res_io;
98 struct resource res_mem;
99 struct resource res_attr;
100
101 void * virt_io;
Dominik Brodowskid39bd562008-08-28 01:05:34 +0200102 unsigned int phys_io;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 unsigned int phys_attr;
104 unsigned int phys_mem;
105 unsigned short speed_io, speed_attr, speed_mem;
106
107 unsigned int irq_state;
108
109 struct timer_list poll_timer;
110};
111
112struct pcmcia_low_level {
113 struct module *owner;
114
115 int (*hw_init)(struct au1000_pcmcia_socket *);
116 void (*hw_shutdown)(struct au1000_pcmcia_socket *);
117
118 void (*socket_state)(struct au1000_pcmcia_socket *, struct pcmcia_state *);
119 int (*configure_socket)(struct au1000_pcmcia_socket *, struct socket_state_t *);
120
121 /*
122 * Enable card status IRQs on (re-)initialisation. This can
123 * be called at initialisation, power management event, or
124 * pcmcia event.
125 */
126 void (*socket_init)(struct au1000_pcmcia_socket *);
127
128 /*
129 * Disable card status IRQs and PCMCIA bus on suspend.
130 */
131 void (*socket_suspend)(struct au1000_pcmcia_socket *);
132};
133
134extern int au1x_board_init(struct device *dev);
135
136#endif /* __ASM_AU1000_PCMCIA_H */