Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Pierre Ossman | aaac1b4 | 2007-02-28 15:33:10 +0100 | [diff] [blame] | 2 | * linux/drivers/mmc/core/core.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2003 Russell King, All Rights Reserved. |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 5 | * Copyright 2007 Pierre Ossman |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
| 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 Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 11 | #ifndef _MMC_CORE_CORE_H |
| 12 | #define _MMC_CORE_CORE_H |
Russell King | 00b137c | 2005-08-19 09:41:24 +0100 | [diff] [blame] | 13 | |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 14 | #include <linux/delay.h> |
Pierre Ossman | 7104e2d | 2006-10-04 02:15:41 -0700 | [diff] [blame] | 15 | |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 16 | #define MMC_CMD_RETRIES 3 |
| 17 | |
Pierre Ossman | 7ea239d | 2006-12-31 00:11:32 +0100 | [diff] [blame] | 18 | struct mmc_bus_ops { |
| 19 | void (*remove)(struct mmc_host *); |
| 20 | void (*detect)(struct mmc_host *); |
Pierre Ossman | 6abaa0c | 2007-05-01 16:00:02 +0200 | [diff] [blame] | 21 | void (*suspend)(struct mmc_host *); |
| 22 | void (*resume)(struct mmc_host *); |
Pierre Ossman | 7ea239d | 2006-12-31 00:11:32 +0100 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); |
| 26 | void mmc_detach_bus(struct mmc_host *host); |
| 27 | |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 28 | void mmc_set_chip_select(struct mmc_host *host, int mode); |
Pierre Ossman | 7ea239d | 2006-12-31 00:11:32 +0100 | [diff] [blame] | 29 | void mmc_set_clock(struct mmc_host *host, unsigned int hz); |
| 30 | void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode); |
| 31 | void mmc_set_bus_width(struct mmc_host *host, unsigned int width); |
| 32 | u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); |
| 33 | void mmc_set_timing(struct mmc_host *host, unsigned int timing); |
| 34 | |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 35 | static 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 Ossman | b93931a | 2007-05-19 14:06:24 +0200 | [diff] [blame] | 45 | void mmc_rescan(struct work_struct *work); |
| 46 | void mmc_start_host(struct mmc_host *host); |
| 47 | void mmc_stop_host(struct mmc_host *host); |
| 48 | |
Adrian Bunk | 98b843b | 2008-04-13 21:15:50 +0300 | [diff] [blame] | 49 | int mmc_attach_mmc(struct mmc_host *host, u32 ocr); |
| 50 | int mmc_attach_sd(struct mmc_host *host, u32 ocr); |
| 51 | int mmc_attach_sdio(struct mmc_host *host, u32 ocr); |
| 52 | |
David Brownell | af51715 | 2007-08-08 09:11:32 -0700 | [diff] [blame] | 53 | extern int use_spi_crc; |
| 54 | |
Haavard Skinnemoen | 6edd8ee | 2008-07-24 14:18:57 +0200 | [diff] [blame] | 55 | /* Debugfs information for hosts and cards */ |
| 56 | void mmc_add_host_debugfs(struct mmc_host *host); |
| 57 | void mmc_remove_host_debugfs(struct mmc_host *host); |
| 58 | |
Haavard Skinnemoen | f4b7f92 | 2008-07-24 14:18:58 +0200 | [diff] [blame] | 59 | void mmc_add_card_debugfs(struct mmc_card *card); |
| 60 | void mmc_remove_card_debugfs(struct mmc_card *card); |
| 61 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | #endif |
Pierre Ossman | da7fbe5 | 2006-12-24 22:46:55 +0100 | [diff] [blame] | 63 | |