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  * @trivial_ccode_map: Assume firmware uses ISO3166 country codes with rev 0
42  * @country_codes: If available, pointer to struct for translating country codes
43  * @bus: Bus specific platform data. Only SDIO at the mmoment.
44  */
45 struct brcmf_mp_device {
46 	bool		p2p_enable;
47 	unsigned int	feature_disable;
48 	int		fcmode;
49 	bool		roamoff;
50 	bool		iapp;
51 	bool		ignore_probe_fail;
52 	bool		trivial_ccode_map;
53 	struct brcmfmac_pd_cc *country_codes;
54 	const char	*board_type;
55 	unsigned char	mac[ETH_ALEN];
56 	union {
57 		struct brcmfmac_sdio_pd sdio;
58 	} bus;
59 };
60 
61 void brcmf_c_set_joinpref_default(struct brcmf_if *ifp);
62 
63 struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
64 					       enum brcmf_bus_type bus_type,
65 					       u32 chip, u32 chiprev);
66 void brcmf_release_module_param(struct brcmf_mp_device *module_param);
67 
68 /* Sets dongle media info (drv_version, mac address). */
69 int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
70 int brcmf_c_set_cur_etheraddr(struct brcmf_if *ifp, const u8 *addr);
71 
72 #ifdef CONFIG_DMI
73 void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
74 #else
75 static inline void
76 brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
77 #endif
78 
79 u8 brcmf_map_prio_to_prec(void *cfg, u8 prio);
80 
81 u8 brcmf_map_prio_to_aci(void *cfg, u8 prio);
82 
83 #endif /* BRCMFMAC_COMMON_H */
84