1 /* $Id: imx_pcic.h,v 1.2 2008/04/27 18:58:44 matt Exp $ */
4 * IMX CF interface to pcic/pcmcia
5 * derived from pxa2x0_pcic
6 * Sun Apr 1 21:42:37 PDT 2007
10 /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */
13 * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org>
15 * Permission to use, copy, modify, and distribute this software for any
16 * purpose with or without fee is hereby granted, provided that the above
17 * copyright notice and this permission notice appear in all copies.
19 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
20 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
22 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
23 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
24 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
25 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 struct imx_pcic_socket
{
32 struct imx_pcic_softc
*sc
;
33 int socket
; /* socket number */
34 struct device
*pcmcia
;
35 struct lwp
*event_thread
;
38 int power_capability
; /* IMX_PCIC_POWER_3V | IMX_PCIC_POWER_5V */
43 void *pcictag_cookie
; /* opaque data for pcictag functions */
44 struct imx_pcic_tag
*pcictag
;
48 #define IMX_PCIC_EVENT_INSERTION 0
49 #define IMX_PCIC_EVENT_REMOVAL 1
52 #define IMX_PCIC_FLAG_CARDD 0
53 #define IMX_PCIC_FLAG_CARDP 1
56 u_int (*read
)(struct imx_pcic_socket
*, int);
57 void (*write
)(struct imx_pcic_socket
*, int, u_int
);
58 void (*set_power
)(struct imx_pcic_socket
*, int);
59 void (*clear_intr
)(struct imx_pcic_socket
*);
60 void *(*intr_establish
)(struct imx_pcic_socket
*, int,
61 int (*)(void *), void *);
62 void (*intr_disestablish
)(struct imx_pcic_socket
*, void *);
66 /* pcictag registers and their values */
67 #define IMX_PCIC_CARD_STATUS 0
68 #define IMX_PCIC_CARD_INVALID 0
69 #define IMX_PCIC_CARD_VALID 1
70 #define IMX_PCIC_CARD_READY 1
71 #define IMX_PCIC_CARD_POWER 2
72 #define IMX_PCIC_POWER_OFF 0
73 #define IMX_PCIC_POWER_3V 1
74 #define IMX_PCIC_POWER_5V 2
75 #define IMX_PCIC_CARD_RESET 3
78 #define IMX_PCIC_NSLOT 1 /* ??? */
80 struct imx_pcic_softc
{
82 struct imx_pcic_socket sc_socket
[IMX_PCIC_NSLOT
];
84 bus_space_tag_t sc_iot
;
85 bus_space_handle_t sc_memctl_ioh
;
92 int sc_irqpin
[IMX_PCIC_NSLOT
];
93 int sc_irqcfpin
[IMX_PCIC_NSLOT
];
96 #define PPF_REVERSE_ORDER (1 << 0)
99 void imx_pcic_attach_common(struct imx_pcic_softc
*,
100 void (*socket_setup_hook
)(struct imx_pcic_socket
*));
101 int imx_pcic_intr(void *);
102 void imx_pcic_create_event_thread(void *);
104 #endif /* _IMX_PCIC_H_ */