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

Commit 606ea9fa authored by Ido Yariv's avatar Ido Yariv Committed by Luciano Coelho
Browse files

wl12xx: Do end-of-transactions transfers only if needed



On newer hardware revisions, there is no need to write the host's
counter at the end of a RX transaction. The same applies to writing the
number of packets at the end of a TX transaction.

It is generally a good idea to avoid unnecessary SDIO/SPI transfers.
Throughput and CPU usage are improved when avoiding these.

Send the host's RX counter and the TX packet count only if needed, based
on the hardware revision.

[Changed WL12XX_QUIRK_END_OF_TRANSACTION to use BIT(0) -- Luca]

Signed-off-by: default avatarIdo Yariv <ido@wizery.com>
Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
Reviewed-by: default avatarLuciano Coelho <coelho@ti.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 8aad2464
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -488,6 +488,9 @@ static void wl1271_boot_hw_version(struct wl1271 *wl)
	fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET;
	fuse = (fuse & PG_VER_MASK) >> PG_VER_OFFSET;


	wl->hw_pg_ver = (s8)fuse;
	wl->hw_pg_ver = (s8)fuse;

	if (((wl->hw_pg_ver & PG_MAJOR_VER_MASK) >> PG_MAJOR_VER_OFFSET) < 3)
		wl->quirks |= WL12XX_QUIRK_END_OF_TRANSACTION;
}
}


/* uploads NVS and firmware */
/* uploads NVS and firmware */
+5 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,11 @@ struct wl1271_static_data {
#define PG_VER_MASK          0x3c
#define PG_VER_MASK          0x3c
#define PG_VER_OFFSET        2
#define PG_VER_OFFSET        2


#define PG_MAJOR_VER_MASK    0x3
#define PG_MAJOR_VER_OFFSET  0x0
#define PG_MINOR_VER_MASK    0xc
#define PG_MINOR_VER_OFFSET  0x2

#define CMD_MBOX_ADDRESS     0x407B4
#define CMD_MBOX_ADDRESS     0x407B4


#define POLARITY_LOW         BIT(1)
#define POLARITY_LOW         BIT(1)
+1 −0
Original line number Original line Diff line number Diff line
@@ -3404,6 +3404,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
	wl->last_tx_hlid = 0;
	wl->last_tx_hlid = 0;
	wl->ap_ps_map = 0;
	wl->ap_ps_map = 0;
	wl->ap_fw_ps_map = 0;
	wl->ap_fw_ps_map = 0;
	wl->quirks = 0;


	memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
	memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
	for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
	for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
+7 −1
Original line number Original line Diff line number Diff line
@@ -198,6 +198,12 @@ void wl1271_rx(struct wl1271 *wl, struct wl1271_fw_common_status *status)
			pkt_offset += pkt_length;
			pkt_offset += pkt_length;
		}
		}
	}
	}

	/*
	 * Write the driver's packet counter to the FW. This is only required
	 * for older hardware revisions
	 */
	if (wl->quirks & WL12XX_QUIRK_END_OF_TRANSACTION)
		wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter);
		wl1271_write32(wl, RX_DRIVER_COUNTER_ADDRESS, wl->rx_counter);
}
}


+8 −2
Original line number Original line Diff line number Diff line
@@ -506,8 +506,14 @@ void wl1271_tx_work_locked(struct wl1271 *wl)
		sent_packets = true;
		sent_packets = true;
	}
	}
	if (sent_packets) {
	if (sent_packets) {
		/* interrupt the firmware with the new packets */
		/*
		wl1271_write32(wl, WL1271_HOST_WR_ACCESS, wl->tx_packets_count);
		 * Interrupt the firmware with the new packets. This is only
		 * required for older hardware revisions
		 */
		if (wl->quirks & WL12XX_QUIRK_END_OF_TRANSACTION)
			wl1271_write32(wl, WL1271_HOST_WR_ACCESS,
				       wl->tx_packets_count);

		wl1271_handle_tx_low_watermark(wl);
		wl1271_handle_tx_low_watermark(wl);
	}
	}


Loading