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

Commit 4a3b97ee authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

wlcore/wl12xx: add hw op for setting blocks in hw_tx_desc



Each chip family has a slightly different Tx descriptor. Set the
descriptor values according to family.

Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent b3b4b4b8
Loading
Loading
Loading
Loading
+20 −7
Original line number Original line Diff line number Diff line
@@ -597,6 +597,18 @@ static u32 wl12xx_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
	return (align_len + blk_size - 1) / blk_size + spare_blks;
	return (align_len + blk_size - 1) / blk_size + spare_blks;
}
}


static void
wl12xx_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
			  u32 blks, u32 spare_blks)
{
	if (wl->chip.id == CHIP_ID_1283_PG20) {
		desc->wl128x_mem.total_mem_blocks = blks;
	} else {
		desc->wl127x_mem.extra_blocks = spare_blks;
		desc->wl127x_mem.total_mem_blocks = blks;
	}
}

static bool wl12xx_mac_in_fuse(struct wl1271 *wl)
static bool wl12xx_mac_in_fuse(struct wl1271 *wl)
{
{
	bool supported = false;
	bool supported = false;
@@ -666,6 +678,7 @@ static struct wlcore_ops wl12xx_ops = {
	.trigger_cmd		= wl12xx_trigger_cmd,
	.trigger_cmd		= wl12xx_trigger_cmd,
	.ack_event		= wl12xx_ack_event,
	.ack_event		= wl12xx_ack_event,
	.calc_tx_blocks		= wl12xx_calc_tx_blocks,
	.calc_tx_blocks		= wl12xx_calc_tx_blocks,
	.set_tx_desc_blocks	= wl12xx_set_tx_desc_blocks,
	.get_pg_ver		= wl12xx_get_pg_ver,
	.get_pg_ver		= wl12xx_get_pg_ver,
	.get_mac		= wl12xx_get_mac,
	.get_mac		= wl12xx_get_mac,
};
};
+10 −0
Original line number Original line Diff line number Diff line
@@ -33,4 +33,14 @@ wlcore_hw_calc_tx_blocks(struct wl1271 *wl, u32 len, u32 spare_blks)
	return wl->ops->calc_tx_blocks(wl, len, spare_blks);
	return wl->ops->calc_tx_blocks(wl, len, spare_blks);
}
}


static inline void
wlcore_hw_set_tx_desc_blocks(struct wl1271 *wl, struct wl1271_tx_hw_descr *desc,
			     u32 blks, u32 spare_blks)
{
	if (!wl->ops->set_tx_desc_blocks)
		BUG_ON(1);

	return wl->ops->set_tx_desc_blocks(wl, desc, blks, spare_blks);
}

#endif
#endif
+2 −7
Original line number Original line Diff line number Diff line
@@ -213,13 +213,8 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct wl12xx_vif *wlvif,
		desc = (struct wl1271_tx_hw_descr *)skb_push(
		desc = (struct wl1271_tx_hw_descr *)skb_push(
			skb, total_len - skb->len);
			skb, total_len - skb->len);


		/* HW descriptor fields change between wl127x and wl128x */
		wlcore_hw_set_tx_desc_blocks(wl, desc, total_blocks,
		if (wl->chip.id == CHIP_ID_1283_PG20) {
					     spare_blocks);
			desc->wl128x_mem.total_mem_blocks = total_blocks;
		} else {
			desc->wl127x_mem.extra_blocks = spare_blocks;
			desc->wl127x_mem.total_mem_blocks = total_blocks;
		}


		desc->id = id;
		desc->id = id;


+5 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,8 @@
#include "wl12xx.h"
#include "wl12xx.h"
#include "event.h"
#include "event.h"


struct wl1271_tx_hw_descr;

/* The maximum number of Tx descriptors in all chip families */
/* The maximum number of Tx descriptors in all chip families */
#define WLCORE_MAX_TX_DESCRIPTORS 32
#define WLCORE_MAX_TX_DESCRIPTORS 32


@@ -36,6 +38,9 @@ struct wlcore_ops {
	void (*trigger_cmd)(struct wl1271 *wl);
	void (*trigger_cmd)(struct wl1271 *wl);
	void (*ack_event)(struct wl1271 *wl);
	void (*ack_event)(struct wl1271 *wl);
	u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks);
	u32 (*calc_tx_blocks)(struct wl1271 *wl, u32 len, u32 spare_blks);
	void (*set_tx_desc_blocks)(struct wl1271 *wl,
				   struct wl1271_tx_hw_descr *desc,
				   u32 blks, u32 spare_blks);
	s8 (*get_pg_ver)(struct wl1271 *wl);
	s8 (*get_pg_ver)(struct wl1271 *wl);
	void (*get_mac)(struct wl1271 *wl);
	void (*get_mac)(struct wl1271 *wl);
};
};