Home | History | Annotate | Line # | Download | only in broadcom
bcm2835_sdhost.c revision 1.3
      1  1.3  jmcneill /* $NetBSD: bcm2835_sdhost.c,v 1.3 2017/08/16 20:54:19 jmcneill Exp $ */
      2  1.1  jmcneill 
      3  1.1  jmcneill /*-
      4  1.1  jmcneill  * Copyright (c) 2017 Jared McNeill <jmcneill (at) invisible.ca>
      5  1.1  jmcneill  * All rights reserved.
      6  1.1  jmcneill  *
      7  1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8  1.1  jmcneill  * modification, are permitted provided that the following conditions
      9  1.1  jmcneill  * are met:
     10  1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12  1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15  1.1  jmcneill  *
     16  1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22  1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1  jmcneill  * SUCH DAMAGE.
     27  1.1  jmcneill  */
     28  1.1  jmcneill 
     29  1.1  jmcneill #include <sys/cdefs.h>
     30  1.3  jmcneill __KERNEL_RCSID(0, "$NetBSD: bcm2835_sdhost.c,v 1.3 2017/08/16 20:54:19 jmcneill Exp $");
     31  1.1  jmcneill 
     32  1.1  jmcneill #include <sys/param.h>
     33  1.1  jmcneill #include <sys/bus.h>
     34  1.1  jmcneill #include <sys/device.h>
     35  1.1  jmcneill #include <sys/intr.h>
     36  1.1  jmcneill #include <sys/systm.h>
     37  1.1  jmcneill #include <sys/kernel.h>
     38  1.1  jmcneill #include <sys/gpio.h>
     39  1.1  jmcneill 
     40  1.1  jmcneill #include <arm/broadcom/bcm2835reg.h>
     41  1.1  jmcneill #include <arm/broadcom/bcm_amba.h>
     42  1.1  jmcneill #include <arm/broadcom/bcm2835_dmac.h>
     43  1.1  jmcneill 
     44  1.1  jmcneill #include <dev/sdmmc/sdmmcvar.h>
     45  1.1  jmcneill #include <dev/sdmmc/sdmmcchip.h>
     46  1.1  jmcneill #include <dev/sdmmc/sdmmc_ioreg.h>
     47  1.1  jmcneill 
     48  1.1  jmcneill #define	SDCMD		0x00
     49  1.1  jmcneill #define	 SDCMD_NEW	__BIT(15)
     50  1.1  jmcneill #define	 SDCMD_FAIL	__BIT(14)
     51  1.1  jmcneill #define	 SDCMD_BUSY	__BIT(11)
     52  1.1  jmcneill #define	 SDCMD_NORESP	__BIT(10)
     53  1.1  jmcneill #define	 SDCMD_LONGRESP	__BIT(9)
     54  1.1  jmcneill #define	 SDCMD_WRITE	__BIT(7)
     55  1.1  jmcneill #define	 SDCMD_READ	__BIT(6)
     56  1.1  jmcneill #define	SDARG		0x04
     57  1.1  jmcneill #define	SDTOUT		0x08
     58  1.1  jmcneill #define	 SDTOUT_DEFAULT	0xf00000
     59  1.1  jmcneill #define	SDCDIV		0x0c
     60  1.1  jmcneill #define	 SDCDIV_MASK	__BITS(10,0)
     61  1.1  jmcneill #define	SDRSP0		0x10
     62  1.1  jmcneill #define	SDRSP1		0x14
     63  1.1  jmcneill #define	SDRSP2		0x18
     64  1.1  jmcneill #define	SDRSP3		0x1c
     65  1.1  jmcneill #define	SDHSTS		0x20
     66  1.1  jmcneill #define	 SDHSTS_BUSY	__BIT(10)
     67  1.1  jmcneill #define	 SDHSTS_BLOCK	__BIT(9)
     68  1.1  jmcneill #define	 SDHSTS_SDIO	__BIT(8)
     69  1.1  jmcneill #define	 SDHSTS_REW_TO	__BIT(7)
     70  1.1  jmcneill #define	 SDHSTS_CMD_TO	__BIT(6)
     71  1.1  jmcneill #define	 SDHSTS_CRC16_E	__BIT(5)
     72  1.1  jmcneill #define	 SDHSTS_CRC7_E	__BIT(4)
     73  1.1  jmcneill #define	 SDHSTS_FIFO_E	__BIT(3)
     74  1.1  jmcneill #define	 SDHSTS_DATA	__BIT(0)
     75  1.1  jmcneill #define	SDVDD		0x30
     76  1.1  jmcneill #define	 SDVDD_POWER	__BIT(0)
     77  1.1  jmcneill #define	SDEDM		0x34
     78  1.1  jmcneill #define	 SDEDM_RD_FIFO	__BITS(18,14)
     79  1.1  jmcneill #define	 SDEDM_WR_FIFO	__BITS(13,9)
     80  1.1  jmcneill #define	SDHCFG		0x38
     81  1.1  jmcneill #define	 SDHCFG_BUSY_EN	__BIT(10)
     82  1.1  jmcneill #define	 SDHCFG_BLOCK_EN __BIT(8)
     83  1.1  jmcneill #define	 SDHCFG_SDIO_EN	__BIT(5)
     84  1.1  jmcneill #define	 SDHCFG_DATA_EN	__BIT(4)
     85  1.1  jmcneill #define	 SDHCFG_SLOW	__BIT(3)
     86  1.1  jmcneill #define	 SDHCFG_WIDE_EXT __BIT(2)
     87  1.1  jmcneill #define	 SDHCFG_WIDE_INT __BIT(1)
     88  1.1  jmcneill #define	 SDHCFG_REL_CMD	__BIT(0)
     89  1.1  jmcneill #define	SDHBCT		0x3c
     90  1.1  jmcneill #define	SDDATA		0x40
     91  1.1  jmcneill #define	SDHBLC		0x50
     92  1.1  jmcneill 
     93  1.1  jmcneill struct sdhost_softc;
     94  1.1  jmcneill 
     95  1.1  jmcneill static int	sdhost_match(device_t, cfdata_t, void *);
     96  1.1  jmcneill static void	sdhost_attach(device_t, device_t, void *);
     97  1.1  jmcneill static void	sdhost_attach_i(device_t);
     98  1.1  jmcneill 
     99  1.1  jmcneill static int	sdhost_intr(void *);
    100  1.1  jmcneill static int	sdhost_dma_setup(struct sdhost_softc *);
    101  1.1  jmcneill static void	sdhost_dma_done(uint32_t, uint32_t, void *);
    102  1.1  jmcneill 
    103  1.1  jmcneill static int	sdhost_host_reset(sdmmc_chipset_handle_t);
    104  1.1  jmcneill static uint32_t	sdhost_host_ocr(sdmmc_chipset_handle_t);
    105  1.1  jmcneill static int	sdhost_host_maxblklen(sdmmc_chipset_handle_t);
    106  1.1  jmcneill static int	sdhost_card_detect(sdmmc_chipset_handle_t);
    107  1.1  jmcneill static int	sdhost_write_protect(sdmmc_chipset_handle_t);
    108  1.1  jmcneill static int	sdhost_bus_power(sdmmc_chipset_handle_t, uint32_t);
    109  1.1  jmcneill static int	sdhost_bus_clock(sdmmc_chipset_handle_t, int, bool);
    110  1.1  jmcneill static int	sdhost_bus_width(sdmmc_chipset_handle_t, int);
    111  1.1  jmcneill static int	sdhost_bus_rod(sdmmc_chipset_handle_t, int);
    112  1.1  jmcneill static void	sdhost_exec_command(sdmmc_chipset_handle_t,
    113  1.1  jmcneill 				      struct sdmmc_command *);
    114  1.1  jmcneill static void	sdhost_card_enable_intr(sdmmc_chipset_handle_t, int);
    115  1.1  jmcneill static void	sdhost_card_intr_ack(sdmmc_chipset_handle_t);
    116  1.1  jmcneill 
    117  1.1  jmcneill static struct sdmmc_chip_functions sdhost_chip_functions = {
    118  1.1  jmcneill 	.host_reset = sdhost_host_reset,
    119  1.1  jmcneill 	.host_ocr = sdhost_host_ocr,
    120  1.1  jmcneill 	.host_maxblklen = sdhost_host_maxblklen,
    121  1.1  jmcneill 	.card_detect = sdhost_card_detect,
    122  1.1  jmcneill 	.write_protect = sdhost_write_protect,
    123  1.1  jmcneill 	.bus_power = sdhost_bus_power,
    124  1.1  jmcneill 	.bus_clock_ddr = sdhost_bus_clock,
    125  1.1  jmcneill 	.bus_width = sdhost_bus_width,
    126  1.1  jmcneill 	.bus_rod = sdhost_bus_rod,
    127  1.1  jmcneill 	.exec_command = sdhost_exec_command,
    128  1.1  jmcneill 	.card_enable_intr = sdhost_card_enable_intr,
    129  1.1  jmcneill 	.card_intr_ack = sdhost_card_intr_ack,
    130  1.1  jmcneill };
    131  1.1  jmcneill 
    132  1.1  jmcneill struct sdhost_softc {
    133  1.1  jmcneill 	device_t sc_dev;
    134  1.1  jmcneill 	bus_space_tag_t sc_bst;
    135  1.1  jmcneill 	bus_space_handle_t sc_bsh;
    136  1.1  jmcneill 	bus_dma_tag_t sc_dmat;
    137  1.1  jmcneill 
    138  1.1  jmcneill 	bus_addr_t sc_addr;
    139  1.1  jmcneill 
    140  1.1  jmcneill 	void *sc_ih;
    141  1.1  jmcneill 	kmutex_t sc_intr_lock;
    142  1.1  jmcneill 	kcondvar_t sc_intr_cv;
    143  1.1  jmcneill 	kcondvar_t sc_dma_cv;
    144  1.1  jmcneill 
    145  1.1  jmcneill 	u_int sc_rate;
    146  1.1  jmcneill 
    147  1.1  jmcneill 	int sc_mmc_width;
    148  1.1  jmcneill 	int sc_mmc_present;
    149  1.1  jmcneill 
    150  1.1  jmcneill 	device_t sc_sdmmc_dev;
    151  1.1  jmcneill 
    152  1.1  jmcneill 	struct bcm_dmac_channel *sc_dmac;
    153  1.1  jmcneill 
    154  1.1  jmcneill 	bus_dmamap_t sc_dmamap;
    155  1.1  jmcneill 	bus_dma_segment_t sc_segs[1];
    156  1.1  jmcneill 	struct bcm_dmac_conblk *sc_cblk;
    157  1.1  jmcneill 
    158  1.1  jmcneill 	uint32_t sc_intr_hsts;
    159  1.1  jmcneill 
    160  1.1  jmcneill 	uint32_t sc_dma_status;
    161  1.1  jmcneill 	uint32_t sc_dma_error;
    162  1.1  jmcneill };
    163  1.1  jmcneill 
    164  1.1  jmcneill CFATTACH_DECL_NEW(bcmsdhost, sizeof(struct sdhost_softc),
    165  1.1  jmcneill 	sdhost_match, sdhost_attach, NULL, NULL);
    166  1.1  jmcneill 
    167  1.1  jmcneill #define SDHOST_WRITE(sc, reg, val)	\
    168  1.1  jmcneill 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
    169  1.1  jmcneill #define SDHOST_READ(sc, reg) \
    170  1.1  jmcneill 	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
    171  1.1  jmcneill 
    172  1.1  jmcneill static int
    173  1.1  jmcneill sdhost_match(device_t parent, cfdata_t cf, void *aux)
    174  1.1  jmcneill {
    175  1.1  jmcneill 	struct amba_attach_args * const aaa = aux;
    176  1.1  jmcneill 
    177  1.1  jmcneill 	return strcmp(aaa->aaa_name, "sdhost") == 0;
    178  1.1  jmcneill }
    179  1.1  jmcneill 
    180  1.1  jmcneill static void
    181  1.1  jmcneill sdhost_attach(device_t parent, device_t self, void *aux)
    182  1.1  jmcneill {
    183  1.1  jmcneill 	struct sdhost_softc * const sc = device_private(self);
    184  1.1  jmcneill 	struct amba_attach_args * const aaa = aux;
    185  1.1  jmcneill 	prop_dictionary_t dict = device_properties(self);
    186  1.3  jmcneill 	bool disable = false;
    187  1.1  jmcneill 
    188  1.1  jmcneill 	sc->sc_dev = self;
    189  1.1  jmcneill 	sc->sc_bst = aaa->aaa_iot;
    190  1.1  jmcneill 	sc->sc_dmat = aaa->aaa_dmat;
    191  1.1  jmcneill 	sc->sc_addr = aaa->aaa_addr;
    192  1.1  jmcneill 	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO);
    193  1.1  jmcneill 	cv_init(&sc->sc_intr_cv, "sdhostintr");
    194  1.1  jmcneill 	cv_init(&sc->sc_dma_cv, "sdhostdma");
    195  1.1  jmcneill 
    196  1.1  jmcneill 	if (bus_space_map(sc->sc_bst, aaa->aaa_addr, aaa->aaa_size, 0,
    197  1.1  jmcneill 	    &sc->sc_bsh) != 0) {
    198  1.1  jmcneill 		aprint_error(": couldn't map registers\n");
    199  1.1  jmcneill 		return;
    200  1.1  jmcneill 	}
    201  1.1  jmcneill 
    202  1.1  jmcneill 	aprint_naive("\n");
    203  1.1  jmcneill 	aprint_normal(": SD HOST controller\n");
    204  1.1  jmcneill 
    205  1.3  jmcneill 	prop_dictionary_get_bool(dict, "disable", &disable);
    206  1.3  jmcneill 	if (disable) {
    207  1.3  jmcneill 		aprint_naive(": disabled\n");
    208  1.3  jmcneill 		aprint_normal(": disabled\n");
    209  1.3  jmcneill 		return;
    210  1.3  jmcneill 	}
    211  1.3  jmcneill 
    212  1.1  jmcneill 	prop_dictionary_get_uint32(dict, "frequency", &sc->sc_rate);
    213  1.1  jmcneill 	if (sc->sc_rate == 0) {
    214  1.1  jmcneill 		aprint_error_dev(self, "couldn't get clock frequency\n");
    215  1.1  jmcneill 		return;
    216  1.1  jmcneill 	}
    217  1.1  jmcneill 
    218  1.2  jmcneill 	aprint_debug_dev(self, "ref freq %u Hz\n", sc->sc_rate);
    219  1.1  jmcneill 
    220  1.1  jmcneill 	if (sdhost_dma_setup(sc) != 0) {
    221  1.1  jmcneill 		aprint_error_dev(self, "failed to setup DMA\n");
    222  1.1  jmcneill 		return;
    223  1.1  jmcneill 	}
    224  1.1  jmcneill 
    225  1.1  jmcneill 	sc->sc_ih = intr_establish(aaa->aaa_intr, IPL_SDMMC, IST_LEVEL,
    226  1.1  jmcneill 	    sdhost_intr, sc);
    227  1.1  jmcneill 	if (sc->sc_ih == NULL) {
    228  1.1  jmcneill 		aprint_error_dev(self, "failed to establish interrupt %d\n",
    229  1.1  jmcneill 		    aaa->aaa_intr);
    230  1.1  jmcneill 		return;
    231  1.1  jmcneill 	}
    232  1.1  jmcneill 	aprint_normal_dev(self, "interrupting on intr %d\n", aaa->aaa_intr);
    233  1.1  jmcneill 
    234  1.1  jmcneill 	config_interrupts(self, sdhost_attach_i);
    235  1.1  jmcneill }
    236  1.1  jmcneill 
    237  1.1  jmcneill static int
    238  1.1  jmcneill sdhost_dma_setup(struct sdhost_softc *sc)
    239  1.1  jmcneill {
    240  1.1  jmcneill 	int error, rseg;
    241  1.1  jmcneill 
    242  1.1  jmcneill 	sc->sc_dmac = bcm_dmac_alloc(BCM_DMAC_TYPE_NORMAL, IPL_SDMMC,
    243  1.1  jmcneill 	    sdhost_dma_done, sc);
    244  1.1  jmcneill 	if (sc->sc_dmac == NULL)
    245  1.1  jmcneill 		return ENXIO;
    246  1.1  jmcneill 
    247  1.1  jmcneill 	error = bus_dmamem_alloc(sc->sc_dmat, PAGE_SIZE, PAGE_SIZE,
    248  1.1  jmcneill 	    PAGE_SIZE, sc->sc_segs, 1, &rseg, BUS_DMA_WAITOK);
    249  1.1  jmcneill 	if (error)
    250  1.1  jmcneill 		return error;
    251  1.1  jmcneill 
    252  1.1  jmcneill 	error = bus_dmamem_map(sc->sc_dmat, sc->sc_segs, rseg, PAGE_SIZE,
    253  1.1  jmcneill 	    (void **)&sc->sc_cblk, BUS_DMA_WAITOK);
    254  1.1  jmcneill 	if (error)
    255  1.1  jmcneill 		return error;
    256  1.1  jmcneill 
    257  1.1  jmcneill 	memset(sc->sc_cblk, 0, PAGE_SIZE);
    258  1.1  jmcneill 
    259  1.1  jmcneill 	error = bus_dmamap_create(sc->sc_dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
    260  1.1  jmcneill 	    BUS_DMA_WAITOK, &sc->sc_dmamap);
    261  1.1  jmcneill 	if (error)
    262  1.1  jmcneill 		return error;
    263  1.1  jmcneill 
    264  1.1  jmcneill 	error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmamap, sc->sc_cblk,
    265  1.1  jmcneill 	    PAGE_SIZE, NULL, BUS_DMA_WAITOK|BUS_DMA_WRITE);
    266  1.1  jmcneill 	if (error)
    267  1.1  jmcneill 		return error;
    268  1.1  jmcneill 
    269  1.1  jmcneill 	return 0;
    270  1.1  jmcneill }
    271  1.1  jmcneill 
    272  1.1  jmcneill static void
    273  1.1  jmcneill sdhost_attach_i(device_t self)
    274  1.1  jmcneill {
    275  1.1  jmcneill 	struct sdhost_softc *sc = device_private(self);
    276  1.1  jmcneill 	struct sdmmcbus_attach_args saa;
    277  1.1  jmcneill 
    278  1.1  jmcneill 	sdhost_host_reset(sc);
    279  1.1  jmcneill 	sdhost_bus_width(sc, 1);
    280  1.1  jmcneill 	sdhost_bus_clock(sc, 400, false);
    281  1.1  jmcneill 
    282  1.1  jmcneill 	memset(&saa, 0, sizeof(saa));
    283  1.1  jmcneill 	saa.saa_busname = "sdmmc";
    284  1.1  jmcneill 	saa.saa_sct = &sdhost_chip_functions;
    285  1.1  jmcneill 	saa.saa_sch = sc;
    286  1.1  jmcneill 	saa.saa_dmat = sc->sc_dmat;
    287  1.1  jmcneill 	saa.saa_clkmin = 400;
    288  1.1  jmcneill 	saa.saa_clkmax = 50000;
    289  1.1  jmcneill 	saa.saa_caps = SMC_CAPS_DMA |
    290  1.1  jmcneill 		       SMC_CAPS_MULTI_SEG_DMA |
    291  1.1  jmcneill 		       SMC_CAPS_SD_HIGHSPEED |
    292  1.1  jmcneill 		       SMC_CAPS_MMC_HIGHSPEED |
    293  1.1  jmcneill 		       SMC_CAPS_4BIT_MODE;
    294  1.1  jmcneill 
    295  1.1  jmcneill 	sc->sc_sdmmc_dev = config_found(self, &saa, NULL);
    296  1.1  jmcneill }
    297  1.1  jmcneill 
    298  1.1  jmcneill static int
    299  1.1  jmcneill sdhost_intr(void *priv)
    300  1.1  jmcneill {
    301  1.1  jmcneill 	struct sdhost_softc * const sc = priv;
    302  1.1  jmcneill 
    303  1.1  jmcneill 	mutex_enter(&sc->sc_intr_lock);
    304  1.1  jmcneill 	const uint32_t hsts = SDHOST_READ(sc, SDHSTS);
    305  1.1  jmcneill 	if (!hsts) {
    306  1.1  jmcneill 		mutex_exit(&sc->sc_intr_lock);
    307  1.1  jmcneill 		return 0;
    308  1.1  jmcneill 	}
    309  1.1  jmcneill 	SDHOST_WRITE(sc, SDHSTS, hsts);
    310  1.1  jmcneill 
    311  1.1  jmcneill #ifdef SDHOST_DEBUG
    312  1.1  jmcneill 	device_printf(sc->sc_dev, "mmc intr hsts %#x\n", hsts);
    313  1.1  jmcneill #endif
    314  1.1  jmcneill 
    315  1.1  jmcneill 	if (hsts) {
    316  1.1  jmcneill 		sc->sc_intr_hsts |= hsts;
    317  1.1  jmcneill 		cv_broadcast(&sc->sc_intr_cv);
    318  1.1  jmcneill 	}
    319  1.1  jmcneill 
    320  1.1  jmcneill 	mutex_exit(&sc->sc_intr_lock);
    321  1.1  jmcneill 
    322  1.1  jmcneill 	return 1;
    323  1.1  jmcneill }
    324  1.1  jmcneill 
    325  1.1  jmcneill static int
    326  1.1  jmcneill sdhost_dma_transfer(struct sdhost_softc *sc, struct sdmmc_command *cmd)
    327  1.1  jmcneill {
    328  1.1  jmcneill 	size_t seg;
    329  1.1  jmcneill 	int error;
    330  1.1  jmcneill 
    331  1.1  jmcneill 	KASSERT(mutex_owned(&sc->sc_intr_lock));
    332  1.1  jmcneill 
    333  1.1  jmcneill 	for (seg = 0; seg < cmd->c_dmamap->dm_nsegs; seg++) {
    334  1.1  jmcneill 		sc->sc_cblk[seg].cb_ti =
    335  1.1  jmcneill 		    __SHIFTIN(13, DMAC_TI_PERMAP); /* SD HOST */
    336  1.1  jmcneill 		sc->sc_cblk[seg].cb_txfr_len =
    337  1.1  jmcneill 		    cmd->c_dmamap->dm_segs[seg].ds_len;
    338  1.1  jmcneill 		/*
    339  1.1  jmcneill 		 * All transfers are assumed to be multiples of 32-bits.
    340  1.1  jmcneill 		 */
    341  1.1  jmcneill 		KASSERTMSG((sc->sc_cblk[seg].cb_txfr_len & 0x3) == 0,
    342  1.1  jmcneill 		    "seg %zu len %d", seg, sc->sc_cblk[seg].cb_txfr_len);
    343  1.1  jmcneill 		if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
    344  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_DEST_INC;
    345  1.1  jmcneill 			/*
    346  1.1  jmcneill 			 * Use 128-bit mode if transfer is a multiple of
    347  1.1  jmcneill 			 * 16-bytes.
    348  1.1  jmcneill 			 */
    349  1.1  jmcneill 			if ((sc->sc_cblk[seg].cb_txfr_len & 0xf) == 0)
    350  1.1  jmcneill 				sc->sc_cblk[seg].cb_ti |= DMAC_TI_DEST_WIDTH;
    351  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_SRC_DREQ;
    352  1.1  jmcneill 			sc->sc_cblk[seg].cb_source_ad =
    353  1.1  jmcneill 			    sc->sc_addr + SDDATA;
    354  1.1  jmcneill 			sc->sc_cblk[seg].cb_dest_ad =
    355  1.1  jmcneill 			    cmd->c_dmamap->dm_segs[seg].ds_addr;
    356  1.1  jmcneill 		} else {
    357  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_SRC_INC;
    358  1.1  jmcneill 			/*
    359  1.1  jmcneill 			 * Use 128-bit mode if transfer is a multiple of
    360  1.1  jmcneill 			 * 16-bytes.
    361  1.1  jmcneill 			 */
    362  1.1  jmcneill 			if ((sc->sc_cblk[seg].cb_txfr_len & 0xf) == 0)
    363  1.1  jmcneill 				sc->sc_cblk[seg].cb_ti |= DMAC_TI_SRC_WIDTH;
    364  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_DEST_DREQ;
    365  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_WAIT_RESP;
    366  1.1  jmcneill 			sc->sc_cblk[seg].cb_source_ad =
    367  1.1  jmcneill 			    cmd->c_dmamap->dm_segs[seg].ds_addr;
    368  1.1  jmcneill 			sc->sc_cblk[seg].cb_dest_ad =
    369  1.1  jmcneill 			    sc->sc_addr + SDDATA;
    370  1.1  jmcneill 		}
    371  1.1  jmcneill 		sc->sc_cblk[seg].cb_stride = 0;
    372  1.1  jmcneill 		if (seg == cmd->c_dmamap->dm_nsegs - 1) {
    373  1.1  jmcneill 			sc->sc_cblk[seg].cb_ti |= DMAC_TI_INTEN;
    374  1.1  jmcneill 			sc->sc_cblk[seg].cb_nextconbk = 0;
    375  1.1  jmcneill 		} else {
    376  1.1  jmcneill 			sc->sc_cblk[seg].cb_nextconbk =
    377  1.1  jmcneill 			    sc->sc_dmamap->dm_segs[0].ds_addr +
    378  1.1  jmcneill 			    sizeof(struct bcm_dmac_conblk) * (seg+1);
    379  1.1  jmcneill 		}
    380  1.1  jmcneill 		sc->sc_cblk[seg].cb_padding[0] = 0;
    381  1.1  jmcneill 		sc->sc_cblk[seg].cb_padding[1] = 0;
    382  1.1  jmcneill 	}
    383  1.1  jmcneill 
    384  1.1  jmcneill 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0,
    385  1.1  jmcneill 	    sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_PREWRITE);
    386  1.1  jmcneill 
    387  1.1  jmcneill 	error = 0;
    388  1.1  jmcneill 
    389  1.1  jmcneill 	sc->sc_dma_status = 0;
    390  1.1  jmcneill 	sc->sc_dma_error = 0;
    391  1.1  jmcneill 
    392  1.1  jmcneill 	bcm_dmac_set_conblk_addr(sc->sc_dmac,
    393  1.1  jmcneill 	    sc->sc_dmamap->dm_segs[0].ds_addr);
    394  1.1  jmcneill 	error = bcm_dmac_transfer(sc->sc_dmac);
    395  1.1  jmcneill 	if (error)
    396  1.1  jmcneill 		return error;
    397  1.1  jmcneill 
    398  1.1  jmcneill 	return 0;
    399  1.1  jmcneill }
    400  1.1  jmcneill 
    401  1.1  jmcneill static int
    402  1.1  jmcneill sdhost_dma_wait(struct sdhost_softc *sc, struct sdmmc_command *cmd)
    403  1.1  jmcneill {
    404  1.1  jmcneill 	int error = 0;
    405  1.1  jmcneill 
    406  1.1  jmcneill 	while (sc->sc_dma_status == 0 && sc->sc_dma_error == 0) {
    407  1.1  jmcneill 		error = cv_timedwait(&sc->sc_dma_cv, &sc->sc_intr_lock, hz*5);
    408  1.1  jmcneill 		if (error == EWOULDBLOCK) {
    409  1.1  jmcneill 			device_printf(sc->sc_dev, "transfer timeout!\n");
    410  1.1  jmcneill 			bcm_dmac_halt(sc->sc_dmac);
    411  1.1  jmcneill 			error = ETIMEDOUT;
    412  1.1  jmcneill 			break;
    413  1.1  jmcneill 		}
    414  1.1  jmcneill 	}
    415  1.1  jmcneill 
    416  1.1  jmcneill 	if (sc->sc_dma_status & DMAC_CS_END) {
    417  1.1  jmcneill 		cmd->c_resid = 0;
    418  1.1  jmcneill 		error = 0;
    419  1.1  jmcneill 	} else {
    420  1.1  jmcneill 		error = EIO;
    421  1.1  jmcneill 	}
    422  1.1  jmcneill 
    423  1.1  jmcneill 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, 0,
    424  1.1  jmcneill 	    sc->sc_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
    425  1.1  jmcneill 
    426  1.1  jmcneill 	return error;
    427  1.1  jmcneill }
    428  1.1  jmcneill 
    429  1.1  jmcneill static void
    430  1.1  jmcneill sdhost_dma_done(uint32_t status, uint32_t error, void *arg)
    431  1.1  jmcneill {
    432  1.1  jmcneill 	struct sdhost_softc * const sc = arg;
    433  1.1  jmcneill 
    434  1.1  jmcneill 	if (status != (DMAC_CS_INT|DMAC_CS_END))
    435  1.1  jmcneill 		device_printf(sc->sc_dev, "dma status %#x error %#x\n",
    436  1.1  jmcneill 		    status, error);
    437  1.1  jmcneill 
    438  1.1  jmcneill 	mutex_enter(&sc->sc_intr_lock);
    439  1.1  jmcneill 	sc->sc_dma_status = status;
    440  1.1  jmcneill 	sc->sc_dma_error = error;
    441  1.1  jmcneill 	cv_broadcast(&sc->sc_dma_cv);
    442  1.1  jmcneill 	mutex_exit(&sc->sc_intr_lock);
    443  1.1  jmcneill }
    444  1.1  jmcneill 
    445  1.1  jmcneill static int
    446  1.1  jmcneill sdhost_wait_idle(struct sdhost_softc *sc, int timeout)
    447  1.1  jmcneill {
    448  1.1  jmcneill 	int retry;
    449  1.1  jmcneill 
    450  1.1  jmcneill 	KASSERT(mutex_owned(&sc->sc_intr_lock));
    451  1.1  jmcneill 
    452  1.1  jmcneill 	retry = timeout * 1000;
    453  1.1  jmcneill 
    454  1.1  jmcneill 	while (--retry > 0) {
    455  1.1  jmcneill 		const uint32_t cmd = SDHOST_READ(sc, SDCMD);
    456  1.1  jmcneill 		if ((cmd & SDCMD_NEW) == 0)
    457  1.1  jmcneill 			return 0;
    458  1.1  jmcneill 		delay(1);
    459  1.1  jmcneill 	}
    460  1.1  jmcneill 
    461  1.1  jmcneill 	return ETIMEDOUT;
    462  1.1  jmcneill }
    463  1.1  jmcneill 
    464  1.1  jmcneill static int
    465  1.1  jmcneill sdhost_host_reset(sdmmc_chipset_handle_t sch)
    466  1.1  jmcneill {
    467  1.1  jmcneill 	struct sdhost_softc * const sc = sch;
    468  1.1  jmcneill 	uint32_t edm;
    469  1.1  jmcneill 
    470  1.1  jmcneill 	SDHOST_WRITE(sc, SDVDD, 0);
    471  1.1  jmcneill 	SDHOST_WRITE(sc, SDCMD, 0);
    472  1.1  jmcneill 	SDHOST_WRITE(sc, SDARG, 0);
    473  1.1  jmcneill 	SDHOST_WRITE(sc, SDTOUT, SDTOUT_DEFAULT);
    474  1.1  jmcneill 	SDHOST_WRITE(sc, SDCDIV, 0);
    475  1.1  jmcneill 	SDHOST_WRITE(sc, SDHSTS, SDHOST_READ(sc, SDHSTS));
    476  1.1  jmcneill 	SDHOST_WRITE(sc, SDHCFG, 0);
    477  1.1  jmcneill 	SDHOST_WRITE(sc, SDHBCT, 0);
    478  1.1  jmcneill 	SDHOST_WRITE(sc, SDHBLC, 0);
    479  1.1  jmcneill 
    480  1.1  jmcneill 	edm = SDHOST_READ(sc, SDEDM);
    481  1.1  jmcneill 	edm &= ~(SDEDM_RD_FIFO|SDEDM_WR_FIFO);
    482  1.1  jmcneill 	edm |= __SHIFTIN(4, SDEDM_RD_FIFO);
    483  1.1  jmcneill 	edm |= __SHIFTIN(4, SDEDM_WR_FIFO);
    484  1.1  jmcneill 	SDHOST_WRITE(sc, SDEDM, edm);
    485  1.1  jmcneill 	delay(20000);
    486  1.1  jmcneill 	SDHOST_WRITE(sc, SDVDD, SDVDD_POWER);
    487  1.1  jmcneill 	delay(20000);
    488  1.1  jmcneill 
    489  1.1  jmcneill 	SDHOST_WRITE(sc, SDHCFG, 0);
    490  1.1  jmcneill 	SDHOST_WRITE(sc, SDCDIV, SDCDIV_MASK);
    491  1.1  jmcneill 
    492  1.1  jmcneill 	return 0;
    493  1.1  jmcneill }
    494  1.1  jmcneill 
    495  1.1  jmcneill static uint32_t
    496  1.1  jmcneill sdhost_host_ocr(sdmmc_chipset_handle_t sch)
    497  1.1  jmcneill {
    498  1.1  jmcneill 	return MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V | MMC_OCR_HCS;
    499  1.1  jmcneill }
    500  1.1  jmcneill 
    501  1.1  jmcneill static int
    502  1.1  jmcneill sdhost_host_maxblklen(sdmmc_chipset_handle_t sch)
    503  1.1  jmcneill {
    504  1.1  jmcneill 	return 8192;
    505  1.1  jmcneill }
    506  1.1  jmcneill 
    507  1.1  jmcneill static int
    508  1.1  jmcneill sdhost_card_detect(sdmmc_chipset_handle_t sch)
    509  1.1  jmcneill {
    510  1.1  jmcneill 	return 1;	/* XXX */
    511  1.1  jmcneill }
    512  1.1  jmcneill 
    513  1.1  jmcneill static int
    514  1.1  jmcneill sdhost_write_protect(sdmmc_chipset_handle_t sch)
    515  1.1  jmcneill {
    516  1.1  jmcneill 	return 0;	/* no write protect pin, assume rw */
    517  1.1  jmcneill }
    518  1.1  jmcneill 
    519  1.1  jmcneill static int
    520  1.1  jmcneill sdhost_bus_power(sdmmc_chipset_handle_t sch, uint32_t ocr)
    521  1.1  jmcneill {
    522  1.1  jmcneill 	return 0;
    523  1.1  jmcneill }
    524  1.1  jmcneill 
    525  1.1  jmcneill static int
    526  1.1  jmcneill sdhost_bus_clock(sdmmc_chipset_handle_t sch, int freq, bool ddr)
    527  1.1  jmcneill {
    528  1.1  jmcneill 	struct sdhost_softc * const sc = sch;
    529  1.1  jmcneill 	u_int target_rate = freq * 1000;
    530  1.1  jmcneill 	int div;
    531  1.1  jmcneill 
    532  1.1  jmcneill 	if (freq == 0)
    533  1.1  jmcneill 		div = SDCDIV_MASK;
    534  1.1  jmcneill 	else {
    535  1.1  jmcneill 		div = sc->sc_rate / target_rate;
    536  1.1  jmcneill 		if (div < 2)
    537  1.1  jmcneill 			div = 2;
    538  1.1  jmcneill 		if ((sc->sc_rate / div) > target_rate)
    539  1.1  jmcneill 			div++;
    540  1.1  jmcneill 		div -= 2;
    541  1.1  jmcneill 		if (div > SDCDIV_MASK)
    542  1.1  jmcneill 			div = SDCDIV_MASK;
    543  1.1  jmcneill 	}
    544  1.1  jmcneill 
    545  1.1  jmcneill 	SDHOST_WRITE(sc, SDCDIV, div);
    546  1.1  jmcneill 
    547  1.1  jmcneill 	return 0;
    548  1.1  jmcneill }
    549  1.1  jmcneill 
    550  1.1  jmcneill static int
    551  1.1  jmcneill sdhost_bus_width(sdmmc_chipset_handle_t sch, int width)
    552  1.1  jmcneill {
    553  1.1  jmcneill 	struct sdhost_softc * const sc = sch;
    554  1.1  jmcneill 	uint32_t hcfg;
    555  1.1  jmcneill 
    556  1.1  jmcneill #ifdef SDHOST_DEBUG
    557  1.1  jmcneill 	aprint_normal_dev(sc->sc_dev, "width = %d\n", width);
    558  1.1  jmcneill #endif
    559  1.1  jmcneill 
    560  1.1  jmcneill 	hcfg = SDHOST_READ(sc, SDHCFG);
    561  1.1  jmcneill 	if (width == 4)
    562  1.1  jmcneill 		hcfg |= SDHCFG_WIDE_EXT;
    563  1.1  jmcneill 	else
    564  1.1  jmcneill 		hcfg &= ~SDHCFG_WIDE_EXT;
    565  1.1  jmcneill 	hcfg |= (SDHCFG_WIDE_INT | SDHCFG_SLOW);
    566  1.1  jmcneill 	SDHOST_WRITE(sc, SDHCFG, hcfg);
    567  1.1  jmcneill 
    568  1.1  jmcneill 	return 0;
    569  1.1  jmcneill }
    570  1.1  jmcneill 
    571  1.1  jmcneill static int
    572  1.1  jmcneill sdhost_bus_rod(sdmmc_chipset_handle_t sch, int on)
    573  1.1  jmcneill {
    574  1.1  jmcneill 	return -1;
    575  1.1  jmcneill }
    576  1.1  jmcneill 
    577  1.1  jmcneill static void
    578  1.1  jmcneill sdhost_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
    579  1.1  jmcneill {
    580  1.1  jmcneill 	struct sdhost_softc * const sc = sch;
    581  1.1  jmcneill 	uint32_t cmdval, hcfg;
    582  1.1  jmcneill 	u_int nblks;
    583  1.1  jmcneill 
    584  1.1  jmcneill #ifdef SDHOST_DEBUG
    585  1.1  jmcneill 	aprint_normal_dev(sc->sc_dev,
    586  1.1  jmcneill 	    "opcode %d flags 0x%x data %p datalen %d blklen %d\n",
    587  1.1  jmcneill 	    cmd->c_opcode, cmd->c_flags, cmd->c_data, cmd->c_datalen,
    588  1.1  jmcneill 	    cmd->c_blklen);
    589  1.1  jmcneill #endif
    590  1.1  jmcneill 
    591  1.1  jmcneill 	mutex_enter(&sc->sc_intr_lock);
    592  1.1  jmcneill 
    593  1.1  jmcneill 	hcfg = SDHOST_READ(sc, SDHCFG);
    594  1.1  jmcneill 	SDHOST_WRITE(sc, SDHCFG, hcfg | SDHCFG_BUSY_EN);
    595  1.1  jmcneill 
    596  1.1  jmcneill 	sc->sc_intr_hsts = 0;
    597  1.1  jmcneill 
    598  1.1  jmcneill 	cmd->c_error = sdhost_wait_idle(sc, 5000);
    599  1.1  jmcneill 	if (cmd->c_error != 0) {
    600  1.1  jmcneill #ifdef SDHOST_DEBUG
    601  1.1  jmcneill 		device_printf(sc->sc_dev, "device is busy\n");
    602  1.1  jmcneill #endif
    603  1.1  jmcneill 		goto done;
    604  1.1  jmcneill 	}
    605  1.1  jmcneill 
    606  1.1  jmcneill 	cmdval = SDCMD_NEW;
    607  1.1  jmcneill 	if (!ISSET(cmd->c_flags, SCF_RSP_PRESENT))
    608  1.1  jmcneill 		cmdval |= SDCMD_NORESP;
    609  1.1  jmcneill 	if (ISSET(cmd->c_flags, SCF_RSP_136))
    610  1.1  jmcneill 		cmdval |= SDCMD_LONGRESP;
    611  1.1  jmcneill 	if (ISSET(cmd->c_flags, SCF_RSP_BSY))
    612  1.1  jmcneill 		cmdval |= SDCMD_BUSY;
    613  1.1  jmcneill 
    614  1.1  jmcneill 	if (cmd->c_datalen > 0) {
    615  1.1  jmcneill 		if (ISSET(cmd->c_flags, SCF_CMD_READ))
    616  1.1  jmcneill 			cmdval |= SDCMD_READ;
    617  1.1  jmcneill 		else
    618  1.1  jmcneill 			cmdval |= SDCMD_WRITE;
    619  1.1  jmcneill 
    620  1.1  jmcneill 		nblks = cmd->c_datalen / cmd->c_blklen;
    621  1.1  jmcneill 		if (nblks == 0 || (cmd->c_datalen % cmd->c_blklen) != 0)
    622  1.1  jmcneill 			++nblks;
    623  1.1  jmcneill 
    624  1.1  jmcneill 		SDHOST_WRITE(sc, SDHBCT, cmd->c_blklen);
    625  1.1  jmcneill 		SDHOST_WRITE(sc, SDHBLC, nblks);
    626  1.1  jmcneill 
    627  1.1  jmcneill 		cmd->c_resid = cmd->c_datalen;
    628  1.1  jmcneill 		cmd->c_error = sdhost_dma_transfer(sc, cmd);
    629  1.1  jmcneill 		if (cmd->c_error != 0) {
    630  1.1  jmcneill #ifdef SDHOST_DEBUG
    631  1.1  jmcneill 			device_printf(sc->sc_dev, "dma transfer failed: %d\n",
    632  1.1  jmcneill 			    cmd->c_error);
    633  1.1  jmcneill #endif
    634  1.1  jmcneill 			goto done;
    635  1.1  jmcneill 		}
    636  1.1  jmcneill 	}
    637  1.1  jmcneill 
    638  1.1  jmcneill 	SDHOST_WRITE(sc, SDARG, cmd->c_arg);
    639  1.1  jmcneill 	SDHOST_WRITE(sc, SDCMD, cmdval | cmd->c_opcode);
    640  1.1  jmcneill 
    641  1.1  jmcneill 	if (cmd->c_datalen > 0) {
    642  1.1  jmcneill 		cmd->c_error = sdhost_dma_wait(sc, cmd);
    643  1.1  jmcneill 		if (cmd->c_error != 0) {
    644  1.1  jmcneill #ifdef SDHOST_DEBUG
    645  1.1  jmcneill 			device_printf(sc->sc_dev,
    646  1.1  jmcneill 			    "wait dma failed: %d\n", cmd->c_error);
    647  1.1  jmcneill #endif
    648  1.1  jmcneill 			goto done;
    649  1.1  jmcneill 		}
    650  1.1  jmcneill 	}
    651  1.1  jmcneill 
    652  1.1  jmcneill 	cmd->c_error = sdhost_wait_idle(sc, 5000);
    653  1.1  jmcneill 	if (cmd->c_error != 0) {
    654  1.1  jmcneill #ifdef SDHOST_DEBUG
    655  1.1  jmcneill 		device_printf(sc->sc_dev,
    656  1.1  jmcneill 		    "wait cmd idle (%#x) failed: %d\n",
    657  1.1  jmcneill 		    SDHOST_READ(sc, SDCMD), cmd->c_error);
    658  1.1  jmcneill #endif
    659  1.1  jmcneill 	}
    660  1.1  jmcneill 
    661  1.1  jmcneill 	if ((SDHOST_READ(sc, SDCMD) & SDCMD_FAIL) != 0) {
    662  1.1  jmcneill #ifdef SDHOST_DEBUG
    663  1.1  jmcneill 		device_printf(sc->sc_dev, "SDCMD: %#x\n",
    664  1.1  jmcneill 		    SDHOST_READ(sc, SDCMD));
    665  1.1  jmcneill #endif
    666  1.1  jmcneill 		cmd->c_error = EIO;
    667  1.1  jmcneill 		goto done;
    668  1.1  jmcneill 	}
    669  1.1  jmcneill 
    670  1.1  jmcneill 	if (ISSET(cmd->c_flags, SCF_RSP_PRESENT)) {
    671  1.1  jmcneill 		if (ISSET(cmd->c_flags, SCF_RSP_136)) {
    672  1.1  jmcneill 			cmd->c_resp[0] = SDHOST_READ(sc, SDRSP0);
    673  1.1  jmcneill 			cmd->c_resp[1] = SDHOST_READ(sc, SDRSP1);
    674  1.1  jmcneill 			cmd->c_resp[2] = SDHOST_READ(sc, SDRSP2);
    675  1.1  jmcneill 			cmd->c_resp[3] = SDHOST_READ(sc, SDRSP3);
    676  1.1  jmcneill 			if (ISSET(cmd->c_flags, SCF_RSP_CRC)) {
    677  1.1  jmcneill 				cmd->c_resp[0] = (cmd->c_resp[0] >> 8) |
    678  1.1  jmcneill 				    (cmd->c_resp[1] << 24);
    679  1.1  jmcneill 				cmd->c_resp[1] = (cmd->c_resp[1] >> 8) |
    680  1.1  jmcneill 				    (cmd->c_resp[2] << 24);
    681  1.1  jmcneill 				cmd->c_resp[2] = (cmd->c_resp[2] >> 8) |
    682  1.1  jmcneill 				    (cmd->c_resp[3] << 24);
    683  1.1  jmcneill 				cmd->c_resp[3] = (cmd->c_resp[3] >> 8);
    684  1.1  jmcneill 			}
    685  1.1  jmcneill 		} else {
    686  1.1  jmcneill 			cmd->c_resp[0] = SDHOST_READ(sc, SDRSP0);
    687  1.1  jmcneill 		}
    688  1.1  jmcneill 	}
    689  1.1  jmcneill 
    690  1.1  jmcneill done:
    691  1.1  jmcneill 	cmd->c_flags |= SCF_ITSDONE;
    692  1.1  jmcneill 	SDHOST_WRITE(sc, SDHCFG, hcfg);
    693  1.1  jmcneill 	SDHOST_WRITE(sc, SDHSTS, SDHOST_READ(sc, SDHSTS));
    694  1.1  jmcneill 	mutex_exit(&sc->sc_intr_lock);
    695  1.1  jmcneill 
    696  1.1  jmcneill #ifdef SDHOST_DEBUG
    697  1.1  jmcneill 	if (cmd->c_error != 0)
    698  1.1  jmcneill 		device_printf(sc->sc_dev, "command failed with error %d\n",
    699  1.1  jmcneill 		    cmd->c_error);
    700  1.1  jmcneill #endif
    701  1.1  jmcneill }
    702  1.1  jmcneill 
    703  1.1  jmcneill static void
    704  1.1  jmcneill sdhost_card_enable_intr(sdmmc_chipset_handle_t sch, int enable)
    705  1.1  jmcneill {
    706  1.1  jmcneill }
    707  1.1  jmcneill 
    708  1.1  jmcneill static void
    709  1.1  jmcneill sdhost_card_intr_ack(sdmmc_chipset_handle_t sch)
    710  1.1  jmcneill {
    711  1.1  jmcneill }
    712