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