mcu.c (61c4fa72196845b060147c044af7b25632ff6376) mcu.c (0987295750574adc59999b8fb9890834574bc4e2)
1// SPDX-License-Identifier: ISC
2/*
3 * Copyright (C) 2019 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
4 */
5
6#include "mt76.h"
7
8struct sk_buff *

--- 10 unchanged lines hidden (view full) ---

19 skb_reserve(skb, head_len);
20 if (data && data_len)
21 skb_put_data(skb, data, data_len);
22
23 return skb;
24}
25EXPORT_SYMBOL_GPL(mt76_mcu_msg_alloc);
26
1// SPDX-License-Identifier: ISC
2/*
3 * Copyright (C) 2019 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
4 */
5
6#include "mt76.h"
7
8struct sk_buff *

--- 10 unchanged lines hidden (view full) ---

19 skb_reserve(skb, head_len);
20 if (data && data_len)
21 skb_put_data(skb, data, data_len);
22
23 return skb;
24}
25EXPORT_SYMBOL_GPL(mt76_mcu_msg_alloc);
26
27/* mmio */
28struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
29 unsigned long expires)
30{
31 unsigned long timeout;
32
33 if (!time_is_after_jiffies(expires))
34 return NULL;
35
36 timeout = expires - jiffies;
27struct sk_buff *mt76_mcu_get_response(struct mt76_dev *dev,
28 unsigned long expires)
29{
30 unsigned long timeout;
31
32 if (!time_is_after_jiffies(expires))
33 return NULL;
34
35 timeout = expires - jiffies;
37 wait_event_timeout(dev->mmio.mcu.wait,
38 (!skb_queue_empty(&dev->mmio.mcu.res_q) ||
36 wait_event_timeout(dev->mcu.wait,
37 (!skb_queue_empty(&dev->mcu.res_q) ||
39 test_bit(MT76_MCU_RESET, &dev->phy.state)),
40 timeout);
38 test_bit(MT76_MCU_RESET, &dev->phy.state)),
39 timeout);
41 return skb_dequeue(&dev->mmio.mcu.res_q);
40 return skb_dequeue(&dev->mcu.res_q);
42}
43EXPORT_SYMBOL_GPL(mt76_mcu_get_response);
44
45void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb)
46{
41}
42EXPORT_SYMBOL_GPL(mt76_mcu_get_response);
43
44void mt76_mcu_rx_event(struct mt76_dev *dev, struct sk_buff *skb)
45{
47 skb_queue_tail(&dev->mmio.mcu.res_q, skb);
48 wake_up(&dev->mmio.mcu.wait);
46 skb_queue_tail(&dev->mcu.res_q, skb);
47 wake_up(&dev->mcu.wait);
49}
50EXPORT_SYMBOL_GPL(mt76_mcu_rx_event);
48}
49EXPORT_SYMBOL_GPL(mt76_mcu_rx_event);