Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 150439
b: refs/heads/master
c: 2c7e579
h: refs/heads/master
i:
  150437: 0c16ac5
  150435: f33dcd0
  150431: 9ab152f
v: v3
  • Loading branch information
Bing Zhao authored and John W. Linville committed May 22, 2009
1 parent baef181 commit 38628cd
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bb9f8692f5043efef0dcef048cdd1db68299c2cb
refs/heads/master: 2c7e57981f24e9f8b732ecf1c01e16111d21b7a5
35 changes: 27 additions & 8 deletions trunk/drivers/net/wireless/libertas/if_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct if_sdio_card {

int model;
unsigned long ioport;
unsigned int scratch_reg;

const char *helper;
const char *firmware;
Expand All @@ -119,19 +120,21 @@ struct if_sdio_card {
/* I/O */
/********************************************************************/

/*
* For SD8385/SD8686, this function reads firmware status after
* the image is downloaded, or reads RX packet length when
* interrupt (with IF_SDIO_H_INT_UPLD bit set) is received.
* For SD8688, this function reads firmware status only.
*/
static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err)
{
int ret, reg;
int ret;
u16 scratch;

if (card->model == IF_SDIO_MODEL_8385)
reg = IF_SDIO_SCRATCH_OLD;
else
reg = IF_SDIO_SCRATCH;

scratch = sdio_readb(card->func, reg, &ret);
scratch = sdio_readb(card->func, card->scratch_reg, &ret);
if (!ret)
scratch |= sdio_readb(card->func, reg + 1, &ret) << 8;
scratch |= sdio_readb(card->func, card->scratch_reg + 1,
&ret) << 8;

if (err)
*err = ret;
Expand Down Expand Up @@ -706,6 +709,8 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card)
if (ret)
goto out;

lbs_deb_sdio("firmware status = %#x\n", scratch);

if (scratch == IF_SDIO_FIRMWARE_OK) {
lbs_deb_sdio("firmware already loaded\n");
goto success;
Expand Down Expand Up @@ -893,6 +898,20 @@ static int if_sdio_probe(struct sdio_func *func,

card->func = func;
card->model = model;

switch (card->model) {
case IF_SDIO_MODEL_8385:
card->scratch_reg = IF_SDIO_SCRATCH_OLD;
break;
case IF_SDIO_MODEL_8686:
card->scratch_reg = IF_SDIO_SCRATCH;
break;
case IF_SDIO_MODEL_8688:
default: /* for newer chipsets */
card->scratch_reg = IF_SDIO_FW_STATUS;
break;
}

spin_lock_init(&card->lock);
card->workqueue = create_workqueue("libertas_sdio");
INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/libertas/if_sdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

#define IF_SDIO_SCRATCH 0x34
#define IF_SDIO_SCRATCH_OLD 0x80fe
#define IF_SDIO_FW_STATUS 0x40
#define IF_SDIO_FIRMWARE_OK 0xfedc

#define IF_SDIO_RX_LEN 0x42
Expand Down

0 comments on commit 38628cd

Please sign in to comment.