1163516Simp/*- 2163516Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3163516Simp * 4163516Simp * Redistribution and use in source and binary forms, with or without 5163516Simp * modification, are permitted provided that the following conditions 6163516Simp * are met: 7163516Simp * 1. Redistributions of source code must retain the above copyright 8163516Simp * notice, this list of conditions and the following disclaimer. 9163516Simp * 2. Redistributions in binary form must reproduce the above copyright 10163516Simp * notice, this list of conditions and the following disclaimer in the 11163516Simp * documentation and/or other materials provided with the distribution. 12163516Simp * 13163516Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14163516Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15163516Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16163516Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17163516Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18163516Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19163516Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20163516Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21163516Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22163516Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23163516Simp * 24170002Simp * Portions of this software may have been developed with reference to 25170002Simp * the SD Simplified Specification. The following disclaimer may apply: 26170002Simp * 27170002Simp * The following conditions apply to the release of the simplified 28170002Simp * specification ("Simplified Specification") by the SD Card Association and 29170002Simp * the SD Group. The Simplified Specification is a subset of the complete SD 30170002Simp * Specification which is owned by the SD Card Association and the SD 31170002Simp * Group. This Simplified Specification is provided on a non-confidential 32170002Simp * basis subject to the disclaimers below. Any implementation of the 33170002Simp * Simplified Specification may require a license from the SD Card 34170002Simp * Association, SD Group, SD-3C LLC or other third parties. 35170002Simp * 36170002Simp * Disclaimers: 37170002Simp * 38170002Simp * The information contained in the Simplified Specification is presented only 39170002Simp * as a standard specification for SD Cards and SD Host/Ancillary products and 40170002Simp * is provided "AS-IS" without any representations or warranties of any 41170002Simp * kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD 42170002Simp * Card Association for any damages, any infringements of patents or other 43170002Simp * right of the SD Group, SD-3C LLC, the SD Card Association or any third 44170002Simp * parties, which may result from its use. No license is granted by 45170002Simp * implication, estoppel or otherwise under any patent or other rights of the 46170002Simp * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 47170002Simp * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 48170002Simp * or the SD Card Association to disclose or distribute any technical 49170002Simp * information, know-how or other confidential information to any third party. 50170002Simp * 51163516Simp * $FreeBSD$ 52163516Simp */ 53163516Simp 54163516Simp#ifndef DEV_MMC_BRIDGE_H 55163516Simp#define DEV_MMC_BRIDGE_H 56163516Simp 57163516Simp/* 58163516Simp * This file defines interfaces for the mmc bridge. The names chosen 59163516Simp * are similar to or the same as the names used in Linux to allow for 60163516Simp * easy porting of what Linux calls mmc host drivers. I use the 61163516Simp * FreeBSD terminology of bridge and bus for consistancy with other 62163516Simp * drivers in the system. This file corresponds roughly to the Linux 63163516Simp * linux/mmc/host.h file. 64163516Simp * 65163516Simp * A mmc bridge is a chipset that can have one or more mmc and/or sd 66163516Simp * cards attached to it. mmc cards are attached on a bus topology, 67163516Simp * while sd and sdio cards are attached using a star topology (meaning 68163516Simp * in practice each sd card has its own, independent slot). Each 69163516Simp * mmcbr is assumed to be derived from the mmcbr. This is done to 70163516Simp * allow for easier addition of bridges (as each bridge does not need 71163516Simp * to be added to the mmcbus file). 72163516Simp * 73163516Simp * Attached to the mmc bridge is an mmcbus. The mmcbus is described 74163516Simp * in dev/mmc/bus.h. 75163516Simp */ 76163516Simp 77163516Simp 78163516Simp/* 79163516Simp * mmc_ios is a structure that is used to store the state of the mmc/sd 80163516Simp * bus configuration. This include the bus' clock speed, its voltage, 81163516Simp * the bus mode for command output, the SPI chip select, some power 82163516Simp * states and the bus width. 83163516Simp */ 84163516Simpenum mmc_vdd { 85163516Simp vdd_150 = 0, vdd_155, vdd_160, vdd_165, vdd_170, vdd_180, 86163516Simp vdd_190, vdd_200, vdd_210, vdd_220, vdd_230, vdd_240, vdd_250, 87163516Simp vdd_260, vdd_270, vdd_280, vdd_290, vdd_300, vdd_310, vdd_320, 88163516Simp vdd_330, vdd_340, vdd_350, vdd_360 89163516Simp}; 90163516Simp 91163516Simpenum mmc_power_mode { 92163516Simp power_off = 0, power_up, power_on 93163516Simp}; 94163516Simp 95163516Simpenum mmc_bus_mode { 96163516Simp opendrain = 1, pushpull 97163516Simp}; 98163516Simp 99163516Simpenum mmc_chip_select { 100163516Simp cs_dontcare = 0, cs_high, cs_low 101163516Simp}; 102163516Simp 103163516Simpenum mmc_bus_width { 104163516Simp bus_width_1 = 0, bus_width_4 = 2, bus_width_8 = 3 105163516Simp}; 106163516Simp 107183704Smavenum mmc_bus_timing { 108183704Smav bus_timing_normal = 0, bus_timing_hs 109183704Smav}; 110183704Smav 111163516Simpstruct mmc_ios { 112163516Simp uint32_t clock; /* Speed of the clock in Hz to move data */ 113163516Simp enum mmc_vdd vdd; /* Voltage to apply to the power pins/ */ 114163516Simp enum mmc_bus_mode bus_mode; 115163516Simp enum mmc_chip_select chip_select; 116163516Simp enum mmc_bus_width bus_width; 117163516Simp enum mmc_power_mode power_mode; 118183704Smav enum mmc_bus_timing timing; 119163516Simp}; 120163516Simp 121163516Simpenum mmc_card_mode { 122163516Simp mode_mmc, mode_sd 123163516Simp}; 124163516Simp 125163516Simpstruct mmc_host { 126163516Simp int f_min; 127163516Simp int f_max; 128163516Simp uint32_t host_ocr; 129163516Simp uint32_t ocr; 130163516Simp uint32_t caps; 131163516Simp#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */ 132163516Simp#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */ 133183704Smav#define MMC_CAP_HSPEED (1 << 2) /* Can do High Speed transfers */ 134163516Simp enum mmc_card_mode mode; 135163516Simp struct mmc_ios ios; /* Current state of the host */ 136163516Simp}; 137163516Simp 138163516Simp#endif /* DEV_MMC_BRIDGE_H */ 139