diff options
-rw-r--r-- | drivers/net/wireless/libertas/if_sdio.c | 35 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/if_sdio.h | 1 |
2 files changed, 28 insertions, 8 deletions
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index 478d766abf8..a7e3fc119b7 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -100,6 +100,7 @@ struct if_sdio_card { | |||
100 | 100 | ||
101 | int model; | 101 | int model; |
102 | unsigned long ioport; | 102 | unsigned long ioport; |
103 | unsigned int scratch_reg; | ||
103 | 104 | ||
104 | const char *helper; | 105 | const char *helper; |
105 | const char *firmware; | 106 | const char *firmware; |
@@ -119,19 +120,21 @@ struct if_sdio_card { | |||
119 | /* I/O */ | 120 | /* I/O */ |
120 | /********************************************************************/ | 121 | /********************************************************************/ |
121 | 122 | ||
123 | /* | ||
124 | * For SD8385/SD8686, this function reads firmware status after | ||
125 | * the image is downloaded, or reads RX packet length when | ||
126 | * interrupt (with IF_SDIO_H_INT_UPLD bit set) is received. | ||
127 | * For SD8688, this function reads firmware status only. | ||
128 | */ | ||
122 | static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err) | 129 | static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err) |
123 | { | 130 | { |
124 | int ret, reg; | 131 | int ret; |
125 | u16 scratch; | 132 | u16 scratch; |
126 | 133 | ||
127 | if (card->model == IF_SDIO_MODEL_8385) | 134 | scratch = sdio_readb(card->func, card->scratch_reg, &ret); |
128 | reg = IF_SDIO_SCRATCH_OLD; | ||
129 | else | ||
130 | reg = IF_SDIO_SCRATCH; | ||
131 | |||
132 | scratch = sdio_readb(card->func, reg, &ret); | ||
133 | if (!ret) | 135 | if (!ret) |
134 | scratch |= sdio_readb(card->func, reg + 1, &ret) << 8; | 136 | scratch |= sdio_readb(card->func, card->scratch_reg + 1, |
137 | &ret) << 8; | ||
135 | 138 | ||
136 | if (err) | 139 | if (err) |
137 | *err = ret; | 140 | *err = ret; |
@@ -706,6 +709,8 @@ static int if_sdio_prog_firmware(struct if_sdio_card *card) | |||
706 | if (ret) | 709 | if (ret) |
707 | goto out; | 710 | goto out; |
708 | 711 | ||
712 | lbs_deb_sdio("firmware status = %#x\n", scratch); | ||
713 | |||
709 | if (scratch == IF_SDIO_FIRMWARE_OK) { | 714 | if (scratch == IF_SDIO_FIRMWARE_OK) { |
710 | lbs_deb_sdio("firmware already loaded\n"); | 715 | lbs_deb_sdio("firmware already loaded\n"); |
711 | goto success; | 716 | goto success; |
@@ -893,6 +898,20 @@ static int if_sdio_probe(struct sdio_func *func, | |||
893 | 898 | ||
894 | card->func = func; | 899 | card->func = func; |
895 | card->model = model; | 900 | card->model = model; |
901 | |||
902 | switch (card->model) { | ||
903 | case IF_SDIO_MODEL_8385: | ||
904 | card->scratch_reg = IF_SDIO_SCRATCH_OLD; | ||
905 | break; | ||
906 | case IF_SDIO_MODEL_8686: | ||
907 | card->scratch_reg = IF_SDIO_SCRATCH; | ||
908 | break; | ||
909 | case IF_SDIO_MODEL_8688: | ||
910 | default: /* for newer chipsets */ | ||
911 | card->scratch_reg = IF_SDIO_FW_STATUS; | ||
912 | break; | ||
913 | } | ||
914 | |||
896 | spin_lock_init(&card->lock); | 915 | spin_lock_init(&card->lock); |
897 | card->workqueue = create_workqueue("libertas_sdio"); | 916 | card->workqueue = create_workqueue("libertas_sdio"); |
898 | INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); | 917 | INIT_WORK(&card->packet_worker, if_sdio_host_to_card_worker); |
diff --git a/drivers/net/wireless/libertas/if_sdio.h b/drivers/net/wireless/libertas/if_sdio.h index d3a4fbe0769..60c9b2fcef0 100644 --- a/drivers/net/wireless/libertas/if_sdio.h +++ b/drivers/net/wireless/libertas/if_sdio.h | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | #define IF_SDIO_SCRATCH 0x34 | 43 | #define IF_SDIO_SCRATCH 0x34 |
44 | #define IF_SDIO_SCRATCH_OLD 0x80fe | 44 | #define IF_SDIO_SCRATCH_OLD 0x80fe |
45 | #define IF_SDIO_FW_STATUS 0x40 | ||
45 | #define IF_SDIO_FIRMWARE_OK 0xfedc | 46 | #define IF_SDIO_FIRMWARE_OK 0xfedc |
46 | 47 | ||
47 | #define IF_SDIO_RX_LEN 0x42 | 48 | #define IF_SDIO_RX_LEN 0x42 |