Commit b63aa031 authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by Felix Fietkau

mt76usb: allow mt76u_bulk_msg be used for reads

Extend mt76u_bulk_msg() such it can be used for synchronous bulk reads.
Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 5c8b0a33
...@@ -729,16 +729,20 @@ static inline u8 q2ep(u8 qid) ...@@ -729,16 +729,20 @@ static inline u8 q2ep(u8 qid)
} }
static inline int static inline int
mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int timeout) mt76u_bulk_msg(struct mt76_dev *dev, void *data, int len, int *actual_len,
int timeout)
{ {
struct usb_interface *intf = to_usb_interface(dev->dev); struct usb_interface *intf = to_usb_interface(dev->dev);
struct usb_device *udev = interface_to_usbdev(intf); struct usb_device *udev = interface_to_usbdev(intf);
struct mt76_usb *usb = &dev->usb; struct mt76_usb *usb = &dev->usb;
unsigned int pipe; unsigned int pipe;
int sent;
pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]); if (actual_len)
return usb_bulk_msg(udev, pipe, data, len, &sent, timeout); pipe = usb_rcvbulkpipe(udev, usb->in_ep[MT_EP_IN_CMD_RESP]);
else
pipe = usb_sndbulkpipe(udev, usb->out_ep[MT_EP_OUT_INBAND_CMD]);
return usb_bulk_msg(udev, pipe, data, len, actual_len, timeout);
} }
int mt76u_vendor_request(struct mt76_dev *dev, u8 req, int mt76u_vendor_request(struct mt76_dev *dev, u8 req,
......
...@@ -126,7 +126,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, ...@@ -126,7 +126,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb,
if (ret) if (ret)
return ret; return ret;
ret = mt76u_bulk_msg(dev, skb->data, skb->len, 500); ret = mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500);
if (ret) if (ret)
return ret; return ret;
...@@ -271,7 +271,7 @@ __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, u8 *data, ...@@ -271,7 +271,7 @@ __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, u8 *data,
data_len = MT_CMD_HDR_LEN + len + sizeof(info); data_len = MT_CMD_HDR_LEN + len + sizeof(info);
err = mt76u_bulk_msg(&dev->mt76, data, data_len, 1000); err = mt76u_bulk_msg(&dev->mt76, data, data_len, NULL, 1000);
if (err) { if (err) {
dev_err(dev->mt76.dev, "firmware upload failed: %d\n", err); dev_err(dev->mt76.dev, "firmware upload failed: %d\n", err);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment