MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / mmc.old / card.h
blob497483d7f87ecdf49b33cfb8636c006eead2b653
1 /*
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.
9 */
10 #ifndef LINUX_MMC_CARD_H
11 #define LINUX_MMC_CARD_H
13 #include <linux/mmc/mmc.h>
15 #if 1 // add by Victor Yu. 11-28-2005
16 #ifndef _PM_MESSAGE_T
17 #define _PM_MESSAGE_T
18 typedef unsigned int pm_message_t;
19 #endif // _PM_MESSAGE_T
20 #endif
22 struct mmc_cid {
23 unsigned int manfid;
24 char prod_name[8];
25 unsigned int serial;
26 unsigned short oemid;
27 unsigned short year;
28 unsigned char hwrev;
29 unsigned char fwrev;
30 unsigned char month;
33 struct mmc_csd {
34 unsigned char mmca_vsn;
35 unsigned short cmdclass;
36 unsigned short tacc_clks;
37 unsigned int tacc_ns;
38 unsigned int max_dtr;
39 unsigned int read_blkbits;
40 unsigned int capacity;
43 struct sd_scr {
44 unsigned char sda_vsn;
45 unsigned char bus_widths;
46 #define SD_SCR_BUS_WIDTH_1 (1<<0)
47 #define SD_SCR_BUS_WIDTH_4 (1<<2)
50 struct mmc_host;
53 * MMC device
55 struct mmc_card {
56 struct list_head node; /* node in hosts devices list */
57 struct mmc_host *host; /* the host this device belongs to */
58 struct device dev; /* the device */
59 unsigned int rca; /* relative card address of device */
60 unsigned int state; /* (our) card state */
61 #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
62 #define MMC_STATE_DEAD (1<<1) /* device no longer in stack */
63 #define MMC_STATE_BAD (1<<2) /* unrecognised device */
64 #define MMC_STATE_SDCARD (1<<3) /* is an SD card */
65 #define MMC_STATE_READONLY (1<<4) /* card is read-only */
66 u32 raw_cid[4]; /* raw card CID */
67 u32 raw_csd[4]; /* raw card CSD */
68 u32 raw_scr[2]; /* raw card SCR */
69 struct mmc_cid cid; /* card identification */
70 struct mmc_csd csd; /* card specific */
71 struct sd_scr scr; /* extra SD information */
74 #define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
75 #define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD)
76 #define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
77 #define mmc_card_sd(c) ((c)->state & MMC_STATE_SDCARD)
78 #define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
80 #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
81 #define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
82 #define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
83 #define mmc_card_set_sd(c) ((c)->state |= MMC_STATE_SDCARD)
84 #define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
86 #define mmc_card_name(c) ((c)->cid.prod_name)
87 #define mmc_card_id(c) ((c)->dev.bus_id)
89 #define mmc_list_to_card(l) container_of(l, struct mmc_card, node)
90 #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev)
91 #define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d)
94 * MMC device driver (e.g., Flash card, I/O card...)
96 struct mmc_driver {
97 struct device_driver drv;
98 int (*probe)(struct mmc_card *);
99 void (*remove)(struct mmc_card *);
100 int (*suspend)(struct mmc_card *, pm_message_t);
101 int (*resume)(struct mmc_card *);
104 extern int mmc_register_driver(struct mmc_driver *);
105 extern void mmc_unregister_driver(struct mmc_driver *);
107 static inline int mmc_card_claim_host(struct mmc_card *card)
109 return __mmc_claim_host(card->host, card);
112 #define mmc_card_release_host(c) mmc_release_host((c)->host)
114 #endif