1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2014 Broadcom Corporation
4  */
5 #ifndef BRCMFMAC_COMMON_H
6 #define BRCMFMAC_COMMON_H
7 
8 #include <linux/platform_device.h>
9 #include <linux/platform_data/brcmfmac.h>
10 #include "fwil_types.h"
11 
12 #define BRCMF_FW_ALTPATH_LEN			256
13 
14 /* Definitions for the module global and device specific settings are defined
15  * here. Two structs are used for them. brcmf_mp_global_t and brcmf_mp_device.
16  * The mp_global is instantiated once in a global struct and gets initialized
17  * by the common_attach function which should be called before any other
18  * (module) initiliazation takes place. The device specific settings is part
19  * of the drvr struct and should be initialized on every brcmf_attach.
20  */
21 
22 /**
23  * struct brcmf_mp_global_t - Global module paramaters.
24  *
25  * @firmware_path: Alternative firmware path.
26  */
27 struct brcmf_mp_global_t {
28 	char	firmware_path[BRCMF_FW_ALTPATH_LEN];
29 };
30 
31 extern struct brcmf_mp_global_t brcmf_mp_global;
32 
33 /**
34  * struct brcmf_mp_device - Device module paramaters.
35  *
36  * @p2p_enable: Legacy P2P0 enable (old wpa_supplicant).
37  * @feature_disable: Feature_disable bitmask.
38  * @fcmode: FWS flow control.
39  * @roamoff: Firmware roaming off?
40  * @ignore_probe_fail: Ignore probe failure.
41  * @country_codes: If available, pointer to struct for translating country codes
42  * @bus: Bus specific platform data. Only SDIO at the mmoment.
43  */
44 struct brcmf_mp_device {
45 	bool		p2p_enable;
46 	unsigned int	feature_disable;
47 	int		fcmode;
48 	bool		roamoff;
49 	bool		iapp;
50 	bool		ignore_probe_fail;
51 	struct brcmfmac_pd_cc *country_codes;
52 	const char	*board_type;
53 	unsigned char	mac[ETH_ALEN];
54 	union {
55 		struct brcmfmac_sdio_pd sdio;
56 	} bus;
57 };
58 
59 void brcmf_c_set_joinpref_default(struct brcmf_if *ifp);
60 
61 struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
62 					       enum brcmf_bus_type bus_type,
63 					       u32 chip, u32 chiprev);
64 void brcmf_release_module_param(struct brcmf_mp_device *module_param);
65 
66 /* Sets dongle media info (drv_version, mac address). */
67 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
68 
69 #ifdef CONFIG_DMI
70 void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
71 #else
72 static inline void
73 brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
74 #endif
75 
76 u8 brcmf_map_prio_to_prec(void *cfg, u8 prio);
77 
78 u8 brcmf_map_prio_to_aci(void *cfg, u8 prio);
79 
80 #endif /* BRCMFMAC_COMMON_H */
81