2 * linux/include/linux/mmc/card.h
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.
8 * Card driver specific definitions.
10 #ifndef LINUX_MMC_CARD_H
11 #define LINUX_MMC_CARD_H
13 #include <linux/mmc/mmc.h>
27 unsigned char mmca_vsn;
28 unsigned short cmdclass;
29 unsigned short tacc_clks;
32 unsigned int read_blkbits;
33 unsigned int capacity;
42 struct list_head node; /* node in hosts devices list */
43 struct mmc_host *host; /* the host this device belongs to */
44 struct device dev; /* the device */
45 unsigned int rca; /* relative card address of device */
46 unsigned int state; /* (our) card state */
47 #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
48 #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */
49 #define MMC_STATE_BAD (1<<2) /* unrecognised device */
50 #define MMC_STATE_SDCARD (1<<3) /* is an SD card */
51 #define MMC_STATE_READONLY (1<<4) /* card is read-only */
52 u32 raw_cid[4]; /* raw card CID */
53 u32 raw_csd[4]; /* raw card CSD */
54 struct mmc_cid cid; /* card identification */
55 struct mmc_csd csd; /* card specific */
58 #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
59 #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD)
60 #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
61 #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
62 #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
64 #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
65 #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
66 #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
67 #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
68 #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
70 #define mmc_card_name(c) ((c)->cid.prod_name)
71 #define mmc_card_id(c) ((c)->dev.bus_id)
73 #define mmc_list_to_card(l) container_of(l, struct mmc_card, node)
74 #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev)
75 #define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d)
78 * MMC device driver (e.g., Flash card, I/O card...)
81 struct device_driver drv;
82 int (*probe)(struct mmc_card *);
83 void (*remove)(struct mmc_card *);
84 int (*suspend)(struct mmc_card *, pm_message_t);
85 int (*resume)(struct mmc_card *);
88 extern int mmc_register_driver(struct mmc_driver *);
89 extern void mmc_unregister_driver(struct mmc_driver *);
91 static inline int mmc_card_claim_host(struct mmc_card *card)
93 return __mmc_claim_host(card->host, card);
96 #define mmc_card_release_host(c) mmc_release_host((c)->host)