Exemple #1
0
/**
 * wil6210_debugfs_init_offset - create set of debugfs files
 * @wil - driver's context, used for printing
 * @dbg - directory on the debugfs, where files will be created
 * @base - base address used in address calculation
 * @tbl - table with file descriptions. Should be terminated with empty element.
 *
 * Creates files accordingly to the @tbl.
 */
static void wil6210_debugfs_init_offset(struct wil6210_priv *wil,
					struct dentry *dbg, void *base,
					const struct dbg_off * const tbl)
{
	int i;

	for (i = 0; tbl[i].name; i++) {
		struct dentry *f;

		switch (tbl[i].type) {
		case doff_u32:
			f = debugfs_create_u32(tbl[i].name, tbl[i].mode, dbg,
					       base + tbl[i].off);
			break;
		case doff_x32:
			f = debugfs_create_x32(tbl[i].name, tbl[i].mode, dbg,
					       base + tbl[i].off);
			break;
		case doff_ulong:
			f = wil_debugfs_create_ulong(tbl[i].name, tbl[i].mode,
						     dbg, base + tbl[i].off);
			break;
		case doff_io32:
			f = wil_debugfs_create_iomem_x32(tbl[i].name,
							 tbl[i].mode, dbg,
							 base + tbl[i].off);
			break;
		default:
			f = ERR_PTR(-EINVAL);
		}
		if (IS_ERR_OR_NULL(f))
			wil_err(wil, "Create file \"%s\": err %ld\n",
				tbl[i].name, PTR_ERR(f));
	}
}
Exemple #2
0
int wil6210_debugfs_init(struct wil6210_priv *wil)
{
	struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME,
			wil_to_wiphy(wil)->debugfsdir);

	if (IS_ERR_OR_NULL(dbg))
		return -ENODEV;

	debugfs_create_file("mbox", S_IRUGO, dbg, wil, &fops_mbox);
	debugfs_create_file("vrings", S_IRUGO, dbg, wil, &fops_vring);
	debugfs_create_file("stations", S_IRUGO, dbg, wil, &fops_sta);
	debugfs_create_file("desc", S_IRUGO, dbg, wil, &fops_txdesc);
	debugfs_create_u32("desc_index", S_IRUGO | S_IWUSR, dbg,
			   &dbg_txdesc_index);
	debugfs_create_u32("vring_index", S_IRUGO | S_IWUSR, dbg,
			   &dbg_vring_index);

	debugfs_create_file("bf", S_IRUGO, dbg, wil, &fops_bf);
	debugfs_create_file("ssid", S_IRUGO | S_IWUSR, dbg, wil, &fops_ssid);
	debugfs_create_u32("secure_pcp", S_IRUGO | S_IWUSR, dbg,
			   &wil->secure_pcp);
	wil_debugfs_create_ulong("status", S_IRUGO | S_IWUSR, dbg,
				 &wil->status);
	debugfs_create_u32("fw_version", S_IRUGO, dbg, &wil->fw_version);
	debugfs_create_x32("hw_version", S_IRUGO, dbg, &wil->hw_version);

	wil6210_debugfs_create_ISR(wil, "USER_ICR", dbg,
				   HOSTADDR(RGF_USER_USER_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_TX_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_TX_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_RX_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_RX_ICR));
	wil6210_debugfs_create_ISR(wil, "DMA_EP_MISC_ICR", dbg,
				   HOSTADDR(RGF_DMA_EP_MISC_ICR));
	wil6210_debugfs_create_pseudo_ISR(wil, dbg);
	wil6210_debugfs_create_ITR_CNT(wil, dbg);

	wil_debugfs_create_iomem_x32("RGF_USER_USAGE_1", S_IRUGO, dbg,
				     wil->csr +
				     HOSTADDR(RGF_USER_USAGE_1));
	debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr);
	debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread);

	debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset);
	debugfs_create_file("rxon", S_IWUSR, dbg, wil, &fops_rxon);
	debugfs_create_file("tx_mgmt", S_IWUSR, dbg, wil, &fops_txmgmt);
	debugfs_create_file("wmi_send", S_IWUSR, dbg, wil, &fops_wmi);
	debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp);
	debugfs_create_file("freq", S_IRUGO, dbg, wil, &fops_freq);
	debugfs_create_file("link", S_IRUGO, dbg, wil, &fops_link);
	debugfs_create_file("info", S_IRUGO, dbg, wil, &fops_info);

	wil6210_debugfs_init_blobs(wil, dbg);

	return 0;
}