1// SPDX-License-Identifier: ISC
2/*
3 * Copyright (c) 2013 Broadcom Corporation
4 */
5#ifndef BRCMFMAC_FIRMWARE_H
6#define BRCMFMAC_FIRMWARE_H
7
8#define BRCMF_FW_REQF_OPTIONAL 0x0001
9
10#define BRCMF_FW_NAME_LEN 320
11
12#define BRCMF_FW_DEFAULT_PATH "brcm/"
13
14#define BRCMF_FW_MAX_BOARD_TYPES 8
15
16/**
17 * struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware
18 * filename and nvram filename. Each bus type implementation should create
19 * a table of firmware mappings (using the macros defined below).
20 *
21 * @chipid: ID of chip.
22 * @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-3
23 * @fw: name of the firmware file.
24 * @nvram: name of nvram file.
25 */
26struct brcmf_firmware_mapping {
27 u32 chipid;
28 u32 revmask;
29 const char *fw_base;
30};
31
32#define BRCMF_FW_DEF(fw_name, fw_base) \
33static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
34 BRCMF_FW_DEFAULT_PATH fw_base; \
35MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin")
36
37/* Firmware and Country Local Matrix files */
38#define BRCMF_FW_CLM_DEF(fw_name, fw_base) \
39static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \
40 BRCMF_FW_DEFAULT_PATH fw_base; \
41MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin"); \
42MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".clm_blob")
43
44#define BRCMF_FW_ENTRY(chipid, mask, name) \
45 { chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME }
46
47void brcmf_fw_nvram_free(void *nvram);
48
49enum brcmf_fw_type {
50 BRCMF_FW_TYPE_BINARY,
51 BRCMF_FW_TYPE_NVRAM
52};
53
54struct brcmf_fw_item {
55 const char *path;
56 enum brcmf_fw_type type;
57 u16 flags;
58 union {
59 const struct firmware *binary;
60 struct {
61 void *data;
62 u32 len;
63 } nv_data;
64 };
65};
66
67struct brcmf_fw_request {
68 u16 domain_nr;
69 u16 bus_nr;
70 u32 n_items;
71 const char *board_types[BRCMF_FW_MAX_BOARD_TYPES];
72 struct brcmf_fw_item items[] __counted_by(n_items);
73};
74
75struct brcmf_fw_name {
76 const char *extension;
77 char *path;
78};
79
80struct brcmf_fw_request *
81brcmf_fw_alloc_request(u32 chip, u32 chiprev,
82 const struct brcmf_firmware_mapping mapping_table[],
83 u32 table_size, struct brcmf_fw_name *fwnames,
84 u32 n_fwnames);
85
86/*
87 * Request firmware(s) asynchronously. When the asynchronous request
88 * fails it will not use the callback, but call device_release_driver()
89 * instead which will call the driver .remove() callback.
90 */
91int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
92 void (*fw_cb)(struct device *dev, int err,
93 struct brcmf_fw_request *req));
94
95#endif /* BRCMFMAC_FIRMWARE_H */
96

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of linux/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h