summaryrefslogtreecommitdiff
path: root/drivers/staging/brcm80211/brcmsmac/wl_ucode_loader.c
blob: cc00dd19746bd1f35819e0be8bdaa8fc4a8435aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Copyright (c) 2010 Broadcom Corporation
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include <linux/types.h>
#include <bcmdefs.h>
#include <wl_ucode.h>

enum {
	D11UCODE_NAMETAG_START = 0,
	D11LCN0BSINITVALS24,
	D11LCN0INITVALS24,
	D11LCN1BSINITVALS24,
	D11LCN1INITVALS24,
	D11LCN2BSINITVALS24,
	D11LCN2INITVALS24,
	D11N0ABSINITVALS16,
	D11N0BSINITVALS16,
	D11N0INITVALS16,
	D11UCODE_OVERSIGHT16_MIMO,
	D11UCODE_OVERSIGHT16_MIMOSZ,
	D11UCODE_OVERSIGHT24_LCN,
	D11UCODE_OVERSIGHT24_LCNSZ,
	D11UCODE_OVERSIGHT_BOMMAJOR,
	D11UCODE_OVERSIGHT_BOMMINOR
};

struct d11init *d11lcn0bsinitvals24;
struct d11init *d11lcn0initvals24;
struct d11init *d11lcn1bsinitvals24;
struct d11init *d11lcn1initvals24;
struct d11init *d11lcn2bsinitvals24;
struct d11init *d11lcn2initvals24;
struct d11init *d11n0absinitvals16;
struct d11init *d11n0bsinitvals16;
struct d11init *d11n0initvals16;
u32 *bcm43xx_16_mimo;
u32 bcm43xx_16_mimosz;
u32 *bcm43xx_24_lcn;
u32 bcm43xx_24_lcnsz;
u32 *bcm43xx_bommajor;
u32 *bcm43xx_bomminor;

int wl_ucode_data_init(struct wl_info *wl)
{
	int rc;
	rc = wl_check_firmwares(wl);

	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24,
					     D11LCN0BSINITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn0initvals24,
					     D11LCN0INITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn1bsinitvals24,
					     D11LCN1BSINITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn1initvals24,
					     D11LCN1INITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn2bsinitvals24,
					     D11LCN2BSINITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11lcn2initvals24,
					     D11LCN2INITVALS24);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0absinitvals16,
					     D11N0ABSINITVALS16);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0bsinitvals16,
					     D11N0BSINITVALS16);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&d11n0initvals16,
					     D11N0INITVALS16);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_16_mimo,
					     D11UCODE_OVERSIGHT16_MIMO);
	rc = rc < 0 ? rc : wl_ucode_init_uint(wl, &bcm43xx_16_mimosz,
					      D11UCODE_OVERSIGHT16_MIMOSZ);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_24_lcn,
					     D11UCODE_OVERSIGHT24_LCN);
	rc = rc < 0 ? rc : wl_ucode_init_uint(wl, &bcm43xx_24_lcnsz,
					      D11UCODE_OVERSIGHT24_LCNSZ);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_bommajor,
					     D11UCODE_OVERSIGHT_BOMMAJOR);
	rc = rc < 0 ? rc : wl_ucode_init_buf(wl, (void **)&bcm43xx_bomminor,
					     D11UCODE_OVERSIGHT_BOMMINOR);
	return rc;
}

void wl_ucode_data_free(void)
{
	wl_ucode_free_buf((void *)d11lcn0bsinitvals24);
	wl_ucode_free_buf((void *)d11lcn0initvals24);
	wl_ucode_free_buf((void *)d11lcn1bsinitvals24);
	wl_ucode_free_buf((void *)d11lcn1initvals24);
	wl_ucode_free_buf((void *)d11lcn2bsinitvals24);
	wl_ucode_free_buf((void *)d11lcn2initvals24);
	wl_ucode_free_buf((void *)d11n0absinitvals16);
	wl_ucode_free_buf((void *)d11n0bsinitvals16);
	wl_ucode_free_buf((void *)d11n0initvals16);
	wl_ucode_free_buf((void *)bcm43xx_16_mimo);
	wl_ucode_free_buf((void *)bcm43xx_24_lcn);
	wl_ucode_free_buf((void *)bcm43xx_bommajor);
	wl_ucode_free_buf((void *)bcm43xx_bomminor);

	return;
}