diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-05-26 07:48:18 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 13:45:31 -0400 |
commit | e29a7d73f4277eb92aa64e17017dea33460828ef (patch) | |
tree | 0b8cfe6d145f41c43f86b475fff86627a305af1e /include/linux/mmc | |
parent | b2bcc798bbb482b2909801280f3c4aff8cbbf5be (diff) |
mmc: basic SDIO device model
Add the sdio bus type and basic device handling.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'include/linux/mmc')
-rw-r--r-- | include/linux/mmc/card.h | 7 | ||||
-rw-r--r-- | include/linux/mmc/sdio_func.h | 35 |
2 files changed, 42 insertions, 0 deletions
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 43480ebebf9..9f5f74482d9 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -56,6 +56,9 @@ struct sd_switch_caps { | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | struct mmc_host; | 58 | struct mmc_host; |
59 | struct sdio_func; | ||
60 | |||
61 | #define SDIO_MAX_FUNCS 7 | ||
59 | 62 | ||
60 | /* | 63 | /* |
61 | * MMC device | 64 | * MMC device |
@@ -73,6 +76,7 @@ struct mmc_card { | |||
73 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ | 76 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ |
74 | #define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ | 77 | #define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */ |
75 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ | 78 | #define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */ |
79 | |||
76 | u32 raw_cid[4]; /* raw card CID */ | 80 | u32 raw_cid[4]; /* raw card CID */ |
77 | u32 raw_csd[4]; /* raw card CSD */ | 81 | u32 raw_csd[4]; /* raw card CSD */ |
78 | u32 raw_scr[2]; /* raw card SCR */ | 82 | u32 raw_scr[2]; /* raw card SCR */ |
@@ -81,6 +85,9 @@ struct mmc_card { | |||
81 | struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ | 85 | struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ |
82 | struct sd_scr scr; /* extra SD information */ | 86 | struct sd_scr scr; /* extra SD information */ |
83 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ | 87 | struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ |
88 | |||
89 | unsigned int sdio_funcs; /* number of SDIO functions */ | ||
90 | struct sdio_func *sdio_func[SDIO_MAX_FUNCS]; /* SDIO functions (devices) */ | ||
84 | }; | 91 | }; |
85 | 92 | ||
86 | #define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) | 93 | #define mmc_card_mmc(c) ((c)->type == MMC_TYPE_MMC) |
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h new file mode 100644 index 00000000000..50c78db420e --- /dev/null +++ b/include/linux/mmc/sdio_func.h | |||
@@ -0,0 +1,35 @@ | |||
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 */ | ||
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 | |||
34 | #endif | ||
35 | |||