mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-01 03:26:51 +00:00
b0b43e1ef9
This will allow us to sync with code sent for upstream. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 43608
105 lines
3.8 KiB
Diff
105 lines
3.8 KiB
Diff
From 71a6bff8656a1713615ffdd9139a83d65ba46c6d Mon Sep 17 00:00:00 2001
|
|
From: Hauke Mehrtens <hauke@hauke-m.de>
|
|
Date: Sat, 3 May 2014 22:54:59 +0200
|
|
Subject: [PATCH 02/17] bcm47xx-nvram: add new broadcom nvram driver with dt
|
|
support
|
|
|
|
This adds a new driver which searches at a given memory range for a
|
|
nvram like it is used on the bcm47xx and bcm53xx SoCs with ARM and MIPS
|
|
CPUs. This driver provides acces to this nvram to other device in the
|
|
device tree. You have to specify the memory ranges where the content of
|
|
the flash chip is memory mapped and this driver will search there for
|
|
some nvram and parse it. Other drivers can use this driver to access the
|
|
device nvram. The nvram is used to store board configurations like the
|
|
mac addresses, the switch configuration and the calibration data for
|
|
the wifi devices.
|
|
|
|
This was copied from arch/mips/bcm47xx/nvram.c and modified to interact
|
|
with device tree. My plan is to make the MIPS bcm47xx also use this new
|
|
driver some time later.
|
|
|
|
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
---
|
|
.../devicetree/bindings/misc/bcm47xx-nvram.txt | 19 ++
|
|
arch/mips/bcm47xx/board.c | 40 ++--
|
|
arch/mips/bcm47xx/nvram.c | 7 +-
|
|
arch/mips/bcm47xx/setup.c | 4 +-
|
|
arch/mips/bcm47xx/sprom.c | 4 +-
|
|
arch/mips/bcm47xx/time.c | 2 +-
|
|
drivers/misc/Kconfig | 5 +
|
|
drivers/misc/Makefile | 1 +
|
|
drivers/misc/bcm47xx-nvram.c | 215 +++++++++++++++++++++
|
|
drivers/net/ethernet/broadcom/b44.c | 2 +-
|
|
drivers/net/ethernet/broadcom/bgmac.c | 5 +-
|
|
drivers/ssb/driver_chipcommon_pmu.c | 3 +-
|
|
include/linux/bcm47xx_nvram.h | 17 +-
|
|
13 files changed, 286 insertions(+), 38 deletions(-)
|
|
create mode 100644 Documentation/devicetree/bindings/misc/bcm47xx-nvram.txt
|
|
create mode 100644 drivers/misc/bcm47xx-nvram.c
|
|
|
|
--- /dev/null
|
|
+++ b/Documentation/devicetree/bindings/misc/bcm47xx-nvram.txt
|
|
@@ -0,0 +1,19 @@
|
|
+Broadcom bcm47xx/bcm53xx nvram access driver
|
|
+
|
|
+This driver provides access to the nvram for other drivers.
|
|
+
|
|
+Required properties:
|
|
+
|
|
+- compatible : brcm,bcm47xx-nvram
|
|
+
|
|
+- reg : iomem address range
|
|
+
|
|
+On NorthStar ARM SoCs the NAND flash is available at 0x1c000000 and the
|
|
+NOR flash is at 0x1e000000
|
|
+
|
|
+Example:
|
|
+
|
|
+nvram0: nvram@0 {
|
|
+ compatible = "brcm,bcm47xx-nvram";
|
|
+ reg = <0x1c000000 0x01000000>;
|
|
+};
|
|
--- a/drivers/misc/Kconfig
|
|
+++ b/drivers/misc/Kconfig
|
|
@@ -515,6 +515,11 @@ config SRAM
|
|
the genalloc API. It is supposed to be used for small on-chip SRAM
|
|
areas found on many SoCs.
|
|
|
|
+config BCM47XX_NVRAM
|
|
+ tristate "BCM47XX nvram driver"
|
|
+ help
|
|
+ This adds support for the brcm47xx nvram driver.
|
|
+
|
|
source "drivers/misc/c2port/Kconfig"
|
|
source "drivers/misc/eeprom/Kconfig"
|
|
source "drivers/misc/cb710/Kconfig"
|
|
--- a/drivers/misc/Makefile
|
|
+++ b/drivers/misc/Makefile
|
|
@@ -54,3 +54,4 @@ obj-$(CONFIG_LATTICE_ECP3_CONFIG) += lat
|
|
obj-$(CONFIG_SRAM) += sram.o
|
|
obj-y += mic/
|
|
obj-$(CONFIG_GENWQE) += genwqe/
|
|
+obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx-nvram.o
|
|
--- a/include/linux/bcm47xx_nvram.h
|
|
+++ b/include/linux/bcm47xx_nvram.h
|
|
@@ -15,7 +15,7 @@
|
|
#include <linux/types.h>
|
|
#include <linux/kernel.h>
|
|
|
|
-#ifdef CONFIG_BCM47XX
|
|
+#if defined(CONFIG_BCM47XX) || defined(CONFIG_BCM47XX_NVRAM)
|
|
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len);
|
|
|
|
int bcm47xx_nvram_gpio_pin(const char *name);
|
|
--- a/drivers/misc/bcm47xx-nvram.c
|
|
+++ b/drivers/misc/bcm47xx-nvram.c
|
|
@@ -28,7 +28,7 @@
|
|
|
|
struct nvram_header {
|
|
u32 magic;
|
|
- u32 len;
|
|
+ __le32 len;
|
|
u32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */
|
|
u32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */
|
|
u32 config_ncdl; /* ncdl values for memc */
|