xref: /netbsd-src/sys/arch/arm/at91/at91cfvar.h (revision c62a0ac493172b27ab90373cf6d490cc03d944a4)
1*c62a0ac4Smatt /*	$Id: at91cfvar.h,v 1.2 2008/07/03 01:15:38 matt Exp $	*/
2*c62a0ac4Smatt /*	$NetBSD: at91cfvar.h,v 1.2 2008/07/03 01:15:38 matt Exp $	*/
3*c62a0ac4Smatt 
4*c62a0ac4Smatt /*
5*c62a0ac4Smatt  * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
6*c62a0ac4Smatt  *
7*c62a0ac4Smatt  * Based on arch/arm/ep93xx/eppcicvar.h,
8*c62a0ac4Smatt  * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
9*c62a0ac4Smatt  *
10*c62a0ac4Smatt  * Redistribution and use in source and binary forms, with or without
11*c62a0ac4Smatt  * modification, are permitted provided that the following conditions
12*c62a0ac4Smatt  * are met:
13*c62a0ac4Smatt  * 1. Redistributions of source code must retain the above copyright
14*c62a0ac4Smatt  *    notice, this list of conditions and the following disclaimer.
15*c62a0ac4Smatt  * 2. Redistributions in binary form must reproduce the above copyright
16*c62a0ac4Smatt  *    notice, this list of conditions and the following disclaimer in the
17*c62a0ac4Smatt  *    documentation and/or other materials provided with the distribution.
18*c62a0ac4Smatt  *
19*c62a0ac4Smatt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20*c62a0ac4Smatt  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*c62a0ac4Smatt  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*c62a0ac4Smatt  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23*c62a0ac4Smatt  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*c62a0ac4Smatt  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*c62a0ac4Smatt  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*c62a0ac4Smatt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*c62a0ac4Smatt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*c62a0ac4Smatt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*c62a0ac4Smatt  * SUCH DAMAGE.
30*c62a0ac4Smatt  */
31*c62a0ac4Smatt 
32*c62a0ac4Smatt #ifndef	_AT91CFVAR_H_
33*c62a0ac4Smatt #define	_AT91CFVAR_H_
34*c62a0ac4Smatt 
35*c62a0ac4Smatt struct at91cf_chipset_tag {
36*c62a0ac4Smatt 	int	(*power_ctl)(void *self, int onoff);
37*c62a0ac4Smatt #define	POWER_OFF	0
38*c62a0ac4Smatt #define	POWER_ON	1
39*c62a0ac4Smatt 	int	(*card_detect)(void *self);
40*c62a0ac4Smatt 	int	(*irq_line)(void *self);
41*c62a0ac4Smatt 	void *	(*intr_establish)(void *self, int which, int ipl, int (*ih_func)(void *), void *arg);
42*c62a0ac4Smatt 	void	(*intr_disestablish)(void *self, int wich, void *cookie);
43*c62a0ac4Smatt #define	CD_IRQ	0	// card detect change interrupt
44*c62a0ac4Smatt #define	CF_IRQ	1	// compact flash card interrupt
45*c62a0ac4Smatt };
46*c62a0ac4Smatt 
47*c62a0ac4Smatt typedef struct at91cf_chipset_tag *at91cf_chipset_tag_t;
48*c62a0ac4Smatt 
49*c62a0ac4Smatt struct at91cf_handle;
50*c62a0ac4Smatt 
51*c62a0ac4Smatt struct at91cf_softc {
52*c62a0ac4Smatt 	device_t		sc_dev;
53*c62a0ac4Smatt 	bus_space_tag_t		sc_iot;
54*c62a0ac4Smatt 	bus_space_handle_t	sc_memory_ioh, sc_common_ioh, sc_io_ioh;
55*c62a0ac4Smatt 	struct at91cf_handle	*sc_ph;
56*c62a0ac4Smatt 	at91cf_chipset_tag_t	sc_cscf;
57*c62a0ac4Smatt 	int			sc_enable;
58*c62a0ac4Smatt };
59*c62a0ac4Smatt 
60*c62a0ac4Smatt void at91cf_attach_common(device_t, device_t, void *,
61*c62a0ac4Smatt 			   at91cf_chipset_tag_t);
62*c62a0ac4Smatt 
63*c62a0ac4Smatt #endif	/* _AT91CFVAR_H_ */
64