Lines Matching full:wo

19 static u32 wo_r32(struct mtk_wed_wo *wo, u32 reg)  in wo_r32()  argument
21 return readl(wo->boot.addr + reg); in wo_r32()
24 static void wo_w32(struct mtk_wed_wo *wo, u32 reg, u32 val) in wo_w32() argument
26 writel(val, wo->boot.addr + reg); in wo_w32()
48 mtk_wed_mcu_get_response(struct mtk_wed_wo *wo, unsigned long expires) in mtk_wed_mcu_get_response() argument
53 wait_event_timeout(wo->mcu.wait, !skb_queue_empty(&wo->mcu.res_q), in mtk_wed_mcu_get_response()
55 return skb_dequeue(&wo->mcu.res_q); in mtk_wed_mcu_get_response()
58 void mtk_wed_mcu_rx_event(struct mtk_wed_wo *wo, struct sk_buff *skb) in mtk_wed_mcu_rx_event() argument
60 skb_queue_tail(&wo->mcu.res_q, skb); in mtk_wed_mcu_rx_event()
61 wake_up(&wo->mcu.wait); in mtk_wed_mcu_rx_event()
82 void mtk_wed_mcu_rx_unsolicited_event(struct mtk_wed_wo *wo, in mtk_wed_mcu_rx_unsolicited_event() argument
91 dev_notice(wo->hw->dev, "%s\n", skb->data); in mtk_wed_mcu_rx_unsolicited_event()
99 dev_notice(wo->hw->dev, in mtk_wed_mcu_rx_unsolicited_event()
108 mtk_wed_update_rx_stats(wo->hw->wed_dev, skb); in mtk_wed_mcu_rx_unsolicited_event()
118 mtk_wed_mcu_skb_send_msg(struct mtk_wed_wo *wo, struct sk_buff *skb, in mtk_wed_mcu_skb_send_msg() argument
124 wo->mcu.timeout = 20 * HZ; in mtk_wed_mcu_skb_send_msg()
131 u16 seq = ++wo->mcu.seq; in mtk_wed_mcu_skb_send_msg()
134 seq = ++wo->mcu.seq; in mtk_wed_mcu_skb_send_msg()
143 return mtk_wed_wo_queue_tx_skb(wo, &wo->q_tx, skb); in mtk_wed_mcu_skb_send_msg()
147 mtk_wed_mcu_parse_response(struct mtk_wed_wo *wo, struct sk_buff *skb, in mtk_wed_mcu_parse_response() argument
153 dev_err(wo->hw->dev, "Message %08x (seq %d) timeout\n", in mtk_wed_mcu_parse_response()
165 mtk_wed_update_rx_stats(wo->hw->wed_dev, skb); in mtk_wed_mcu_parse_response()
174 int mtk_wed_mcu_send_msg(struct mtk_wed_wo *wo, int id, int cmd, in mtk_wed_mcu_send_msg() argument
186 mutex_lock(&wo->mcu.mutex); in mtk_wed_mcu_send_msg()
188 ret = mtk_wed_mcu_skb_send_msg(wo, skb, id, cmd, &seq, wait_resp); in mtk_wed_mcu_send_msg()
192 expires = jiffies + wo->mcu.timeout; in mtk_wed_mcu_send_msg()
194 skb = mtk_wed_mcu_get_response(wo, expires); in mtk_wed_mcu_send_msg()
195 ret = mtk_wed_mcu_parse_response(wo, skb, cmd, seq); in mtk_wed_mcu_send_msg()
200 mutex_unlock(&wo->mcu.mutex); in mtk_wed_mcu_send_msg()
208 struct mtk_wed_wo *wo = dev->hw->wed_wo; in mtk_wed_mcu_msg_update() local
213 if (WARN_ON(!wo)) in mtk_wed_mcu_msg_update()
216 return mtk_wed_mcu_send_msg(wo, MTK_WED_MODULE_ID_WO, id, data, len, in mtk_wed_mcu_msg_update()
221 mtk_wed_get_memory_region(struct mtk_wed_wo *wo, in mtk_wed_get_memory_region() argument
228 index = of_property_match_string(wo->hw->node, "memory-region-names", in mtk_wed_get_memory_region()
233 np = of_parse_phandle(wo->hw->node, "memory-region", index); in mtk_wed_get_memory_region()
245 region->addr = devm_ioremap(wo->hw->dev, region->phy_addr, region->size); in mtk_wed_get_memory_region()
251 mtk_wed_mcu_run_firmware(struct mtk_wed_wo *wo, const struct firmware *fw, in mtk_wed_mcu_run_firmware() argument
295 mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo) in mtk_wed_mcu_load_firmware() argument
299 .name = "wo-emi", in mtk_wed_mcu_load_firmware()
302 .name = "wo-ilm", in mtk_wed_mcu_load_firmware()
305 .name = "wo-data", in mtk_wed_mcu_load_firmware()
317 ret = mtk_wed_get_memory_region(wo, &mem_region[i]); in mtk_wed_mcu_load_firmware()
322 wo->boot.name = "wo-boot"; in mtk_wed_mcu_load_firmware()
323 ret = mtk_wed_get_memory_region(wo, &wo->boot); in mtk_wed_mcu_load_firmware()
328 wed_w32(wo->hw->wed_dev, MTK_WED_SCR0 + 4 * MTK_WED_DUMMY_CR_FWDL, in mtk_wed_mcu_load_firmware()
329 wo->hw->index + 1); in mtk_wed_mcu_load_firmware()
332 if (of_device_is_compatible(wo->hw->node, "mediatek,mt7981-wed")) in mtk_wed_mcu_load_firmware()
335 fw_name = wo->hw->index ? MT7986_FIRMWARE_WO1 : MT7986_FIRMWARE_WO0; in mtk_wed_mcu_load_firmware()
337 ret = request_firmware(&fw, fw_name, wo->hw->dev); in mtk_wed_mcu_load_firmware()
343 dev_info(wo->hw->dev, in mtk_wed_mcu_load_firmware()
344 "MTK WED WO Firmware Version: %.10s, Build Time: %.15s\n", in mtk_wed_mcu_load_firmware()
346 dev_info(wo->hw->dev, "MTK WED WO Chip ID %02x Region %d\n", in mtk_wed_mcu_load_firmware()
350 ret = mtk_wed_mcu_run_firmware(wo, fw, &mem_region[i]); in mtk_wed_mcu_load_firmware()
356 boot_cr = wo->hw->index ? MTK_WO_MCU_CFG_LS_WA_BOOT_ADDR_ADDR in mtk_wed_mcu_load_firmware()
358 wo_w32(wo, boot_cr, mem_region[MTK_WED_WO_REGION_EMI].phy_addr >> 16); in mtk_wed_mcu_load_firmware()
359 /* wo firmware reset */ in mtk_wed_mcu_load_firmware()
360 wo_w32(wo, MTK_WO_MCU_CFG_LS_WF_MCCR_CLR_ADDR, 0xc00); in mtk_wed_mcu_load_firmware()
362 val = wo_r32(wo, MTK_WO_MCU_CFG_LS_WF_MCU_CFG_WM_WA_ADDR); in mtk_wed_mcu_load_firmware()
363 val |= wo->hw->index ? MTK_WO_MCU_CFG_LS_WF_WM_WA_WA_CPU_RSTB_MASK in mtk_wed_mcu_load_firmware()
365 wo_w32(wo, MTK_WO_MCU_CFG_LS_WF_MCU_CFG_WM_WA_ADDR, val); in mtk_wed_mcu_load_firmware()
373 mtk_wed_mcu_read_fw_dl(struct mtk_wed_wo *wo) in mtk_wed_mcu_read_fw_dl() argument
375 return wed_r32(wo->hw->wed_dev, in mtk_wed_mcu_read_fw_dl()
379 int mtk_wed_mcu_init(struct mtk_wed_wo *wo) in mtk_wed_mcu_init() argument
384 skb_queue_head_init(&wo->mcu.res_q); in mtk_wed_mcu_init()
385 init_waitqueue_head(&wo->mcu.wait); in mtk_wed_mcu_init()
386 mutex_init(&wo->mcu.mutex); in mtk_wed_mcu_init()
388 ret = mtk_wed_mcu_load_firmware(wo); in mtk_wed_mcu_init()
392 return readx_poll_timeout(mtk_wed_mcu_read_fw_dl, wo, val, !val, in mtk_wed_mcu_init()