diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2014-12-10 21:50:57 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2014-12-10 21:50:57 +0000 |
commit | 40d94a3ef026e9e9f27203f744af405fb2e5c82b (patch) | |
tree | 7d15a6ed54dbeb4f254454cbe4eafaf9a761fc2b /target/linux/bcm53xx/patches-3.14 | |
parent | ba81966001af4ff028795b6edbf25ce49596d654 (diff) | |
download | upstream-40d94a3ef026e9e9f27203f744af405fb2e5c82b.tar.gz upstream-40d94a3ef026e9e9f27203f744af405fb2e5c82b.tar.bz2 upstream-40d94a3ef026e9e9f27203f744af405fb2e5c82b.zip |
bcm53xx: backport NVRAM driver sent upstream
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 43612
Diffstat (limited to 'target/linux/bcm53xx/patches-3.14')
4 files changed, 124 insertions, 263 deletions
diff --git a/target/linux/bcm53xx/patches-3.14/110-bcm47xx-move-the-nvram-header-file-into-common-space.patch b/target/linux/bcm53xx/patches-3.14/110-bcm47xx-move-the-nvram-header-file-into-common-space.patch deleted file mode 100644 index 84923e92a6..0000000000 --- a/target/linux/bcm53xx/patches-3.14/110-bcm47xx-move-the-nvram-header-file-into-common-space.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 7063a1583166abe1a9cefed38c2f53a0e14a0005 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens <hauke@hauke-m.de> -Date: Sun, 4 May 2014 16:35:42 +0200 -Subject: [PATCH 01/17] MIPS: BCM47XX: move the nvram header file into common - space - -Moving mach-bcm47xx/bcm47xx_nvram.h to include/linux/bcm47xx_nvram.h -makes it possible to reuse this header on the ARM based bcm47xx/bcm53xx -SoCs (e.g. BCM5301X devices). Broadcom uses ARM CPUs in their new SoC -form the bcm47xx and bcm53xx line, but many other things like nvram -stayed the same. - -This is a preparation for adding a new nvram driver, which can be used -by the ARM SoC and the MIPS SoC code. The device drivers accessing -nvram do not have to care about ARM or MIPS SoC version. - -Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> ---- - arch/mips/bcm47xx/board.c | 2 +- - arch/mips/bcm47xx/nvram.c | 2 +- - arch/mips/bcm47xx/setup.c | 2 +- - arch/mips/bcm47xx/sprom.c | 2 +- - arch/mips/bcm47xx/time.c | 2 +- - arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h | 53 ----------------- - drivers/net/ethernet/broadcom/b44.c | 8 +-- - drivers/net/ethernet/broadcom/bgmac.c | 2 +- - drivers/ssb/driver_chipcommon_pmu.c | 6 +- - include/linux/bcm47xx_nvram.h | 66 ++++++++++++++++++++++ - 10 files changed, 74 insertions(+), 71 deletions(-) - delete mode 100644 arch/mips/include/asm/mach-bcm47xx/bcm47xx_nvram.h - create mode 100644 include/linux/bcm47xx_nvram.h - ---- a/arch/mips/bcm47xx/board.c -+++ b/arch/mips/bcm47xx/board.c -@@ -2,7 +2,7 @@ - #include <linux/export.h> - #include <linux/string.h> - #include <bcm47xx_board.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - - struct bcm47xx_board_type { - const enum bcm47xx_board board; ---- a/arch/mips/bcm47xx/nvram.c -+++ b/arch/mips/bcm47xx/nvram.c -@@ -17,7 +17,7 @@ - #include <linux/kernel.h> - #include <linux/string.h> - #include <asm/addrspace.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - #include <asm/mach-bcm47xx/bcm47xx.h> - - static char nvram_buf[NVRAM_SPACE]; ---- a/arch/mips/bcm47xx/setup.c -+++ b/arch/mips/bcm47xx/setup.c -@@ -42,7 +42,7 @@ - #include <asm/reboot.h> - #include <asm/time.h> - #include <bcm47xx.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - #include <bcm47xx_board.h> - - union bcm47xx_bus bcm47xx_bus; ---- a/arch/mips/bcm47xx/sprom.c -+++ b/arch/mips/bcm47xx/sprom.c -@@ -27,7 +27,7 @@ - */ - - #include <bcm47xx.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - - static void create_key(const char *prefix, const char *postfix, - const char *name, char *buf, int len) ---- a/arch/mips/bcm47xx/time.c -+++ b/arch/mips/bcm47xx/time.c -@@ -27,7 +27,7 @@ - #include <linux/ssb/ssb.h> - #include <asm/time.h> - #include <bcm47xx.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - #include <bcm47xx_board.h> - - void __init plat_time_init(void) ---- a/drivers/net/ethernet/broadcom/b44.c -+++ b/drivers/net/ethernet/broadcom/b44.c -@@ -31,6 +31,7 @@ - #include <linux/ssb/ssb.h> - #include <linux/slab.h> - #include <linux/phy.h> -+#include <linux/bcm47xx_nvram.h> - - #include <asm/uaccess.h> - #include <asm/io.h> -@@ -399,8 +400,6 @@ static void b44_set_flow_ctrl(struct b44 - __b44_set_flow_ctrl(bp, pause_enab); - } - --#ifdef CONFIG_BCM47XX --#include <bcm47xx_nvram.h> - static void b44_wap54g10_workaround(struct b44 *bp) - { - char buf[20]; -@@ -429,11 +428,6 @@ static void b44_wap54g10_workaround(stru - error: - pr_warning("PHY: cannot reset MII transceiver isolate bit\n"); - } --#else --static inline void b44_wap54g10_workaround(struct b44 *bp) --{ --} --#endif - - static int b44_setup_phy(struct b44 *bp) - { ---- a/drivers/net/ethernet/broadcom/bgmac.c -+++ b/drivers/net/ethernet/broadcom/bgmac.c -@@ -17,7 +17,7 @@ - #include <linux/interrupt.h> - #include <linux/dma-mapping.h> - #include <linux/platform_data/b53.h> --#include <bcm47xx_nvram.h> -+#include <linux/bcm47xx_nvram.h> - - static const struct bcma_device_id bgmac_bcma_tbl[] = { - BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS), ---- a/drivers/ssb/driver_chipcommon_pmu.c -+++ b/drivers/ssb/driver_chipcommon_pmu.c -@@ -13,9 +13,7 @@ - #include <linux/ssb/ssb_driver_chipcommon.h> - #include <linux/delay.h> - #include <linux/export.h> --#ifdef CONFIG_BCM47XX --#include <bcm47xx_nvram.h> --#endif -+#include <linux/bcm47xx_nvram.h> - - #include "ssb_private.h" - -@@ -320,11 +318,9 @@ static void ssb_pmu_pll_init(struct ssb_ - u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */ - - if (bus->bustype == SSB_BUSTYPE_SSB) { --#ifdef CONFIG_BCM47XX - char buf[20]; - if (bcm47xx_nvram_getenv("xtalfreq", buf, sizeof(buf)) >= 0) - crystalfreq = simple_strtoul(buf, NULL, 0); --#endif - } - - switch (bus->chip_id) { diff --git a/target/linux/bcm53xx/patches-3.14/110-firmware-backport-NVRAM-driver.patch b/target/linux/bcm53xx/patches-3.14/110-firmware-backport-NVRAM-driver.patch new file mode 100644 index 0000000000..5c460f1ad9 --- /dev/null +++ b/target/linux/bcm53xx/patches-3.14/110-firmware-backport-NVRAM-driver.patch @@ -0,0 +1,119 @@ +From 0509f6dcc46d10ea4bb8c70494dc7ae11bcb3f01 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Wed, 10 Dec 2014 21:14:10 +0100 +Subject: [PATCH] firmware: backport NVRAM driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +--- + arch/arm/Kconfig | 2 ++ + drivers/firmware/Kconfig | 1 + + drivers/firmware/Makefile | 1 + + drivers/firmware/broadcom/bcm47xx_nvram.c | 3 ++- + drivers/net/ethernet/broadcom/b44.c | 2 +- + drivers/net/ethernet/broadcom/bgmac.c | 2 +- + drivers/ssb/driver_chipcommon_pmu.c | 2 +- + 7 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 4733d32..ab18030 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -2286,6 +2286,8 @@ source "net/Kconfig" + + source "drivers/Kconfig" + ++source "drivers/firmware/Kconfig" ++ + source "fs/Kconfig" + + source "arch/arm/Kconfig.debug" +diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig +index 4198388..ffbc9e4 100644 +--- a/drivers/firmware/Kconfig ++++ b/drivers/firmware/Kconfig +@@ -132,6 +132,7 @@ config ISCSI_IBFT + detect iSCSI boot parameters dynamically during system boot, say Y. + Otherwise, say N. + ++source "drivers/firmware/broadcom/Kconfig" + source "drivers/firmware/google/Kconfig" + source "drivers/firmware/efi/Kconfig" + +diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile +index 5373dc5..e251f2b 100644 +--- a/drivers/firmware/Makefile ++++ b/drivers/firmware/Makefile +@@ -12,6 +12,7 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o + obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o + obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o + ++obj-y += broadcom/ + obj-$(CONFIG_GOOGLE_FIRMWARE) += google/ + obj-$(CONFIG_EFI) += efi/ + obj-$(CONFIG_UEFI_CPER) += efi/ +diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c b/drivers/firmware/broadcom/bcm47xx_nvram.c +index b6e1cc7..8ca7358 100644 +--- a/drivers/firmware/broadcom/bcm47xx_nvram.c ++++ b/drivers/firmware/broadcom/bcm47xx_nvram.c +@@ -11,6 +11,7 @@ + * option) any later version. + */ + ++#include <linux/io.h> + #include <linux/types.h> + #include <linux/module.h> + #include <linux/kernel.h> +@@ -34,7 +35,7 @@ struct nvram_header { + }; + + static char nvram_buf[NVRAM_SPACE]; +-static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000}; ++static const u32 nvram_sizes[] = {0x8000, 0xF000, 0x10000, 0x160000}; + + static u32 find_nvram_size(void __iomem *end) + { +diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c +index 8a7bf7d..bf3bcd6 100644 +--- a/drivers/net/ethernet/broadcom/b44.c ++++ b/drivers/net/ethernet/broadcom/b44.c +@@ -400,7 +400,7 @@ static void b44_set_flow_ctrl(struct b44 *bp, u32 local, u32 remote) + } + + #ifdef CONFIG_BCM47XX +-#include <bcm47xx_nvram.h> ++#include <linux/bcm47xx_nvram.h> + static void b44_wap54g10_workaround(struct b44 *bp) + { + char buf[20]; +diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c +index 34c7bc8..943707f 100644 +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -17,7 +17,7 @@ + #include <linux/interrupt.h> + #include <linux/dma-mapping.h> + #include <linux/platform_data/b53.h> +-#include <bcm47xx_nvram.h> ++#include <linux/bcm47xx_nvram.h> + + static const struct bcma_device_id bgmac_bcma_tbl[] = { + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS), +diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c +index 1173a09..0942841 100644 +--- a/drivers/ssb/driver_chipcommon_pmu.c ++++ b/drivers/ssb/driver_chipcommon_pmu.c +@@ -14,7 +14,7 @@ + #include <linux/delay.h> + #include <linux/export.h> + #ifdef CONFIG_BCM47XX +-#include <bcm47xx_nvram.h> ++#include <linux/bcm47xx_nvram.h> + #endif + + #include "ssb_private.h" +-- +1.8.4.5 + diff --git a/target/linux/bcm53xx/patches-3.14/111-bcm47xx-nvram-add-new-nvram-driver-with-dt-support.patch b/target/linux/bcm53xx/patches-3.14/111-bcm47xx-nvram-add-new-nvram-driver-with-dt-support.patch deleted file mode 100644 index c4c73394f6..0000000000 --- a/target/linux/bcm53xx/patches-3.14/111-bcm47xx-nvram-add-new-nvram-driver-with-dt-support.patch +++ /dev/null @@ -1,104 +0,0 @@ -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 */ diff --git a/target/linux/bcm53xx/patches-3.14/112-bcm53xx-sprom-add-sprom-driver.patch b/target/linux/bcm53xx/patches-3.14/112-bcm53xx-sprom-add-sprom-driver.patch index 739d8cf90d..e316a661ea 100644 --- a/target/linux/bcm53xx/patches-3.14/112-bcm53xx-sprom-add-sprom-driver.patch +++ b/target/linux/bcm53xx/patches-3.14/112-bcm53xx-sprom-add-sprom-driver.patch @@ -42,9 +42,9 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +}; --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig -@@ -520,6 +520,17 @@ config BCM47XX_NVRAM - help - This adds support for the brcm47xx nvram driver. +@@ -515,6 +515,17 @@ config SRAM + the genalloc API. It is supposed to be used for small on-chip SRAM + areas found on many SoCs. +config BCM47XX_SPROM + tristate "BCM47XX sprom driver" @@ -62,8 +62,8 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> source "drivers/misc/cb710/Kconfig" --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile -@@ -55,3 +55,4 @@ obj-$(CONFIG_SRAM) += sram.o +@@ -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 +obj-$(CONFIG_BCM47XX_SPROM) += bcm47xx-sprom.o |