Home | History | Annotate | Line # | Download | only in sdmmc
sdhcvar.h revision 1.33.2.1
      1  1.33.2.1    martin /*	$NetBSD: sdhcvar.h,v 1.33.2.1 2024/02/03 11:47:06 martin 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.32  jmcneill #define	SDHC_FLAG_POLL_CARD_DET	0x00100000 /* polling card detect */
     59      1.32  jmcneill #define	SDHC_FLAG_SLOW_SDR50  	0x00200000 /* reduce SDR50 speed */
     60      1.32  jmcneill #define	SDHC_FLAG_USDHC		0x00400000 /* Freescale uSDHC */
     61      1.32  jmcneill #define	SDHC_FLAG_NO_AUTO_STOP	0x00800000 /* No auto CMD12 */
     62      1.32  jmcneill #define	SDHC_FLAG_NO_BUSY_INTR	0x01000000 /* No intr when RESP_BUSY */
     63      1.32  jmcneill #define	SDHC_FLAG_STOP_WITH_TC	0x02000000 /* CMD12 can set xfer complete w/o SCF_RSP_BSY */
     64      1.32  jmcneill #define	SDHC_FLAG_BROKEN_ADMA2_ZEROLEN 0x04000000 /*
     65      1.31   hkenken 						   * Broken ADMA2 zero length descriptor
     66      1.31   hkenken 						   * Can't 64K Byte data transfer
     67      1.31   hkenken 						   */
     68      1.32  jmcneill #define	SDHC_FLAG_NO_1_8_V	0x08000000 /* No 1.8V supply */
     69      1.33  jmcneill #define	SDHC_FLAG_BROKEN_ADMA	0x10000000 /* ADMA engine does not work */
     70       1.8     skrll 
     71       1.5      matt 	uint32_t		sc_clkbase;
     72       1.9  kiyohara 	int			sc_clkmsk;	/* Mask for SDCLK */
     73       1.8     skrll 	uint32_t		sc_caps;/* attachment provided capabilities */
     74      1.22  jmcneill 	uint32_t		sc_caps2;
     75       1.9  kiyohara 
     76       1.9  kiyohara 	int (*sc_vendor_rod)(struct sdhc_softc *, int);
     77       1.9  kiyohara 	int (*sc_vendor_write_protect)(struct sdhc_softc *);
     78       1.9  kiyohara 	int (*sc_vendor_card_detect)(struct sdhc_softc *);
     79      1.25  jmcneill 	int (*sc_vendor_bus_width)(struct sdhc_softc *, int);
     80      1.10      matt 	int (*sc_vendor_bus_clock)(struct sdhc_softc *, int);
     81      1.30  jmcneill 	int (*sc_vendor_bus_clock_post)(struct sdhc_softc *, int);
     82      1.15  jmcneill 	int (*sc_vendor_transfer_data_dma)(struct sdhc_softc *, struct sdmmc_command *);
     83      1.28    nonaka 	void (*sc_vendor_hw_reset)(struct sdhc_softc *, struct sdhc_host *);
     84      1.29  jmcneill 	int (*sc_vendor_signal_voltage)(struct sdhc_softc *, int);
     85  1.33.2.1    martin 
     86  1.33.2.1    martin 	u_int			sc_write_delay; /* delay (us) after io write */
     87       1.1    nonaka };
     88       1.1    nonaka 
     89       1.1    nonaka /* Host controller functions called by the attachment driver. */
     90       1.1    nonaka int	sdhc_host_found(struct sdhc_softc *, bus_space_tag_t,
     91       1.1    nonaka 	    bus_space_handle_t, bus_size_t);
     92       1.1    nonaka int	sdhc_intr(void *);
     93      1.12  jakllsch int	sdhc_detach(struct sdhc_softc *, int);
     94       1.4    nonaka bool	sdhc_suspend(device_t, const pmf_qual_t *);
     95       1.4    nonaka bool	sdhc_resume(device_t, const pmf_qual_t *);
     96       1.4    nonaka bool	sdhc_shutdown(device_t, int);
     97      1.21  jmcneill kmutex_t *sdhc_host_lock(struct sdhc_host *);
     98      1.28    nonaka uint8_t	sdhc_host_read_1(struct sdhc_host *, int);
     99      1.28    nonaka uint16_t sdhc_host_read_2(struct sdhc_host *, int);
    100      1.28    nonaka uint32_t sdhc_host_read_4(struct sdhc_host *, int);
    101      1.28    nonaka void	sdhc_host_write_1(struct sdhc_host *, int, uint8_t);
    102      1.28    nonaka void	sdhc_host_write_2(struct sdhc_host *, int, uint16_t);
    103      1.28    nonaka void	sdhc_host_write_4(struct sdhc_host *, int, uint32_t);
    104       1.1    nonaka 
    105       1.1    nonaka #endif	/* _SDHCVAR_H_ */
    106