xref: /freebsd/sys/dev/mmc/mmcvar.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1114b4164SWarner Losh /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3718cf2ccSPedro F. Giffuni  *
4114b4164SWarner Losh  * Copyright (c) 2006 Bernd Walter.  All rights reserved.
5f86e6000SWarner Losh  * Copyright (c) 2006 M. Warner Losh <imp@FreeBSD.org>
6114b4164SWarner Losh  *
7114b4164SWarner Losh  * Redistribution and use in source and binary forms, with or without
8114b4164SWarner Losh  * modification, are permitted provided that the following conditions
9114b4164SWarner Losh  * are met:
10114b4164SWarner Losh  * 1. Redistributions of source code must retain the above copyright
11114b4164SWarner Losh  *    notice, this list of conditions and the following disclaimer.
12114b4164SWarner Losh  * 2. Redistributions in binary form must reproduce the above copyright
13114b4164SWarner Losh  *    notice, this list of conditions and the following disclaimer in the
14114b4164SWarner Losh  *    documentation and/or other materials provided with the distribution.
15114b4164SWarner Losh  *
16114b4164SWarner Losh  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17114b4164SWarner Losh  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18114b4164SWarner Losh  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19114b4164SWarner Losh  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20114b4164SWarner Losh  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21114b4164SWarner Losh  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22114b4164SWarner Losh  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23114b4164SWarner Losh  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24114b4164SWarner Losh  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25114b4164SWarner Losh  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26114b4164SWarner Losh  *
2714eced72SWarner Losh  * Portions of this software may have been developed with reference to
2814eced72SWarner Losh  * the SD Simplified Specification.  The following disclaimer may apply:
2914eced72SWarner Losh  *
3014eced72SWarner Losh  * The following conditions apply to the release of the simplified
3114eced72SWarner Losh  * specification ("Simplified Specification") by the SD Card Association and
3214eced72SWarner Losh  * the SD Group. The Simplified Specification is a subset of the complete SD
3314eced72SWarner Losh  * Specification which is owned by the SD Card Association and the SD
3414eced72SWarner Losh  * Group. This Simplified Specification is provided on a non-confidential
3514eced72SWarner Losh  * basis subject to the disclaimers below. Any implementation of the
3614eced72SWarner Losh  * Simplified Specification may require a license from the SD Card
3714eced72SWarner Losh  * Association, SD Group, SD-3C LLC or other third parties.
3814eced72SWarner Losh  *
3914eced72SWarner Losh  * Disclaimers:
4014eced72SWarner Losh  *
4114eced72SWarner Losh  * The information contained in the Simplified Specification is presented only
4214eced72SWarner Losh  * as a standard specification for SD Cards and SD Host/Ancillary products and
4314eced72SWarner Losh  * is provided "AS-IS" without any representations or warranties of any
4414eced72SWarner Losh  * kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD
4514eced72SWarner Losh  * Card Association for any damages, any infringements of patents or other
4614eced72SWarner Losh  * right of the SD Group, SD-3C LLC, the SD Card Association or any third
4714eced72SWarner Losh  * parties, which may result from its use. No license is granted by
4814eced72SWarner Losh  * implication, estoppel or otherwise under any patent or other rights of the
4914eced72SWarner Losh  * SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing
5014eced72SWarner Losh  * herein shall be construed as an obligation by the SD Group, the SD-3C LLC
5114eced72SWarner Losh  * or the SD Card Association to disclose or distribute any technical
5214eced72SWarner Losh  * information, know-how or other confidential information to any third party.
53114b4164SWarner Losh  */
54114b4164SWarner Losh 
55114b4164SWarner Losh #ifndef DEV_MMC_MMCVAR_H
56114b4164SWarner Losh #define DEV_MMC_MMCVAR_H
57114b4164SWarner Losh 
58114b4164SWarner Losh enum mmc_device_ivars {
5972dec079SMarius Strobl     MMC_IVAR_SPEC_VERS,
60114b4164SWarner Losh     MMC_IVAR_DSR_IMP,
61114b4164SWarner Losh     MMC_IVAR_MEDIA_SIZE,
62114b4164SWarner Losh     MMC_IVAR_RCA,
63114b4164SWarner Losh     MMC_IVAR_SECTOR_SIZE,
64114b4164SWarner Losh     MMC_IVAR_TRAN_SPEED,
6540fab6e7SWarner Losh     MMC_IVAR_READ_ONLY,
66c18f1e26SAlexander Motin     MMC_IVAR_HIGH_CAP,
6767d752c3SAlexander Motin     MMC_IVAR_CARD_TYPE,
6867d752c3SAlexander Motin     MMC_IVAR_BUS_WIDTH,
693906d42dSAlexander Motin     MMC_IVAR_ERASE_SECTOR,
703a4a2557SAlexander Motin     MMC_IVAR_MAX_DATA,
7179f39c6aSMarius Strobl     MMC_IVAR_CMD6_TIMEOUT,
7279f39c6aSMarius Strobl     MMC_IVAR_QUIRKS,
73f3a4b7f7SIan Lepore     MMC_IVAR_CARD_ID_STRING,
74f3a4b7f7SIan Lepore     MMC_IVAR_CARD_SN_STRING,
75114b4164SWarner Losh };
76114b4164SWarner Losh 
77114b4164SWarner Losh /*
78f3a4b7f7SIan Lepore  * Simplified accessors for mmc devices
79114b4164SWarner Losh  */
80114b4164SWarner Losh #define MMC_ACCESSOR(var, ivar, type)					\
81114b4164SWarner Losh 	__BUS_ACCESSOR(mmc, var, MMC, ivar, type)
82114b4164SWarner Losh 
8372dec079SMarius Strobl MMC_ACCESSOR(spec_vers, SPEC_VERS, uint8_t)
84114b4164SWarner Losh MMC_ACCESSOR(dsr_imp, DSR_IMP, int)
85bcd91d25SJayachandran C. MMC_ACCESSOR(media_size, MEDIA_SIZE, long)
86114b4164SWarner Losh MMC_ACCESSOR(rca, RCA, int)
87114b4164SWarner Losh MMC_ACCESSOR(sector_size, SECTOR_SIZE, int)
88114b4164SWarner Losh MMC_ACCESSOR(tran_speed, TRAN_SPEED, int)
8940fab6e7SWarner Losh MMC_ACCESSOR(read_only, READ_ONLY, int)
90c18f1e26SAlexander Motin MMC_ACCESSOR(high_cap, HIGH_CAP, int)
9167d752c3SAlexander Motin MMC_ACCESSOR(card_type, CARD_TYPE, int)
9267d752c3SAlexander Motin MMC_ACCESSOR(bus_width, BUS_WIDTH, int)
933906d42dSAlexander Motin MMC_ACCESSOR(erase_sector, ERASE_SECTOR, int)
943a4a2557SAlexander Motin MMC_ACCESSOR(max_data, MAX_DATA, int)
9579f39c6aSMarius Strobl MMC_ACCESSOR(cmd6_timeout, CMD6_TIMEOUT, u_int)
9679f39c6aSMarius Strobl MMC_ACCESSOR(quirks, QUIRKS, u_int)
977aa65846SMarius Strobl MMC_ACCESSOR(card_id_string, CARD_ID_STRING, const char *)
98f3a4b7f7SIan Lepore MMC_ACCESSOR(card_sn_string, CARD_SN_STRING, const char *)
99114b4164SWarner Losh 
100114b4164SWarner Losh #endif /* DEV_MMC_MMCVAR_H */
101