Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c27e5c6a authored by Komal Seelam's avatar Komal Seelam Committed by Komal Seelam
Browse files

cnss: Sysfs support to test BMI Commands



QCA6180 supports various BMI commands which are not needed for
the wlan BMI Phase.
To verify all the BMI Commands add support to test them on need.

Test: echo 0x09 to fw_image_setup to enable bmi testing.

Commands:
BMI_NO_COMMAND, BMI_WRITE_MEMORY, BMI_READ_MEMORY,
BMI_EXECUTE, BMI_GET_TARGET_INFO, BMI_DONE

Change-Id: Ifa2ba0d53b0123e69b3d683c68cd0c773be26353
Signed-off-by: default avatarKomal Seelam <kseelam@codeaurora.org>
parent edf9ef3a
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -137,6 +137,8 @@ static DEFINE_SPINLOCK(pci_link_down_lock);
#define SEG_UNLOCKED_PAGE	(0x04)
#define SEG_NON_SECURE_DATA	(0x05)

#define BMI_TEST_SETUP		(0x09)

struct cnss_wlan_gpio_info {
	char *name;
	u32 num;
@@ -240,6 +242,7 @@ static struct cnss_data {
	dma_addr_t dma_fw_image;
	u32 dma_fw_size;
	u32 seg_count;
	uint32_t bmi_test;
	struct segment_memory seg_mem[MAX_NUM_OF_SEGMENTS];
} *penv;

@@ -1172,8 +1175,11 @@ static ssize_t fw_image_setup_store(struct device *dev,
			return -EINVAL;
		}
		penv->fw_image_setup = val;
	} else if (val == FW_IMAGE_PRINT)
	} else if (val == FW_IMAGE_PRINT) {
		print_allocated_image_table();
	} else if (val == BMI_TEST_SETUP) {
		penv->bmi_test = val;
	}

	return count;
}
@@ -2155,7 +2161,10 @@ static int cnss_probe(struct platform_device *pdev)
#endif

	ret = device_create_file(dev, &dev_attr_fw_image_setup);

	if (ret) {
		pr_err("cnss: fw_image_setup sys file creation failed\n");
		goto err_bus_reg;
	}
	pr_info("cnss: Platform driver probed successfully.\n");
	return ret;

@@ -2316,6 +2325,16 @@ void cnss_set_driver_status(enum cnss_driver_status driver_status)
}
EXPORT_SYMBOL(cnss_set_driver_status);

int cnss_get_bmi_setup(void)
{
	if (!penv)
		return -ENODEV;

	return penv->bmi_test;

}
EXPORT_SYMBOL(cnss_get_bmi_setup);

#ifdef CONFIG_CNSS_SECURE_FW
int cnss_get_sha_hash(const u8 *data, u32 data_len, u8 *hash_idx, u8 *out)
{
+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ extern int cnss_get_sha_hash(const u8 *data, u32 data_len,
extern void *cnss_get_fw_ptr(void);

extern int cnss_get_codeswap_struct(struct codeswap_codeseg_info *swap_seg);
extern int cnss_get_bmi_setup(void);

extern void cnss_pm_wake_lock_init(struct wakeup_source *ws, const char *name);
extern void cnss_pm_wake_lock(struct wakeup_source *ws);