MIPS: BCM47XX: Move NVRAM driver to the drivers/firmware/
Subsystems (3)
Rafał Miłecki
maintainerRFC PATCH 1/1 MIPS: BCM47XX: Move NVRAM driver to the drivers/firmware/
After Broadcom switched from MIPS to ARM for their home routers we need to have NVRAM driver in some common place (not arch/mips/). We were thinking about putting it in bus directory, however there are two possible buses for MIPS: drivers/ssb/ and drivers/bcma/. So this won't fit there neither.
This is why I would like to move this driver to the drivers/firmware/
---
Hey, this is another try for the NVRAM driver. At first I tried moving it to the drivers/misc/, but then decided drivers/soc/ will be better. Then after discussion with Paul we decided to try drivers/firmware/ and so I do.
Meanwhile I've sent few patches cleaning nvram.c: following kernel coding style and using helpers like readl.
I would like to get few Reviewed-by for this patch. If I get that, then I'll re-send this patch to Ralf without the RFC.
If you want to review nvram.c code, please make sure to check version in ralf/upstream-sfr.git repository as it contains many cleanups:git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git
http://git.linux-mips.org/cgit/ralf/upstream-sfr.git/log/
Mentioned patches (more cleanups):
http://patchwork.linux-mips.org/project/linux-mips/list/?submitter=478
Finally: why drivers/firmware/? Please see Paul's e-mail:
<[email protected]>
http://www.linux-mips.org/archives/linux-mips/2014-11/msg00678.html
Unfortunately there is no mailing list for drivers/firmware/, so I've picked ppl with 5+ commits to this directory. Hope this is OK.
--- arch/mips/Kconfig | 1 + arch/mips/bcm47xx/Makefile | 2 +- drivers/firmware/Kconfig | 1 + drivers/firmware/Makefile | 1 + drivers/firmware/broadcom/Kconfig | 11 +++++++++++ drivers/firmware/broadcom/Makefile | 1 + .../nvram.c => drivers/firmware/broadcom/bcm47xx_nvram.c | 2 ++ include/linux/bcm47xx_nvram.h | 2 +- 8 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 drivers/firmware/broadcom/Kconfig create mode 100644 drivers/firmware/broadcom/Makefile rename arch/mips/bcm47xx/nvram.c => drivers/firmware/broadcom/bcm47xx_nvram.c (99%)
arch/mips/Kconfig +1 -0
@@ -174,6 +174,7 @@ config BCM47XX select USE_GENERIC_EARLY_PRINTK_8250 select GPIOLIB select LEDS_GPIO_REGISTER + select BCM47XX_NVRAM help Support for BCM47XX based boards
arch/mips/bcm47xx/Makefile +1 -1
@@ -3,5 +3,5 @@ # under Linux. # -obj-y += irq.o nvram.o prom.o serial.o setup.o time.o sprom.o +obj-y += irq.o prom.o serial.o setup.o time.o sprom.o obj-y += board.o buttons.o leds.o workarounds.o
drivers/firmware/Kconfig +1 -0
@@ -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"
drivers/firmware/Makefile +1 -0
@@ -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/
drivers/firmware/broadcom/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +config BCM47XX_NVRAM + bool "Broadcom NVRAM driver" + depends on BCM47XX || ARCH_BCM_5301X + help + Broadcom home routers contain flash partition called "nvram" with all + important hardware configuration as well as some minor user setup. + NVRAM partition contains a text-like data representing name=value + pairs. + This driver provides an easy way to get value of requested parameter. + It simply reads content of NVRAM and parses it. It doesn't control any + hardware part itself.
drivers/firmware/broadcom/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_BCM47XX_NVRAM) += bcm47xx_nvram.o
drivers/firmware/broadcom/bcm47xx_nvram.c renamed from arch/mips/bcm47xx/nvram.c +2 -0
@@ -228,3 +228,5 @@ int bcm47xx_nvram_gpio_pin(const char *name)return -ENOENT ; }EXPORT_SYMBOL (bcm47xx_nvram_gpio_pin); + +MODULE_LICENSE ("GPLv2" );
include/linux/bcm47xx_nvram.h +1 -1
@@ -11,7 +11,7 @@#include <linux/types.h> #include <linux/kernel.h> -#ifdef CONFIG_BCM47XX +#ifdef CONFIG_BCM47XX_NVRAM int bcm47xx_nvram_init_from_mem (u32 base,u32 lim);int bcm47xx_nvram_getenv (const char *name,char *val,size_t val_len);int bcm47xx_nvram_gpio_pin (const char *name);
Signature · 1 line
1.8.4.5
Quoted 27 lines · Rafał Miłecki
After Broadcom switched from MIPS to ARM for their home routers we need to have NVRAM driver in some common place (not
arch/mips/). We were thinking about putting it in bus directory, however there are two possible buses for MIPS:drivers/ssb/anddrivers/bcma/. So this won't fit there neither.
This is why I would like to move this driver to thedrivers/firmware/Signed-off-by Rafał Miłecki <[email protected]>---
Hey, this is another try for the NVRAM driver. At first I tried moving it to thedrivers/misc/, but then decideddrivers/soc/will be better. Then after discussion with Paul we decided to trydrivers/firmware/and so I do.Meanwhile I've sent few patches cleaning
nvram.c: following kernel coding style and using helpers like readl.I would like to get few Reviewed-by for this patch. If I get that, then I'll re-send this patch to Ralf without the RFC.
If you want to review
nvram.ccode, please make sure to check version in ralf/upstream-sfr.git repository as it contains many cleanups:git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git
http://git.linux-mips.org/cgit/ralf/upstream-sfr.git/log/Mentioned patches (more cleanups):
http://patchwork.linux-mips.org/project/linux-mips/list/?submitter=478
Quoted 6 lines
Finally: why
drivers/firmware/? Please see Paul's e-mail:
<[email protected]>
http://www.linux-mips.org/archives/linux-mips/2014-11/msg00678.htmlUnfortunately there is no mailing list for
drivers/firmware/, so I've picked ppl with 5+ commits to this directory. Hope this is OK.
Just to restate, if it's unclear for any other reviewers (as it initially was for me): this isn't an NVRAM driver as most folks understand the term. This "NVRAM" code parses SoC configuration data that is passed to the kernel in flash from the bootloader firmware, "CFE".
- Paul
Rafał Miłecki
maintainerQuoted 36 lines · Paul Walmsley
Quoted 27 lines · Rafał Miłecki
After Broadcom switched from MIPS to ARM for their home routers we need to have NVRAM driver in some common place (not
arch/mips/). We were thinking about putting it in bus directory, however there are two possible buses for MIPS:drivers/ssb/anddrivers/bcma/. So this won't fit there neither.
This is why I would like to move this driver to thedrivers/firmware/Signed-off-by Rafał Miłecki <[email protected]>---
Hey, this is another try for the NVRAM driver. At first I tried moving it to thedrivers/misc/, but then decideddrivers/soc/will be better. Then after discussion with Paul we decided to trydrivers/firmware/and so I do.Meanwhile I've sent few patches cleaning
nvram.c: following kernel coding style and using helpers like readl.I would like to get few Reviewed-by for this patch. If I get that, then I'll re-send this patch to Ralf without the RFC.
If you want to review
nvram.ccode, please make sure to check version in ralf/upstream-sfr.git repository as it contains many cleanups:git://git.linux-mips.org/pub/scm/ralf/upstream-sfr.git
http://git.linux-mips.org/cgit/ralf/upstream-sfr.git/log/Mentioned patches (more cleanups):
http://patchwork.linux-mips.org/project/linux-mips/list/?submitter=478Quoted 6 lines
Finally: why
drivers/firmware/? Please see Paul's e-mail:
<[email protected]>
http://www.linux-mips.org/archives/linux-mips/2014-11/msg00678.htmlUnfortunately there is no mailing list for
drivers/firmware/, so I've picked ppl with 5+ commits to this directory. Hope this is OK.
Quoted 6 lines
Reviewed-by Paul Walmsley <[email protected]>Just to restate, if it's unclear for any other reviewers (as it initially was for me): this isn't an NVRAM driver as most folks understand the term. This "NVRAM" code parses SoC configuration data that is passed to the kernel in flash from the bootloader firmware, "CFE".
Thanks Paul.
Could anyone else review this, please?
Signature · 1 line
Rafał