blob: c819effa1032c5ccebf896dff58d78f6e7ca13d5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Pierre Ossmanaaac1b42007-02-28 15:33:10 +01002 * linux/drivers/mmc/core/core.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
Pierre Ossmanda7fbe52006-12-24 22:46:55 +01005 * Copyright 2007 Pierre Ossman
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
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.
10 */
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010011#ifndef _MMC_CORE_CORE_H
12#define _MMC_CORE_CORE_H
Russell King00b137c2005-08-19 09:41:24 +010013
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010014#include <linux/delay.h>
Pierre Ossman7104e2d2006-10-04 02:15:41 -070015
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010016#define MMC_CMD_RETRIES 3
17
Pierre Ossman7ea239d2006-12-31 00:11:32 +010018struct mmc_bus_ops {
19 void (*remove)(struct mmc_host *);
20 void (*detect)(struct mmc_host *);
Pierre Ossman6abaa0c2007-05-01 16:00:02 +020021 void (*suspend)(struct mmc_host *);
22 void (*resume)(struct mmc_host *);
Pierre Ossman7ea239d2006-12-31 00:11:32 +010023};
24
25void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
26void mmc_detach_bus(struct mmc_host *host);
27
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010028void mmc_set_chip_select(struct mmc_host *host, int mode);
Pierre Ossman7ea239d2006-12-31 00:11:32 +010029void mmc_set_clock(struct mmc_host *host, unsigned int hz);
30void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
31void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
32u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
33void mmc_set_timing(struct mmc_host *host, unsigned int timing);
34
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010035static inline void mmc_delay(unsigned int ms)
36{
37 if (ms < 1000 / HZ) {
38 cond_resched();
39 mdelay(ms);
40 } else {
41 msleep(ms);
42 }
43}
44
Pierre Ossmanb93931a2007-05-19 14:06:24 +020045void mmc_rescan(struct work_struct *work);
46void mmc_start_host(struct mmc_host *host);
47void mmc_stop_host(struct mmc_host *host);
48
Adrian Bunk98b843b2008-04-13 21:15:50 +030049int mmc_attach_mmc(struct mmc_host *host, u32 ocr);
50int mmc_attach_sd(struct mmc_host *host, u32 ocr);
51int mmc_attach_sdio(struct mmc_host *host, u32 ocr);
52
David Brownellaf517152007-08-08 09:11:32 -070053extern int use_spi_crc;
54
Haavard Skinnemoen6edd8ee2008-07-24 14:18:57 +020055/* Debugfs information for hosts and cards */
56void mmc_add_host_debugfs(struct mmc_host *host);
57void mmc_remove_host_debugfs(struct mmc_host *host);
58
Haavard Skinnemoenf4b7f922008-07-24 14:18:58 +020059void mmc_add_card_debugfs(struct mmc_card *card);
60void mmc_remove_card_debugfs(struct mmc_card *card);
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062#endif
Pierre Ossmanda7fbe52006-12-24 22:46:55 +010063