xref: /freebsd/sys/dev/mmc/mmcbus_if.m (revision aca38eab8a124f1acd26a6cf1eb4b91c4fb7d4f6)
1114b4164SWarner Losh#-
2114b4164SWarner Losh# Copyright (c) 2006 M. Warner Losh
3114b4164SWarner Losh# All rights reserved.
4114b4164SWarner Losh#
5114b4164SWarner Losh# Redistribution and use in source and binary forms, with or without
6114b4164SWarner Losh# modification, are permitted provided that the following conditions
7114b4164SWarner Losh# are met:
8114b4164SWarner Losh# 1. Redistributions of source code must retain the above copyright
9114b4164SWarner Losh#    notice, this list of conditions and the following disclaimer.
10114b4164SWarner Losh# 2. Redistributions in binary form must reproduce the above copyright
11114b4164SWarner Losh#    notice, this list of conditions and the following disclaimer in the
12114b4164SWarner Losh#    documentation and/or other materials provided with the distribution.
13114b4164SWarner Losh#
14114b4164SWarner Losh# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15114b4164SWarner Losh# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16114b4164SWarner Losh# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17114b4164SWarner Losh# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18114b4164SWarner Losh# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19114b4164SWarner Losh# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20114b4164SWarner Losh# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21114b4164SWarner Losh# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22114b4164SWarner Losh# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23114b4164SWarner Losh# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24114b4164SWarner Losh# SUCH DAMAGE.
25114b4164SWarner Losh#
2614eced72SWarner Losh# Portions of this software may have been developed with reference to
2714eced72SWarner Losh# the SD Simplified Specification.  The following disclaimer may apply:
2814eced72SWarner Losh#
2914eced72SWarner Losh# The following conditions apply to the release of the simplified
3014eced72SWarner Losh# specification ("Simplified Specification") by the SD Card Association and
3114eced72SWarner Losh# the SD Group. The Simplified Specification is a subset of the complete SD
3214eced72SWarner Losh# Specification which is owned by the SD Card Association and the SD
3314eced72SWarner Losh# Group. This Simplified Specification is provided on a non-confidential
3414eced72SWarner Losh# basis subject to the disclaimers below. Any implementation of the
3514eced72SWarner Losh# Simplified Specification may require a license from the SD Card
3614eced72SWarner Losh# Association, SD Group, SD-3C LLC or other third parties.
3714eced72SWarner Losh#
3814eced72SWarner Losh# Disclaimers:
3914eced72SWarner Losh#
4014eced72SWarner Losh# The information contained in the Simplified Specification is presented only
4114eced72SWarner Losh# as a standard specification for SD Cards and SD Host/Ancillary products and
4214eced72SWarner Losh# is provided "AS-IS" without any representations or warranties of any
4314eced72SWarner Losh# kind. No responsibility is assumed by the SD Group, SD-3C LLC or the SD
4414eced72SWarner Losh# Card Association for any damages, any infringements of patents or other
4514eced72SWarner Losh# right of the SD Group, SD-3C LLC, the SD Card Association or any third
4614eced72SWarner Losh# parties, which may result from its use. No license is granted by
4714eced72SWarner Losh# implication, estoppel or otherwise under any patent or other rights of the
4814eced72SWarner Losh# SD Group, SD-3C LLC, the SD Card Association or any third party. Nothing
4914eced72SWarner Losh# herein shall be construed as an obligation by the SD Group, the SD-3C LLC
5014eced72SWarner Losh# or the SD Card Association to disclose or distribute any technical
5114eced72SWarner Losh# information, know-how or other confidential information to any third party.
5214eced72SWarner Losh#
53114b4164SWarner Losh# $FreeBSD$
54114b4164SWarner Losh#
55114b4164SWarner Losh
56*aca38eabSMarius Strobl#include <sys/types.h>
57114b4164SWarner Losh#include <dev/mmc/mmcreg.h>
58114b4164SWarner Losh
59114b4164SWarner Losh#
60*aca38eabSMarius Strobl# This is the set of callbacks that the MMC subroutines and the mmc/sd card
61*aca38eabSMarius Strobl# driver call into the bus to make requests.
62114b4164SWarner Losh#
63114b4164SWarner Losh
64114b4164SWarner LoshINTERFACE mmcbus;
65114b4164SWarner Losh
66114b4164SWarner Losh#
67*aca38eabSMarius Strobl# Pause re-tuning, optionally with triggering re-tuning up-front.  Requires
68*aca38eabSMarius Strobl# the bus to be claimed.
69*aca38eabSMarius Strobl#
70*aca38eabSMarius StroblMETHOD void retune_pause {
71*aca38eabSMarius Strobl	device_t	brdev;
72*aca38eabSMarius Strobl	device_t	reqdev;
73*aca38eabSMarius Strobl	bool		retune;
74*aca38eabSMarius Strobl};
75*aca38eabSMarius Strobl
76*aca38eabSMarius Strobl#
77*aca38eabSMarius Strobl# Unpause re-tuning.  Requires the bus to be claimed.
78*aca38eabSMarius Strobl#
79*aca38eabSMarius StroblMETHOD void retune_unpause {
80*aca38eabSMarius Strobl	device_t	brdev;
81*aca38eabSMarius Strobl	device_t	reqdev;
82*aca38eabSMarius Strobl};
83*aca38eabSMarius Strobl
84*aca38eabSMarius Strobl#
85*aca38eabSMarius Strobl# Queue and wait for a request.  Requires the bus to be claimed.
86114b4164SWarner Losh#
87114b4164SWarner LoshMETHOD int wait_for_request {
88114b4164SWarner Losh	device_t	brdev;
89114b4164SWarner Losh	device_t	reqdev;
90114b4164SWarner Losh	struct mmc_request *req;
91114b4164SWarner Losh};
92114b4164SWarner Losh
93114b4164SWarner Losh#
94*aca38eabSMarius Strobl# Claim the current bus, blocking the current thread until the host is no
95*aca38eabSMarius Strobl# longer busy.
96114b4164SWarner Losh#
97114b4164SWarner LoshMETHOD int acquire_bus {
98114b4164SWarner Losh	device_t	brdev;
99114b4164SWarner Losh	device_t	reqdev;
100*aca38eabSMarius Strobl};
101114b4164SWarner Losh
102114b4164SWarner Losh#
103*aca38eabSMarius Strobl# Release the current bus.
104114b4164SWarner Losh#
105114b4164SWarner LoshMETHOD int release_bus {
106114b4164SWarner Losh	device_t	brdev;
107114b4164SWarner Losh	device_t	reqdev;
108*aca38eabSMarius Strobl};
109