Skip to content

Commit

Permalink
staging: brcm80211: clean up firmware download code in fullmac
Browse files Browse the repository at this point in the history
In brcmfmac the firmware download related code scatter all around.
And some old dead code which is not following the standard firmware
routine is still present. This patch limits the firmware download
related code only in dhd_sdio.c and removes the rest.

Signed-off-by: Franky Lin <frankyl@broadcom.com>
Reviewed-by: Roland Vossen <rvossen@broadcom.com>
Reviewed-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Franky Lin authored and Greg Kroah-Hartman committed Jul 5, 2011
1 parent 0f37034 commit b7859cd
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 366 deletions.
3 changes: 3 additions & 0 deletions drivers/staging/brcm80211/brcmfmac/bcmchip.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
/* ARM Cortex M3 core, ID 0x82a */
#define BCM4329_CORE_ARM_BASE 0x18002000
#define BCM4329_RAMSIZE 0x48000
/* firmware name */
#define BCM4329_FW_NAME "brcm/bcm4329-fullmac-4.bin"
#define BCM4329_NV_NAME "brcm/bcm4329-fullmac-4.txt"

#endif /* _bcmchip_h_ */
2 changes: 0 additions & 2 deletions drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func);
static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr);
extern int brcmf_sdioh_reset_comm(struct mmc_card *card);

extern PBCMSDH_SDMMC_INSTANCE gInstance;

uint sd_f2_blocksize = 512; /* Default blocksize */

uint sd_msglevel = 0x01;
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,6 @@ typedef struct _BCMSDH_SDMMC_INSTANCE {
u32 host_claimed;
} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE;

extern PBCMSDH_SDMMC_INSTANCE gInstance;

#endif /* __BCMSDH_SDMMC_H__ */
9 changes: 0 additions & 9 deletions drivers/staging/brcm80211/brcmfmac/dhd.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@
#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
#define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */

/* optionally set by a module_param_string() */
#define MOD_PARAM_PATHLEN 2048

/* For supporting multiple interfaces */
#define DHD_MAX_IFS 16
#define DHD_DEL_IF -0xe
Expand Down Expand Up @@ -819,9 +816,6 @@ extern uint brcmf_pktgen_len;
#define BRCMF_MAX_PKTGEN_LEN 1800
#endif

extern char brcmf_fw_path[MOD_PARAM_PATHLEN];
extern char brcmf_nv_path[MOD_PARAM_PATHLEN];

extern u32 g_assert_type;
extern const bcmevent_name_t bcmevent_names[];
extern const int bcmevent_names_size;
Expand Down Expand Up @@ -912,9 +906,6 @@ extern int brcmf_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition,
extern int brcmf_os_ioctl_resp_wake(dhd_pub_t *pub);
extern unsigned int brcmf_os_get_ioctl_resp_timeout(void);
extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
extern void *brcmf_os_open_image(char *filename);
extern int brcmf_os_get_image_block(char *buf, int len, void *image);
extern void brcmf_os_close_image(void *image);
extern void brcmf_os_sdlock_sndup_rxq(dhd_pub_t *pub);
extern void brcmf_customer_gpio_wlan_ctrl(int onoff);
extern int brcmf_custom_get_mac_address(unsigned char *buf);
Expand Down
8 changes: 0 additions & 8 deletions drivers/staging/brcm80211/brcmfmac/dhd_bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ extern uint brcmf_watchdog_ms;
extern int dhd_bus_register(void);
extern void dhd_bus_unregister(void);

/* Download firmware image and nvram image */
extern bool dhd_bus_download_firmware(struct dhd_bus *bus,
char *fw_path, char *nv_path);

/* Stop bus module: clear pending frames, disable data flow */
extern void brcmf_sdbrcm_bus_stop(struct dhd_bus *bus, bool enforce_mutex);

Expand Down Expand Up @@ -75,10 +71,6 @@ extern void dhd_bus_clearcounts(dhd_pub_t *dhdp);
/* return the dongle chipid */
extern uint dhd_bus_chip(struct dhd_bus *bus);

/* Set user-specified nvram parameters. */
extern void dhd_bus_set_nvram_params(struct dhd_bus *bus,
const char *nvram_params);

extern void *dhd_bus_pub(struct dhd_bus *bus);
extern void *dhd_bus_txq(struct dhd_bus *bus);
extern uint dhd_bus_hdrlen(struct dhd_bus *bus);
Expand Down
13 changes: 0 additions & 13 deletions drivers/staging/brcm80211/brcmfmac/dhd_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
#define PKTFILTER_BUF_SIZE 2048

int brcmf_msg_level;
char brcmf_fw_path[MOD_PARAM_PATHLEN];
char brcmf_nv_path[MOD_PARAM_PATHLEN];

#define MSGTRACE_VERSION 1

Expand Down Expand Up @@ -111,17 +109,6 @@ void brcmf_c_init(void)
* initializations.
*/
brcmf_msg_level = DHD_ERROR_VAL;
#ifdef CONFIG_BCM4329_FW_PATH
strncpy(brcmf_fw_path, CONFIG_BCM4329_FW_PATH, MOD_PARAM_PATHLEN - 1);
#else
brcmf_fw_path[0] = '\0';
#endif
#ifdef CONFIG_BCM4329_NVRAM_PATH
strncpy(brcmf_nv_path,
CONFIG_BCM4329_NVRAM_PATH, MOD_PARAM_PATHLEN - 1);
#else
brcmf_nv_path[0] = '\0';
#endif
}

static int brcmf_c_dump(dhd_pub_t *dhdp, char *buf, int buflen)
Expand Down
84 changes: 2 additions & 82 deletions drivers/staging/brcm80211/brcmfmac/dhd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "dhd_proto.h"
#include "dhd_dbg.h"
#include "wl_cfg80211.h"
#include "bcmchip.h"

/* Global ASSERT type flag */
u32 g_assert_type;
Expand Down Expand Up @@ -96,20 +97,6 @@ typedef struct dhd_info {
#endif /* CONFIG_HAS_EARLYSUSPEND */
} dhd_info_t;

/* Definitions to provide path to the firmware and nvram
* example nvram_path[MOD_PARAM_PATHLEN]="/projects/wlan/nvram.txt"
*/
char firmware_path[MOD_PARAM_PATHLEN];
char nvram_path[MOD_PARAM_PATHLEN];

/* load firmware and/or nvram values from the filesystem */
module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0);
module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0);

/* No firmware required */
bool brcmf_no_fw_req;
module_param(brcmf_no_fw_req, bool, 0);

/* Error bits */
module_param(brcmf_msg_level, int, 0);

Expand Down Expand Up @@ -1080,7 +1067,7 @@ static void brcmf_ethtool_get_drvinfo(struct net_device *net,

sprintf(info->driver, KBUILD_MODNAME);
sprintf(info->version, "%lu", dhd->pub.drv_version);
sprintf(info->fw_version, "%s", wl_cfg80211_get_fwname());
sprintf(info->fw_version, "%s", BCM4329_FW_NAME);
sprintf(info->bus_info, "%s", dev_name(&wl_cfg80211_get_sdio_func()->dev));
}

Expand Down Expand Up @@ -1438,12 +1425,6 @@ dhd_pub_t *brcmf_attach(struct dhd_bus *bus, uint bus_hdrlen)
struct net_device *net;

DHD_TRACE(("%s: Enter\n", __func__));
/* updates firmware nvram path if it was provided as module
paramters */
if ((firmware_path != NULL) && (firmware_path[0] != '\0'))
strcpy(brcmf_fw_path, firmware_path);
if ((nvram_path != NULL) && (nvram_path[0] != '\0'))
strcpy(brcmf_nv_path, nvram_path);

/* Allocate etherdev, including space for private structure */
net = alloc_etherdev(sizeof(dhd));
Expand Down Expand Up @@ -1503,10 +1484,6 @@ dhd_pub_t *brcmf_attach(struct dhd_bus *bus, uint bus_hdrlen)
DHD_ERROR(("wl_cfg80211_attach failed\n"));
goto fail;
}
if (!brcmf_no_fw_req) {
strcpy(brcmf_fw_path, wl_cfg80211_get_fwname());
strcpy(brcmf_nv_path, wl_cfg80211_get_nvramname());
}

if (brcmf_sysioc) {
sema_init(&dhd->sysioc_sem, 0);
Expand Down Expand Up @@ -1562,17 +1539,6 @@ int brcmf_bus_start(dhd_pub_t *dhdp)

DHD_TRACE(("%s:\n", __func__));

/* try to download image and nvram to the dongle */
if (dhd->pub.busstate == DHD_BUS_DOWN) {
if (!(dhd_bus_download_firmware(dhd->pub.bus, brcmf_fw_path,
brcmf_nv_path))) {
DHD_ERROR(("%s: dhd_bus_download_firmware failed. "
"firmware = %s nvram = %s\n",
__func__, brcmf_fw_path, brcmf_nv_path));
return -1;
}
}

/* Bring up the bus */
ret = brcmf_sdbrcm_bus_init(&dhd->pub, true);
if (ret != 0) {
Expand Down Expand Up @@ -1881,52 +1847,6 @@ int brcmf_os_ioctl_resp_wake(dhd_pub_t *pub)
return 0;
}

void *brcmf_os_open_image(char *filename)
{
struct file *fp;

if (!brcmf_no_fw_req)
return wl_cfg80211_request_fw(filename);

fp = filp_open(filename, O_RDONLY, 0);
/*
* 2.6.11 (FC4) supports filp_open() but later revs don't?
* Alternative:
* fp = open_namei(AT_FDCWD, filename, O_RD, 0);
* ???
*/
if (IS_ERR(fp))
fp = NULL;

return fp;
}

int brcmf_os_get_image_block(char *buf, int len, void *image)
{
struct file *fp = (struct file *)image;
int rdlen;

if (!brcmf_no_fw_req)
return wl_cfg80211_read_fw(buf, len);

if (!image)
return 0;

rdlen = kernel_read(fp, fp->f_pos, buf, len);
if (rdlen > 0)
fp->f_pos += rdlen;

return rdlen;
}

void brcmf_os_close_image(void *image)
{
if (!brcmf_no_fw_req)
return wl_cfg80211_release_fw();
if (image)
filp_close((struct file *)image, NULL);
}

static int brcmf_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata,
brcmf_event_msg_t *event, void **data)
{
Expand Down
Loading

0 comments on commit b7859cd

Please sign in to comment.