]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/linux/mmc/sdio_func.h
sdio: split up common and function CIS parsing
[linux-2.6-omap-h63xx.git] / include / linux / mmc / sdio_func.h
1 /*
2  *  include/linux/mmc/sdio_func.h
3  *
4  *  Copyright 2007 Pierre Ossman
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or (at
9  * your option) any later version.
10  */
11
12 #ifndef MMC_SDIO_FUNC_H
13 #define MMC_SDIO_FUNC_H
14
15 struct mmc_card;
16
17 /*
18  * SDIO function CIS tuple (unknown to the core)
19  */
20 struct sdio_func_tuple {
21         struct sdio_func_tuple *next;
22         unsigned char code;
23         unsigned char size;
24         unsigned char data[0];
25 };
26
27 /*
28  * SDIO function devices
29  */
30 struct sdio_func {
31         struct mmc_card         *card;          /* the card this device belongs to */
32         struct device           dev;            /* the device */
33         unsigned int            num;            /* function number */
34
35         unsigned char           class;          /* standard interface class */
36         unsigned short          vendor;         /* vendor id */
37         unsigned short          device;         /* device id */
38
39         unsigned short          blksize;        /* maximum block size */
40
41         unsigned int            state;          /* function state */
42 #define SDIO_STATE_PRESENT      (1<<0)          /* present in sysfs */
43
44         struct sdio_func_tuple *tuples;
45 };
46
47 #define sdio_func_present(f)    ((f)->state & SDIO_STATE_PRESENT)
48
49 #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
50
51 #define sdio_func_id(f)         ((f)->dev.bus_id)
52
53 #define sdio_get_drvdata(f)     dev_get_drvdata(&(f)->dev)
54 #define sdio_set_drvdata(f,d)   dev_set_drvdata(&(f)->dev, d)
55
56 /*
57  * SDIO function device driver
58  */
59 struct sdio_driver {
60         char *name;
61
62         int (*probe)(struct sdio_func *);
63         void (*remove)(struct sdio_func *);
64
65         struct device_driver drv;
66 };
67
68 extern int sdio_register_driver(struct sdio_driver *);
69 extern void sdio_unregister_driver(struct sdio_driver *);
70
71 /*
72  * SDIO I/O operations
73  */
74 extern void sdio_claim_host(struct sdio_func *func);
75 extern void sdio_release_host(struct sdio_func *func);
76
77 extern int sdio_enable_func(struct sdio_func *func);
78 extern int sdio_disable_func(struct sdio_func *func);
79
80 extern unsigned char sdio_readb(struct sdio_func *func,
81         unsigned int addr, int *err_ret);
82
83 extern void sdio_writeb(struct sdio_func *func, unsigned char b,
84         unsigned int addr, int *err_ret);
85
86 #endif
87