drivers/accel/qaic/mhi_controller.c

Source file repositories/reference/linux-study-clean/drivers/accel/qaic/mhi_controller.c

File Facts

System
Linux kernel
Corpus path
drivers/accel/qaic/mhi_controller.c
Extension
.c
Size
21292 bytes
Lines
933
Domain
Driver Families
Bucket
drivers/accel
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only

/* Copyright (c) 2019-2021, The Linux Foundation. All rights reserved. */
/* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */

#include <linux/delay.h>
#include <linux/err.h>
#include <linux/memblock.h>
#include <linux/mhi.h>
#include <linux/moduleparam.h>
#include <linux/pci.h>
#include <linux/sizes.h>

#include "mhi_controller.h"
#include "qaic.h"

#define MAX_RESET_TIME_SEC 25

static unsigned int mhi_timeout_ms = 2000; /* 2 sec default */
module_param(mhi_timeout_ms, uint, 0600);
MODULE_PARM_DESC(mhi_timeout_ms, "MHI controller timeout value");

static const char *fw_image_paths[FAMILY_MAX] = {
	[FAMILY_AIC100] = "qcom/aic100/sbl.bin",
	[FAMILY_AIC200] = "qcom/aic200/sbl.bin",
};

static const struct mhi_channel_config aic100_channels[] = {
	{
		.name = "QAIC_LOOPBACK",
		.num = 0,
		.num_elements = 32,
		.local_elements = 0,
		.event_ring = 0,
		.dir = DMA_TO_DEVICE,
		.ee_mask = MHI_CH_EE_AMSS,
		.pollcfg = 0,
		.doorbell = MHI_DB_BRST_DISABLE,
		.lpm_notify = false,
		.offload_channel = false,
		.doorbell_mode_switch = false,
		.wake_capable = false,
	},
	{
		.name = "QAIC_LOOPBACK",
		.num = 1,
		.num_elements = 32,
		.local_elements = 0,
		.event_ring = 0,
		.dir = DMA_FROM_DEVICE,
		.ee_mask = MHI_CH_EE_AMSS,
		.pollcfg = 0,
		.doorbell = MHI_DB_BRST_DISABLE,
		.lpm_notify = false,
		.offload_channel = false,
		.doorbell_mode_switch = false,
		.wake_capable = false,
	},
	{
		.name = "QAIC_SAHARA",
		.num = 2,
		.num_elements = 32,
		.local_elements = 0,
		.event_ring = 0,
		.dir = DMA_TO_DEVICE,
		.ee_mask = MHI_CH_EE_SBL,
		.pollcfg = 0,
		.doorbell = MHI_DB_BRST_DISABLE,
		.lpm_notify = false,
		.offload_channel = false,
		.doorbell_mode_switch = false,
		.wake_capable = false,
	},
	{
		.name = "QAIC_SAHARA",
		.num = 3,
		.num_elements = 32,
		.local_elements = 0,
		.event_ring = 0,
		.dir = DMA_FROM_DEVICE,
		.ee_mask = MHI_CH_EE_SBL,
		.pollcfg = 0,
		.doorbell = MHI_DB_BRST_DISABLE,
		.lpm_notify = false,
		.offload_channel = false,
		.doorbell_mode_switch = false,
		.wake_capable = false,
	},
	{
		.name = "QAIC_DIAG",

Annotation

Implementation Notes