Skip to contentSkip to conversation

wlcore/wl18xx: fw logger over sdio

PATCH Applied Guy Mishol 2 participants 2 messages Dec 22, 2015 – Dec 31, 2015 TI wilink wireless drivers

lore
Share & tools
lore

Guy Mishol

author
#0 lore raw

PATCH 1/1 wlcore/wl18xx: fw logger over sdio

From: Shahar Patury <[email protected]>

Enable the FW Logger to work over the SDIO interface in addition to over UART interface.
In the new design we use fw internal memory instead of packet ram that was used in older (wl12xx) design.
This change reduces the impact on TP and stability.

A new event was added to notify fw logger is ready for reading. Dynamic configuration to debugfs was added as well.

---
V6: Resubmitted again due to patch description update

 drivers/net/wireless/ti/wl18xx/event.c   |    2 +
 drivers/net/wireless/ti/wl18xx/event.h   |    1 +
 drivers/net/wireless/ti/wl18xx/main.c    |    9 ++-
 drivers/net/wireless/ti/wlcore/cmd.h     |    1 -
 drivers/net/wireless/ti/wlcore/debugfs.c |   60 +++++++++++++++++++
 drivers/net/wireless/ti/wlcore/event.c   |   82 +++++++++++++++++++++++++
 drivers/net/wireless/ti/wlcore/event.h   |    9 +++
 drivers/net/wireless/ti/wlcore/io.c      |   11 ++--
 drivers/net/wireless/ti/wlcore/io.h      |    4 +-
 drivers/net/wireless/ti/wlcore/main.c    |   96 +++--------------------------
 drivers/net/wireless/ti/wlcore/rx.c      |    1 -
 drivers/net/wireless/ti/wlcore/sysfs.c   |   26 --------
 drivers/net/wireless/ti/wlcore/wlcore.h  |    3 -
 13 files changed, 177 insertions(+), 128 deletions(-)
drivers/net/wireless/ti/wl18xx/event.c +2 -0
index 09c7e09..719907a 100644
@@ -205,6 +205,8 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
 						 mbox->sc_ssid,
 						 mbox->sc_pwd_len,
 						 mbox->sc_pwd);
+	if (vector & FW_LOGGER_INDICATION)
+		wlcore_event_fw_logger(wl);
 
 	return 0;
 }
drivers/net/wireless/ti/wl18xx/event.h +1 -0
index f3d4f13..070de12 100644
@@ -41,6 +41,7 @@ enum {
 	SMART_CONFIG_SYNC_EVENT_ID               = BIT(22),
 	SMART_CONFIG_DECODE_EVENT_ID             = BIT(23),
 	TIME_SYNC_EVENT_ID                       = BIT(24),
+	FW_LOGGER_INDICATION			= BIT(25),
 };
 
 enum wl18xx_radar_types {
drivers/net/wireless/ti/wl18xx/main.c +5 -4
index 50cce42..60eda4d 100644
@@ -461,7 +461,7 @@ static struct wlcore_conf wl18xx_conf = {
 	},
 	.fwlog = {
 		.mode                         = WL12XX_FWLOG_CONTINUOUS,
-		.mem_blocks                   = 2,
+		.mem_blocks                   = 0,
 		.severity                     = 0,
 		.timestamp                    = WL12XX_FWLOG_TIMESTAMP_DISABLED,
 		.output                       = WL12XX_FWLOG_OUTPUT_DBG_PINS,
@@ -584,7 +584,7 @@ static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
 		.mem  = { .start = 0x00A00000, .size  = 0x00012000 },
 		.reg  = { .start = 0x00807000, .size  = 0x00005000 },
 		.mem2 = { .start = 0x00800000, .size  = 0x0000B000 },
-		.mem3 = { .start = 0x00000000, .size  = 0x00000000 },
+		.mem3 = { .start = 0x00401594, .size  = 0x00001020 },
 	},
 	[PART_DOWN] = {
 		.mem  = { .start = 0x00000000, .size  = 0x00014000 },
@@ -602,7 +602,7 @@ static const struct wlcore_partition_set wl18xx_ptable[PART_TABLE_LEN] = {
 		.mem  = { .start = 0x00800000, .size  = 0x000050FC },
 		.reg  = { .start = 0x00B00404, .size  = 0x00001000 },
 		.mem2 = { .start = 0x00C00000, .size  = 0x00000400 },
-		.mem3 = { .start = 0x00000000, .size  = 0x00000000 },
+		.mem3 = { .start = 0x00401594, .size  = 0x00001020 },
 	},
 	[PART_PHY_INIT] = {
 		.mem  = { .start = WL18XX_PHY_INIT_MEM_ADDR,
@@ -1029,7 +1029,8 @@ static int wl18xx_boot(struct wl1271 *wl)
 		DFS_CHANNELS_CONFIG_COMPLETE_EVENT |
 		SMART_CONFIG_SYNC_EVENT_ID |
 		SMART_CONFIG_DECODE_EVENT_ID |
-		TIME_SYNC_EVENT_ID;
+		TIME_SYNC_EVENT_ID |
+		FW_LOGGER_INDICATION;
 
 	wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;
 
drivers/net/wireless/ti/wlcore/cmd.h +0 -1
index 8dc46c0..e28e2f23 100644
@@ -626,7 +626,6 @@ struct wl12xx_cmd_remove_peer {
  */
 enum wl12xx_fwlogger_log_mode {
 	WL12XX_FWLOG_CONTINUOUS,
-	WL12XX_FWLOG_ON_DEMAND
 };
 
 /* Include/exclude timestamps from the log messages */
drivers/net/wireless/ti/wlcore/debugfs.c +60 -0

72 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/event.c +82 -0

88 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/event.h +9 -0
index acc7a59..75e8e98 100644
@@ -64,6 +64,14 @@ enum {
 
 #define NUM_OF_RSSI_SNR_TRIGGERS 8
 
+struct fw_logger_information {
+	__le32 max_buff_size;
+	__le32 actual_buff_size;
+	__le32 num_trace_drop;
+	__le32 buff_read_ptr;
+	__le32 buff_write_ptr;
+} __packed;
+
 struct wl1271;
 
 int wl1271_event_unmask(struct wl1271 *wl);
@@ -84,4 +92,5 @@ void wlcore_event_max_tx_failure(struct wl1271 *wl, unsigned long sta_bitmap);
 void wlcore_event_inactive_sta(struct wl1271 *wl, unsigned long sta_bitmap);
 void wlcore_event_roc_complete(struct wl1271 *wl);
 void wlcore_event_rssi_trigger(struct wl1271 *wl, s8 *metric_arr);
+int  wlcore_event_fw_logger(struct wl1271 *wl);
 #endif
drivers/net/wireless/ti/wlcore/io.c +6 -5
index 68e74ee..9ac118e 100644
@@ -175,12 +175,13 @@ int wlcore_set_partition(struct wl1271 *wl,
 	if (ret < 0)
 		goto out;
 
-	/*
-	 * We don't need the size of the last partition, as it is
-	 * automatically calculated based on the total memory size and
-	 * the sizes of the previous partitions.
-	 */
 	ret = wlcore_raw_write32(wl, HW_PART3_START_ADDR, p->mem3.start);
+	if (ret < 0)
+		goto out;
+
+	ret = wlcore_raw_write32(wl, HW_PART3_SIZE_ADDR, p->mem3.size);
+	if (ret < 0)
+		goto out;
 
 out:
 	return ret;
drivers/net/wireless/ti/wlcore/io.h +2 -2
index 0305729..020c7b8 100644
@@ -36,8 +36,8 @@
 #define HW_PART1_START_ADDR             (HW_PARTITION_REGISTERS_ADDR + 12)
 #define HW_PART2_SIZE_ADDR              (HW_PARTITION_REGISTERS_ADDR + 16)
 #define HW_PART2_START_ADDR             (HW_PARTITION_REGISTERS_ADDR + 20)
-#define HW_PART3_START_ADDR             (HW_PARTITION_REGISTERS_ADDR + 24)
-
+#define HW_PART3_SIZE_ADDR              (HW_PARTITION_REGISTERS_ADDR + 24)
+#define HW_PART3_START_ADDR             (HW_PARTITION_REGISTERS_ADDR + 28)
 #define HW_ACCESS_REGISTER_SIZE         4
 
 #define HW_ACCESS_PRAM_MAX_RANGE	0x3c000
drivers/net/wireless/ti/wlcore/main.c +10 -86

151 lines not on this page · raw message

drivers/net/wireless/ti/wlcore/rx.c +0 -1
index 5b29273..34e7e93 100644
@@ -149,7 +149,6 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length,
 	if (desc->packet_class == WL12XX_RX_CLASS_LOGGER) {
 		size_t len = length - sizeof(*desc);
 		wl12xx_copy_fwlog(wl, data + sizeof(*desc), len);
-		wake_up_interruptible(&wl->fwlog_waitq);
 		return 0;
 	}
 
drivers/net/wireless/ti/wlcore/sysfs.c +0 -26
index 24dd288..a9218e5 100644
@@ -119,32 +119,6 @@ static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
 	if (ret < 0)
 		return -ERESTARTSYS;
 
-	/* Let only one thread read the log at a time, blocking others */
-	while (wl->fwlog_size == 0) {
-		DEFINE_WAIT(wait);
-
-		prepare_to_wait_exclusive(&wl->fwlog_waitq,
-					  &wait,
-					  TASK_INTERRUPTIBLE);
-
-		if (wl->fwlog_size != 0) {
-			finish_wait(&wl->fwlog_waitq, &wait);
-			break;
-		}
-
-		mutex_unlock(&wl->mutex);
-
-		schedule();
-		finish_wait(&wl->fwlog_waitq, &wait);
-
-		if (signal_pending(current))
-			return -ERESTARTSYS;
-
-		ret = mutex_lock_interruptible(&wl->mutex);
-		if (ret < 0)
-			return -ERESTARTSYS;
-	}
-
 	/* Check if the fwlog is still valid */
 	if (wl->fwlog_size < 0) {
 		mutex_unlock(&wl->mutex);
drivers/net/wireless/ti/wlcore/wlcore.h +0 -3
index 906be6a..dda01b1 100644
@@ -310,9 +310,6 @@ struct wl1271 {
 	/* FW memory block size */
 	u32 fw_mem_block_size;
 
-	/* Sysfs FW log entry readers wait queue */
-	wait_queue_head_t fwlog_waitq;
-
 	/* Hardware recovery work */
 	struct work_struct recovery_work;
 	bool watchdog_recovery;
Signature · 1 line
1.7.9
Applied
#1 lore raw
Quoted 8 lines

From: Shahar Patury <[email protected]>

Enable the FW Logger to work over the SDIO interface in addition to over UART interface. In the new design we use fw internal memory instead of packet ram that was used in older (wl12xx) design. This change reduces the impact on TP and stability.

Quoted 5 lines

A new event was added to notify fw logger is ready for reading. Dynamic configuration to debugfs was added as well.

Thanks, applied to wireless-drivers-next.git.

Kalle Valo