linux/drivers/bus/mhi/host/pci_generic.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * MHI PCI driver - MHI over PCI controller driver
 *
 * This module is a generic driver for registering MHI-over-PCI devices,
 * such as PCIe QCOM modems.
 *
 * Copyright (C) 2020 Linaro Ltd <[email protected]>
 */

#include <linux/delay.h>
#include <linux/device.h>
#include <linux/mhi.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/pm_runtime.h>
#include <linux/timer.h>
#include <linux/workqueue.h>

#define MHI_PCI_DEFAULT_BAR_NUM

#define MHI_POST_RESET_DELAY_MS

#define HEALTH_CHECK_PERIOD

/* PCI VID definitions */
#define PCI_VENDOR_ID_THALES
#define PCI_VENDOR_ID_QUECTEL

#define MHI_EDL_DB
#define MHI_EDL_COOKIE

/**
 * struct mhi_pci_dev_info - MHI PCI device specific information
 * @config: MHI controller configuration
 * @name: name of the PCI module
 * @fw: firmware path (if any)
 * @edl: emergency download mode firmware path (if any)
 * @edl_trigger: capable of triggering EDL mode in the device (if supported)
 * @bar_num: PCI base address register to use for MHI MMIO register space
 * @dma_data_width: DMA transfer word size (32 or 64 bits)
 * @mru_default: default MRU size for MBIM network packets
 * @sideband_wake: Devices using dedicated sideband GPIO for wakeup instead
 *		   of inband wake support (such as sdx24)
 */
struct mhi_pci_dev_info {};

#define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring)						\

#define MHI_CHANNEL_CONFIG_DL(ch_num, ch_name, el_count, ev_ring)

#define MHI_CHANNEL_CONFIG_DL_AUTOQUEUE(ch_num, ch_name, el_count, ev_ring)

#define MHI_EVENT_CONFIG_CTRL(ev_ring, el_count)

#define MHI_CHANNEL_CONFIG_HW_UL(ch_num, ch_name, el_count, ev_ring)						\

#define MHI_CHANNEL_CONFIG_HW_DL(ch_num, ch_name, el_count, ev_ring)

#define MHI_CHANNEL_CONFIG_UL_SBL(ch_num, ch_name, el_count, ev_ring)						\

#define MHI_CHANNEL_CONFIG_DL_SBL(ch_num, ch_name, el_count, ev_ring)

#define MHI_CHANNEL_CONFIG_UL_FP(ch_num, ch_name, el_count, ev_ring)						\

#define MHI_CHANNEL_CONFIG_DL_FP(ch_num, ch_name, el_count, ev_ring)

#define MHI_EVENT_CONFIG_DATA(ev_ring, el_count)

#define MHI_EVENT_CONFIG_SW_DATA(ev_ring, el_count)

#define MHI_EVENT_CONFIG_HW_DATA(ev_ring, el_count, ch_num)

static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] =;

static struct mhi_event_config modem_qcom_v1_mhi_events[] =;

static const struct mhi_controller_config modem_qcom_v2_mhiv_config =;

static const struct mhi_controller_config modem_qcom_v1_mhiv_config =;

static const struct mhi_pci_dev_info mhi_qcom_sdx75_info =;

static const struct mhi_pci_dev_info mhi_qcom_sdx65_info =;

static const struct mhi_pci_dev_info mhi_qcom_sdx55_info =;

static const struct mhi_pci_dev_info mhi_qcom_sdx24_info =;

static const struct mhi_channel_config mhi_quectel_em1xx_channels[] =;

static struct mhi_event_config mhi_quectel_em1xx_events[] =;

static const struct mhi_controller_config modem_quectel_em1xx_config =;

static const struct mhi_pci_dev_info mhi_quectel_em1xx_info =;

static const struct mhi_pci_dev_info mhi_quectel_rm5xx_info =;

static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] =;

static struct mhi_event_config mhi_foxconn_sdx55_events[] =;

static const struct mhi_controller_config modem_foxconn_sdx55_config =;

static const struct mhi_controller_config modem_foxconn_sdx72_config =;

static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info =;

static const struct mhi_pci_dev_info mhi_foxconn_t99w175_info =;

static const struct mhi_pci_dev_info mhi_foxconn_dw5930e_info =;

static const struct mhi_pci_dev_info mhi_foxconn_t99w368_info =;

static const struct mhi_pci_dev_info mhi_foxconn_t99w373_info =;

static const struct mhi_pci_dev_info mhi_foxconn_t99w510_info =;

static const struct mhi_pci_dev_info mhi_foxconn_dw5932e_info =;

static const struct mhi_pci_dev_info mhi_foxconn_t99w515_info =;

static const struct mhi_pci_dev_info mhi_foxconn_dw5934e_info =;

static const struct mhi_channel_config mhi_mv3x_channels[] =;

static struct mhi_event_config mhi_mv3x_events[] =;

static const struct mhi_controller_config modem_mv3x_config =;

static const struct mhi_pci_dev_info mhi_mv31_info =;

static const struct mhi_pci_dev_info mhi_mv32_info =;

static const struct mhi_channel_config mhi_sierra_em919x_channels[] =;

static struct mhi_event_config modem_sierra_em919x_mhi_events[] =;

static const struct mhi_controller_config modem_sierra_em919x_config =;

static const struct mhi_pci_dev_info mhi_sierra_em919x_info =;

static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] =;

static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] =;

static const struct mhi_controller_config modem_telit_fn980_hw_v1_config =;

static const struct mhi_pci_dev_info mhi_telit_fn980_hw_v1_info =;

static const struct mhi_channel_config mhi_telit_fn990_channels[] =;

static struct mhi_event_config mhi_telit_fn990_events[] =;

static const struct mhi_controller_config modem_telit_fn990_config =;

static const struct mhi_pci_dev_info mhi_telit_fn990_info =;

/* Keep the list sorted based on the PID. New VID should be added as the last entry */
static const struct pci_device_id mhi_pci_id_table[] =;
MODULE_DEVICE_TABLE(pci, mhi_pci_id_table);

enum mhi_pci_device_status {};

struct mhi_pci_device {};

static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl,
			    void __iomem *addr, u32 *out)
{}

static void mhi_pci_write_reg(struct mhi_controller *mhi_cntrl,
			      void __iomem *addr, u32 val)
{}

static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl,
			      enum mhi_callback cb)
{}

static void mhi_pci_wake_get_nop(struct mhi_controller *mhi_cntrl, bool force)
{}

static void mhi_pci_wake_put_nop(struct mhi_controller *mhi_cntrl, bool override)
{}

static void mhi_pci_wake_toggle_nop(struct mhi_controller *mhi_cntrl)
{}

static bool mhi_pci_is_alive(struct mhi_controller *mhi_cntrl)
{}

static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
			 unsigned int bar_num, u64 dma_mask)
{}

static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl,
			    const struct mhi_controller_config *mhi_cntrl_config)
{}

static int mhi_pci_runtime_get(struct mhi_controller *mhi_cntrl)
{}

static void mhi_pci_runtime_put(struct mhi_controller *mhi_cntrl)
{}

static void mhi_pci_recovery_work(struct work_struct *work)
{}

static void health_check(struct timer_list *t)
{}

static int mhi_pci_generic_edl_trigger(struct mhi_controller *mhi_cntrl)
{}

static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{}

static void mhi_pci_remove(struct pci_dev *pdev)
{}

static void mhi_pci_shutdown(struct pci_dev *pdev)
{}

static void mhi_pci_reset_prepare(struct pci_dev *pdev)
{}

static void mhi_pci_reset_done(struct pci_dev *pdev)
{}

static pci_ers_result_t mhi_pci_error_detected(struct pci_dev *pdev,
					       pci_channel_state_t state)
{}

static pci_ers_result_t mhi_pci_slot_reset(struct pci_dev *pdev)
{}

static void mhi_pci_io_resume(struct pci_dev *pdev)
{}

static const struct pci_error_handlers mhi_pci_err_handler =;

static int  __maybe_unused mhi_pci_runtime_suspend(struct device *dev)
{}

static int __maybe_unused mhi_pci_runtime_resume(struct device *dev)
{}

static int  __maybe_unused mhi_pci_suspend(struct device *dev)
{}

static int __maybe_unused mhi_pci_resume(struct device *dev)
{}

static int __maybe_unused mhi_pci_freeze(struct device *dev)
{}

static int __maybe_unused mhi_pci_restore(struct device *dev)
{}

static const struct dev_pm_ops mhi_pci_pm_ops =;

static struct pci_driver mhi_pci_driver =;
module_pci_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();