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 	union {
54 		struct brcmfmac_sdio_pd sdio;
55 	} bus;
56 };
57 
58 void brcmf_c_set_joinpref_default(struct brcmf_if *ifp);
59 
60 struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
61 					       enum brcmf_bus_type bus_type,
62 					       u32 chip, u32 chiprev);
63 void brcmf_release_module_param(struct brcmf_mp_device *module_param);
64 
65 /* Sets dongle media info (drv_version, mac address). */
66 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
67 
68 #ifdef CONFIG_DMI
69 void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
70 #else
71 static inline void
72 brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
73 #endif
74 
75 u8 brcmf_map_prio_to_prec(void *cfg, u8 prio);
76 
77 u8 brcmf_map_prio_to_aci(void *cfg, u8 prio);
78 
79 #endif /* BRCMFMAC_COMMON_H */
80