Lines Matching +full:8 +full:dev
21 mt76x02u_multiple_mcu_reads(struct mt76_dev *dev, u8 *data, int len) in mt76x02u_multiple_mcu_reads() argument
23 struct mt76_usb *usb = &dev->usb; in mt76x02u_multiple_mcu_reads()
26 WARN_ON_ONCE(len / 8 != usb->mcu.rp_len); in mt76x02u_multiple_mcu_reads()
29 u32 reg = get_unaligned_le32(data + 8 * i) - usb->mcu.base; in mt76x02u_multiple_mcu_reads()
30 u32 val = get_unaligned_le32(data + 8 * i + 4); in mt76x02u_multiple_mcu_reads()
37 static int mt76x02u_mcu_wait_resp(struct mt76_dev *dev, u8 seq) in mt76x02u_mcu_wait_resp() argument
39 struct mt76_usb *usb = &dev->usb; in mt76x02u_mcu_wait_resp()
45 ret = mt76u_bulk_msg(dev, data, MCU_RESP_URB_SIZE, &len, in mt76x02u_mcu_wait_resp()
53 mt76x02u_multiple_mcu_reads(dev, data + 4, len - 8); in mt76x02u_mcu_wait_resp()
60 dev_err(dev->dev, "error: MCU resp evt:%lx seq:%hhx-%lx\n", in mt76x02u_mcu_wait_resp()
65 dev_err(dev->dev, "error: %s failed with %d\n", __func__, ret); in mt76x02u_mcu_wait_resp()
70 __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, in __mt76x02u_mcu_send_msg() argument
77 if (test_bit(MT76_REMOVED, &dev->phy.state)) { in __mt76x02u_mcu_send_msg()
83 seq = ++dev->mcu.msg_seq & 0xf; in __mt76x02u_mcu_send_msg()
85 seq = ++dev->mcu.msg_seq & 0xf; in __mt76x02u_mcu_send_msg()
95 ret = mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500, in __mt76x02u_mcu_send_msg()
101 ret = mt76x02u_mcu_wait_resp(dev, seq); in __mt76x02u_mcu_send_msg()
110 mt76x02u_mcu_send_msg(struct mt76_dev *dev, int cmd, const void *data, in mt76x02u_mcu_send_msg() argument
116 skb = mt76_mcu_msg_alloc(dev, data, len); in mt76x02u_mcu_send_msg()
120 mutex_lock(&dev->mcu.mutex); in mt76x02u_mcu_send_msg()
121 err = __mt76x02u_mcu_send_msg(dev, skb, cmd, wait_resp); in mt76x02u_mcu_send_msg()
122 mutex_unlock(&dev->mcu.mutex); in mt76x02u_mcu_send_msg()
133 mt76x02u_mcu_wr_rp(struct mt76_dev *dev, u32 base, in mt76x02u_mcu_wr_rp() argument
136 const int max_vals_per_cmd = MT_INBAND_PACKET_MAX_LEN / 8; in mt76x02u_mcu_wr_rp()
146 skb = alloc_skb(cnt * 8 + MT_DMA_HDR_LEN + 4, GFP_KERNEL); in mt76x02u_mcu_wr_rp()
156 mutex_lock(&dev->mcu.mutex); in mt76x02u_mcu_wr_rp()
157 ret = __mt76x02u_mcu_send_msg(dev, skb, CMD_RANDOM_WRITE, cnt == n); in mt76x02u_mcu_wr_rp()
158 mutex_unlock(&dev->mcu.mutex); in mt76x02u_mcu_wr_rp()
162 return mt76x02u_mcu_wr_rp(dev, base, data + cnt, n - cnt); in mt76x02u_mcu_wr_rp()
166 mt76x02u_mcu_rd_rp(struct mt76_dev *dev, u32 base, in mt76x02u_mcu_rd_rp() argument
170 const int max_vals_per_cmd = MT_INBAND_PACKET_MAX_LEN / 8; in mt76x02u_mcu_rd_rp()
171 struct mt76_usb *usb = &dev->usb; in mt76x02u_mcu_rd_rp()
182 skb = alloc_skb(cnt * 8 + MT_DMA_HDR_LEN + 4, GFP_KERNEL); in mt76x02u_mcu_rd_rp()
192 mutex_lock(&dev->mcu.mutex); in mt76x02u_mcu_rd_rp()
198 ret = __mt76x02u_mcu_send_msg(dev, skb, CMD_RANDOM_READ, true); in mt76x02u_mcu_rd_rp()
202 mutex_unlock(&dev->mcu.mutex); in mt76x02u_mcu_rd_rp()
207 void mt76x02u_mcu_fw_reset(struct mt76x02_dev *dev) in mt76x02u_mcu_fw_reset() argument
209 mt76u_vendor_request(&dev->mt76, MT_VEND_DEV_MODE, in mt76x02u_mcu_fw_reset()
216 __mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, u8 *data, in __mt76x02u_mcu_fw_send_data() argument
231 mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, in __mt76x02u_mcu_fw_send_data()
234 mt76u_single_wr(&dev->mt76, MT_VEND_WRITE_FCE, in __mt76x02u_mcu_fw_send_data()
239 err = mt76u_bulk_msg(&dev->mt76, data, data_len, NULL, 1000, in __mt76x02u_mcu_fw_send_data()
242 dev_err(dev->mt76.dev, "firmware upload failed: %d\n", err); in __mt76x02u_mcu_fw_send_data()
246 val = mt76_rr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX); in __mt76x02u_mcu_fw_send_data()
248 mt76_wr(dev, MT_TX_CPU_FROM_FCE_CPU_DESC_IDX, val); in __mt76x02u_mcu_fw_send_data()
253 int mt76x02u_mcu_fw_send_data(struct mt76x02_dev *dev, const void *data, in mt76x02u_mcu_fw_send_data() argument
256 int len, err = 0, pos = 0, max_len = max_payload - 8; in mt76x02u_mcu_fw_send_data()
265 err = __mt76x02u_mcu_fw_send_data(dev, buf, data + pos, in mt76x02u_mcu_fw_send_data()
280 void mt76x02u_init_mcu(struct mt76_dev *dev) in mt76x02u_init_mcu() argument
284 .tailroom = 8, in mt76x02u_init_mcu()
291 dev->mcu_ops = &mt76x02u_mcu_ops; in mt76x02u_init_mcu()