carl9170: update COPYRIGHT boilerplate text
[carl9170fw.git] / carlfw / src / fw.c
1 /*
2  * carl9170 firmware - used by the ar9170 wireless device
3  *
4  * Firmware descriptor
5  *
6  * Copyright 2009-2011 Christian Lamparter <chunkeey@googlemail.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  */
21 #include "carl9170.h"
22 #include "fwdsc.h"
23
24 #define FILL(small, big, more...)                                       \
25         .small = {                                                      \
26                 CARL9170FW_FILL_DESC(big##_MAGIC,                       \
27                         sizeof(struct carl9170fw_## small##_desc),      \
28                         CARL9170FW_## big##_DESC_MIN_VER,               \
29                         CARL9170FW_## big##_DESC_CUR_VER),              \
30                 more                                                    \
31         }
32
33 const struct carl9170_firmware_descriptor __in_section(fwdsc) __visible carl9170fw_desc = {
34         FILL(otus, OTUS,
35              .feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) |
36                                         BIT(CARL9170FW_USB_RESP_EP2) |
37                                         BIT(CARL9170FW_HANDLE_BACK_REQ) |
38                                         BIT(CARL9170FW_RX_FILTER) |
39                                         BIT(CARL9170FW_HW_COUNTERS) |
40                                         BIT(CARL9170FW_RX_BA_FILTER) |
41                                         BIT(CARL9170FW_USB_INIT_FIRMWARE) |
42 #ifdef CONFIG_CARL9170FW_USB_UP_STREAM
43                                         BIT(CARL9170FW_USB_UP_STREAM) |
44 #endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
45 #ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
46                                         BIT(CARL9170FW_USB_DOWN_STREAM) |
47 #endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
48 #ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
49                                         BIT(CARL9170FW_COMMAND_PHY) |
50                                         BIT(CARL9170FW_PSM) |
51                                         BIT(CARL9170FW_FIXED_5GHZ_PSM) |
52 #endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
53 #ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
54                                         BIT(CARL9170FW_COMMAND_CAM) |
55 #endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
56                                         BIT(CARL9170FW_WLANTX_CAB) |
57 #ifdef CONFIG_CARL9170FW_UNUSABLE
58                                         BIT(CARL9170FW_UNUSABLE) |
59 #endif /* CONFIG_CARL9170FW_UNUSABLE */
60 #ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
61                                         BIT(CARL9170FW_GPIO_INTERRUPT) |
62 #endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
63 #ifdef CONFIG_CARL9170FW_WOL
64                                         BIT(CARL9170FW_WOL) |
65 #endif /* CONFIG_CARL9170FW_WOL */
66                                         (0)),
67
68              .miniboot_size = cpu_to_le16(0),
69              .tx_descs = AR9170_TX_BLOCK_NUMBER,
70              .cmd_bufs = CARL9170_INT_RQ_CACHES,
71              .rx_max_frame_len = cpu_to_le16(CONFIG_CARL9170FW_RX_FRAME_LEN),
72              .tx_frag_len = cpu_to_le16(AR9170_BLOCK_SIZE),
73              .fw_address = cpu_to_le32(AR9170_PRAM_OFFSET),
74              .bcn_addr = (__le32) cpu_to_le32(&dma_mem.reserved.bcn),
75              .bcn_len = (__le16) cpu_to_le16(sizeof(dma_mem.reserved.bcn)),
76              .vif_num = CARL9170_INTF_NUM,
77              .api_ver = CONFIG_CARL9170FW_RELEASE_VERSION,
78         ),
79
80         FILL(txsq, TXSQ,
81              .seq_table_addr = cpu_to_le32(&fw.wlan.sequence),
82         ),
83
84 #ifdef CONFIG_CARL9170FW_WOL
85         FILL(wol, WOL,
86              .supported_triggers = BIT(CARL9170_WOL_DISCONNECT) |
87                                    BIT(CARL9170_WOL_MAGIC_PKT),
88         ),
89 #endif /* CONFIG_CARL9170FW_WOL */
90
91
92         FILL(motd, MOTD,
93              .fw_year_month_day = cpu_to_le32(
94                         CARL9170FW_SET_DAY(CARL9170FW_VERSION_DAY) +
95                         CARL9170FW_SET_MONTH(CARL9170FW_VERSION_MONTH) +
96                         CARL9170FW_SET_YEAR(CARL9170FW_VERSION_YEAR)),
97              .desc = "Community AR9170 Linux",
98              .release = CARL9170FW_VERSION_GIT),
99
100         FILL(dbg, DBG,
101              .bogoclock_addr = cpu_to_le32(0),
102              .counter_addr = cpu_to_le32(&fw.counter),
103              .rx_total_addr = cpu_to_le32(0),
104              .rx_overrun_addr = cpu_to_le32(0),
105              .rx_filter = cpu_to_le32(&fw.wlan.rx_filter),
106         ),
107
108         FILL(last, LAST),
109 };
110
111 #undef FILL
112
113 struct firmware_context_struct fw;