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