diff options
author | Ido Yariv <ido@wizery.com> | 2012-11-28 04:42:49 -0500 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2012-12-11 05:37:24 -0500 |
commit | 2e07d02828759a506b5205b2cff40daa58df5bf7 (patch) | |
tree | 46494a77713df5aa44667afa1ae596d945ae2deb /drivers/net/wireless/ti | |
parent | 2fd8a3bb49400a4a0fe9d9cd9d49019e7a46403e (diff) |
wlcore: Always pass DMA-able buffers to mmc functions
Some of the mmc drivers initiate DMA transfers with buffers passed from
higher layers. This means that the driver shouldn't ever pass non
DMA-able buffers, such as ones that are unaligned, allocated on the
stack or static.
Fix a couple of calls to the mmc layer in which buffers which weren't
necessarily DMA-able were passed.
[Use sizeof(*wl->buffer_32) instead of sizeof(u32) -- Luca]
Signed-off-by: Ido Yariv <ido@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/main.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl12xx/wl12xx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/io.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/main.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/wlcore.h | 2 |
5 files changed, 44 insertions, 13 deletions
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c index 6d4a02171abc..5b023a5bcc09 100644 --- a/drivers/net/wireless/ti/wl12xx/main.c +++ b/drivers/net/wireless/ti/wl12xx/main.c | |||
@@ -613,7 +613,7 @@ static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) | |||
613 | 613 | ||
614 | if (wl->chip.id != CHIP_ID_128X_PG20) { | 614 | if (wl->chip.id != CHIP_ID_128X_PG20) { |
615 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; | 615 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; |
616 | struct wl127x_rx_mem_pool_addr rx_mem_addr; | 616 | struct wl12xx_priv *priv = wl->priv; |
617 | 617 | ||
618 | /* | 618 | /* |
619 | * Choose the block we want to read | 619 | * Choose the block we want to read |
@@ -622,13 +622,13 @@ static int wl127x_prepare_read(struct wl1271 *wl, u32 rx_desc, u32 len) | |||
622 | */ | 622 | */ |
623 | u32 mem_block = rx_desc & RX_MEM_BLOCK_MASK; | 623 | u32 mem_block = rx_desc & RX_MEM_BLOCK_MASK; |
624 | 624 | ||
625 | rx_mem_addr.addr = (mem_block << 8) + | 625 | priv->rx_mem_addr->addr = (mem_block << 8) + |
626 | le32_to_cpu(wl_mem_map->packet_memory_pool_start); | 626 | le32_to_cpu(wl_mem_map->packet_memory_pool_start); |
627 | 627 | ||
628 | rx_mem_addr.addr_extra = rx_mem_addr.addr + 4; | 628 | priv->rx_mem_addr->addr_extra = priv->rx_mem_addr->addr + 4; |
629 | 629 | ||
630 | ret = wlcore_write(wl, WL1271_SLV_REG_DATA, &rx_mem_addr, | 630 | ret = wlcore_write(wl, WL1271_SLV_REG_DATA, priv->rx_mem_addr, |
631 | sizeof(rx_mem_addr), false); | 631 | sizeof(*priv->rx_mem_addr), false); |
632 | if (ret < 0) | 632 | if (ret < 0) |
633 | return ret; | 633 | return ret; |
634 | } | 634 | } |
@@ -1761,6 +1761,10 @@ static int wl12xx_setup(struct wl1271 *wl) | |||
1761 | wl1271_error("Invalid tcxo parameter %s", tcxo_param); | 1761 | wl1271_error("Invalid tcxo parameter %s", tcxo_param); |
1762 | } | 1762 | } |
1763 | 1763 | ||
1764 | priv->rx_mem_addr = kmalloc(sizeof(*priv->rx_mem_addr), GFP_KERNEL); | ||
1765 | if (!priv->rx_mem_addr) | ||
1766 | return -ENOMEM; | ||
1767 | |||
1764 | return 0; | 1768 | return 0; |
1765 | } | 1769 | } |
1766 | 1770 | ||
@@ -1794,6 +1798,21 @@ out: | |||
1794 | return ret; | 1798 | return ret; |
1795 | } | 1799 | } |
1796 | 1800 | ||
1801 | static int __devexit wl12xx_remove(struct platform_device *pdev) | ||
1802 | { | ||
1803 | struct wl1271 *wl = platform_get_drvdata(pdev); | ||
1804 | struct wl12xx_priv *priv; | ||
1805 | |||
1806 | if (!wl) | ||
1807 | goto out; | ||
1808 | priv = wl->priv; | ||
1809 | |||
1810 | kfree(priv->rx_mem_addr); | ||
1811 | |||
1812 | out: | ||
1813 | return wlcore_remove(pdev); | ||
1814 | } | ||
1815 | |||
1797 | static const struct platform_device_id wl12xx_id_table[] __devinitconst = { | 1816 | static const struct platform_device_id wl12xx_id_table[] __devinitconst = { |
1798 | { "wl12xx", 0 }, | 1817 | { "wl12xx", 0 }, |
1799 | { } /* Terminating Entry */ | 1818 | { } /* Terminating Entry */ |
@@ -1802,7 +1821,7 @@ MODULE_DEVICE_TABLE(platform, wl12xx_id_table); | |||
1802 | 1821 | ||
1803 | static struct platform_driver wl12xx_driver = { | 1822 | static struct platform_driver wl12xx_driver = { |
1804 | .probe = wl12xx_probe, | 1823 | .probe = wl12xx_probe, |
1805 | .remove = __devexit_p(wlcore_remove), | 1824 | .remove = __devexit_p(wl12xx_remove), |
1806 | .id_table = wl12xx_id_table, | 1825 | .id_table = wl12xx_id_table, |
1807 | .driver = { | 1826 | .driver = { |
1808 | .name = "wl12xx_driver", | 1827 | .name = "wl12xx_driver", |
diff --git a/drivers/net/wireless/ti/wl12xx/wl12xx.h b/drivers/net/wireless/ti/wl12xx/wl12xx.h index a07be5e022fb..d4552857480c 100644 --- a/drivers/net/wireless/ti/wl12xx/wl12xx.h +++ b/drivers/net/wireless/ti/wl12xx/wl12xx.h | |||
@@ -73,6 +73,8 @@ struct wl12xx_priv { | |||
73 | 73 | ||
74 | int ref_clock; | 74 | int ref_clock; |
75 | int tcxo_clock; | 75 | int tcxo_clock; |
76 | |||
77 | struct wl127x_rx_mem_pool_addr *rx_mem_addr; | ||
76 | }; | 78 | }; |
77 | 79 | ||
78 | #endif /* __WL12XX_PRIV_H__ */ | 80 | #endif /* __WL12XX_PRIV_H__ */ |
diff --git a/drivers/net/wireless/ti/wlcore/io.h b/drivers/net/wireless/ti/wlcore/io.h index f48530fec14f..af7d9f9b3b4d 100644 --- a/drivers/net/wireless/ti/wlcore/io.h +++ b/drivers/net/wireless/ti/wlcore/io.h | |||
@@ -105,13 +105,13 @@ static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr, | |||
105 | { | 105 | { |
106 | int ret; | 106 | int ret; |
107 | 107 | ||
108 | ret = wlcore_raw_read(wl, addr, &wl->buffer_32, | 108 | ret = wlcore_raw_read(wl, addr, wl->buffer_32, |
109 | sizeof(wl->buffer_32), false); | 109 | sizeof(*wl->buffer_32), false); |
110 | if (ret < 0) | 110 | if (ret < 0) |
111 | return ret; | 111 | return ret; |
112 | 112 | ||
113 | if (val) | 113 | if (val) |
114 | *val = le32_to_cpu(wl->buffer_32); | 114 | *val = le32_to_cpu(*wl->buffer_32); |
115 | 115 | ||
116 | return 0; | 116 | return 0; |
117 | } | 117 | } |
@@ -119,9 +119,9 @@ static inline int __must_check wlcore_raw_read32(struct wl1271 *wl, int addr, | |||
119 | static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr, | 119 | static inline int __must_check wlcore_raw_write32(struct wl1271 *wl, int addr, |
120 | u32 val) | 120 | u32 val) |
121 | { | 121 | { |
122 | wl->buffer_32 = cpu_to_le32(val); | 122 | *wl->buffer_32 = cpu_to_le32(val); |
123 | return wlcore_raw_write(wl, addr, &wl->buffer_32, | 123 | return wlcore_raw_write(wl, addr, wl->buffer_32, |
124 | sizeof(wl->buffer_32), false); | 124 | sizeof(*wl->buffer_32), false); |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline int __must_check wlcore_read(struct wl1271 *wl, int addr, | 127 | static inline int __must_check wlcore_read(struct wl1271 *wl, int addr, |
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c index 227c571a2690..0e599c92a071 100644 --- a/drivers/net/wireless/ti/wlcore/main.c +++ b/drivers/net/wireless/ti/wlcore/main.c | |||
@@ -5860,8 +5860,17 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size, | |||
5860 | goto err_fwlog; | 5860 | goto err_fwlog; |
5861 | } | 5861 | } |
5862 | 5862 | ||
5863 | wl->buffer_32 = kmalloc(sizeof(*wl->buffer_32), GFP_KERNEL); | ||
5864 | if (!wl->buffer_32) { | ||
5865 | ret = -ENOMEM; | ||
5866 | goto err_mbox; | ||
5867 | } | ||
5868 | |||
5863 | return hw; | 5869 | return hw; |
5864 | 5870 | ||
5871 | err_mbox: | ||
5872 | kfree(wl->mbox); | ||
5873 | |||
5865 | err_fwlog: | 5874 | err_fwlog: |
5866 | free_page((unsigned long)wl->fwlog); | 5875 | free_page((unsigned long)wl->fwlog); |
5867 | 5876 | ||
@@ -5900,6 +5909,7 @@ int wlcore_free_hw(struct wl1271 *wl) | |||
5900 | device_remove_file(wl->dev, &dev_attr_hw_pg_ver); | 5909 | device_remove_file(wl->dev, &dev_attr_hw_pg_ver); |
5901 | 5910 | ||
5902 | device_remove_file(wl->dev, &dev_attr_bt_coex_state); | 5911 | device_remove_file(wl->dev, &dev_attr_bt_coex_state); |
5912 | kfree(wl->buffer_32); | ||
5903 | kfree(wl->mbox); | 5913 | kfree(wl->mbox); |
5904 | free_page((unsigned long)wl->fwlog); | 5914 | free_page((unsigned long)wl->fwlog); |
5905 | dev_kfree_skb(wl->dummy_packet); | 5915 | dev_kfree_skb(wl->dummy_packet); |
diff --git a/drivers/net/wireless/ti/wlcore/wlcore.h b/drivers/net/wireless/ti/wlcore/wlcore.h index 6c2fd0398e9d..118208a8e997 100644 --- a/drivers/net/wireless/ti/wlcore/wlcore.h +++ b/drivers/net/wireless/ti/wlcore/wlcore.h | |||
@@ -334,7 +334,7 @@ struct wl1271 { | |||
334 | 334 | ||
335 | struct wl1271_stats stats; | 335 | struct wl1271_stats stats; |
336 | 336 | ||
337 | __le32 buffer_32; | 337 | __le32 *buffer_32; |
338 | u32 buffer_cmd; | 338 | u32 buffer_cmd; |
339 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; | 339 | u32 buffer_busyword[WL1271_BUSY_WORD_CNT]; |
340 | 340 | ||