rtsxvar.h revision 1.1.4.2 1 1.1.4.2 rmind /* $NetBSD: rtsxvar.h,v 1.1.4.2 2014/05/18 17:45:37 rmind Exp $ */
2 1.1.4.2 rmind /* $OpenBSD: rtsxvar.h,v 1.2 2013/11/06 13:51:02 stsp Exp $ */
3 1.1.4.2 rmind
4 1.1.4.2 rmind /*
5 1.1.4.2 rmind * Copyright (c) 2006 Uwe Stuehler <uwe (at) openbsd.org>
6 1.1.4.2 rmind * Copyright (c) 2012 Stefan Sperling <stsp (at) openbsd.org>
7 1.1.4.2 rmind *
8 1.1.4.2 rmind * Permission to use, copy, modify, and distribute this software for any
9 1.1.4.2 rmind * purpose with or without fee is hereby granted, provided that the above
10 1.1.4.2 rmind * copyright notice and this permission notice appear in all copies.
11 1.1.4.2 rmind *
12 1.1.4.2 rmind * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 1.1.4.2 rmind * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 1.1.4.2 rmind * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 1.1.4.2 rmind * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 1.1.4.2 rmind * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 1.1.4.2 rmind * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 1.1.4.2 rmind * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 1.1.4.2 rmind */
20 1.1.4.2 rmind
21 1.1.4.2 rmind #ifndef _RTSXVAR_H_
22 1.1.4.2 rmind #define _RTSXVAR_H_
23 1.1.4.2 rmind
24 1.1.4.2 rmind #include <sys/bus.h>
25 1.1.4.2 rmind #include <sys/device.h>
26 1.1.4.2 rmind #include <sys/pmf.h>
27 1.1.4.2 rmind #include <sys/mutex.h>
28 1.1.4.2 rmind #include <sys/condvar.h>
29 1.1.4.2 rmind
30 1.1.4.2 rmind /* Number of registers to save for suspend/resume in terms of their ranges. */
31 1.1.4.2 rmind #define RTSX_NREG ((0XFDAE - 0XFDA0) + (0xFD69 - 0xFD32) + (0xFE34 - 0xFE20))
32 1.1.4.2 rmind
33 1.1.4.2 rmind struct rtsx_softc {
34 1.1.4.2 rmind device_t sc_dev;
35 1.1.4.2 rmind
36 1.1.4.2 rmind device_t sc_sdmmc; /* generic SD/MMC device */
37 1.1.4.2 rmind
38 1.1.4.2 rmind bus_space_tag_t sc_iot; /* host register set tag */
39 1.1.4.2 rmind bus_space_handle_t sc_ioh; /* host register set handle */
40 1.1.4.2 rmind bus_size_t sc_iosize;
41 1.1.4.2 rmind bus_dma_tag_t sc_dmat; /* DMA tag from attachment driver */
42 1.1.4.2 rmind bus_dmamap_t sc_dmap_cmd; /* DMA map for command transfer */
43 1.1.4.2 rmind
44 1.1.4.2 rmind struct kmutex sc_host_mtx;
45 1.1.4.2 rmind struct kmutex sc_intr_mtx;
46 1.1.4.2 rmind struct kcondvar sc_intr_cv;
47 1.1.4.2 rmind
48 1.1.4.2 rmind uint32_t sc_intr_status; /* soft interrupt status */
49 1.1.4.2 rmind
50 1.1.4.2 rmind uint8_t sc_regs[RTSX_NREG]; /* host controller state */
51 1.1.4.2 rmind uint32_t sc_regs4[6]; /* host controller state */
52 1.1.4.2 rmind
53 1.1.4.2 rmind uint32_t sc_flags;
54 1.1.4.2 rmind #define RTSX_F_CARD_PRESENT __BIT(0)
55 1.1.4.2 rmind #define RTSX_F_SDIO_SUPPORT __BIT(1)
56 1.1.4.2 rmind #define RTSX_F_5209 __BIT(2)
57 1.1.4.2 rmind #define RTSX_F_5229 __BIT(3)
58 1.1.4.2 rmind #define RTSX_F_5229_TYPE_C __BIT(4)
59 1.1.4.2 rmind };
60 1.1.4.2 rmind
61 1.1.4.2 rmind /* Host controller functions called by the attachment driver. */
62 1.1.4.2 rmind int rtsx_attach(struct rtsx_softc *, bus_space_tag_t,
63 1.1.4.2 rmind bus_space_handle_t, bus_size_t, bus_dma_tag_t, int);
64 1.1.4.2 rmind int rtsx_detach(struct rtsx_softc *, int);
65 1.1.4.2 rmind bool rtsx_suspend(device_t, const pmf_qual_t *);
66 1.1.4.2 rmind bool rtsx_resume(device_t, const pmf_qual_t *);
67 1.1.4.2 rmind bool rtsx_shutdown(device_t, int);
68 1.1.4.2 rmind int rtsx_intr(void *);
69 1.1.4.2 rmind
70 1.1.4.2 rmind #endif /* _RTSXVAR_H_ */
71