MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / include / linux / mmc.old / host.h
blob8cb04597d75c9a953d48f4826324a438d62e3ce1
1 /*
2 * linux/include/linux/mmc/host.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 * Host driver specific definitions.
9 */
10 #ifndef LINUX_MMC_HOST_H
11 #define LINUX_MMC_HOST_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_ios {
23 unsigned int clock; /* clock rate */
24 unsigned short vdd;
26 #define MMC_VDD_150 0
27 #define MMC_VDD_155 1
28 #define MMC_VDD_160 2
29 #define MMC_VDD_165 3
30 #define MMC_VDD_170 4
31 #define MMC_VDD_180 5
32 #define MMC_VDD_190 6
33 #define MMC_VDD_200 7
34 #define MMC_VDD_210 8
35 #define MMC_VDD_220 9
36 #define MMC_VDD_230 10
37 #define MMC_VDD_240 11
38 #define MMC_VDD_250 12
39 #define MMC_VDD_260 13
40 #define MMC_VDD_270 14
41 #define MMC_VDD_280 15
42 #define MMC_VDD_290 16
43 #define MMC_VDD_300 17
44 #define MMC_VDD_310 18
45 #define MMC_VDD_320 19
46 #define MMC_VDD_330 20
47 #define MMC_VDD_340 21
48 #define MMC_VDD_350 22
49 #define MMC_VDD_360 23
51 unsigned char bus_mode; /* command output mode */
53 #define MMC_BUSMODE_OPENDRAIN 1
54 #define MMC_BUSMODE_PUSHPULL 2
56 unsigned char chip_select; /* SPI chip select */
58 #define MMC_CS_DONTCARE 0
59 #define MMC_CS_HIGH 1
60 #define MMC_CS_LOW 2
62 unsigned char power_mode; /* power supply mode */
64 #define MMC_POWER_OFF 0
65 #define MMC_POWER_UP 1
66 #define MMC_POWER_ON 2
68 unsigned char bus_width; /* data bus width */
70 #define MMC_BUS_WIDTH_1 0
71 #define MMC_BUS_WIDTH_4 2
74 struct mmc_host_ops {
75 void (*request)(struct mmc_host *host, struct mmc_request *req);
76 void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios);
77 int (*get_ro)(struct mmc_host *host);
80 struct mmc_card;
81 struct device;
83 struct mmc_host {
84 struct device *dev;
85 struct class_device class_dev;
86 int index;
87 struct mmc_host_ops *ops;
88 unsigned int f_min;
89 unsigned int f_max;
90 u32 ocr_avail;
92 unsigned long caps; /* Host capabilities */
94 #define MMC_CAP_4_BIT_DATA (1 << 0) /* Can the host do 4 bit transfers */
96 /* host specific block data */
97 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
98 unsigned short max_hw_segs; /* see blk_queue_max_hw_segments */
99 unsigned short max_phys_segs; /* see blk_queue_max_phys_segments */
100 unsigned short max_sectors; /* see blk_queue_max_sectors */
101 unsigned short unused;
103 /* private data */
104 struct mmc_ios ios; /* current io bus settings */
105 u32 ocr; /* the current OCR setting */
107 unsigned int mode; /* current card mode of host */
108 #define MMC_MODE_MMC 0
109 #define MMC_MODE_SD 1
111 struct list_head cards; /* devices attached to this host */
113 wait_queue_head_t wq;
114 spinlock_t lock; /* card_busy lock */
115 struct mmc_card *card_busy; /* the MMC card claiming host */
116 struct mmc_card *card_selected; /* the selected MMC card */
118 struct work_struct detect;
120 unsigned long private[0] ____cacheline_aligned;
123 extern struct mmc_host *mmc_alloc_host(int extra, struct device *);
124 extern int mmc_add_host(struct mmc_host *);
125 extern void mmc_remove_host(struct mmc_host *);
126 extern void mmc_free_host(struct mmc_host *);
128 static inline void *mmc_priv(struct mmc_host *host)
130 return (void *)host->private;
133 #define mmc_dev(x) ((x)->dev)
134 #define mmc_hostname(x) ((x)->class_dev.class_id)
136 extern int mmc_suspend_host(struct mmc_host *, pm_message_t);
137 extern int mmc_resume_host(struct mmc_host *);
139 extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
140 extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
142 #endif