21 #define UNIFI_PROC_BOTH 3
28 unsigned int cmd_param_size;
31 unsigned char ret_buffer[32];
36 if (
get_user(cmd_param_size, (
int*)arg_pos)) {
38 "unifi_putest_cmd52_read: Failed to get the argument\n");
44 "unifi_putest_cmd52_read: cmd52 struct mismatch\n");
48 arg_pos +=
sizeof(
unsigned int);
53 "unifi_putest_cmd52_read: Failed to get the cmd52 params\n");
63 if (cmd52_params.
funcnum == 0) {
73 "\nunifi_putest_cmd52_read: Read8() failed (csrResult=0x%x)\n", csrResult);
82 ret_buffer_pos +=
sizeof(
unsigned int);
88 ret_buffer_pos - ret_buffer);
91 "unifi_putest_cmd52_read: Failed to return the data\n");
103 unsigned int cmd_param_size;
108 if (
get_user(cmd_param_size, (
int*)arg_pos)) {
110 "unifi_putest_cmd52_write: Failed to get the argument\n");
116 "unifi_putest_cmd52_write: cmd52 struct mismatch\n");
120 arg_pos +=
sizeof(
unsigned int);
125 "unifi_putest_cmd52_write: Failed to get the cmd52 params\n");
135 if (cmd52_params.
funcnum == 0) {
145 "unifi_putest_cmd52_write: Write8() failed (csrResult=0x%x)\n", csrResult);
156 unsigned int cmd_param_size;
159 unsigned char ret_buffer[32];
163 if (
get_user(cmd_param_size, (
int*)arg_pos)) {
165 "unifi_putest_gp_read16: Failed to get the argument\n");
171 "unifi_putest_gp_read16: struct mismatch\n");
175 arg_pos +=
sizeof(
unsigned int);
180 "unifi_putest_gp_read16: Failed to get the params\n");
188 "unifi_putest_gp_read16: unifi_card_read16() GP=0x%x failed (csrResult=0x%x)\n", gp_r16_params.
addr, csrResult);
198 ret_buffer_pos +=
sizeof(
unsigned int);
204 ret_buffer_pos - ret_buffer);
207 "unifi_putest_gp_read16: Failed to return the data\n");
218 unsigned int cmd_param_size;
222 if (
get_user(cmd_param_size, (
int*)arg_pos)) {
224 "unifi_putest_gp_write16: Failed to get the argument\n");
230 "unifi_putest_gp_write16: struct mismatch\n");
234 arg_pos +=
sizeof(
unsigned int);
239 "unifi_putest_gp_write16: Failed to get the params\n");
249 "unifi_putest_gp_write16: unifi_card_write16() GP=%x failed (csrResult=0x%x)\n", gp_w16_params.
addr, csrResult);
258 int sdio_clock_speed;
263 "unifi_putest_set_sdio_clock: Failed to get the argument\n");
274 "unifi_putest_set_sdio_clock: Set clock failed (csrResult=0x%x)\n", csrResult);
302 "unifi_putest_start: failed to suspend UniFi\n");
308 if (already_in_test) {
313 unifi_error(priv,
"Failed to start XAPs. Hard reset required.\n");
321 unifi_error(priv,
"CsrSdioPowerOn csrResult = %d\n", csrResult);
329 "unifi_putest_start: failed to init UniFi\n");
347 unifi_error(priv,
"Failed to start XAPs. Hard reset required.\n");
372 "unifi_putest_stop: failed to resume SME\n");
383 #define UF_PUTEST_MAX_FW_FILE_NAME 16
384 #define UNIFI_MAX_FW_PATH_LEN 32
385 unsigned int fw_name_length;
387 unsigned char *name_buffer;
391 struct dlpriv temp_fw_sta;
398 "unifi_putest_dl_fw: Failed to get the length argument\n");
402 unifi_trace(priv,
UDBG2,
"unifi_putest_dl_fw: file name size = %d\n", fw_name_length);
407 "unifi_putest_dl_fw: F/W file name is too long\n");
413 if (
copy_from_user(fw_name, (
void*)name_buffer, fw_name_length)) {
414 unifi_error(priv,
"unifi_putest_dl_fw: Failed to get the file name\n");
417 fw_name[fw_name_length] =
'\0';
421 temp_fw_sta = priv->
fw_sta;
429 priv->
fw_sta.fw_desc = (
void *)fw_entry;
433 unifi_error(priv,
"Firmware file not available\n");
442 unifi_error(priv,
"Failed to start XAPs. Hard reset required.\n");
453 "unifi_putest_dl_fw: failed to download the f/w\n");
461 priv->
fw_sta = temp_fw_sta;
469 unsigned int fw_length;
470 unsigned char *fw_buf =
NULL;
471 unsigned char *fw_user_ptr;
472 struct dlpriv temp_fw_sta;
478 "unifi_putest_dl_fw_buff: Failed to get the length arg\n");
482 unifi_trace(priv,
UDBG2,
"unifi_putest_dl_fw_buff: size = %d\n", fw_length);
485 if (fw_length == 0 || fw_length > 0xfffffff) {
487 "unifi_putest_dl_fw_buff: buffer length bad %u\n", fw_length);
494 unifi_error(priv,
"unifi_putest_dl_fw_buff: malloc fail\n");
501 unifi_error(priv,
"unifi_putest_dl_fw_buff: Failed to get the buffer\n");
507 temp_fw_sta = priv->
fw_sta;
514 priv->
fw_sta.dl_data = fw_buf;
515 priv->
fw_sta.dl_len = fw_length;
522 unifi_error(priv,
"Failed to start XAPs. Hard reset required.\n");
533 "unifi_putest_dl_fw_buff: failed to download the f/w\n");
539 priv->
fw_sta = temp_fw_sta;
552 unifi_info(priv,
"Preparing for SDIO coredump\n");
553 #if defined (CSR_WIFI_HIP_DEBUG_OFFLINE)
554 unifi_debug_buf_dump();
561 unifi_error(priv,
"PUTEST_START shouldn't be used before a coredump\n");
569 for (i = 0; i < 3; i++) {
574 unifi_info(priv,
"Failed to read chip version! Try %d\n", i);
583 unifi_error(priv,
"CsrSdioFunctionEnable failed %d\n", r);
595 unifi_error(priv,
"CsrSdioMaxBusClockFrequencySet() failed %d\n", r);
603 unifi_error(priv,
"unifi_card_hard_reset() failed %d\n", r);
606 unifi_info(priv,
"Read chip version of 0x%04x\n", data_u16);
633 unsigned int cmd_param_size;
635 u8 *block_local_buffer;
638 if (
get_user(cmd_param_size, (
int*)arg_pos)) {
640 "cmd52r_block: Failed to get the argument\n");
646 "cmd52r_block: cmd52 struct mismatch\n");
650 arg_pos +=
sizeof(
unsigned int);
655 "cmd52r_block: Failed to get the cmd52 params\n");
663 if (block_local_buffer ==
NULL) {
664 unifi_error(priv,
"cmd52r_block: Failed to allocate buffer\n");
672 unifi_error(priv,
"cmd52r_block: unifi_readn failed\n");
680 "cmd52r_block: Failed to return the data\n");