Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only
0002  *
0003  * Copyright (c) 2021, MediaTek Inc.
0004  * Copyright (c) 2021-2022, Intel Corporation.
0005  *
0006  * Authors:
0007  *  Haijun Liu <haijun.liu@mediatek.com>
0008  *  Eliot Lee <eliot.lee@intel.com>
0009  *  Moises Veleta <moises.veleta@intel.com>
0010  *  Ricardo Martinez <ricardo.martinez@linux.intel.com>
0011  *
0012  * Contributors:
0013  *  Amir Hanania <amir.hanania@intel.com>
0014  *  Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>
0015  *  Sreehari Kancharla <sreehari.kancharla@intel.com>
0016  */
0017 
0018 #ifndef __T7XX_MODEM_OPS_H__
0019 #define __T7XX_MODEM_OPS_H__
0020 
0021 #include <linux/spinlock.h>
0022 #include <linux/types.h>
0023 #include <linux/workqueue.h>
0024 
0025 #include "t7xx_hif_cldma.h"
0026 #include "t7xx_pci.h"
0027 
0028 #define FEATURE_COUNT       64
0029 
0030 /**
0031  * enum hif_ex_stage -  HIF exception handshake stages with the HW.
0032  * @HIF_EX_INIT:        Disable and clear TXQ.
0033  * @HIF_EX_INIT_DONE:   Polling for initialization to be done.
0034  * @HIF_EX_CLEARQ_DONE: Disable RX, flush TX/RX workqueues and clear RX.
0035  * @HIF_EX_ALLQ_RESET:  HW is back in safe mode for re-initialization and restart.
0036  */
0037 enum hif_ex_stage {
0038     HIF_EX_INIT,
0039     HIF_EX_INIT_DONE,
0040     HIF_EX_CLEARQ_DONE,
0041     HIF_EX_ALLQ_RESET,
0042 };
0043 
0044 struct mtk_runtime_feature {
0045     u8              feature_id;
0046     u8              support_info;
0047     u8              reserved[2];
0048     __le32              data_len;
0049     __le32              data[];
0050 };
0051 
0052 enum md_event_id {
0053     FSM_PRE_START,
0054     FSM_START,
0055     FSM_READY,
0056 };
0057 
0058 struct t7xx_sys_info {
0059     bool                ready;
0060     bool                handshake_ongoing;
0061     u8              feature_set[FEATURE_COUNT];
0062     struct t7xx_port        *ctl_port;
0063 };
0064 
0065 struct t7xx_modem {
0066     struct cldma_ctrl       *md_ctrl[CLDMA_NUM];
0067     struct t7xx_pci_dev     *t7xx_dev;
0068     struct t7xx_sys_info        core_md;
0069     bool                md_init_finish;
0070     bool                rgu_irq_asserted;
0071     struct workqueue_struct     *handshake_wq;
0072     struct work_struct      handshake_work;
0073     struct t7xx_fsm_ctl     *fsm_ctl;
0074     struct port_proxy       *port_prox;
0075     unsigned int            exp_id;
0076     spinlock_t          exp_lock; /* Protects exception events */
0077 };
0078 
0079 void t7xx_md_exception_handshake(struct t7xx_modem *md);
0080 void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id);
0081 int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev);
0082 int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev);
0083 void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev);
0084 void t7xx_clear_rgu_irq(struct t7xx_pci_dev *t7xx_dev);
0085 int t7xx_acpi_fldr_func(struct t7xx_pci_dev *t7xx_dev);
0086 int t7xx_pci_mhccif_isr(struct t7xx_pci_dev *t7xx_dev);
0087 
0088 #endif  /* __T7XX_MODEM_OPS_H__ */