Loading...
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 */
27struct brcmf_mp_global_t {
28 char firmware_path[BRCMF_FW_ALTPATH_LEN];
29};
30
31extern 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 */
45struct 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 const char *antenna_sku;
57 const void *cal_blob;
58 int cal_size;
59 union {
60 struct brcmfmac_sdio_pd sdio;
61 } bus;
62};
63
64void brcmf_c_set_joinpref_default(struct brcmf_if *ifp);
65
66struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
67 enum brcmf_bus_type bus_type,
68 u32 chip, u32 chiprev);
69void brcmf_release_module_param(struct brcmf_mp_device *module_param);
70
71/* Sets dongle media info (drv_version, mac address). */
72int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
73int brcmf_c_set_cur_etheraddr(struct brcmf_if *ifp, const u8 *addr);
74
75#ifdef CONFIG_DMI
76void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
77#else
78static inline void
79brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
80#endif
81
82#ifdef CONFIG_ACPI
83void brcmf_acpi_probe(struct device *dev, enum brcmf_bus_type bus_type,
84 struct brcmf_mp_device *settings);
85#else
86static inline void brcmf_acpi_probe(struct device *dev,
87 enum brcmf_bus_type bus_type,
88 struct brcmf_mp_device *settings) {}
89#endif
90
91u8 brcmf_map_prio_to_prec(void *cfg, u8 prio);
92
93u8 brcmf_map_prio_to_aci(void *cfg, u8 prio);
94
95#endif /* BRCMFMAC_COMMON_H */