Home | History | Annotate | Line # | Download | only in sdmmc
sdhcvar.h revision 1.29.12.1
      1  1.29.12.1  christos /*	$NetBSD: sdhcvar.h,v 1.29.12.1 2019/06/10 22:07:32 christos Exp $	*/
      2        1.1    nonaka /*	$OpenBSD: sdhcvar.h,v 1.3 2007/09/06 08:01:01 jsg 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  *
      7        1.1    nonaka  * Permission to use, copy, modify, and distribute this software for any
      8        1.1    nonaka  * purpose with or without fee is hereby granted, provided that the above
      9        1.1    nonaka  * copyright notice and this permission notice appear in all copies.
     10        1.1    nonaka  *
     11        1.1    nonaka  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12        1.1    nonaka  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13        1.1    nonaka  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14        1.1    nonaka  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15        1.1    nonaka  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16        1.1    nonaka  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17        1.1    nonaka  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18        1.1    nonaka  */
     19        1.1    nonaka 
     20        1.1    nonaka #ifndef _SDHCVAR_H_
     21        1.1    nonaka #define _SDHCVAR_H_
     22        1.1    nonaka 
     23        1.1    nonaka #include <sys/bus.h>
     24        1.1    nonaka #include <sys/device.h>
     25        1.1    nonaka #include <sys/pmf.h>
     26        1.1    nonaka 
     27        1.1    nonaka struct sdhc_host;
     28       1.14  jakllsch struct sdmmc_command;
     29        1.1    nonaka 
     30        1.1    nonaka struct sdhc_softc {
     31        1.1    nonaka 	device_t		sc_dev;
     32        1.1    nonaka 
     33        1.1    nonaka 	struct sdhc_host	**sc_host;
     34        1.1    nonaka 	int			sc_nhosts;
     35        1.1    nonaka 
     36        1.1    nonaka 	bus_dma_tag_t		sc_dmat;
     37        1.1    nonaka 
     38        1.1    nonaka 	uint32_t		sc_flags;
     39       1.16    bouyer #define	SDHC_FLAG_USE_DMA	0x00000001
     40       1.16    bouyer #define	SDHC_FLAG_FORCE_DMA	0x00000002
     41       1.16    bouyer #define	SDHC_FLAG_NO_PWR0	0x00000004 /* Freescale ESDHC */
     42       1.16    bouyer #define	SDHC_FLAG_HAVE_DVS	0x00000008 /* Freescale ESDHC */
     43       1.16    bouyer #define	SDHC_FLAG_32BIT_ACCESS	0x00000010 /* Freescale ESDHC */
     44       1.16    bouyer #define	SDHC_FLAG_ENHANCED	0x00000020 /* Freescale ESDHC */
     45       1.16    bouyer #define	SDHC_FLAG_8BIT_MODE	0x00000040 /* MMC 8bit mode is supported */
     46       1.16    bouyer #define	SDHC_FLAG_HAVE_CGM	0x00000080 /* Netlogic XLP */
     47       1.16    bouyer #define	SDHC_FLAG_NO_LED_ON	0x00000100 /* LED_ON unsupported in HOST_CTL */
     48       1.16    bouyer #define	SDHC_FLAG_HOSTCAPS	0x00000200 /* No device provided capabilities */
     49       1.16    bouyer #define	SDHC_FLAG_RSP136_CRC	0x00000400 /* Resp 136 with CRC and end-bit */
     50       1.16    bouyer #define	SDHC_FLAG_SINGLE_ONLY	0x00000800 /* Single transfer only */
     51       1.16    bouyer #define	SDHC_FLAG_WAIT_RESET	0x00001000 /* Wait for soft resets to start */
     52       1.16    bouyer #define	SDHC_FLAG_NO_HS_BIT	0x00002000 /* Don't set SDHC_HIGH_SPEED bit */
     53       1.16    bouyer #define	SDHC_FLAG_EXTERNAL_DMA	0x00004000
     54       1.16    bouyer #define	SDHC_FLAG_EXTDMA_DMAEN	0x00008000 /* ext. dma need SDHC_DMA_ENABLE */
     55       1.17  jmcneill #define	SDHC_FLAG_NO_CLKBASE	0x00020000 /* ignore clkbase register */
     56       1.18  jmcneill #define	SDHC_FLAG_SINGLE_POWER_WRITE 0x00040000
     57       1.19  jmcneill #define	SDHC_FLAG_NO_TIMEOUT	0x00080000 /* ignore timeout interrupts */
     58       1.20  jmcneill #define	SDHC_FLAG_USE_ADMA2	0x00100000
     59       1.23  jmcneill #define	SDHC_FLAG_POLL_CARD_DET	0x00200000 /* polling card detect */
     60       1.24   mlelstv #define	SDHC_FLAG_SLOW_SDR50  	0x00400000 /* reduce SDR50 speed */
     61       1.26       ryo #define	SDHC_FLAG_USDHC		0x00800000 /* Freescale uSDHC */
     62       1.27  kiyohara #define	SDHC_FLAG_NO_AUTO_STOP	0x01000000 /* No auto CMD12 */
     63       1.27  kiyohara #define	SDHC_FLAG_NO_BUSY_INTR	0x02000000 /* No intr when RESP_BUSY */
     64  1.29.12.1  christos #define	SDHC_FLAG_STOP_WITH_TC	0x04000000 /* CMD12 can set xfer complete w/o SCF_RSP_BSY */
     65        1.8     skrll 
     66        1.5      matt 	uint32_t		sc_clkbase;
     67        1.9  kiyohara 	int			sc_clkmsk;	/* Mask for SDCLK */
     68        1.8     skrll 	uint32_t		sc_caps;/* attachment provided capabilities */
     69       1.22  jmcneill 	uint32_t		sc_caps2;
     70        1.9  kiyohara 
     71        1.9  kiyohara 	int (*sc_vendor_rod)(struct sdhc_softc *, int);
     72        1.9  kiyohara 	int (*sc_vendor_write_protect)(struct sdhc_softc *);
     73        1.9  kiyohara 	int (*sc_vendor_card_detect)(struct sdhc_softc *);
     74       1.25  jmcneill 	int (*sc_vendor_bus_width)(struct sdhc_softc *, int);
     75       1.10      matt 	int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
     76  1.29.12.1  christos 	int (*sc_vendor_bus_clock_post)(struct sdhc_softc *, int);
     77       1.15  jmcneill 	int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
     78       1.28    nonaka 	void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *);
     79       1.29  jmcneill 	int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int);
     80        1.1    nonaka };
     81        1.1    nonaka 
     82        1.1    nonaka /* Host controller functions called by the attachment driver. */
     83        1.1    nonaka int	sdhc_host_found(struct sdhc_softc *, bus_space_tag_t,
     84        1.1    nonaka 	    bus_space_handle_t, bus_size_t);
     85        1.1    nonaka int	sdhc_intr(void *);
     86       1.12  jakllsch int	sdhc_detach(struct sdhc_softc *, int);
     87        1.4    nonaka bool	sdhc_suspend(device_t, const pmf_qual_t *);
     88        1.4    nonaka bool	sdhc_resume(device_t, const pmf_qual_t *);
     89        1.4    nonaka bool	sdhc_shutdown(device_t, int);
     90       1.21  jmcneill kmutex_t *sdhc_host_lock(struct sdhc_host *);
     91       1.28    nonaka uint8_t	sdhc_host_read_1(struct sdhc_host *, int);
     92       1.28    nonaka uint16_t sdhc_host_read_2(struct sdhc_host *, int);
     93       1.28    nonaka uint32_t sdhc_host_read_4(struct sdhc_host *, int);
     94       1.28    nonaka void	sdhc_host_write_1(struct sdhc_host *, int, uint8_t);
     95       1.28    nonaka void	sdhc_host_write_2(struct sdhc_host *, int, uint16_t);
     96       1.28    nonaka void	sdhc_host_write_4(struct sdhc_host *, int, uint32_t);
     97        1.1    nonaka 
     98        1.1    nonaka #endif	/* _SDHCVAR_H_ */
     99