aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-02 03:32:56 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-02 03:32:56 -0400
commit6cdee2f96a97f6da26bd3759c3f8823332fbb438 (patch)
treeec79086f05ffc3bdf1aecc37e108ccfc3a95450d /drivers/net/wireless
parent0625491493d9000e4556bf566d205c28c8e7dc4e (diff)
parent2fbd3da3877ad8d923b055e5996f80b4d4a6daf4 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/yellowfin.c
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c120
-rw-r--r--drivers/net/wireless/orinoco/hw.c2
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c14
3 files changed, 78 insertions, 58 deletions
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 3838f9f9a47a..8d58e6ed4e7d 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -2893,45 +2893,27 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
2893 return 0; 2893 return 0;
2894} 2894}
2895 2895
2896static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, 2896static int ipw_fw_dma_add_buffer(struct ipw_priv *priv, dma_addr_t *src_address,
2897 u32 src_phys, u32 dest_address, u32 length) 2897 int nr, u32 dest_address, u32 len)
2898{ 2898{
2899 u32 bytes_left = length; 2899 int ret, i;
2900 u32 src_offset = 0; 2900 u32 size;
2901 u32 dest_offset = 0; 2901
2902 int status = 0;
2903 IPW_DEBUG_FW(">> \n"); 2902 IPW_DEBUG_FW(">> \n");
2904 IPW_DEBUG_FW_INFO("src_phys=0x%x dest_address=0x%x length=0x%x\n", 2903 IPW_DEBUG_FW_INFO("nr=%d dest_address=0x%x len=0x%x\n",
2905 src_phys, dest_address, length); 2904 nr, dest_address, len);
2906 while (bytes_left > CB_MAX_LENGTH) { 2905
2907 status = ipw_fw_dma_add_command_block(priv, 2906 for (i = 0; i < nr; i++) {
2908 src_phys + src_offset, 2907 size = min_t(u32, len - i * CB_MAX_LENGTH, CB_MAX_LENGTH);
2909 dest_address + 2908 ret = ipw_fw_dma_add_command_block(priv, src_address[i],
2910 dest_offset, 2909 dest_address +
2911 CB_MAX_LENGTH, 0, 0); 2910 i * CB_MAX_LENGTH, size,
2912 if (status) { 2911 0, 0);
2912 if (ret) {
2913 IPW_DEBUG_FW_INFO(": Failed\n"); 2913 IPW_DEBUG_FW_INFO(": Failed\n");
2914 return -1; 2914 return -1;
2915 } else 2915 } else
2916 IPW_DEBUG_FW_INFO(": Added new cb\n"); 2916 IPW_DEBUG_FW_INFO(": Added new cb\n");
2917
2918 src_offset += CB_MAX_LENGTH;
2919 dest_offset += CB_MAX_LENGTH;
2920 bytes_left -= CB_MAX_LENGTH;
2921 }
2922
2923 /* add the buffer tail */
2924 if (bytes_left > 0) {
2925 status =
2926 ipw_fw_dma_add_command_block(priv, src_phys + src_offset,
2927 dest_address + dest_offset,
2928 bytes_left, 0, 0);
2929 if (status) {
2930 IPW_DEBUG_FW_INFO(": Failed on the buffer tail\n");
2931 return -1;
2932 } else
2933 IPW_DEBUG_FW_INFO
2934 (": Adding new cb - the buffer tail\n");
2935 } 2917 }
2936 2918
2937 IPW_DEBUG_FW("<< \n"); 2919 IPW_DEBUG_FW("<< \n");
@@ -3179,59 +3161,91 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
3179 3161
3180static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len) 3162static int ipw_load_firmware(struct ipw_priv *priv, u8 * data, size_t len)
3181{ 3163{
3182 int rc = -1; 3164 int ret = -1;
3183 int offset = 0; 3165 int offset = 0;
3184 struct fw_chunk *chunk; 3166 struct fw_chunk *chunk;
3185 dma_addr_t shared_phys; 3167 int total_nr = 0;
3186 u8 *shared_virt; 3168 int i;
3169 struct pci_pool *pool;
3170 u32 *virts[CB_NUMBER_OF_ELEMENTS_SMALL];
3171 dma_addr_t phys[CB_NUMBER_OF_ELEMENTS_SMALL];
3187 3172
3188 IPW_DEBUG_TRACE("<< : \n"); 3173 IPW_DEBUG_TRACE("<< : \n");
3189 shared_virt = pci_alloc_consistent(priv->pci_dev, len, &shared_phys);
3190 3174
3191 if (!shared_virt) 3175 pool = pci_pool_create("ipw2200", priv->pci_dev, CB_MAX_LENGTH, 0, 0);
3176 if (!pool) {
3177 IPW_ERROR("pci_pool_create failed\n");
3192 return -ENOMEM; 3178 return -ENOMEM;
3193 3179 }
3194 memmove(shared_virt, data, len);
3195 3180
3196 /* Start the Dma */ 3181 /* Start the Dma */
3197 rc = ipw_fw_dma_enable(priv); 3182 ret = ipw_fw_dma_enable(priv);
3198 3183
3199 /* the DMA is already ready this would be a bug. */ 3184 /* the DMA is already ready this would be a bug. */
3200 BUG_ON(priv->sram_desc.last_cb_index > 0); 3185 BUG_ON(priv->sram_desc.last_cb_index > 0);
3201 3186
3202 do { 3187 do {
3188 u32 chunk_len;
3189 u8 *start;
3190 int size;
3191 int nr = 0;
3192
3203 chunk = (struct fw_chunk *)(data + offset); 3193 chunk = (struct fw_chunk *)(data + offset);
3204 offset += sizeof(struct fw_chunk); 3194 offset += sizeof(struct fw_chunk);
3195 chunk_len = le32_to_cpu(chunk->length);
3196 start = data + offset;
3197
3198 nr = (chunk_len + CB_MAX_LENGTH - 1) / CB_MAX_LENGTH;
3199 for (i = 0; i < nr; i++) {
3200 virts[total_nr] = pci_pool_alloc(pool, GFP_KERNEL,
3201 &phys[total_nr]);
3202 if (!virts[total_nr]) {
3203 ret = -ENOMEM;
3204 goto out;
3205 }
3206 size = min_t(u32, chunk_len - i * CB_MAX_LENGTH,
3207 CB_MAX_LENGTH);
3208 memcpy(virts[total_nr], start, size);
3209 start += size;
3210 total_nr++;
3211 /* We don't support fw chunk larger than 64*8K */
3212 BUG_ON(total_nr > CB_NUMBER_OF_ELEMENTS_SMALL);
3213 }
3214
3205 /* build DMA packet and queue up for sending */ 3215 /* build DMA packet and queue up for sending */
3206 /* dma to chunk->address, the chunk->length bytes from data + 3216 /* dma to chunk->address, the chunk->length bytes from data +
3207 * offeset*/ 3217 * offeset*/
3208 /* Dma loading */ 3218 /* Dma loading */
3209 rc = ipw_fw_dma_add_buffer(priv, shared_phys + offset, 3219 ret = ipw_fw_dma_add_buffer(priv, &phys[total_nr - nr],
3210 le32_to_cpu(chunk->address), 3220 nr, le32_to_cpu(chunk->address),
3211 le32_to_cpu(chunk->length)); 3221 chunk_len);
3212 if (rc) { 3222 if (ret) {
3213 IPW_DEBUG_INFO("dmaAddBuffer Failed\n"); 3223 IPW_DEBUG_INFO("dmaAddBuffer Failed\n");
3214 goto out; 3224 goto out;
3215 } 3225 }
3216 3226
3217 offset += le32_to_cpu(chunk->length); 3227 offset += chunk_len;
3218 } while (offset < len); 3228 } while (offset < len);
3219 3229
3220 /* Run the DMA and wait for the answer */ 3230 /* Run the DMA and wait for the answer */
3221 rc = ipw_fw_dma_kick(priv); 3231 ret = ipw_fw_dma_kick(priv);
3222 if (rc) { 3232 if (ret) {
3223 IPW_ERROR("dmaKick Failed\n"); 3233 IPW_ERROR("dmaKick Failed\n");
3224 goto out; 3234 goto out;
3225 } 3235 }
3226 3236
3227 rc = ipw_fw_dma_wait(priv); 3237 ret = ipw_fw_dma_wait(priv);
3228 if (rc) { 3238 if (ret) {
3229 IPW_ERROR("dmaWaitSync Failed\n"); 3239 IPW_ERROR("dmaWaitSync Failed\n");
3230 goto out; 3240 goto out;
3231 } 3241 }
3232 out: 3242 out:
3233 pci_free_consistent(priv->pci_dev, len, shared_virt, shared_phys); 3243 for (i = 0; i < total_nr; i++)
3234 return rc; 3244 pci_pool_free(pool, virts[i], phys[i]);
3245
3246 pci_pool_destroy(pool);
3247
3248 return ret;
3235} 3249}
3236 3250
3237/* stop nic */ 3251/* stop nic */
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
index 40d8dfa7eace..359652d35e63 100644
--- a/drivers/net/wireless/orinoco/hw.c
+++ b/drivers/net/wireless/orinoco/hw.c
@@ -644,7 +644,7 @@ int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc)
644 int err = 0; 644 int err = 0;
645 u8 tsc_arr[4][ORINOCO_SEQ_LEN]; 645 u8 tsc_arr[4][ORINOCO_SEQ_LEN];
646 646
647 if ((key < 0) || (key > 4)) 647 if ((key < 0) || (key >= 4))
648 return -EINVAL; 648 return -EINVAL;
649 649
650 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV, 650 err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index 9679b29e1c49..2017ccc00145 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -871,6 +871,9 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
871 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */ 871 priv->aifsn[3] = 3; /* AIFSN[AC_BE] */
872 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0); 872 rtl818x_iowrite8(priv, &priv->map->ACM_CONTROL, 0);
873 873
874 /* ENEDCA flag must always be set, transmit issues? */
875 rtl818x_iowrite8(priv, &priv->map->MSR, RTL818X_MSR_ENEDCA);
876
874 return 0; 877 return 0;
875} 878}
876 879
@@ -1176,13 +1179,16 @@ static void rtl8187_bss_info_changed(struct ieee80211_hw *dev,
1176 rtl818x_iowrite8(priv, &priv->map->BSSID[i], 1179 rtl818x_iowrite8(priv, &priv->map->BSSID[i],
1177 info->bssid[i]); 1180 info->bssid[i]);
1178 1181
1182 if (priv->is_rtl8187b)
1183 reg = RTL818X_MSR_ENEDCA;
1184 else
1185 reg = 0;
1186
1179 if (is_valid_ether_addr(info->bssid)) { 1187 if (is_valid_ether_addr(info->bssid)) {
1180 reg = RTL818X_MSR_INFRA; 1188 reg |= RTL818X_MSR_INFRA;
1181 if (priv->is_rtl8187b)
1182 reg |= RTL818X_MSR_ENEDCA;
1183 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1189 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1184 } else { 1190 } else {
1185 reg = RTL818X_MSR_NO_LINK; 1191 reg |= RTL818X_MSR_NO_LINK;
1186 rtl818x_iowrite8(priv, &priv->map->MSR, reg); 1192 rtl818x_iowrite8(priv, &priv->map->MSR, reg);
1187 } 1193 }
1188 1194