xref: /freebsd/sys/dev/mmc/mmcbrvar.h (revision f856af0466c076beef4ea9b15d088e1119a945b8)
1 /*-
2  * Copyright (c) 2006 Bernd Walter.  All rights reserved.
3  * Copyright (c) 2006 M. Warner Losh.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * "$FreeBSD$"
26  */
27 
28 #ifndef DEV_MMC_MMCBRVAR_H
29 #define DEV_MMC_MMCBRVAR_H
30 
31 #include <dev/mmc/bridge.h>
32 #include "mmcbr_if.h"
33 
34 enum mmcbr_device_ivars {
35     MMCBR_IVAR_BUS_MODE,
36     MMCBR_IVAR_BUS_WIDTH,
37     MMCBR_IVAR_CHIP_SELECT,
38     MMCBR_IVAR_CLOCK,
39     MMCBR_IVAR_F_MIN,
40     MMCBR_IVAR_F_MAX,
41     MMCBR_IVAR_HOST_OCR,
42     MMCBR_IVAR_MODE,
43     MMCBR_IVAR_OCR,
44     MMCBR_IVAR_POWER_MODE,
45     MMCBR_IVAR_VDD,
46 //    MMCBR_IVAR_,
47 };
48 
49 /*
50  * Simplified accessors for pci devices
51  */
52 #define MMCBR_ACCESSOR(var, ivar, type)					\
53 	__BUS_ACCESSOR(mmcbr, var, MMCBR, ivar, type)
54 
55 MMCBR_ACCESSOR(bus_mode, BUS_MODE, int)
56 MMCBR_ACCESSOR(bus_width, BUS_WIDTH, int)
57 MMCBR_ACCESSOR(chip_select, CHIP_SELECT, int)
58 MMCBR_ACCESSOR(clock, CLOCK, int)
59 MMCBR_ACCESSOR(f_max, F_MAX, int)
60 MMCBR_ACCESSOR(f_min, F_MIN, int)
61 MMCBR_ACCESSOR(host_ocr, HOST_OCR, int)
62 MMCBR_ACCESSOR(mode, MODE, int)
63 MMCBR_ACCESSOR(ocr, OCR, int)
64 MMCBR_ACCESSOR(power_mode, POWER_MODE, int)
65 MMCBR_ACCESSOR(vdd, VDD, int)
66 
67 static int __inline
68 mmcbr_update_ios(device_t dev)
69 {
70 	return (MMCBR_UPDATE_IOS(device_get_parent(dev), dev));
71 }
72 
73 #endif /* DEV_MMC_MMCBRVAR_H */
74