Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d792895 authored by Hante Meuleman's avatar Hante Meuleman Committed by Kalle Valo
Browse files

brcmfmac: switch to new platform data



Platform data is only available for sdio. With this patch a new
platform data structure is being used which allows for platform
data for any device and configurable per device. This patch only
switches to the new structure and adds support for SDIO devices.

Reviewed-by: default avatarArend Van Spriel <arend@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarHante Meuleman <meuleman@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 73ef9e64
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ static void brcmf_sdiod_dummy_irqhandler(struct sdio_func *func)

int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)
{
	struct brcmfmac_sdio_platform_data *pdata;
	struct brcmfmac_sdio_pd *pdata;
	int ret = 0;
	u8 data;
	u32 addr, gpiocontrol;
@@ -173,7 +173,7 @@ int brcmf_sdiod_intr_register(struct brcmf_sdio_dev *sdiodev)

int brcmf_sdiod_intr_unregister(struct brcmf_sdio_dev *sdiodev)
{
	struct brcmfmac_sdio_platform_data *pdata;
	struct brcmfmac_sdio_pd *pdata;

	brcmf_dbg(SDIO, "Entering\n");

@@ -1164,17 +1164,6 @@ static int brcmf_ops_sdio_probe(struct sdio_func *func,
	dev_set_drvdata(&func->dev, bus_if);
	dev_set_drvdata(&sdiodev->func[1]->dev, bus_if);
	sdiodev->dev = &sdiodev->func[1]->dev;
	sdiodev->pdata = brcmf_get_module_param(sdiodev->dev);

#ifdef CONFIG_PM_SLEEP
	/* wowl can be supported when KEEP_POWER is true and (WAKE_SDIO_IRQ
	 * is true or when platform data OOB irq is true).
	 */
	if ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_KEEP_POWER) &&
	    ((sdio_get_host_pm_caps(sdiodev->func[1]) & MMC_PM_WAKE_SDIO_IRQ) ||
	     (sdiodev->pdata && sdiodev->pdata->oob_irq_supported)))
		bus_if->wowl_supported = true;
#endif

	brcmf_sdiod_change_state(sdiodev, BRCMF_SDIOD_DOWN);

+2 −2
Original line number Diff line number Diff line
@@ -6459,8 +6459,8 @@ int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg,
static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
					struct brcmf_fil_country_le *ccreq)
{
	struct cc_translate *country_codes;
	struct cc_entry *cc;
	struct brcmfmac_pd_cc *country_codes;
	struct brcmfmac_pd_cc_entry *cc;
	s32 found_index;
	int i;

+37 −6
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ module_param_named(ignore_probe_fail, brcmf_ignore_probe_fail, int, 0);
MODULE_PARM_DESC(ignore_probe_fail, "always succeed probe for debugging");
#endif

static struct brcmfmac_sdio_platform_data *brcmfmac_pdata;
static struct brcmfmac_platform_data *brcmfmac_pdata;
struct brcmf_mp_global_t brcmf_mp_global;

int brcmf_c_preinit_dcmds(struct brcmf_if *ifp)
@@ -229,15 +229,46 @@ void __brcmf_dbg(u32 level, const char *func, const char *fmt, ...)

static void brcmf_mp_attach(void)
{
	/* If module param firmware path is set then this will always be used,
	 * if not set then if available use the platform data version. To make
	 * sure it gets initialized at all, always copy the module param version
	 */
	strlcpy(brcmf_mp_global.firmware_path, brcmf_firmware_path,
		BRCMF_FW_ALTPATH_LEN);
	if ((brcmfmac_pdata) && (brcmfmac_pdata->fw_alternative_path) &&
	    (brcmf_mp_global.firmware_path[0] == '\0')) {
		strlcpy(brcmf_mp_global.firmware_path,
			brcmfmac_pdata->fw_alternative_path,
			BRCMF_FW_ALTPATH_LEN);
	}
}

struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev)
struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
						enum brcmf_bus_type bus_type,
						u32 chip, u32 chiprev)
{
	if (!brcmfmac_pdata)
		brcmf_of_probe(dev, &brcmfmac_pdata);
	return brcmfmac_pdata;
	struct brcmfmac_sdio_pd *pdata;
	struct brcmfmac_pd_device *device_pd;
	int i;

	if (brcmfmac_pdata) {
		for (i = 0; i < brcmfmac_pdata->device_count; i++) {
			device_pd = &brcmfmac_pdata->devices[i];
			if ((device_pd->bus_type == bus_type) &&
			    (device_pd->id == chip) &&
			    ((device_pd->rev == chiprev) ||
			     (device_pd->rev == -1))) {
				brcmf_dbg(INFO, "Platform data for device found\n");
				if (device_pd->bus_type == BRCMF_BUSTYPE_SDIO)
					return &device_pd->bus.sdio;
				break;
			}
		}
	}
	pdata = NULL;
	brcmf_of_probe(dev, &pdata);

	return pdata;
}

int brcmf_mp_device_attach(struct brcmf_pub *drvr)
@@ -287,7 +318,7 @@ static int brcmf_common_pd_remove(struct platform_device *pdev)
static struct platform_driver brcmf_pd = {
	.remove		= brcmf_common_pd_remove,
	.driver		= {
		.name	= BRCMFMAC_SDIO_PDATA_NAME,
		.name	= BRCMFMAC_PDATA_NAME,
	}
};

+5 −30
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#define BRCMFMAC_COMMON_H

#include <linux/platform_device.h>
#include <linux/platform_data/brcmfmac-sdio.h>
#include <linux/platform_data/brcmfmac.h>
#include "fwil_types.h"

extern const u8 ALLFFMAC[ETH_ALEN];
@@ -42,33 +42,6 @@ struct brcmf_mp_global_t {

extern struct brcmf_mp_global_t brcmf_mp_global;

/**
 * struct cc_entry - Struct for translating user space country code (iso3166) to
 *		     firmware country code and revision.
 *
 * @iso3166: iso3166 alpha 2 country code string.
 * @cc: firmware country code string.
 * @rev: firmware country code revision.
 */
struct cc_entry {
	char	iso3166[BRCMF_COUNTRY_BUF_SZ];
	char	cc[BRCMF_COUNTRY_BUF_SZ];
	s32	rev;
};

/**
 * struct cc_translate - Struct for translating country codes as set by user
 *			 space to a country code and rev which can be used by
 *			 firmware.
 *
 * @table_size: number of entries in table (> 0)
 * @table: dynamic array of 1 or more elements with translation information.
 */
struct cc_translate {
	int	table_size;
	struct cc_entry table[0];
};

/**
 * struct brcmf_mp_device - Device module paramaters.
 *
@@ -88,10 +61,12 @@ struct brcmf_mp_device {
	int	fcmode;
	bool	roamoff;
	bool	ignore_probe_fail;
	struct cc_translate *country_codes;
	struct brcmfmac_pd_cc *country_codes;
};

struct brcmfmac_sdio_platform_data *brcmf_get_module_param(struct device *dev);
struct brcmfmac_sdio_pd *brcmf_get_module_param(struct device *dev,
						enum brcmf_bus_type bus_type,
						u32 chip, u32 chiprev);
int brcmf_mp_device_attach(struct brcmf_pub *drvr);
void brcmf_mp_device_detach(struct brcmf_pub *drvr);
#ifdef DEBUG
+1 −2
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@
#include "common.h"
#include "of.h"

void
brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_platform_data **sdio)
void brcmf_of_probe(struct device *dev, struct brcmfmac_sdio_pd **sdio)
{
	struct device_node *np = dev->of_node;
	int irq;
Loading