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