2
0
forked from Ivasoft/openwrt

bcm53xx: use static NVRAM pointer for now

This will allow us to sync with code sent for upstream.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 43608
This commit is contained in:
Rafał Miłecki
2014-12-10 19:56:56 +00:00
parent a1da38f7b1
commit b0b43e1ef9
4 changed files with 14 additions and 534 deletions

View File

@@ -39,6 +39,8 @@ struct bcm47xx_nvram {
char *nvram_buf;
};
static struct bcm47xx_nvram *nvram = NULL;
static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000};
static u32 find_nvram_size(void __iomem *end)
@@ -117,16 +119,9 @@ found:
return 0;
}
int bcm47xx_nvram_getenv(const struct device *dev, const char *name, char *val,
size_t val_len)
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
{
char *var, *value, *end, *eq;
struct bcm47xx_nvram *nvram;
if (!dev)
return -ENODEV;
nvram = dev_get_drvdata(dev);
if (!name || !nvram || !nvram->nvram_len)
return -EINVAL;
@@ -149,20 +144,17 @@ int bcm47xx_nvram_getenv(const struct device *dev, const char *name, char *val,
}
EXPORT_SYMBOL(bcm47xx_nvram_getenv);
int bcm47xx_nvram_gpio_pin(const struct device *dev, const char *name)
int bcm47xx_nvram_gpio_pin(const char *name)
{
int i, err;
char nvram_var[10];
char buf[30];
if (!dev)
return -ENODEV;
for (i = 0; i < 32; i++) {
err = snprintf(nvram_var, sizeof(nvram_var), "gpio%i", i);
if (err <= 0)
continue;
err = bcm47xx_nvram_getenv(dev, nvram_var, buf, sizeof(buf));
err = bcm47xx_nvram_getenv(nvram_var, buf, sizeof(buf));
if (err <= 0)
continue;
if (!strcmp(name, buf))
@@ -176,7 +168,6 @@ static int bcm47xx_nvram_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct bcm47xx_nvram *nvram;
int err;
struct resource flash_mem;
void __iomem *mmio;
@@ -199,8 +190,6 @@ static int bcm47xx_nvram_probe(struct platform_device *pdev)
if (err)
goto err_unmap_mmio;
platform_set_drvdata(pdev, nvram);
err_unmap_mmio:
iounmap(mmio);
return err;

View File

@@ -637,9 +637,7 @@ static void bcm47xx_sprom_fill(struct ssb_sprom *sprom,
static int bcm47xx_sprom_getenv(const struct bcm47xx_sprom_fill *fill,
const char *name, char *val, size_t val_len)
{
const struct platform_device *nvram_dev = fill->priv;
return bcm47xx_nvram_getenv(&nvram_dev->dev, name, val, val_len);
return bcm47xx_nvram_getenv(name, val, val_len);
};
static int bcm47xx_sprom_probe(struct platform_device *pdev)