Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
[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 #include <linux/types.h>
18 #include <bcmdefs.h>
19 #include <d11ucode_ext.h>
20 #include <wl_ucode.h>
21
22
23
24 d11init_t *d11lcn0bsinitvals24;
25 d11init_t *d11lcn0initvals24;
26 d11init_t *d11lcn1bsinitvals24;
27 d11init_t *d11lcn1initvals24;
28 d11init_t *d11lcn2bsinitvals24;
29 d11init_t *d11lcn2initvals24;
30 d11init_t *d11n0absinitvals16;
31 d11init_t *d11n0bsinitvals16;
32 d11init_t *d11n0initvals16;
33 u32 *bcm43xx_16_mimo;
34 u32 bcm43xx_16_mimosz;
35 u32 *bcm43xx_24_lcn;
36 u32 bcm43xx_24_lcnsz;
37 u32 *bcm43xx_bommajor;
38 u32 *bcm43xx_bomminor;
39
40 int wl_ucode_data_init(struct wl_info *wl)
41 {
42         int rc;
43         rc = wl_check_firmwares(wl);
44         if (rc < 0)
45                 return rc;
46         wl_ucode_init_buf(wl, (void **)&d11lcn0bsinitvals24,
47                           D11LCN0BSINITVALS24);
48         wl_ucode_init_buf(wl, (void **)&d11lcn0initvals24, D11LCN0INITVALS24);
49         wl_ucode_init_buf(wl, (void **)&d11lcn1bsinitvals24,
50                           D11LCN1BSINITVALS24);
51         wl_ucode_init_buf(wl, (void **)&d11lcn1initvals24, D11LCN1INITVALS24);
52         wl_ucode_init_buf(wl, (void **)&d11lcn2bsinitvals24,
53                           D11LCN2BSINITVALS24);
54         wl_ucode_init_buf(wl, (void **)&d11lcn2initvals24, D11LCN2INITVALS24);
55         wl_ucode_init_buf(wl, (void **)&d11n0absinitvals16, D11N0ABSINITVALS16);
56         wl_ucode_init_buf(wl, (void **)&d11n0bsinitvals16, D11N0BSINITVALS16);
57         wl_ucode_init_buf(wl, (void **)&d11n0initvals16, D11N0INITVALS16);
58         wl_ucode_init_buf(wl, (void **)&bcm43xx_16_mimo,
59                           D11UCODE_OVERSIGHT16_MIMO);
60         wl_ucode_init_uint(wl, &bcm43xx_16_mimosz, D11UCODE_OVERSIGHT16_MIMOSZ);
61         wl_ucode_init_buf(wl, (void **)&bcm43xx_24_lcn,
62                           D11UCODE_OVERSIGHT24_LCN);
63         wl_ucode_init_uint(wl, &bcm43xx_24_lcnsz, D11UCODE_OVERSIGHT24_LCNSZ);
64         wl_ucode_init_buf(wl, (void **)&bcm43xx_bommajor,
65                           D11UCODE_OVERSIGHT_BOMMAJOR);
66         wl_ucode_init_buf(wl, (void **)&bcm43xx_bomminor,
67                           D11UCODE_OVERSIGHT_BOMMINOR);
68
69         return 0;
70 }
71
72 void wl_ucode_data_free(void)
73 {
74         wl_ucode_free_buf((void *)d11lcn0bsinitvals24);
75         wl_ucode_free_buf((void *)d11lcn0initvals24);
76         wl_ucode_free_buf((void *)d11lcn1bsinitvals24);
77         wl_ucode_free_buf((void *)d11lcn1initvals24);
78         wl_ucode_free_buf((void *)d11lcn2bsinitvals24);
79         wl_ucode_free_buf((void *)d11lcn2initvals24);
80         wl_ucode_free_buf((void *)d11n0absinitvals16);
81         wl_ucode_free_buf((void *)d11n0bsinitvals16);
82         wl_ucode_free_buf((void *)d11n0initvals16);
83         wl_ucode_free_buf((void *)bcm43xx_16_mimo);
84         wl_ucode_free_buf((void *)bcm43xx_24_lcn);
85         wl_ucode_free_buf((void *)bcm43xx_bommajor);
86         wl_ucode_free_buf((void *)bcm43xx_bomminor);
87
88         return;
89 }