Home | History | Annotate | Line # | Download | only in xscale
      1  1.2  nonaka /*	$NetBSD: pxa2x0_mci.h,v 1.2 2012/01/21 19:44:28 nonaka Exp $	*/
      2  1.1  nonaka 
      3  1.1  nonaka /*-
      4  1.2  nonaka  * Copyright (C) 2006 NONAKA Kimihiro <nonaka (at) netbsd.org>
      5  1.1  nonaka  * All rights reserved.
      6  1.1  nonaka  *
      7  1.1  nonaka  * Redistribution and use in source and binary forms, with or without
      8  1.1  nonaka  * modification, are permitted provided that the following conditions
      9  1.1  nonaka  * are met:
     10  1.1  nonaka  * 1. Redistributions of source code must retain the above copyright
     11  1.1  nonaka  *    notice, this list of conditions and the following disclaimer.
     12  1.1  nonaka  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  nonaka  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  nonaka  *    documentation and/or other materials provided with the distribution.
     15  1.1  nonaka  *
     16  1.2  nonaka  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17  1.2  nonaka  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18  1.2  nonaka  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19  1.2  nonaka  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  1.2  nonaka  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21  1.2  nonaka  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22  1.2  nonaka  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23  1.2  nonaka  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24  1.2  nonaka  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25  1.2  nonaka  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26  1.1  nonaka  */
     27  1.1  nonaka 
     28  1.1  nonaka #ifndef	_PXA2X0_MCI_H_
     29  1.1  nonaka #define	_PXA2X0_MCI_H_
     30  1.1  nonaka 
     31  1.1  nonaka #include <sys/bus.h>
     32  1.1  nonaka #include <sys/device.h>
     33  1.1  nonaka #include <sys/mutex.h>
     34  1.1  nonaka #include <sys/condvar.h>
     35  1.1  nonaka 
     36  1.1  nonaka #include <arm/xscale/pxa2x0_dmac.h>
     37  1.1  nonaka 
     38  1.1  nonaka struct pxamci_tag {
     39  1.1  nonaka 	void		*cookie;
     40  1.1  nonaka 
     41  1.1  nonaka 	uint32_t	(*get_ocr)(void *);
     42  1.1  nonaka 	int		(*set_power)(void *, uint32_t);
     43  1.1  nonaka 	int		(*card_detect)(void *);
     44  1.1  nonaka 	int		(*write_protect)(void *);
     45  1.1  nonaka };
     46  1.1  nonaka 
     47  1.1  nonaka struct pxamci_softc {
     48  1.1  nonaka 	device_t		sc_dev;
     49  1.1  nonaka 	bus_space_tag_t		sc_iot;
     50  1.1  nonaka 	bus_space_handle_t	sc_ioh;
     51  1.1  nonaka 	void			*sc_ih;
     52  1.1  nonaka 	device_t		sc_sdmmc;
     53  1.1  nonaka 
     54  1.1  nonaka 	struct dmac_xfer	*sc_rxdx;
     55  1.1  nonaka 	bus_dma_segment_t	sc_rxdr;	/* read descriptor */
     56  1.1  nonaka 	struct dmac_xfer	*sc_txdx;
     57  1.1  nonaka 	bus_dma_segment_t	sc_txdr;	/* write descriptor */
     58  1.1  nonaka 
     59  1.1  nonaka 	struct pxamci_tag	sc_tag;
     60  1.1  nonaka 
     61  1.1  nonaka 	u_int			sc_caps;
     62  1.1  nonaka #define	PMC_CAPS_4BIT	(1U << 0)
     63  1.1  nonaka #define	PMC_CAPS_NO_DMA	(1U << 1)
     64  1.1  nonaka 
     65  1.1  nonaka 	u_int			sc_flags;
     66  1.1  nonaka #define	PMF_CARDINITED	(1U << 0)
     67  1.1  nonaka 
     68  1.1  nonaka 	struct sdmmc_command * volatile sc_cmd;	/* command in progress */
     69  1.1  nonaka 
     70  1.1  nonaka 	uint32_t sc_imask;
     71  1.1  nonaka 
     72  1.1  nonaka 	uint32_t sc_ocr;			/* selected OCR */
     73  1.1  nonaka 	int sc_maxblklen;			/* maximum block length */
     74  1.1  nonaka 	int sc_buswidth;			/* current bus width */
     75  1.1  nonaka 
     76  1.1  nonaka 	u_int sc_clkmin;
     77  1.1  nonaka 	u_int sc_clkmax;
     78  1.1  nonaka 	u_int sc_clkbase;
     79  1.1  nonaka 	uint32_t sc_clkrt;
     80  1.1  nonaka };
     81  1.1  nonaka 
     82  1.1  nonaka int	pxamci_attach_sub(device_t, struct pxaip_attach_args *);
     83  1.1  nonaka void	pxamci_card_detect_event(struct pxamci_softc *);
     84  1.1  nonaka 
     85  1.1  nonaka #endif	/* _PXA2X0_MCI_H_ */
     86