Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259408
b: refs/heads/master
c: d794fec
h: refs/heads/master
v: v3
  • Loading branch information
Arend van Spriel authored and Greg Kroah-Hartman committed Jun 7, 2011
1 parent 8458e83 commit d0ba37c
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 524 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f97e956afc30cf69c73e75035dc69aafa9a04215
refs/heads/master: d794fec0a9546f705980750f96df4bead15a15a0
3 changes: 1 addition & 2 deletions trunk/drivers/staging/brcm80211/brcmsmac/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ BRCMSMAC_OFILES := \
bcmotp.o \
bcmsrom.o \
dma.o \
nicpci.o \
nvram.o
nicpci.o

MODULEPFX := brcmsmac

Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/staging/brcm80211/brcmsmac/aiutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@

/* ********** from siutils.c *********** */
#include <nicpci.h>
#include <bcmnvram.h>
#include <bcmsrom.h>
#include <wlc_pmu.h>
#include <wlc_scb.h>
#include <wlc_pub.h>

/* slow_clk_ctl */
#define SCC_SS_MASK 0x00000007 /* slow clock source mask */
Expand Down Expand Up @@ -985,9 +986,6 @@ static si_info_t *ai_doattach(si_info_t *sii, uint devid,
udelay(10);
}

/* Init nvram from flash if it exists */
nvram_init();

/* Init nvram from sprom/otp if they exist */
if (srom_var_init
(&sii->pub, bustype, regs, vars, varsz)) {
Expand Down Expand Up @@ -1096,8 +1094,6 @@ void ai_detach(struct si_pub *sih)
sii->regs[idx] = NULL;
}

nvram_exit(); /* free up nvram buffers */

if (sih->bustype == PCI_BUS) {
if (sii->pch)
pcicore_deinit(sii->pch);
Expand Down
149 changes: 0 additions & 149 deletions trunk/drivers/staging/brcm80211/brcmsmac/bcmnvram.h

This file was deleted.

124 changes: 4 additions & 120 deletions trunk/drivers/staging/brcm80211/brcmsmac/bcmsrom.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <nicpci.h>
#include <aiutils.h>
#include <bcmsrom.h>

#include <bcmnvram.h>
#include <bcmotp.h>

#define SROM_OFFSET(sih) ((sih->ccrev > 31) ? \
Expand Down Expand Up @@ -780,12 +778,9 @@ static const sromvar_t perpath_pci_sromvars[] = {
{NULL, 0, 0, 0, 0}
};

static int initvars_srom_si(struct si_pub *sih, void *curmap, char **vars,
uint *count);
static void _initvars_srom_pci(u8 sromrev, u16 *srom, uint off, varbuf_t *b);
static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
uint *count);
static int initvars_flash_si(struct si_pub *sih, char **vars, uint *count);
static int sprom_read_pci(struct si_pub *sih, u16 *sprom,
uint wordoff, u16 *buf, uint nwords, bool check_crc);
#if defined(BCMNVRAMR)
Expand All @@ -796,8 +791,6 @@ static u16 srom_cc_cmd(struct si_pub *sih, void *ccregs, u32 cmd,

static int initvars_table(char *start, char *end,
char **vars, uint *count);
static int initvars_flash(struct si_pub *sih, char **vp,
uint len);

/* Initialization of varbuf structure */
static void varbuf_init(varbuf_t *b, char *buf, uint size)
Expand Down Expand Up @@ -877,20 +870,9 @@ int srom_var_init(struct si_pub *sih, uint bustype, void *curmap,
*vars = NULL;
*count = 0;

switch (bustype) {
case SI_BUS:
case JTAG_BUS:
return initvars_srom_si(sih, curmap, vars, count);

case PCI_BUS:
if (curmap == NULL)
return -1;

if (curmap != NULL && bustype == PCI_BUS)
return initvars_srom_pci(sih, curmap, vars, count);

default:
break;
}
return -1;
}

Expand Down Expand Up @@ -1063,87 +1045,6 @@ static int initvars_table(char *start, char *end,
return 0;
}

/*
* Find variables with <devpath> from flash. 'base' points to the beginning
* of the table upon enter and to the end of the table upon exit when success.
* Return 0 on success, nonzero on error.
*/
static int initvars_flash(struct si_pub *sih, char **base, uint len)
{
char *vp = *base;
char *flash;
int err;
char *s;
uint l, dl, copy_len;
char devpath[SI_DEVPATH_BUFSZ];

/* allocate memory and read in flash */
flash = kmalloc(NVRAM_SPACE, GFP_ATOMIC);
if (!flash)
return -ENOMEM;
err = nvram_getall(flash, NVRAM_SPACE);
if (err)
goto exit;

ai_devpath(sih, devpath, sizeof(devpath));

/* grab vars with the <devpath> prefix in name */
dl = strlen(devpath);
for (s = flash; s && *s; s += l + 1) {
l = strlen(s);

/* skip non-matching variable */
if (strncmp(s, devpath, dl))
continue;

/* is there enough room to copy? */
copy_len = l - dl + 1;
if (len < copy_len) {
err = -EOVERFLOW;
goto exit;
}

/* no prefix, just the name=value */
strncpy(vp, &s[dl], copy_len);
vp += copy_len;
len -= copy_len;
}

/* add null string as terminator */
if (len < 1) {
err = -EOVERFLOW;
goto exit;
}
*vp++ = '\0';

*base = vp;

exit: kfree(flash);
return err;
}

/*
* Initialize nonvolatile variable table from flash.
* Return 0 on success, nonzero on error.
*/
static int initvars_flash_si(struct si_pub *sih, char **vars, uint *count)
{
char *vp, *base;
int err;

base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
if (!vp)
return -ENOMEM;

err = initvars_flash(sih, &vp, MAXSZ_NVRAM_VARS);
if (err == 0)
err = initvars_table(base, vp, vars, count);

kfree(base);

return err;
}

/* Parse SROM and create name=value pairs. 'srom' points to
* the SROM word array. 'off' specifies the offset of the
* first word 'srom' points to, which should be either 0 or
Expand Down Expand Up @@ -1405,20 +1306,12 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
goto errout;
}

base = vp = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
if (!vp) {
base = kmalloc(MAXSZ_NVRAM_VARS, GFP_ATOMIC);
if (!base) {
err = -2;
goto errout;
}

/* read variables from flash */
if (flash) {
err = initvars_flash(sih, &vp, MAXSZ_NVRAM_VARS);
if (err)
goto errout;
goto varsdone;
}

varbuf_init(&b, base, MAXSZ_NVRAM_VARS);

/* parse SROM into name=value pairs. */
Expand All @@ -1428,8 +1321,7 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
vp = b.buf;
*vp++ = '\0';

varsdone:
err = initvars_table(base, vp, vars, count);
err = initvars_table(base, vp, vars, count);

errout:
if (base)
Expand All @@ -1438,11 +1330,3 @@ static int initvars_srom_pci(struct si_pub *sih, void *curmap, char **vars,
kfree(srom);
return err;
}


static int initvars_srom_si(struct si_pub *sih, void *curmap, char **vars,
uint *varsz)
{
/* Search flash nvram section for srom variables */
return initvars_flash_si(sih, vars, varsz);
}
Loading

0 comments on commit d0ba37c

Please sign in to comment.