2 * Copyright (c) 2006 M. Warner Losh. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #ifndef DEV_MMC_BRIDGE_H
28 #define DEV_MMC_BRIDGE_H
31 * This file defines interfaces for the mmc bridge. The names chosen
32 * are similar to or the same as the names used in Linux to allow for
33 * easy porting of what Linux calls mmc host drivers. I use the
34 * FreeBSD terminology of bridge and bus for consistancy with other
35 * drivers in the system. This file corresponds roughly to the Linux
36 * linux/mmc/host.h file.
38 * A mmc bridge is a chipset that can have one or more mmc and/or sd
39 * cards attached to it. mmc cards are attached on a bus topology,
40 * while sd and sdio cards are attached using a star topology (meaning
41 * in practice each sd card has its own, independent slot). Each
42 * mmcbr is assumed to be derived from the mmcbr. This is done to
43 * allow for easier addition of bridges (as each bridge does not need
44 * to be added to the mmcbus file).
46 * Attached to the mmc bridge is an mmcbus. The mmcbus is described
52 * mmc_ios is a structure that is used to store the state of the mmc/sd
53 * bus configuration. This include the bus' clock speed, its voltage,
54 * the bus mode for command output, the SPI chip select, some power
55 * states and the bus width.
58 vdd_150 = 0, vdd_155, vdd_160, vdd_165, vdd_170, vdd_180,
59 vdd_190, vdd_200, vdd_210, vdd_220, vdd_230, vdd_240, vdd_250,
60 vdd_260, vdd_270, vdd_280, vdd_290, vdd_300, vdd_310, vdd_320,
61 vdd_330, vdd_340, vdd_350, vdd_360
65 power_off = 0, power_up, power_on
69 opendrain = 1, pushpull
72 enum mmc_chip_select {
73 cs_dontcare = 0, cs_high, cs_low
77 bus_width_1 = 0, bus_width_4 = 2, bus_width_8 = 3
81 uint32_t clock; /* Speed of the clock in Hz to move data */
82 enum mmc_vdd vdd; /* Voltage to apply to the power pins/ */
83 enum mmc_bus_mode bus_mode;
84 enum mmc_chip_select chip_select;
85 enum mmc_bus_width bus_width;
86 enum mmc_power_mode power_mode;
99 #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */
100 #define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */
101 enum mmc_card_mode mode;
102 struct mmc_ios ios; /* Current state of the host */
105 #endif /* DEV_MMC_BRIDGE_H */