t7xx_modem_ops.h (2374B)
1/* SPDX-License-Identifier: GPL-2.0-only 2 * 3 * Copyright (c) 2021, MediaTek Inc. 4 * Copyright (c) 2021-2022, Intel Corporation. 5 * 6 * Authors: 7 * Haijun Liu <haijun.liu@mediatek.com> 8 * Eliot Lee <eliot.lee@intel.com> 9 * Moises Veleta <moises.veleta@intel.com> 10 * Ricardo Martinez <ricardo.martinez@linux.intel.com> 11 * 12 * Contributors: 13 * Amir Hanania <amir.hanania@intel.com> 14 * Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com> 15 * Sreehari Kancharla <sreehari.kancharla@intel.com> 16 */ 17 18#ifndef __T7XX_MODEM_OPS_H__ 19#define __T7XX_MODEM_OPS_H__ 20 21#include <linux/spinlock.h> 22#include <linux/types.h> 23#include <linux/workqueue.h> 24 25#include "t7xx_hif_cldma.h" 26#include "t7xx_pci.h" 27 28#define FEATURE_COUNT 64 29 30/** 31 * enum hif_ex_stage - HIF exception handshake stages with the HW. 32 * @HIF_EX_INIT: Disable and clear TXQ. 33 * @HIF_EX_INIT_DONE: Polling for initialization to be done. 34 * @HIF_EX_CLEARQ_DONE: Disable RX, flush TX/RX workqueues and clear RX. 35 * @HIF_EX_ALLQ_RESET: HW is back in safe mode for re-initialization and restart. 36 */ 37enum hif_ex_stage { 38 HIF_EX_INIT, 39 HIF_EX_INIT_DONE, 40 HIF_EX_CLEARQ_DONE, 41 HIF_EX_ALLQ_RESET, 42}; 43 44struct mtk_runtime_feature { 45 u8 feature_id; 46 u8 support_info; 47 u8 reserved[2]; 48 __le32 data_len; 49 __le32 data[]; 50}; 51 52enum md_event_id { 53 FSM_PRE_START, 54 FSM_START, 55 FSM_READY, 56}; 57 58struct t7xx_sys_info { 59 bool ready; 60 bool handshake_ongoing; 61 u8 feature_set[FEATURE_COUNT]; 62 struct t7xx_port *ctl_port; 63}; 64 65struct t7xx_modem { 66 struct cldma_ctrl *md_ctrl[CLDMA_NUM]; 67 struct t7xx_pci_dev *t7xx_dev; 68 struct t7xx_sys_info core_md; 69 bool md_init_finish; 70 bool rgu_irq_asserted; 71 struct workqueue_struct *handshake_wq; 72 struct work_struct handshake_work; 73 struct t7xx_fsm_ctl *fsm_ctl; 74 struct port_proxy *port_prox; 75 unsigned int exp_id; 76 spinlock_t exp_lock; /* Protects exception events */ 77}; 78 79void t7xx_md_exception_handshake(struct t7xx_modem *md); 80void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id); 81int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev); 82int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev); 83void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev); 84void t7xx_clear_rgu_irq(struct t7xx_pci_dev *t7xx_dev); 85int t7xx_acpi_fldr_func(struct t7xx_pci_dev *t7xx_dev); 86int t7xx_pci_mhccif_isr(struct t7xx_pci_dev *t7xx_dev); 87 88#endif /* __T7XX_MODEM_OPS_H__ */