Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[pandora-kernel.git] / drivers / staging / brcm80211 / sys / wl_ucode_loader.c
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 typedef struct wl_info wl_info_t;
18 #include <linux/types.h>
19 #include <bcmdefs.h>
20 #include <d11ucode_ext.h>
21 #include <wl_ucode.h>
22
23 extern int wl_ucode_init_buf(wl_info_t *wl, void **pbuf, unsigned int idx);
24 extern int wl_ucode_init_uint(wl_info_t *wl, unsigned *data, unsigned int idx);
25 extern int wl_ucode_data_init(wl_info_t *wl);
26 extern void wl_ucode_data_free(void);
27 extern void wl_ucode_free_buf(void *);
28
29 d11init_t *d11lcn0bsinitvals24;
30 d11init_t *d11lcn0initvals24;
31 d11init_t *d11lcn1bsinitvals24;
32 d11init_t *d11lcn1initvals24;
33 d11init_t *d11lcn2bsinitvals24;
34 d11init_t *d11lcn2initvals24;
35 d11init_t *d11n0absinitvals16;
36 d11init_t *d11n0bsinitvals16;
37 d11init_t *d11n0initvals16;
38 u32 *bcm43xx_16_mimo;
39 u32 bcm43xx_16_mimosz;
40 u32 *bcm43xx_24_lcn;
41 u32 bcm43xx_24_lcnsz;
42 u32 *bcm43xx_bommajor;
43 u32 *bcm43xx_bomminor;
44
45 int wl_ucode_data_init(wl_info_t *wl)
46 {
47         wl_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24,
48                           D11LCN0BSINITVALS24);
49         wl_ucode_init_buf(wl, (void **)&d11lcn0initvals24, D11LCN0INITVALS24);
50         wl_ucode_init_buf(wl, (void **)&d11lcn1bsinitvals24,
51                           D11LCN1BSINITVALS24);
52         wl_ucode_init_buf(wl, (void **)&d11lcn1initvals24, D11LCN1INITVALS24);
53         wl_ucode_init_buf(wl, (void **)&d11lcn2bsinitvals24,
54                           D11LCN2BSINITVALS24);
55         wl_ucode_init_buf(wl, (void **)&d11lcn2initvals24, D11LCN2INITVALS24);
56         wl_ucode_init_buf(wl, (void **)&d11n0absinitvals16, D11N0ABSINITVALS16);
57         wl_ucode_init_buf(wl, (void **)&d11n0bsinitvals16, D11N0BSINITVALS16);
58         wl_ucode_init_buf(wl, (void **)&d11n0initvals16, D11N0INITVALS16);
59         wl_ucode_init_buf(wl, (void **)&bcm43xx_16_mimo,
60                           D11UCODE_OVERSIGHT16_MIMO);
61         wl_ucode_init_uint(wl, &bcm43xx_16_mimosz, D11UCODE_OVERSIGHT16_MIMOSZ);
62         wl_ucode_init_buf(wl, (void **)&bcm43xx_24_lcn,
63                           D11UCODE_OVERSIGHT24_LCN);
64         wl_ucode_init_uint(wl, &bcm43xx_24_lcnsz, D11UCODE_OVERSIGHT24_LCNSZ);
65         wl_ucode_init_buf(wl, (void **)&bcm43xx_bommajor,
66                           D11UCODE_OVERSIGHT_BOMMAJOR);
67         wl_ucode_init_buf(wl, (void **)&bcm43xx_bomminor,
68                           D11UCODE_OVERSIGHT_BOMMINOR);
69
70         return 0;
71 }
72
73 void wl_ucode_data_free(void)
74 {
75         wl_ucode_free_buf((void *)d11lcn0bsinitvals24);
76         wl_ucode_free_buf((void *)d11lcn0initvals24);
77         wl_ucode_free_buf((void *)d11lcn1bsinitvals24);
78         wl_ucode_free_buf((void *)d11lcn1initvals24);
79         wl_ucode_free_buf((void *)d11lcn2bsinitvals24);
80         wl_ucode_free_buf((void *)d11lcn2initvals24);
81         wl_ucode_free_buf((void *)d11n0absinitvals16);
82         wl_ucode_free_buf((void *)d11n0bsinitvals16);
83         wl_ucode_free_buf((void *)d11n0initvals16);
84         wl_ucode_free_buf((void *)bcm43xx_16_mimo);
85         wl_ucode_free_buf((void *)bcm43xx_24_lcn);
86         wl_ucode_free_buf((void *)bcm43xx_bommajor);
87         wl_ucode_free_buf((void *)bcm43xx_bomminor);
88
89         return;
90 }