diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2007-06-11 15:01:00 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 14:13:52 -0400 |
commit | 0597007f1b22bbb5d4234ca09c045f9bb2711270 (patch) | |
tree | ffe8cc7fd237a76e399c755ae4b58a469a03dd50 /drivers | |
parent | 35c66c19088bddb11110c124bad8abd4441a8421 (diff) |
sdio: basic parsing of FBR
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/sdio.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 7ce3e3104d21..be623856f288 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -23,8 +23,34 @@ | |||
23 | #include "sd_ops.h" | 23 | #include "sd_ops.h" |
24 | #include "sdio_ops.h" | 24 | #include "sdio_ops.h" |
25 | 25 | ||
26 | static int sdio_read_fbr(struct sdio_func *func) | ||
27 | { | ||
28 | int ret; | ||
29 | unsigned char data; | ||
30 | |||
31 | ret = mmc_io_rw_direct(func->card, 0, 0, | ||
32 | func->num * 0x100 + SDIO_FBR_STD_IF, 0, &data); | ||
33 | if (ret) | ||
34 | goto out; | ||
35 | |||
36 | data &= 0x0f; | ||
37 | |||
38 | if (data == 0x0f) { | ||
39 | ret = mmc_io_rw_direct(func->card, 0, 0, | ||
40 | func->num * 0x100 + SDIO_FBR_STD_IF_EXT, 0, &data); | ||
41 | if (ret) | ||
42 | goto out; | ||
43 | } | ||
44 | |||
45 | func->class = data; | ||
46 | |||
47 | out: | ||
48 | return ret; | ||
49 | } | ||
50 | |||
26 | static int sdio_init_func(struct mmc_card *card, unsigned int fn) | 51 | static int sdio_init_func(struct mmc_card *card, unsigned int fn) |
27 | { | 52 | { |
53 | int ret; | ||
28 | struct sdio_func *func; | 54 | struct sdio_func *func; |
29 | 55 | ||
30 | BUG_ON(fn > SDIO_MAX_FUNCS); | 56 | BUG_ON(fn > SDIO_MAX_FUNCS); |
@@ -35,9 +61,21 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn) | |||
35 | 61 | ||
36 | func->num = fn; | 62 | func->num = fn; |
37 | 63 | ||
64 | ret = sdio_read_fbr(func); | ||
65 | if (ret) | ||
66 | goto fail; | ||
67 | |||
38 | card->sdio_func[fn - 1] = func; | 68 | card->sdio_func[fn - 1] = func; |
39 | 69 | ||
40 | return 0; | 70 | return 0; |
71 | |||
72 | fail: | ||
73 | /* | ||
74 | * It is okay to remove the function here even though we hold | ||
75 | * the host lock as we haven't registered the device yet. | ||
76 | */ | ||
77 | sdio_remove_func(func); | ||
78 | return ret; | ||
41 | } | 79 | } |
42 | 80 | ||
43 | static int sdio_read_cccr(struct mmc_card *card) | 81 | static int sdio_read_cccr(struct mmc_card *card) |