linux/drivers/net/wwan/t7xx/t7xx_modem_ops.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2021, MediaTek Inc.
 * Copyright (c) 2021-2022, Intel Corporation.
 *
 * Authors:
 *  Haijun Liu <[email protected]>
 *  Eliot Lee <[email protected]>
 *  Moises Veleta <[email protected]>
 *  Ricardo Martinez <[email protected]>
 *
 * Contributors:
 *  Amir Hanania <[email protected]>
 *  Chiranjeevi Rapolu <[email protected]>
 *  Sreehari Kancharla <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/gfp.h>
#include <linux/io.h>
#include <linux/irqreturn.h>
#include <linux/kthread.h>
#include <linux/skbuff.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/wait.h>
#include <linux/workqueue.h>

#include "t7xx_cldma.h"
#include "t7xx_hif_cldma.h"
#include "t7xx_mhccif.h"
#include "t7xx_modem_ops.h"
#include "t7xx_netdev.h"
#include "t7xx_pci.h"
#include "t7xx_pcie_mac.h"
#include "t7xx_port.h"
#include "t7xx_port_proxy.h"
#include "t7xx_reg.h"
#include "t7xx_state_monitor.h"

#define RT_ID_MD_PORT_ENUM
#define RT_ID_AP_PORT_ENUM
/* Modem feature query identification code - "ICCC" */
#define MD_FEATURE_QUERY_ID

#define FEATURE_VER
#define FEATURE_MSK

#define RGU_RESET_DELAY_MS
#define PORT_RESET_DELAY_MS
#define FASTBOOT_RESET_DELAY_MS
#define EX_HS_TIMEOUT_MS
#define EX_HS_POLL_DELAY_MS

enum mtk_feature_support_type {};

static unsigned int t7xx_get_interrupt_status(struct t7xx_pci_dev *t7xx_dev)
{}

/**
 * t7xx_pci_mhccif_isr() - Process MHCCIF interrupts.
 * @t7xx_dev: MTK device.
 *
 * Check the interrupt status and queue commands accordingly.
 *
 * Returns:
 ** 0		- Success.
 ** -EINVAL	- Failure to get FSM control.
 */
int t7xx_pci_mhccif_isr(struct t7xx_pci_dev *t7xx_dev)
{}

static void t7xx_clr_device_irq_via_pcie(struct t7xx_pci_dev *t7xx_dev)
{}

void t7xx_clear_rgu_irq(struct t7xx_pci_dev *t7xx_dev)
{}

static int t7xx_acpi_reset(struct t7xx_pci_dev *t7xx_dev, char *fn_name)
{}

static void t7xx_host_event_notify(struct t7xx_pci_dev *t7xx_dev, unsigned int event_id)
{}

int t7xx_reset_device(struct t7xx_pci_dev *t7xx_dev, enum reset_type type)
{}

static void t7xx_reset_device_via_pmic(struct t7xx_pci_dev *t7xx_dev)
{}

static irqreturn_t t7xx_rgu_isr_thread(int irq, void *data)
{}

static irqreturn_t t7xx_rgu_isr_handler(int irq, void *data)
{}

static void t7xx_pcie_register_rgu_isr(struct t7xx_pci_dev *t7xx_dev)
{}

/**
 * t7xx_cldma_exception() - CLDMA exception handler.
 * @md_ctrl: modem control struct.
 * @stage: exception stage.
 *
 * Part of the modem exception recovery.
 * Stages are one after the other as describe below:
 * HIF_EX_INIT:		Disable and clear TXQ.
 * HIF_EX_CLEARQ_DONE:	Disable RX, flush TX/RX workqueues and clear RX.
 * HIF_EX_ALLQ_RESET:	HW is back in safe mode for re-initialization and restart.
 */

/* Modem Exception Handshake Flow
 *
 * Modem HW Exception interrupt received
 *           (MD_IRQ_CCIF_EX)
 *                   |
 *         +---------v--------+
 *         |   HIF_EX_INIT    | : Disable and clear TXQ
 *         +------------------+
 *                   |
 *         +---------v--------+
 *         | HIF_EX_INIT_DONE | : Wait for the init to be done
 *         +------------------+
 *                   |
 *         +---------v--------+
 *         |HIF_EX_CLEARQ_DONE| : Disable and clear RXQ
 *         +------------------+ : Flush TX/RX workqueues
 *                   |
 *         +---------v--------+
 *         |HIF_EX_ALLQ_RESET | : Restart HW and CLDMA
 *         +------------------+
 */
static void t7xx_cldma_exception(struct cldma_ctrl *md_ctrl, enum hif_ex_stage stage)
{}

static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage)
{}

static int t7xx_wait_hif_ex_hk_event(struct t7xx_modem *md, int event_id)
{}

static void t7xx_md_sys_sw_init(struct t7xx_pci_dev *t7xx_dev)
{}

struct feature_query {};

static void t7xx_prepare_host_rt_data_query(struct t7xx_sys_info *core)
{}

static int t7xx_prepare_device_rt_data(struct t7xx_sys_info *core, struct device *dev,
				       void *data)
{}

static int t7xx_parse_host_rt_data(struct t7xx_fsm_ctl *ctl, struct t7xx_sys_info *core,
				   struct device *dev, void *data, int data_length)
{}

static int t7xx_core_reset(struct t7xx_modem *md)
{}

static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info,
				 struct t7xx_fsm_ctl *ctl,
				 enum t7xx_fsm_event_state event_id,
				 enum t7xx_fsm_event_state err_detect)
{}

static void t7xx_md_hk_wq(struct work_struct *work)
{}

static void t7xx_ap_hk_wq(struct work_struct *work)
{}

void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
{}

void t7xx_md_exception_handshake(struct t7xx_modem *md)
{}

static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev)
{}

int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev)
{}

/**
 * t7xx_md_init() - Initialize modem.
 * @t7xx_dev: MTK device.
 *
 * Allocate and initialize MD control block, and initialize data path.
 * Register MHCCIF ISR and RGU ISR, and start the state machine.
 *
 * Return:
 ** 0		- Success.
 ** -ENOMEM	- Allocation failure.
 */
int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
{}

void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev)
{}