blob: 3365fef5f71315c5128f8d8463568910ee21b2a0 [file] [log] [blame]
Pierre Ossmane29a7d72007-05-26 13:48:18 +02001/*
2 * include/linux/mmc/sdio_func.h
3 *
4 * Copyright 2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef MMC_SDIO_FUNC_H
13#define MMC_SDIO_FUNC_H
14
15struct mmc_card;
16
17/*
18 * SDIO function devices
19 */
20struct sdio_func {
21 struct mmc_card *card; /* the card this device belongs to */
22 struct device dev; /* the device */
23 unsigned int num; /* function number */
24 unsigned int state; /* function state */
25#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
26};
27
28#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
29
30#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
31
32#define sdio_func_id(f) ((f)->dev.bus_id)
33
Pierre Ossmanf76c8512007-05-27 12:00:02 +020034#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
35#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
36
37/*
38 * SDIO function device driver
39 */
40struct sdio_driver {
41 char *name;
42
43 int (*probe)(struct sdio_func *);
44 void (*remove)(struct sdio_func *);
45
46 struct device_driver drv;
47};
48
49extern int sdio_register_driver(struct sdio_driver *);
50extern void sdio_unregister_driver(struct sdio_driver *);
51
Pierre Ossman46f555f2007-05-27 12:57:15 +020052/*
53 * SDIO I/O operations
54 */
55extern void sdio_claim_host(struct sdio_func *func);
56extern void sdio_release_host(struct sdio_func *func);
57
Pierre Ossmanfa64efa2007-05-27 14:22:37 +020058extern int sdio_enable_func(struct sdio_func *func);
59extern int sdio_disable_func(struct sdio_func *func);
60
Pierre Ossman46f555f2007-05-27 12:57:15 +020061extern unsigned char sdio_readb(struct sdio_func *func,
62 unsigned int addr, int *err_ret);
63
64extern void sdio_writeb(struct sdio_func *func, unsigned char b,
65 unsigned int addr, int *err_ret);
66
Pierre Ossmane29a7d72007-05-26 13:48:18 +020067#endif
68