aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rtl818x
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/rtl818x')
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187.h57
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_dev.c15
-rw-r--r--drivers/net/wireless/rtl818x/rtl8187_rtl8225.c8
3 files changed, 64 insertions, 16 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
index 9718f61809c..edeff82a4d0 100644
--- a/drivers/net/wireless/rtl818x/rtl8187.h
+++ b/drivers/net/wireless/rtl818x/rtl8187.h
@@ -120,6 +120,12 @@ struct rtl8187_priv {
120 __le64 buf; 120 __le64 buf;
121 struct sk_buff_head queue; 121 struct sk_buff_head queue;
122 } b_tx_status; /* This queue is used by both -b and non-b devices */ 122 } b_tx_status; /* This queue is used by both -b and non-b devices */
123 struct mutex io_mutex;
124 union {
125 u8 bits8;
126 __le16 bits16;
127 __le32 bits32;
128 } *io_dmabuf;
123}; 129};
124 130
125void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data); 131void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
@@ -129,10 +135,14 @@ static inline u8 rtl818x_ioread8_idx(struct rtl8187_priv *priv,
129{ 135{
130 u8 val; 136 u8 val;
131 137
138 mutex_lock(&priv->io_mutex);
132 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 139 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
133 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 140 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
134 (unsigned long)addr, idx & 0x03, &val, 141 (unsigned long)addr, idx & 0x03,
135 sizeof(val), HZ / 2); 142 &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
143
144 val = priv->io_dmabuf->bits8;
145 mutex_unlock(&priv->io_mutex);
136 146
137 return val; 147 return val;
138} 148}
@@ -147,10 +157,14 @@ static inline u16 rtl818x_ioread16_idx(struct rtl8187_priv *priv,
147{ 157{
148 __le16 val; 158 __le16 val;
149 159
160 mutex_lock(&priv->io_mutex);
150 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 161 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
151 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 162 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
152 (unsigned long)addr, idx & 0x03, &val, 163 (unsigned long)addr, idx & 0x03,
153 sizeof(val), HZ / 2); 164 &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
165
166 val = priv->io_dmabuf->bits16;
167 mutex_unlock(&priv->io_mutex);
154 168
155 return le16_to_cpu(val); 169 return le16_to_cpu(val);
156} 170}
@@ -165,10 +179,14 @@ static inline u32 rtl818x_ioread32_idx(struct rtl8187_priv *priv,
165{ 179{
166 __le32 val; 180 __le32 val;
167 181
182 mutex_lock(&priv->io_mutex);
168 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0), 183 usb_control_msg(priv->udev, usb_rcvctrlpipe(priv->udev, 0),
169 RTL8187_REQ_GET_REG, RTL8187_REQT_READ, 184 RTL8187_REQ_GET_REG, RTL8187_REQT_READ,
170 (unsigned long)addr, idx & 0x03, &val, 185 (unsigned long)addr, idx & 0x03,
171 sizeof(val), HZ / 2); 186 &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
187
188 val = priv->io_dmabuf->bits32;
189 mutex_unlock(&priv->io_mutex);
172 190
173 return le32_to_cpu(val); 191 return le32_to_cpu(val);
174} 192}
@@ -181,10 +199,15 @@ static inline u32 rtl818x_ioread32(struct rtl8187_priv *priv, __le32 *addr)
181static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv, 199static inline void rtl818x_iowrite8_idx(struct rtl8187_priv *priv,
182 u8 *addr, u8 val, u8 idx) 200 u8 *addr, u8 val, u8 idx)
183{ 201{
202 mutex_lock(&priv->io_mutex);
203
204 priv->io_dmabuf->bits8 = val;
184 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 205 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
185 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 206 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
186 (unsigned long)addr, idx & 0x03, &val, 207 (unsigned long)addr, idx & 0x03,
187 sizeof(val), HZ / 2); 208 &priv->io_dmabuf->bits8, sizeof(val), HZ / 2);
209
210 mutex_unlock(&priv->io_mutex);
188} 211}
189 212
190static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val) 213static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
@@ -195,12 +218,15 @@ static inline void rtl818x_iowrite8(struct rtl8187_priv *priv, u8 *addr, u8 val)
195static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv, 218static inline void rtl818x_iowrite16_idx(struct rtl8187_priv *priv,
196 __le16 *addr, u16 val, u8 idx) 219 __le16 *addr, u16 val, u8 idx)
197{ 220{
198 __le16 buf = cpu_to_le16(val); 221 mutex_lock(&priv->io_mutex);
199 222
223 priv->io_dmabuf->bits16 = cpu_to_le16(val);
200 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 224 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
201 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 225 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
202 (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), 226 (unsigned long)addr, idx & 0x03,
203 HZ / 2); 227 &priv->io_dmabuf->bits16, sizeof(val), HZ / 2);
228
229 mutex_unlock(&priv->io_mutex);
204} 230}
205 231
206static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr, 232static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
@@ -212,12 +238,15 @@ static inline void rtl818x_iowrite16(struct rtl8187_priv *priv, __le16 *addr,
212static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv, 238static inline void rtl818x_iowrite32_idx(struct rtl8187_priv *priv,
213 __le32 *addr, u32 val, u8 idx) 239 __le32 *addr, u32 val, u8 idx)
214{ 240{
215 __le32 buf = cpu_to_le32(val); 241 mutex_lock(&priv->io_mutex);
216 242
243 priv->io_dmabuf->bits32 = cpu_to_le32(val);
217 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 244 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
218 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 245 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
219 (unsigned long)addr, idx & 0x03, &buf, sizeof(buf), 246 (unsigned long)addr, idx & 0x03,
220 HZ / 2); 247 &priv->io_dmabuf->bits32, sizeof(val), HZ / 2);
248
249 mutex_unlock(&priv->io_mutex);
221} 250}
222 251
223static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr, 252static inline void rtl818x_iowrite32(struct rtl8187_priv *priv, __le32 *addr,
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
index fd81884b9c7..d51ba0a88c2 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
@@ -71,6 +71,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
71 {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187}, 71 {USB_DEVICE(0x18E8, 0x6232), .driver_info = DEVICE_RTL8187},
72 /* AirLive */ 72 /* AirLive */
73 {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187}, 73 {USB_DEVICE(0x1b75, 0x8187), .driver_info = DEVICE_RTL8187},
74 /* Linksys */
75 {USB_DEVICE(0x1737, 0x0073), .driver_info = DEVICE_RTL8187B},
74 {} 76 {}
75}; 77};
76 78
@@ -1329,6 +1331,14 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1329 priv = dev->priv; 1331 priv = dev->priv;
1330 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B); 1332 priv->is_rtl8187b = (id->driver_info == DEVICE_RTL8187B);
1331 1333
1334 /* allocate "DMA aware" buffer for register accesses */
1335 priv->io_dmabuf = kmalloc(sizeof(*priv->io_dmabuf), GFP_KERNEL);
1336 if (!priv->io_dmabuf) {
1337 err = -ENOMEM;
1338 goto err_free_dev;
1339 }
1340 mutex_init(&priv->io_mutex);
1341
1332 SET_IEEE80211_DEV(dev, &intf->dev); 1342 SET_IEEE80211_DEV(dev, &intf->dev);
1333 usb_set_intfdata(intf, dev); 1343 usb_set_intfdata(intf, dev);
1334 priv->udev = udev; 1344 priv->udev = udev;
@@ -1495,7 +1505,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1495 err = ieee80211_register_hw(dev); 1505 err = ieee80211_register_hw(dev);
1496 if (err) { 1506 if (err) {
1497 printk(KERN_ERR "rtl8187: Cannot register device\n"); 1507 printk(KERN_ERR "rtl8187: Cannot register device\n");
1498 goto err_free_dev; 1508 goto err_free_dmabuf;
1499 } 1509 }
1500 mutex_init(&priv->conf_mutex); 1510 mutex_init(&priv->conf_mutex);
1501 skb_queue_head_init(&priv->b_tx_status.queue); 1511 skb_queue_head_init(&priv->b_tx_status.queue);
@@ -1506,6 +1516,8 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
1506 1516
1507 return 0; 1517 return 0;
1508 1518
1519 err_free_dmabuf:
1520 kfree(priv->io_dmabuf);
1509 err_free_dev: 1521 err_free_dev:
1510 ieee80211_free_hw(dev); 1522 ieee80211_free_hw(dev);
1511 usb_set_intfdata(intf, NULL); 1523 usb_set_intfdata(intf, NULL);
@@ -1526,6 +1538,7 @@ static void __devexit rtl8187_disconnect(struct usb_interface *intf)
1526 priv = dev->priv; 1538 priv = dev->priv;
1527 usb_reset_device(priv->udev); 1539 usb_reset_device(priv->udev);
1528 usb_put_dev(interface_to_usbdev(intf)); 1540 usb_put_dev(interface_to_usbdev(intf));
1541 kfree(priv->io_dmabuf);
1529 ieee80211_free_hw(dev); 1542 ieee80211_free_hw(dev);
1530} 1543}
1531 1544
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
index 78df281b297..a09819386a1 100644
--- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
+++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c
@@ -88,9 +88,15 @@ static void rtl8225_write_8051(struct ieee80211_hw *dev, u8 addr, __le16 data)
88 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80); 88 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80);
89 udelay(10); 89 udelay(10);
90 90
91 mutex_lock(&priv->io_mutex);
92
93 priv->io_dmabuf->bits16 = data;
91 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0), 94 usb_control_msg(priv->udev, usb_sndctrlpipe(priv->udev, 0),
92 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE, 95 RTL8187_REQ_SET_REG, RTL8187_REQT_WRITE,
93 addr, 0x8225, &data, sizeof(data), HZ / 2); 96 addr, 0x8225, &priv->io_dmabuf->bits16, sizeof(data),
97 HZ / 2);
98
99 mutex_unlock(&priv->io_mutex);
94 100
95 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2)); 101 rtl818x_iowrite16(priv, &priv->map->RFPinsOutput, reg80 | (1 << 2));
96 udelay(10); 102 udelay(10);