mtd: core: call devm_of_platform_populate() for MTD devices
Subsystems (4)
PATCH v2 1/3 mtd: core: call devm_of_platform_populate() for MTD devices
From: Rafał Miłecki <[email protected]>
This adds support for bindings present in MTD devices (applies to partitions too) nodes. The purpose of this change is to allow drivers handle MTD device (partition) data. Some partitions may contain info that requires parsing & processing.
An example can be U-Boot partition that contains block with environment variables somehwere in a middle. That block should be described in DT and parsed by a specific driver.
--- drivers/mtd/mtdcore.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/mtdcore.c +4 -0
@@ -19,6 +19,7 @@#include <linux/ioctl.h> #include <linux/init.h> #include <linux/of.h> +#include <linux/of_platform.h> #include <linux/proc_fs.h> #include <linux/idr.h> #include <linux/backing-dev.h>
@@ -690,6 +691,9 @@ int add_mtd_device(struct mtd_info *mtd) not->add (mtd);mutex_unlock (&mtd_table_mutex); + +devm_of_platform_populate (&mtd->dev); +/* We _know_ we aren't being removed, because our caller is still holding us here. So none of this try_ nonsense, and no bitching about it
Signature · 1 line
2.31.1
PATCH v2 2/3 dt-bindings: nvmem: add U-Boot environment variables binding
From: Rafał Miłecki <[email protected]>
This binding allows describing a (part of) MTD device (partition) that contains a block with environment variables. Operating system usually needs to parse that block to read variables values that may affect booting process & device configuration.
---
V2: s/u,boot/u-boot/
--- .../devicetree/bindings/nvmem/u-boot,env.yaml | 56 +++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yaml
Documentation/devicetree/bindings/nvmem/u-boot,env.yaml new file +56 -0
@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: U-Boot environment variables + +description: | + U-Boot uses environment variables to store device parameters and + configuration. They may be used for booting process, setup or keeping end user + interesting info. + + Data is stored on flash partition in a U-Boot specific format (CRC32 and NUL + separated key-value pairs). + + This binding allows specifying data location and format (default one or vendor + specific). + +maintainers: + - Rafał Miłecki <[email protected]> + +allOf: + - $ref: nvmem.yaml# + +properties: + compatible: + enum: + - u-boot,env + - brcm,env + + reg: + maxItems: 1 + +unevaluatedProperties: false + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x100000>; + + #address-cells = <1>; + #size-cells = <1>; + + nvmem@10000 { + compatible = "u-boot,env"; + reg = <0x10000 0x10000>; + }; + }; + };
MAINTAINERS +5 -0
@@ -19624,6 +19624,11 @@ W: http://linuxtv.org T: git git://linuxtv.org/media_tree.git F: drivers/media/pci/tw686x/ +U-BOOT ENVIRONMENT VARIABLES +M: Rafał Miłecki <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml + UACCE ACCELERATOR FRAMEWORK M: Zhangfei Gao <[email protected]> M: Zhou Wang <[email protected]>
Signature · 1 line
2.31.1
Rob Herring
maintainerRe: [PATCH V2 2/3] dt-bindings: nvmem: add U-Boot environment variables binding
Quoted 6 lines · Rafał Miłecki
From: Rafał Miłecki <[email protected]>
This binding allows describing a (part of) MTD device (partition) that contains a block with environment variables. Operating system usually needs to parse that block to read variables values that may affect booting process & device configuration.
What do the u-boot folks think about this binding? This needs an ack from a u-boot maintainer.
Quoted 57 lines
Signed-off-by Rafał Miłecki <[email protected]>---
V2: s/u,boot/u-boot/--- .../devicetree/bindings/nvmem/u-boot,env.yaml | 56 +++++++++++++++++++ MAINTAINERS | 5 ++ 2 files changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvmem/u-boot,env.yamlDocumentation/devicetree/bindings/nvmem/u-boot,env.yaml new file +41
-0@@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/nvmem/u-boot,env.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: U-Boot environment variables + +description: | + U-Boot uses environment variables to store device parameters and + configuration. They may be used for booting process, setup or keeping end user + interesting info. + + Data is stored on flash partition in a U-Boot specific format (CRC32 and NUL + separated key-value pairs). + + This binding allows specifying data location and format (default one or vendor + specific). + +maintainers: + - Rafał Miłecki <[email protected]> + +allOf: + - $ref: nvmem.yaml# + +properties: + compatible: + enum: + - u-boot,env + - brcm,env + + reg: + maxItems: 1 + +unevaluatedProperties: false + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>;
Documentation/devicetree/bindings/nvmem/u-boot,env.yaml line 51
Quoted 10 lines
Documentation/devicetree/bindings/nvmem/u-boot,env.yaml new file +10
-0+ #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x100000>; + + #address-cells = <1>; + #size-cells = <1>; + + nvmem@10000 {
I think most existing cases define a partition for the u-boot env, but this looks like you have it nested with other u-boot related data? Is there any reason to nest the partitions? A compatible in a partition node should be enough.
Quoted 25 lines
Documentation/devicetree/bindings/nvmem/u-boot,env.yaml new file +5
-0+ compatible = "u-boot,env"; + reg = <0x10000 0x10000>; + }; + }; + };MAINTAINERS +5
-0@@ -19624,6 +19624,11 @@ W: http://linuxtv.org T: git git://linuxtv.org/media_tree.git F: drivers/media/pci/tw686x/ +U-BOOT ENVIRONMENT VARIABLES +M: Rafał Miłecki <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml + UACCE ACCELERATOR FRAMEWORK M: Zhangfei Gao <[email protected]> M: Zhou Wang <[email protected]>Signature · 1 line
2.31.1
PATCH v2 3/3 nvmem: add driver handling U-Boot environment variables
In reply to Rafał MiłeckiFrom: Rafał Miłecki <[email protected]>
U-Boot binary contains a block of environment variables (NVMEM) that should be parsed and exposed as NVMEM cells.
---
V2: Drop debugging dev_info() call
Fix variable type mismatch
--- MAINTAINERS | 1 + drivers/nvmem/Kconfig | 10 ++ drivers/nvmem/Makefile | 2 + drivers/nvmem/u-boot-env.c | 235 +++++++++++++++++++++++++++++++++++++ 4 files changed, 248 insertions(+) create mode 100644 drivers/nvmem/u-boot-env.c
MAINTAINERS +1 -0
@@ -19628,6 +19628,7 @@ U-BOOT ENVIRONMENT VARIABLES M: Rafał Miłecki <[email protected]> S: Maintained F: Documentation/devicetree/bindings/nvmem/u-boot,env.yaml +F: drivers/nvmem/u-boot-env.c UACCE ACCELERATOR FRAMEWORK M: Zhangfei Gao <[email protected]>
drivers/nvmem/Kconfig +10 -0
@@ -300,4 +300,14 @@ config NVMEM_BRCM_NVRAM This driver provides support for Broadcom's NVRAM that can be accessed using I/O mapping. +config NVMEM_U_BOOT_ENV + tristate "U-Boot environment variables support" + depends on ARCH_BCM4908 || COMPILE_TEST + depends on OF + help + This driver adds support for parsing U-Boot environment variables + stored on flash partition. + + If compiled as module it will be called nvmem_u-boot-env. + endif
drivers/nvmem/Makefile +2 -0
@@ -61,3 +61,5 @@ obj-$(CONFIG_NVMEM_RMEM) += nvmem-rmem.o nvmem-rmem-y := rmem.o obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o nvmem_brcm_nvram-y := brcm_nvram.o +obj-$(CONFIG_NVMEM_U_BOOT_ENV) += nvmem_u-boot-env.o +nvmem_u-boot-env-y := u-boot-env.o
drivers/nvmem/u-boot-env.c new file +235 -0
235 lines not on this page · raw message
Signature · 1 line
2.31.1
kernel test robot
build botRe: [PATCH V2 3/3] nvmem: add driver handling U-Boot environment variables
I love your patch! Yet something to improve:
Hi "Rafał,
I love your patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on mtd/mtd/next mtd/mtd/fixes linus/master v5.16-rc8] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: nios2-randconfig-r013-20220105 (https://download.01.org/0day-ci/archive/20220105/202201051502.yOxThsL0-lkp(a)intel.com/config) compiler: nios2-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/52f6be4712d04b927cd356dd95940bd76f1f5b97
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 git checkout 52f6be4712d04b927cd356dd95940bd76f1f5b97
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=nios2 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
nios2-linux-ld: drivers/nvmem/u-boot-env.o: in function `u_boot_env_read':
u-boot-env.c:(.text+0x2c): undefined reference to mtd_read' u-boot-env.c:(.text+0x2c): relocation truncated to fit: R_NIOS2_CALL26 against mtd_read'
nios2-linux-ld: drivers/nvmem/u-boot-env.o: in function `u_boot_env_parse':
u-boot-env.c:(.text+0x2d4): undefined reference to mtd_read' u-boot-env.c:(.text+0x2d4): relocation truncated to fit: R_NIOS2_CALL26 against mtd_read'
>> nios2-linux-ld: u-boot-env.c:(.text+0x314): undefined reference to `mtd_read'
u-boot-env.c:(.text+0x314): relocation truncated to fit: R_NIOS2_CALL26 against `mtd_read'
nios2-linux-ld: drivers/nvmem/u-boot-env.o: in function `u_boot_env_probe':
u-boot-env.c:(.text+0x4ec): undefined reference to get_mtd_device_nm' u-boot-env.c:(.text+0x4ec): relocation truncated to fit: R_NIOS2_CALL26 against get_mtd_device_nm'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH V2 3/3] nvmem: add driver handling U-Boot environment variables
In reply to Rafał MiłeckiI love your patch! Yet something to improve:
Hi "Rafał,
I love your patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on mtd/mtd/next mtd/mtd/fixes linus/master v5.16-rc8 next-20220105] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: hexagon-randconfig-r013-20220105 (https://download.01.org/0day-ci/archive/20220105/202201051949.ZpWQfrvi-lkp(a)intel.com/config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/52f6be4712d04b927cd356dd95940bd76f1f5b97
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 git checkout 52f6be4712d04b927cd356dd95940bd76f1f5b97
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "mtd_read" [drivers/nvmem/nvmem_u-boot-env.ko] undefined! >> ERROR: modpost: "get_mtd_device_nm" [drivers/nvmem/nvmem_u-boot-env.ko] undefined!
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/svc-i3c-master.ko] undefined!
ERROR: modpost: "__raw_writesl" [drivers/i3c/master/dw-i3c-master.ko] undefined!
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/dw-i3c-master.ko] undefined!
ERROR: modpost: "__raw_writesl" [drivers/i3c/master/i3c-master-cdns.ko] undefined!
ERROR: modpost: "__raw_readsl" [drivers/i3c/master/i3c-master-cdns.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH V2 3/3] nvmem: add driver handling U-Boot environment variables
In reply to Rafał MiłeckiI love your patch! Yet something to improve:
Hi "Rafał,
I love your patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on mtd/mtd/next mtd/mtd/fixes linus/master v5.16-rc8] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arm64-randconfig-r003-20220105 (https://download.01.org/0day-ci/archive/20220105/202201052036.kcalPY98-lkp(a)intel.com/config) compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/52f6be4712d04b927cd356dd95940bd76f1f5b97
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rafa-Mi-ecki/mtd-core-call-devm_of_platform_populate-for-MTD-devices/20211230-170531 git checkout 52f6be4712d04b927cd356dd95940bd76f1f5b97
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
aarch64-linux-ld: Unexpected GOT/PLT entries detected!
aarch64-linux-ld: Unexpected run-time procedure linkages detected!
aarch64-linux-ld: drivers/nvmem/u-boot-env.o: in function `u_boot_env_read':
>> u-boot-env.c:(.text+0x4c): undefined reference to `mtd_read' aarch64-linux-ld: drivers/nvmem/u-boot-env.o: in function `u_boot_env_probe': >> u-boot-env.c:(.text+0x3e0): undefined reference to `get_mtd_device_nm' >> aarch64-linux-ld: u-boot-env.c:(.text+0x428): undefined reference to `mtd_read'
aarch64-linux-ld: u-boot-env.c:(.text+0x494): undefined reference to `mtd_read'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org