On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / drivers / mmc / core / core.h
blob1c687830c9598cdda50edc7783e7b6f2d49b09c6
1 /*
2 * linux/drivers/mmc/core/core.h
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
5 * Copyright 2007 Pierre Ossman
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #ifndef _MMC_CORE_CORE_H
12 #define _MMC_CORE_CORE_H
14 #include <linux/delay.h>
16 #define MMC_CMD_RETRIES 3
18 /* Spec says initialisation must happen at or below 400kHz.
19 * Some MMC cards fail to initialise at 400kHz (even as low as 200kHz) and
20 * Some host controllers (eg. tmio_mmc) cannot garantee to set the clock below
21 * 400kHz (it rounds to the closest clock freq available).
23 * 64 kHz seems like a good speed/reliability compromise.
26 #define MMC_INIT_FREQ 64000
28 struct mmc_bus_ops {
29 int (*awake)(struct mmc_host *);
30 int (*sleep)(struct mmc_host *);
31 void (*remove)(struct mmc_host *);
32 void (*detect)(struct mmc_host *);
33 int (*suspend)(struct mmc_host *);
34 int (*resume)(struct mmc_host *);
35 void (*power_save)(struct mmc_host *);
36 void (*power_restore)(struct mmc_host *);
39 void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
40 void mmc_detach_bus(struct mmc_host *host);
42 void mmc_set_chip_select(struct mmc_host *host, int mode);
43 void mmc_set_clock(struct mmc_host *host, unsigned int hz);
44 void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
45 void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
46 u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
47 void mmc_set_timing(struct mmc_host *host, unsigned int timing);
49 static inline void mmc_delay(unsigned int ms)
51 if (ms < 1000 / HZ) {
52 cond_resched();
53 mdelay(ms);
54 } else {
55 msleep(ms);
59 void mmc_rescan(struct work_struct *work);
60 void mmc_start_host(struct mmc_host *host);
61 void mmc_stop_host(struct mmc_host *host);
63 int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
64 int mmc_attach_sd(struct mmc_host *host, u32 ocr);
65 int mmc_attach_sdio(struct mmc_host *host, u32 ocr);
67 extern int use_spi_crc;
69 /* Debugfs information for hosts and cards */
70 void mmc_add_host_debugfs(struct mmc_host *host);
71 void mmc_remove_host_debugfs(struct mmc_host *host);
73 void mmc_add_card_debugfs(struct mmc_card *card);
74 void mmc_remove_card_debugfs(struct mmc_card *card);
76 #endif