1a94a63f0SWarner Losh /*- 24d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3f24882ecSPedro F. Giffuni * 4a94a63f0SWarner Losh * Copyright (c) 2014-2016 Ilya Bakulin. All rights reserved. 5a94a63f0SWarner Losh * 6a94a63f0SWarner Losh * Redistribution and use in source and binary forms, with or without 7a94a63f0SWarner Losh * modification, are permitted provided that the following conditions 8a94a63f0SWarner Losh * are met: 9a94a63f0SWarner Losh * 1. Redistributions of source code must retain the above copyright 10a94a63f0SWarner Losh * notice, this list of conditions and the following disclaimer. 11a94a63f0SWarner Losh * 2. Redistributions in binary form must reproduce the above copyright 12a94a63f0SWarner Losh * notice, this list of conditions and the following disclaimer in the 13a94a63f0SWarner Losh * documentation and/or other materials provided with the distribution. 14a94a63f0SWarner Losh * 15a94a63f0SWarner Losh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16a94a63f0SWarner Losh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17a94a63f0SWarner Losh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18a94a63f0SWarner Losh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19a94a63f0SWarner Losh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20a94a63f0SWarner Losh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21a94a63f0SWarner Losh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22a94a63f0SWarner Losh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23a94a63f0SWarner Losh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24a94a63f0SWarner Losh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25a94a63f0SWarner Losh * 26a94a63f0SWarner Losh * Portions of this software may have been developed with reference to 27a94a63f0SWarner Losh * the SD Simplified Specification. The following disclaimer may apply: 28a94a63f0SWarner Losh * 29a94a63f0SWarner Losh * The following conditions apply to the release of the simplified 30a94a63f0SWarner Losh * specification ("Simplified Specification") by the SD Card Association and 31a94a63f0SWarner Losh * the SD Group. The Simplified Specification is a subset of the complete SD 32a94a63f0SWarner Losh * Specification which is owned by the SD Card Association and the SD 33a94a63f0SWarner Losh * Group. This Simplified Specification is provided on a non-confidential 34a94a63f0SWarner Losh * basis subject to the disclaimers below. Any implementation of the 35a94a63f0SWarner Losh * Simplified Specification may require a license from the SD Card 36a94a63f0SWarner Losh * Association, SD Group, SD-3C LLC or other third parties. 37a94a63f0SWarner Losh * 38a94a63f0SWarner Losh * Disclaimers: 39a94a63f0SWarner Losh * 40a94a63f0SWarner Losh * The information contained in the Simplified Specification is presented only 41a94a63f0SWarner Losh * as a standard specification for SD Cards and SD Host/Ancillary products and 42a94a63f0SWarner Losh * is provided "AS-IS" without any representations or warranties of any 43a94a63f0SWarner Losh * kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD 44a94a63f0SWarner Losh * Card Association for any damages, any infringements of patents or other 45a94a63f0SWarner Losh * right of the SD Group, SD-3C LLC, the SD Card Association or any third 46a94a63f0SWarner Losh * parties, which may result from its use. No license is granted by 47a94a63f0SWarner Losh * implication, estoppel or otherwise under any patent or other rights of the 48a94a63f0SWarner Losh * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing 49a94a63f0SWarner Losh * herein shall be construed as an obligation by the SD Group, the SD-3C LLC 50a94a63f0SWarner Losh * or the SD Card Association to disclose or distribute any technical 51a94a63f0SWarner Losh * information, know-how or other confidential information to any third party. 52a94a63f0SWarner Losh * 53a94a63f0SWarner Losh * Inspired coded in sys/dev/mmc. Thanks to Warner Losh <imp@FreeBSD.org>, 54a94a63f0SWarner Losh * Bernd Walter <tisco@FreeBSD.org>, and other authors. 55a94a63f0SWarner Losh */ 56a94a63f0SWarner Losh 57a94a63f0SWarner Losh #ifndef CAM_MMC_H 58a94a63f0SWarner Losh #define CAM_MMC_H 59a94a63f0SWarner Losh 60a94a63f0SWarner Losh #include <dev/mmc/mmcreg.h> 61a94a63f0SWarner Losh /* 62a94a63f0SWarner Losh * This structure describes an MMC/SD card 63a94a63f0SWarner Losh */ 64a94a63f0SWarner Losh struct mmc_params { 65*73551d4fSWarner Losh uint8_t model[40]; /* Card model */ 66a94a63f0SWarner Losh 67a94a63f0SWarner Losh /* Card OCR */ 68a94a63f0SWarner Losh uint32_t card_ocr; 69a94a63f0SWarner Losh 70a94a63f0SWarner Losh /* OCR of the IO portion of the card */ 71a94a63f0SWarner Losh uint32_t io_ocr; 72a94a63f0SWarner Losh 73a94a63f0SWarner Losh /* Card CID -- raw and parsed */ 74a94a63f0SWarner Losh uint32_t card_cid[4]; 75a94a63f0SWarner Losh struct mmc_cid cid; 76a94a63f0SWarner Losh 77a94a63f0SWarner Losh /* Card CSD -- raw */ 78a94a63f0SWarner Losh uint32_t card_csd[4]; 79a94a63f0SWarner Losh 80a94a63f0SWarner Losh /* Card RCA */ 81a94a63f0SWarner Losh uint16_t card_rca; 82a94a63f0SWarner Losh 83a94a63f0SWarner Losh /* What kind of card is it */ 84a94a63f0SWarner Losh uint32_t card_features; 85a94a63f0SWarner Losh #define CARD_FEATURE_MEMORY 0x1 86a94a63f0SWarner Losh #define CARD_FEATURE_SDHC 0x1 << 1 87a94a63f0SWarner Losh #define CARD_FEATURE_SDIO 0x1 << 2 88a94a63f0SWarner Losh #define CARD_FEATURE_SD20 0x1 << 3 89a94a63f0SWarner Losh #define CARD_FEATURE_MMC 0x1 << 4 9002c474b4SIlya Bakulin #define CARD_FEATURE_18V 0x1 << 5 91a94a63f0SWarner Losh 92a94a63f0SWarner Losh uint8_t sdio_func_count; 93a94a63f0SWarner Losh } __packed; 94a94a63f0SWarner Losh 95e8e5c764SIlya Bakulin /* 96e8e5c764SIlya Bakulin * Only one MMC card on bus is supported now. 97e8e5c764SIlya Bakulin * If we ever want to support multiple MMC cards on the same bus, 98e8e5c764SIlya Bakulin * mmc_xpt needs to be extended to issue new RCAs based on number 99e8e5c764SIlya Bakulin * of already probed cards. Furthermore, retuning and high-speed 100e8e5c764SIlya Bakulin * settings should also take all cards into account. 101e8e5c764SIlya Bakulin */ 102e8e5c764SIlya Bakulin #define MMC_PROPOSED_RCA 2 103a94a63f0SWarner Losh #endif 104