mmcbr_if.m revision 163516
1163516Simp#-
2163516Simp# Copyright (c) 2006 M. Warner Losh
3163516Simp# All rights reserved.
4163516Simp#
5163516Simp# Redistribution and use in source and binary forms, with or without
6163516Simp# modification, are permitted provided that the following conditions
7163516Simp# are met:
8163516Simp# 1. Redistributions of source code must retain the above copyright
9163516Simp#    notice, this list of conditions and the following disclaimer.
10163516Simp# 2. Redistributions in binary form must reproduce the above copyright
11163516Simp#    notice, this list of conditions and the following disclaimer in the
12163516Simp#    documentation and/or other materials provided with the distribution.
13163516Simp#
14163516Simp# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15163516Simp# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16163516Simp# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17163516Simp# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18163516Simp# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19163516Simp# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20163516Simp# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21163516Simp# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22163516Simp# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23163516Simp# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24163516Simp# SUCH DAMAGE.
25163516Simp#
26163516Simp# $FreeBSD: head/sys/dev/mmc/mmcbr_if.m 163516 2006-10-20 06:39:59Z imp $
27163516Simp#
28163516Simp
29163516Simp#include <sys/types.h>
30163516Simp#include <dev/mmc/bridge.h>
31163516Simp#include <dev/mmc/mmcreg.h>
32163516Simp
33163516Simp#
34163516Simp# This is the interface that a mmc bridge chip gives to the mmc bus
35163516Simp# that attaches to the mmc bridge.
36163516Simp#
37163516Simp
38163516SimpINTERFACE mmcbr;
39163516Simp
40163516Simp#
41163516Simp# Called by the mmcbus to setup the IO pins correctly, the voltage to use
42163516Simp# for the card, the type of selects, power modes and bus width.
43163516Simp#
44163516SimpMETHOD int update_ios {
45163516Simp	device_t	brdev;
46163516Simp	device_t	reqdev;
47163516Simp};
48163516Simp
49163516Simp#
50163516Simp# Called by the mmcbus or its children to schedule a mmc request.  These
51163516Simp# requests are queued.  Time passes.  The bridge then gets notification
52163516Simp# of the status of request, who then notifies the requesting device via
53163516Simp# the xfer_done mmcbus method.
54163516Simp#
55163516SimpMETHOD int request {
56163516Simp	device_t	brdev;
57163516Simp	device_t	reqdev;
58163516Simp	struct mmc_request *req;
59163516Simp};
60163516Simp
61163516Simp#
62163516Simp# Called by mmcbus to get the read only status bits.
63163516Simp#
64163516SimpMETHOD int get_ro {
65163516Simp	device_t	brdev;
66163516Simp	device_t	reqdev;
67163516Simp};
68163516Simp
69163516Simp#
70163516Simp# Claim the current bridge, blocking the current thread until the host
71163516Simp# is no longer busy.
72163516Simp#
73163516SimpMETHOD int acquire_host {
74163516Simp	device_t	brdev;
75163516Simp	device_t	reqdev;
76163516Simp}
77163516Simp
78163516Simp#
79163516Simp# Release the current bridge.
80163516Simp#
81163516SimpMETHOD int release_host {
82163516Simp	device_t	brdev;
83163516Simp	device_t	reqdev;
84163516Simp}
85