Pierre Ossman | e29a7d7 | 2007-05-26 13:48:18 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 15 | struct mmc_card; |
| 16 | |
| 17 | /* |
| 18 | * SDIO function devices |
| 19 | */ |
| 20 | struct 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 */ |
Pierre Ossman | 0597007 | 2007-06-11 21:01:00 +0200 | [diff] [blame] | 24 | |
| 25 | unsigned char class; /* standard interface class */ |
| 26 | unsigned short vendor; /* vendor id */ |
| 27 | unsigned short device; /* device id */ |
| 28 | |
Pierre Ossman | e29a7d7 | 2007-05-26 13:48:18 +0200 | [diff] [blame] | 29 | unsigned int state; /* function state */ |
| 30 | #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */ |
| 31 | }; |
| 32 | |
| 33 | #define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT) |
| 34 | |
| 35 | #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT) |
| 36 | |
| 37 | #define sdio_func_id(f) ((f)->dev.bus_id) |
| 38 | |
Pierre Ossman | f76c851 | 2007-05-27 12:00:02 +0200 | [diff] [blame] | 39 | #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev) |
| 40 | #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d) |
| 41 | |
| 42 | /* |
| 43 | * SDIO function device driver |
| 44 | */ |
| 45 | struct sdio_driver { |
| 46 | char *name; |
| 47 | |
| 48 | int (*probe)(struct sdio_func *); |
| 49 | void (*remove)(struct sdio_func *); |
| 50 | |
| 51 | struct device_driver drv; |
| 52 | }; |
| 53 | |
| 54 | extern int sdio_register_driver(struct sdio_driver *); |
| 55 | extern void sdio_unregister_driver(struct sdio_driver *); |
| 56 | |
Pierre Ossman | 46f555f | 2007-05-27 12:57:15 +0200 | [diff] [blame] | 57 | /* |
| 58 | * SDIO I/O operations |
| 59 | */ |
| 60 | extern void sdio_claim_host(struct sdio_func *func); |
| 61 | extern void sdio_release_host(struct sdio_func *func); |
| 62 | |
Pierre Ossman | fa64efa | 2007-05-27 14:22:37 +0200 | [diff] [blame] | 63 | extern int sdio_enable_func(struct sdio_func *func); |
| 64 | extern int sdio_disable_func(struct sdio_func *func); |
| 65 | |
Pierre Ossman | 46f555f | 2007-05-27 12:57:15 +0200 | [diff] [blame] | 66 | extern unsigned char sdio_readb(struct sdio_func *func, |
| 67 | unsigned int addr, int *err_ret); |
| 68 | |
| 69 | extern void sdio_writeb(struct sdio_func *func, unsigned char b, |
| 70 | unsigned int addr, int *err_ret); |
| 71 | |
Pierre Ossman | e29a7d7 | 2007-05-26 13:48:18 +0200 | [diff] [blame] | 72 | #endif |
| 73 | |