1 /* $NetBSD: pxa2x0_pcic.h,v 1.3 2007/10/17 19:53:44 garbled Exp $ */
2 /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */
5 * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #ifndef _PXA2X0_PCIC_H_
21 #define _PXA2X0_PCIC_H_
23 struct pxapcic_socket
{
24 struct pxapcic_softc
*sc
;
25 int socket
; /* socket number */
26 struct device
*pcmcia
;
27 struct lwp
*event_thread
;
30 int power_capability
; /* PXAPCIC_POWER_3V | PXAPCIC_POWER_5V */
35 void *pcictag_cookie
; /* opaque data for pcictag functions */
36 struct pxapcic_tag
*pcictag
;
40 #define PXAPCIC_EVENT_INSERTION 0
41 #define PXAPCIC_EVENT_REMOVAL 1
44 #define PXAPCIC_FLAG_CARDD 0
45 #define PXAPCIC_FLAG_CARDP 1
48 u_int (*read
)(struct pxapcic_socket
*, int);
49 void (*write
)(struct pxapcic_socket
*, int, u_int
);
50 void (*set_power
)(struct pxapcic_socket
*, int);
51 void (*clear_intr
)(struct pxapcic_socket
*);
52 void *(*intr_establish
)(struct pxapcic_socket
*, int,
53 int (*)(void *), void *);
54 void (*intr_disestablish
)(struct pxapcic_socket
*, void *);
57 /* pcictag registers and their values */
58 #define PXAPCIC_CARD_STATUS 0
59 #define PXAPCIC_CARD_INVALID 0
60 #define PXAPCIC_CARD_VALID 1
61 #define PXAPCIC_CARD_READY 1
62 #define PXAPCIC_CARD_POWER 2
63 #define PXAPCIC_POWER_OFF 0
64 #define PXAPCIC_POWER_3V 1
65 #define PXAPCIC_POWER_5V 2
66 #define PXAPCIC_CARD_RESET 3
68 #define PXAPCIC_NSLOT 2
70 struct pxapcic_softc
{
72 struct pxapcic_socket sc_socket
[PXAPCIC_NSLOT
];
74 bus_space_tag_t sc_iot
;
75 bus_space_handle_t sc_memctl_ioh
;
80 int sc_irqpin
[PXAPCIC_NSLOT
];
81 int sc_irqcfpin
[PXAPCIC_NSLOT
];
84 #define PPF_REVERSE_ORDER (1 << 0)
87 void pxapcic_attach_common(struct pxapcic_softc
*,
88 void (*socket_setup_hook
)(struct pxapcic_socket
*));
89 int pxapcic_intr(void *);
90 void pxapcic_create_event_thread(void *);
92 #endif /* _PXA2X0_PCIC_H_ */