drivers/net/wireless/ath/ath10k/core.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/ath10k/core.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/ath10k/core.c
Extension
.c
Size
101342 bytes
Lines
3785
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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

WARN_ON(!ath10k_core_fw_feature_str[feat])) {
		return scnprintf(buf, buf_len, "bit%d", feat);
	}

	return scnprintf(buf, buf_len, "%s", ath10k_core_fw_feature_str[feat]);
}

void ath10k_core_get_fw_features_str(struct ath10k *ar,
				     char *buf,
				     size_t buf_len)
{
	size_t len = 0;
	int i;

	for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) {
		if (test_bit(i, ar->normal_mode_fw.fw_file.fw_features)) {
			if (len > 0)
				len += scnprintf(buf + len, buf_len - len, ",");

			len += ath10k_core_get_fw_feature_str(buf + len,
							      buf_len - len,
							      i);
		}
	}
}

static void ath10k_send_suspend_complete(struct ath10k *ar)
{
	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot suspend complete\n");

	complete(&ar->target_suspend);
}

static int ath10k_init_sdio(struct ath10k *ar, enum ath10k_firmware_mode mode)
{
	bool mtu_workaround = ar->hw_params.credit_size_workaround;
	int ret;
	u32 param = 0;

	ret = ath10k_bmi_write32(ar, hi_mbox_io_block_sz, 256);
	if (ret)
		return ret;

	ret = ath10k_bmi_write32(ar, hi_mbox_isr_yield_limit, 99);
	if (ret)
		return ret;

	ret = ath10k_bmi_read32(ar, hi_acs_flags, &param);
	if (ret)
		return ret;

	param |= HI_ACS_FLAGS_SDIO_REDUCE_TX_COMPL_SET;

	if (mode == ATH10K_FIRMWARE_MODE_NORMAL && !mtu_workaround)
		param |= HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;
	else
		param &= ~HI_ACS_FLAGS_ALT_DATA_CREDIT_SIZE;

	if (mode == ATH10K_FIRMWARE_MODE_UTF)
		param &= ~HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;
	else
		param |= HI_ACS_FLAGS_SDIO_SWAP_MAILBOX_SET;

	ret = ath10k_bmi_write32(ar, hi_acs_flags, param);
	if (ret)
		return ret;

	ret = ath10k_bmi_read32(ar, hi_option_flag2, &param);
	if (ret)
		return ret;

	param |= HI_OPTION_SDIO_CRASH_DUMP_ENHANCEMENT_HOST;

	ret = ath10k_bmi_write32(ar, hi_option_flag2, param);
	if (ret)
		return ret;

	return 0;
}

static int ath10k_init_configure_target(struct ath10k *ar)
{
	u32 param_host;
	int ret;

	/* tell target which HTC version it is used*/
	ret = ath10k_bmi_write32(ar, hi_app_host_interest,
				 HTC_PROTOCOL_VERSION);
	if (ret) {
		ath10k_err(ar, "settings HTC version failed\n");

Annotation

Implementation Notes