Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 65606
b: refs/heads/master
c: 0597007
h: refs/heads/master
v: v3
  • Loading branch information
Pierre Ossman committed Sep 23, 2007
1 parent 6f06a04 commit fe97a97
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35c66c19088bddb11110c124bad8abd4441a8421
refs/heads/master: 0597007f1b22bbb5d4234ca09c045f9bb2711270
38 changes: 38 additions & 0 deletions trunk/drivers/mmc/core/sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,34 @@
#include "sd_ops.h"
#include "sdio_ops.h"

static int sdio_read_fbr(struct sdio_func *func)
{
int ret;
unsigned char data;

ret = mmc_io_rw_direct(func->card, 0, 0,
func->num * 0x100 + SDIO_FBR_STD_IF, 0, &data);
if (ret)
goto out;

data &= 0x0f;

if (data == 0x0f) {
ret = mmc_io_rw_direct(func->card, 0, 0,
func->num * 0x100 + SDIO_FBR_STD_IF_EXT, 0, &data);
if (ret)
goto out;
}

func->class = data;

out:
return ret;
}

static int sdio_init_func(struct mmc_card *card, unsigned int fn)
{
int ret;
struct sdio_func *func;

BUG_ON(fn > SDIO_MAX_FUNCS);
Expand All @@ -35,9 +61,21 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn)

func->num = fn;

ret = sdio_read_fbr(func);
if (ret)
goto fail;

card->sdio_func[fn - 1] = func;

return 0;

fail:
/*
* It is okay to remove the function here even though we hold
* the host lock as we haven't registered the device yet.
*/
sdio_remove_func(func);
return ret;
}

static int sdio_read_cccr(struct mmc_card *card)
Expand Down
5 changes: 5 additions & 0 deletions trunk/include/linux/mmc/sdio_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ struct sdio_func {
struct mmc_card *card; /* the card this device belongs to */
struct device dev; /* the device */
unsigned int num; /* function number */

unsigned char class; /* standard interface class */
unsigned short vendor; /* vendor id */
unsigned short device; /* device id */

unsigned int state; /* function state */
#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
};
Expand Down

0 comments on commit fe97a97

Please sign in to comment.