xref: /openbsd/sys/dev/ic/rtsxvar.h (revision e49248d7)
1 /*	$OpenBSD: rtsxvar.h,v 1.6 2017/10/09 16:12:20 stsp Exp $	*/
2 
3 /*
4  * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
5  * Copyright (c) 2012 Stefan Sperling <stsp@openbsd.org>
6  *
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.
10  *
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.
18  */
19 
20 #ifndef _RTSXVAR_H_
21 #define _RTSXVAR_H_
22 
23 #include <machine/bus.h>
24 
25 /* Number of registers to save for suspend/resume in terms of their ranges. */
26 #define RTSX_NREG ((0XFDAE - 0XFDA0) + (0xFD69 - 0xFD32) + (0xFE34 - 0xFE20))
27 
28 struct rtsx_softc {
29 	struct device	sc_dev;
30 	struct device	*sdmmc;		/* generic SD/MMC device */
31 	bus_space_tag_t	iot;		/* host register set tag */
32 	bus_space_handle_t ioh;		/* host register set handle */
33 	bus_dma_tag_t	dmat;		/* DMA tag from attachment driver */
34 	bus_dmamap_t	dmap_cmd;	/* DMA map for command transfer */
35 	bus_dmamap_t	dmap_data;	/* DMA map for data transfer */
36 	bus_dmamap_t	dmap_adma;	/* DMA map for ADMA SG descriptors */
37 	caddr_t		admabuf;	/* buffer for ADMA SG descriptors */
38 	bus_dma_segment_t adma_segs[1];	/* segments for ADMA SG buffer */
39 	int		flags;
40 	u_int32_t 	intr_status;	/* soft interrupt status */
41 	u_int8_t	regs[RTSX_NREG];/* host controller state */
42 	u_int32_t	regs4[6];	/* host controller state */
43 };
44 
45 /* Host controller functions called by the attachment driver. */
46 int	rtsx_attach(struct rtsx_softc *, bus_space_tag_t,
47 	    bus_space_handle_t, bus_size_t, bus_dma_tag_t, int);
48 int	rtsx_activate(struct device *, int);
49 int	rtsx_intr(void *);
50 
51 /* flag values */
52 #define	RTSX_F_CARD_PRESENT	0x01
53 #define	RTSX_F_SDIO_SUPPORT	0x02
54 #define	RTSX_F_5209		0x04
55 #define	RTSX_F_5229		0x08
56 #define	RTSX_F_5229_TYPE_C	0x10
57 #define	RTSX_F_525A		0x20
58 
59 #endif
60