update to 2.6.9-rc1
[linux-flexiantxendom0-3.2.10.git] / include / linux / mmc / card.h
1 /*
2  *  linux/include/linux/mmc/card.h
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  *  Card driver specific definitions.
9  */
10 #ifndef LINUX_MMC_CARD_H
11 #define LINUX_MMC_CARD_H
12
13 #include <linux/mmc/mmc.h>
14
15 struct mmc_cid {
16         unsigned int            manfid;
17         unsigned int            serial;
18         char                    prod_name[8];
19         unsigned char           hwrev;
20         unsigned char           fwrev;
21         unsigned char           month;
22         unsigned char           year;
23 };
24
25 struct mmc_csd {
26         unsigned char           mmc_prot;
27         unsigned short          cmdclass;
28         unsigned short          tacc_clks;
29         unsigned int            tacc_ns;
30         unsigned int            max_dtr;
31         unsigned int            read_blkbits;
32         unsigned int            capacity;
33 };
34
35 struct mmc_host;
36
37 /*
38  * MMC device
39  */
40 struct mmc_card {
41         struct list_head        node;           /* node in hosts devices list */
42         struct mmc_host         *host;          /* the host this device belongs to */
43         struct device           dev;            /* the device */
44         unsigned int            rca;            /* relative card address of device */
45         unsigned int            state;          /* (our) card state */
46 #define MMC_STATE_PRESENT       (1<<0)
47 #define MMC_STATE_DEAD          (1<<1)
48         struct mmc_cid          cid;            /* card identification */
49         struct mmc_csd          csd;            /* card specific */
50 };
51
52 #define mmc_card_dead(c)        ((c)->state & MMC_STATE_DEAD)
53 #define mmc_card_present(c)     ((c)->state & MMC_STATE_PRESENT)
54
55 #define mmc_card_name(c)        ((c)->cid.prod_name)
56 #define mmc_card_id(c)          ((c)->dev.bus_id)
57
58 #define mmc_list_to_card(l)     container_of(l, struct mmc_card, node)
59 #define mmc_get_drvdata(c)      dev_get_drvdata(&(c)->dev)
60 #define mmc_set_drvdata(c,d)    dev_set_drvdata(&(c)->dev, d)
61
62 /*
63  * MMC device driver (e.g., Flash card, I/O card...)
64  */
65 struct mmc_driver {
66         struct device_driver drv;
67         int (*probe)(struct mmc_card *);
68         void (*remove)(struct mmc_card *);
69         int (*suspend)(struct mmc_card *, u32);
70         int (*resume)(struct mmc_card *);
71 };
72
73 extern int mmc_register_driver(struct mmc_driver *);
74 extern void mmc_unregister_driver(struct mmc_driver *);
75
76 static inline int mmc_card_claim_host(struct mmc_card *card)
77 {
78         return __mmc_claim_host(card->host, card);
79 }
80
81 #define mmc_card_release_host(c)        mmc_release_host((c)->host)
82
83 #endif