[PATCH] MAINTAINERS: Update path for U-Boot environment variables YAML

2024-08-07 Thread Rafał Miłecki
From: Rafał Miłecki This file was moved to the layouts/ subdirectory. Signed-off-by: Rafał Miłecki --- I missed this MAINTAINERS change in the commit 1b3f5b88c541 ("dt-bindings: nvmem: convert U-Boot env to a layout"). Srini: I believe your policy is to rebase your tree and send

[PATCH V2 1/3] nvmem: u-boot-env: error if NVMEM device is too small

2024-07-29 Thread Rafał Miłecki
[rmilecki: simplify commit description & rebase] Signed-off-by: Rafał Miłecki --- V2: New patch in the series drivers/nvmem/u-boot-env.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c index 936e39b20b38..593f0bf4a395 100644 --- a/d

[PATCH V2 3/3] nvmem: layouts: add U-Boot env layout

2024-07-29 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in a specific format. Actual data can be placed in various storage sources (MTD, UBI volume, EEPROM, NVRAM, etc.). Move all generic (NVMEM device independent) code from NVMEM device driver to an NVMEM layout driver. Then add a simple

[PATCH V2 2/3] dt-bindings: nvmem: convert U-Boot env to a layout

2024-07-29 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI volumes and other NVMEM devices. Link: https://lore.kernel.org/all/20231221173421.13737-1-zaj...@gmail.com

[PATCH 2/2] nvmem: layouts: add U-Boot env layout

2024-07-15 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in a specific format. Actual data can be placed in various storage sources (MTD, UBI volume, EEPROM, NVRAM, etc.). Move all generic (NVMEM device independent) code from NVMEM device driver to an NVMEM layout driver. Then add a simple

[PATCH 1/2] dt-bindings: nvmem: convert U-Boot env to a layout

2024-07-15 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI volumes and other NVMEM devices. Link: https://lore.kernel.org/all/20231221173421.13737-1-zaj...@gmail.com

Re: [PATCH] dt-bindings: nvmem: convert U-Boot env to a layout

2024-07-08 Thread Rafał Miłecki
On 8.07.2024 08:32, Miquel Raynal wrote: zaj...@gmail.com wrote on Sat, 6 Jul 2024 00:58:21 +0200: From: Rafał Miłecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI

[PATCH] dt-bindings: nvmem: convert U-Boot env to a layout

2024-07-05 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be stored in various data sources. MTD is just one of available options. Refactor DT binding into a layout so it can be used with UBI volumes and other NVMEM devices. Link: https://lore.kernel.org/all/20231221173421.13737-1-zaj...@gmail.com

Re: [PATCH V3 1/6] dt-bindings: nvmem: layouts: add U-Boot environment variables layout

2024-01-04 Thread Rafał Miłecki
On 4.01.2024 08:58, Miquel Raynal wrote: r...@kernel.org wrote on Wed, 3 Jan 2024 17:11:29 -0700: On Thu, Dec 21, 2023 at 06:34:16PM +0100, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot env data is a way of storing firmware variables. It's a format that can be used of top of va

[PATCH V3 6/6] nvmem: layouts: add U-Boot env layout

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki Move all generic (NVMEM devices independent) code from NVMEM device driver to NVMEM layout driver. Then add a simple NVMEM layout code on top of it. Thanks to proper layout it's possible to support U-Boot env data stored on any kind of NVMEM device. For bac

[PATCH V3 5/6] nvmem: u-boot-env: improve coding style

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki 1. Prefer kzalloc() over kcalloc() See memory-allocation.rst which says: "to be on the safe side it's best to use routines that set memory to zero, like kzalloc()" 2. Drop dev_err() for u_boot_env_add_cells() fail It can fail only on -ENOMEM. We don&

[PATCH V3 4/6] nvmem: u-boot-env: use nvmem device helpers

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki Use nvmem_dev_size() and nvmem_device_read() to make this driver less mtd dependent. Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- V2: Don't introduce memleak when handling nvmem_device_read() failures V3: Split PATCH 3/3 into two drivers/nvmem/u-boot-

[PATCH V3 3/6] nvmem: u-boot-env: use nvmem_add_one_cell() nvmem subsystem helper

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki Simplify adding NVMEM cells. Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- V3: Split PATCH 3/3 into two drivers/nvmem/u-boot-env.c | 55 +++--- 1 file changed, 21 insertions(+), 34 deletions(-) diff --git a/drivers/nvmem/u

[PATCH V3 2/6] nvmem: core: add nvmem_dev_size() helper

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM content. It's especially useful for NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- drivers/nvmem/core.c

[PATCH V3 1/6] dt-bindings: nvmem: layouts: add U-Boot environment variables layout

2023-12-21 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot env data is a way of storing firmware variables. It's a format that can be used of top of various storage devices. Its binding should be an NVMEM layout instead of a standalone device. This patch adds layout binding which allows using it on top of MTD NVMEM devi

Re: [PATCH V2 3/5] nvmem: u-boot-env: use more nvmem subsystem helpers

2023-12-19 Thread Rafał Miłecki
On 19.12.2023 19:13, Greg Kroah-Hartman wrote: On Tue, Dec 19, 2023 at 06:40:23PM +0100, Rafał Miłecki wrote: From: Rafał Miłecki 1. Use nvmem_dev_size() and nvmem_device_read() to make this driver less mtd dependent 2. Use nvmem_add_one_cell() to simplify adding NVMEM cells Shouldn&#

[PATCH V2 5/5] nvmem: layouts: add U-Boot env layout

2023-12-19 Thread Rafał Miłecki
From: Rafał Miłecki This patch moves all generic (NVMEM devices independent) code from NVMEM device driver to NVMEM layout driver. Then it adds a simple NVMEM layout code on top of it. Thanks to proper layout it's possible to support U-Boot env data stored on any kind of NVMEM device.

[PATCH V2 4/5] nvmem: u-boot-env: improve coding style

2023-12-19 Thread Rafał Miłecki
From: Rafał Miłecki 1. Prefer kzalloc() over kcalloc() See memory-allocation.rst which says: "to be on the safe side it's best to use routines that set memory to zero, like kzalloc()" 2. Drop dev_err() for u_boot_env_add_cells() fail It can fail only on -ENOMEM. We don&

[PATCH V2 3/5] nvmem: u-boot-env: use more nvmem subsystem helpers

2023-12-19 Thread Rafał Miłecki
From: Rafał Miłecki 1. Use nvmem_dev_size() and nvmem_device_read() to make this driver less mtd dependent 2. Use nvmem_add_one_cell() to simplify adding NVMEM cells Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- V2: Don't introduce memleak when handling nvmem_device

[PATCH V2 2/5] nvmem: core: add nvmem_dev_size() helper

2023-12-19 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM content. It's especially useful for NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki Reviewed-by: Miquel Raynal --- drivers/nvmem/core.c

[PATCH V2 1/5] dt-bindings: nvmem: layouts: add U-Boot environment variables layout

2023-12-19 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot env data is a way of storing firmware variables. It's a format that can be used of top of various storage devices. Its binding should be an NVMEM layout instead of a standalone device. This patch adds layout binding which allows using it on top of MTD NVMEM devi

Re: [PATCH 4/4] nvmem: layouts: add U-Boot env layout

2023-12-19 Thread Rafał Miłecki
On 19.12.2023 10:55, Rafał Miłecki wrote: On 19.12.2023 08:55, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Mon, 18 Dec 2023 23:10:20 +0100: On 18.12.2023 15:21, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Mon, 18 Dec 2023 14:37:22 +0100: From: Rafał Miłecki

Re: [PATCH 4/4] nvmem: layouts: add U-Boot env layout

2023-12-19 Thread Rafał Miłecki
On 19.12.2023 08:55, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Mon, 18 Dec 2023 23:10:20 +0100: On 18.12.2023 15:21, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Mon, 18 Dec 2023 14:37:22 +0100: From: Rafał Miłecki This patch moves all generic (NVMEM

Re: [PATCH 1/4] dt-bindings: nvmem: layouts: add U-Boot environment variables layout

2023-12-18 Thread Rafał Miłecki
On 18.12.2023 15:48, Rob Herring wrote: On Mon, 18 Dec 2023 14:37:19 +0100, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot env data is a way of storing firmware variables. It's a format that can be used of top of various storage devices. Its binding should be an NVMEM layout instead

Re: [PATCH 4/4] nvmem: layouts: add U-Boot env layout

2023-12-18 Thread Rafał Miłecki
On 18.12.2023 15:21, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Mon, 18 Dec 2023 14:37:22 +0100: From: Rafał Miłecki This patch moves all generic (NVMEM devices independent) code from NVMEM device driver to NVMEM layout driver. Then it adds a simple NVMEM layout code on top of

Re: [PATCH RFC] dt-bindings: nvmem: u-boot, env: add any-name MAC cells compatible

2023-12-18 Thread Rafał Miłecki
On 14.12.2023 22:27, Simon Glass wrote: On Thu, 14 Dec 2023 at 08:36, Rafał Miłecki wrote: From: Rafał Miłecki So far we had a property for "ethaddr" NVMEM cell containing base Ethernet MAC address. The problem is vendors often pick non-standard names for storing MAC(s) (other tha

[PATCH 3/4] nvmem: u-boot-env: use more nvmem subsystem helpers

2023-12-18 Thread Rafał Miłecki
From: Rafał Miłecki 1. Use nvmem_dev_size() and nvmem_device_read() to make this driver less mtd dependent 2. Use nvmem_add_one_cell() to simplify adding NVMEM cells Signed-off-by: Rafał Miłecki --- drivers/nvmem/u-boot-env.c | 79 +- 1 file changed, 35

[PATCH 4/4] nvmem: layouts: add U-Boot env layout

2023-12-18 Thread Rafał Miłecki
From: Rafał Miłecki This patch moves all generic (NVMEM devices independent) code from NVMEM device driver to NVMEM layout driver. Then it adds a simple NVMEM layout code on top of it. Thanks to proper layout it's possible to support U-Boot env data stored on any kind of NVMEM device.

[PATCH 1/4] dt-bindings: nvmem: layouts: add U-Boot environment variables layout

2023-12-18 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot env data is a way of storing firmware variables. It's a format that can be used of top of various storage devices. Its binding should be an NVMEM layout instead of a standalone device. This patch adds layout binding which allows using it on top of MTD NVMEM devi

[PATCH 2/4] nvmem: core: add nvmem_dev_size() helper

2023-12-18 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM content. It's especially useful for NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki --- drivers/nvmem/core.c | 13 + include/

[PATCH RFC] dt-bindings: nvmem: u-boot, env: add any-name MAC cells compatible

2023-12-14 Thread Rafał Miłecki
From: Rafał Miłecki So far we had a property for "ethaddr" NVMEM cell containing base Ethernet MAC address. The problem is vendors often pick non-standard names for storing MAC(s) (other than "ethaddr"). A few names were noticed over years: 1. "wanaddr" (Edim

[PATCH] fw_env: keep calling read() until whole flash block is read

2023-12-13 Thread Rafał Miłecki
From: Rafał Miłecki It's totally valid for read() to provide less bytes than requested maximum. It may happen if there is no more data available yet or source pushes data in small chunks. This actually happens when trying to read env data from NVMEM device. Kernel may provide NVMEM conte

[PATCH] fw_env: rename variables holding env data content

2023-12-13 Thread Rafał Miłecki
From: Rafał Miłecki Rename "addr0" and "addr1" to "buf0" and "buf1" accordingly. Name "addr" suggests that variable contains a numeric value being some kind of address. Name "buf" is de facto a standard name for pointer to allocated me

[PATCH] fw_env: fix reading NVMEM device's "compatible" value

2023-12-12 Thread Rafał Miłecki
From: Rafał Miłecki Call to fread() was changed to check for return value. The problem is it can't be checked for returning 1 (as it is) to determine success. We call fread() with buffer size as "size" argument. Reading any "compatible" value shorter than buffer size w

Re: [PATCH v2] net: phy: broadcom: add support for BCM54210E

2023-08-06 Thread Rafał Miłecki
") AUX/SHD/bcm54xx_config_clock_delay update ported from Linux 6.5-rc4 commit 28e219aea0b9e ("net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead") Signed-off-by: Marek Vasut Reviewed-by: Rafał Miłecki

Re: [PATCH] net: phy: broadcom: add support for BCM54210E

2023-08-05 Thread Rafał Miłecki
On 5.08.2023 05:38, Marek Vasut wrote: It's Broadcom PHY simply described as single-port RGMII 10/100/1000BASE-T PHY. It requires disabling delay skew and GTXCLK bits. Ported from Linux kernel commit 0fc9ae1076697 ("net: phy: broadcom: add support for BCM54210E") Signed-off-by: Marek Vasut ---

[PATCH V2 3/3] nvmem: u-boot-env: post-process "ethaddr" env variable

2023-03-18 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drive

[PATCH V2 2/3] nvmem: core: support specifying both: cell raw data & post read lengths

2023-03-18 Thread Rafał Miłecki
From: Rafał Miłecki Callback .read_post_process() is designed to modify raw cell content before providing it to the consumer. So far we were dealing with modifications that didn't affect cell size (length). In some cases however cell content needs to be reformatted and resized. It'

[PATCH V2 1/3] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-03-18 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

[PATCH V2 0/3] nvmem: support post read for U-Boot's "ethaddr"

2023-03-18 Thread Rafał Miłecki
From: Rafał Miłecki This change is required for NVMEM consumers to get expected MAC address from U-Boot env data variable "ethaddr". To address some previous concerns: 1. Yes, U-Boot env binding & driver should be converted to NVMEM layout 2. My priority is to get working MAC rat

Re: [PATCH 2/4] nvmem: core: allow nvmem_cell_post_process_t callbacks to adjust buffer

2023-03-09 Thread Rafał Miłecki
, 9 Mar 2023 10:53:07 >> +: >> >>> On 09/03/2023 10:32, Miquel Raynal wrote: >>>> Hi Srinivas, >>>> >>>> srinivas.kandaga...@linaro.org wrote on Thu, 9 Mar 2023 10:12:24 >>>> +: >>>> >>>&g

Re: [PATCH 2/4] nvmem: core: allow nvmem_cell_post_process_t callbacks to adjust buffer

2023-03-09 Thread Rafał Miłecki
:12:24 +: On 22/02/2023 17:22, Rafał Miłecki wrote: @@ -1791,11 +1792,15 @@ ssize_t nvmem_device_cell_read(struct nvmem_device *nvmem, if (!nvmem) return -EINVAL; > + /* Cells with read_post_process hook may realloc buffer we can't allow here */ +

[PATCH 3/4] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-02-22 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

[PATCH 4/4] nvmem: u-boot-env: post-process "ethaddr" env variable

2023-02-22 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drive

[PATCH 2/4] nvmem: core: allow nvmem_cell_post_process_t callbacks to adjust buffer

2023-02-22 Thread Rafał Miłecki
From: Rafał Miłecki Sometimes reading NVMEM cell value involves some data reformatting. it may require resizing available buffer. Support that. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). Signed-off

[PATCH 1/4] nvmem: core: add per-cell post processing

2023-02-22 Thread Rafał Miłecki
From: Michael Walle Instead of relying on the name the consumer is using for the cell, like it is done for the nvmem .cell_post_process configuration parameter, provide a per-cell post processing hook. This can then be populated by the NVMEM provider (or the NVMEM layout) when adding the cell. S

[PATCH 0/4] nvmem: cell post-processing & U-Boot env MAC support

2023-02-22 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored using ASCII format. One of important entries is "ethaddr" which contains base MAC address. That NVMEM cell requires some extra processing when reading: 1. ASCII needs translating into binary MAC format 2. Final MAC n

Re: [PATCH V3 1/6] nvmem: core: add nvmem_dev_size() helper

2023-01-30 Thread Rafał Miłecki
On 30.01.2023 11:56, Miquel Raynal wrote: Hi Rafał, zaj...@gmail.com wrote on Fri, 27 Jan 2023 13:57:04 +0100: From: Rafał Miłecki This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block

[PATCH V3 6/6] nvmem: u-boot-env: post process "ethaddr" env variable

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drivers/nvmem

[PATCH V3 5/6] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

[PATCH V3 4/6] nvmem: u-boot-env: convert to layout driver

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found on various NVMEM devices (not just MTD) so convert this driver to a generic layout one. This way - thanks to using NVMEM generic API - this driver can be reused in other scenarios. For backward DT compatibility we need to support

[PATCH V3 2/6] nvmem: core: allow .read_post_process() callbacks to adjust buffer

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki Sometimes reading NVMEM cell value involves some data reformatting. it may require resizing available buffer. Support that. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). Signed-off

[PATCH V3 3/6] dt-bindings: nvmem: convert U-Boot env vars to NVMEM layout

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found of various underlaying storage entities. This binding should be defined as a layout on top on NVMEM device not a NVMEM device itself. Signed-off-by: Rafał Miłecki Reviewed-by: Rob Herring --- .../bindings/nvmem/layouts/nvmem

[PATCH V3 1/6] nvmem: core: add nvmem_dev_size() helper

2023-01-27 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki --- V2: Drop "const" from "const size_t" --- drivers/nvmem/c

Re: [PATCH] mtd: rawnand: nand_base: Handle algorithm selection

2023-01-26 Thread Rafał Miłecki
On 26.01.2023 02:14, William Zhang wrote: On 01/21/2023 03:43 PM, Linus Walleij wrote: For BRCMNAND with 1-bit BCH ECC (BCH-1) such as used on the D-Link DIR-885L and DIR-890L routers, we need to explicitly select the ECC like this in the device tree:    nand-ecc-algo = "bch";    nand-ecc-stren

[PATCH V2 6/6] nvmem: u-boot-env: post process "ethaddr" env variable

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drivers/nvmem

[PATCH V2 4/6] nvmem: u-boot-env: convert to layout driver

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found on various NVMEM devices (not just MTD) so convert this driver to a generic layout one. This way - thanks to using NVMEM generic API - this driver can be reused in other scenarios. For backward DT compatibility we need to support

[PATCH V2 5/6] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

[PATCH V2 3/6] dt-bindings: nvmem: convert U-Boot env vars to NVMEM layout

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found of various underlaying storage entities. This binding should be defined as a layout on top on NVMEM device not a NVMEM device itself. Signed-off-by: Rafał Miłecki --- .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + .../nvmem

[PATCH V2 2/6] nvmem: core: allow .read_post_process() callbacks to adjust buffer

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki Sometimes reading NVMEM cell value involves some data reformatting. it may require resizing available buffer. Support that. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). Signed-off

[PATCH V2 1/6] nvmem: core: add nvmem_dev_size() helper

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki --- V2: Drop "const" from "const size_t" --- drivers/nvmem/c

Re: [PATCH 6/6] nvmem: u-boot-env: post process "ethaddr" env variable

2023-01-10 Thread Rafał Miłecki
On 10.01.2023 13:19, Michael Walle wrote: Hi, Am 2023-01-10 11:54, schrieb Rafał Miłecki: From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for

[PATCH 4/6] nvmem: u-boot-env: convert to layout driver

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found on various NVMEM devices (not just MTD) so convert this driver to a generic layout one. This way - thanks to using NVMEM generic API - this driver can be reused in other scenarios. For backward DT compatibility we need to support

[PATCH 6/6] nvmem: u-boot-env: post process "ethaddr" env variable

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drivers/nvmem

[PATCH 5/6] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

[PATCH 3/6] dt-bindings: nvmem: convert U-Boot env vars to NVMEM layout

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables can be found of various underlaying storage entities. This binding should be defined as a layout on top on NVMEM device not a NVMEM device itself. Signed-off-by: Rafał Miłecki --- .../bindings/nvmem/layouts/nvmem-layout.yaml | 1 + .../nvmem

[PATCH 2/6] nvmem: core: allow .read_post_process() callbacks to adjust data length

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki Sometimes reading NVMEM cell value involves some data reformatting. It requires passing updated size value to the caller. Support that. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). Sig

[PATCH 1/6] nvmem: core: add nvmem_dev_size() helper

2023-01-10 Thread Rafał Miłecki
From: Rafał Miłecki This is required by layouts that need to read whole NVMEM space. It applies to NVMEM devices without hardcoded layout (like U-Boot environment data block). Signed-off-by: Rafał Miłecki --- drivers/nvmem/core.c | 13 + include/linux/nvmem-consumer.h

[PATCH 3/3] nvmem: u-boot-env: post process "ethaddr" env variable

2023-01-05 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot environment variables are stored in ASCII format so "ethaddr" requires parsing into binary to make it work with Ethernet interfaces. This includes support for indexes to support #nvmem-cell-cells = <1>. Signed-off-by: Rafał Miłecki --- drivers/nv

[PATCH 2/3] nvmem: core: allow .read_post_process() callbacks to adjust data length

2023-01-05 Thread Rafał Miłecki
From: Rafał Miłecki Sometimes reading NVMEM cell value involves some data reformatting. It requires passing updated size value to the caller. Support that. It's required e.g. to provide properly formatted MAC address in case it's stored in a non-binary format (e.g. using ASCII). Sig

[PATCH 1/3] dt-bindings: nvmem: u-boot, env: add MAC's #nvmem-cell-cells

2023-01-05 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot's "ethaddr" environment variable is very often used to store *base* MAC address. It's used as a base for calculating addresses for multiple interfaces. It's done by adding proper values. Actual offsets are picked by manufacturers and vary acros

Re: [PATCH v20 1/4] net: Add TCP protocol

2022-11-28 Thread Rafał Miłecki
On 28.11.2022 20:52, Tom Rini wrote: On Tue, Nov 08, 2022 at 02:17:28PM +0800, Ying-Chun Liu (PaulLiu) wrote: From: "Ying-Chun Liu (PaulLiu)" Currently file transfers are done using tftp or NFS both over udp. This requires a request to be sent from client (u-boot) to the boot server. The cur

[PATCH V2 2/2] nvmem: u-boot-env: reformat MAC in "ethaddr" cell when reading

2022-11-27 Thread Rafał Miłecki
From: Rafał Miłecki NVMEM consumers expect MAC in a byte-based format (see e.g. nvmem_get_mac_address()). U-Boot environment data stores all values in ASCII form. Add post processing callback detecting "ethaddr" reads and reformat data as expected. This fixes Ethernet drivers readin

[PATCH V2 1/2] nvmem: core: refactor .cell_post_process() CB arguments

2022-11-27 Thread Rafał Miłecki
From: Rafał Miłecki Pass whole NVMEM cell struct and length pointer as arguments to callback functions. This allows: 1. Cells content to be modified based on more info Some cells (identified by their names) contain specific data that needs further processing. This can be e.g. MAC address

[PATCH 2/2] nvmem: u-boot-env: reformat MAC in "ethaddr" cell when reading

2022-11-27 Thread Rafał Miłecki
From: Rafał Miłecki NVMEM consumers expect MAC in a byte-based format (see e.g. nvmem_get_mac_address()). U-Boot environment data stores all values in ASCII form. Add post processing callback detecting "ethaddr" reads and reformat data as expected. This fixes Ethernet drivers readin

[PATCH 1/2] nvmem: core: refactor .cell_post_process() CB arguments

2022-11-27 Thread Rafał Miłecki
From: Rafał Miłecki Pass whole NVMEM cell struct and length pointer as arguments to callback functions. This allows: 1. Cells content to be modified based on more info Some cells (identified by their names) contain specific data that needs further processing. This can be e.g. MAC address

Re: [PATCH] nvmem: u-boot-env: add Broadcom format support

2022-11-11 Thread Rafał Miłecki
On 17.10.2022 09:17, Rafał Miłecki wrote: From: Rafał Miłecki Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. They decided to store U-Boot environment data inside U-Boot partition and to use a custom header (with "uEnv" magic and env data length). Add support for

Re: [PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions

2022-10-18 Thread Rafał Miłecki
On 18.10.2022 17:50, Conor Dooley wrote: On Tue, Oct 18, 2022 at 05:42:01PM +0200, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot partition may contain subpartitions. For example Broadcom includes environment data block in the middle of its U-Boot partition. This allows describing

[PATCH V3 2/2] dt-bindings: nvmem: u-boot, env: add Broadcom's variant binding

2022-10-18 Thread Rafał Miłecki
From: Rafał Miłecki Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. U-Boot stores its configuration in an environment data block. Such blocks are usually stored on flash as a separated partition at hardcoded address. Broadcom however decided to: 1. Store env data block inside U

[PATCH V3 1/2] dt-bindings: mtd: partitions: u-boot: allow dynamic subpartitions

2022-10-18 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot partition may contain subpartitions. For example Broadcom includes environment data block in the middle of its U-Boot partition. This allows describing Broadcom's U-Boot env data and will allow referencing its NVMEM cell in the future. Reg: 118f3fbe517f4

Re: [PATCH V2] dt-bindings: nvmem: u-boot, env: add Broadcom's variant binding

2022-10-18 Thread Rafał Miłecki
On 18.10.2022 12:19, Conor Dooley wrote: On Fri, Oct 14, 2022 at 04:09:40PM -0500, Rob Herring wrote: On Fri, 30 Sep 2022 18:36:31 +0200, Rafał Miłecki wrote: From: Rafał Miłecki Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. U-Boot stores its configuration in an

[PATCH] nvmem: u-boot-env: add Broadcom format support

2022-10-17 Thread Rafał Miłecki
From: Rafał Miłecki Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. They decided to store U-Boot environment data inside U-Boot partition and to use a custom header (with "uEnv" magic and env data length). Add support for Broadcom's specific binding and thei

[PATCH V2] dt-bindings: nvmem: u-boot, env: add Broadcom's variant binding

2022-09-30 Thread Rafał Miłecki
From: Rafał Miłecki Broadcom uses U-Boot for a lot of their bcmbca familiy chipsets. U-Boot stores its configuration in an environment data block. Such blocks are usually stored on flash as a separated partition at hardcoded address. Broadcom however decided to: 1. Store env data block inside U

Re: [PATCH] dt-bindings: nvmem: u-boot, env: add Broadcom's variant binding

2022-09-21 Thread Rafał Miłecki
On 7.04.2022 20:17, Rob Herring wrote: On Thu, Apr 07, 2022 at 04:55:14AM -0700, Joel Peshkin wrote: The first 32b value is a magic number (endian swapped mnemonic of "uEnv" short for "u-boot environment"). Finding that magic number of a 4K boundary followed by a length and then a u-boot e

[PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells

2022-09-15 Thread Rafał Miłecki
From: Rafał Miłecki DT binding allows specifying NVMEM cells as NVMEM device (provider) subnodes. Looks for such subnodes when building NVMEM cells. This allows NVMEM consumers to use U-Boot environment variables. Signed-off-by: Rafał Miłecki --- drivers/nvmem/u-boot-env.c | 1 + 1 file

[PATCH] nvmem: u-boot-env: fix crc32 casting type

2022-08-17 Thread Rafał Miłecki
From: Rafał Miłecki This fixes: drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32 Reported-by: kernel test robot Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables") Signed-off-by: Rafał Miłecki --- drivers/nvmem/u-boot-env.c

Re: [PATCH] dt-bindings: nvmem: u-boot,env: add basic NVMEM cells

2022-08-16 Thread Rafał Miłecki
On 3.07.2022 10:48, Rafał Miłecki wrote: U-Boot doesn't have cells at hardcoded addresses. They are stored in internal format. It's still important to define relevant cells in DT so NVMEM consumers can reference them. Update binding to allow including basic cells as NVMEM devic

Re: [PATCH] timer: bcmbca: Add Broadcom BCMBCA timer support

2022-08-01 Thread Rafał Miłecki
On 2.08.2022 00:03, William Zhang wrote: This driver supports the peripheral block timer found on the Broadcom BCA SoCs. It is 30-bit up-count timer running at 50MHz and can be used as the system clock source such as on BCM63138. Signed-off-by: William Zhang (...) +static const struct udev

[PATCH 2/2] mtd: parsers: add Broadcom's U-Boot parser

2022-07-11 Thread Rafał Miłecki
From: Rafał Miłecki Broadcom stores environment variables blocks inside U-Boot partition itself. This driver finds & registers them. Signed-off-by: Rafał Miłecki --- drivers/mtd/parsers/Kconfig | 10 drivers/mtd/parsers/Makefile | 1 + drivers/mtd/parsers/brcm_u-boot.c

[PATCH 1/2] dt-bindings: mtd: partitions: add binding for U-Boot bootloader

2022-07-11 Thread Rafał Miłecki
From: Rafał Miłecki Right now there is no (known) real reason for a custom binding for standard U-Boot partitions. Broadcom's U-Boot however requires extra handling - looking for environment variables subblocks. This commit adds Broadcom specific binding. Signed-off-by: Rafał Mi

[PATCH] dt-bindings: nvmem: u-boot,env: add basic NVMEM cells

2022-07-03 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot doesn't have cells at hardcoded addresses. They are stored in internal format. It's still important to define relevant cells in DT so NVMEM consumers can reference them. Update binding to allow including basic cells as NVMEM device subnodes. Signed-off

[PATCH] fw_env: add fallback to Linux's NVMEM based access

2022-06-16 Thread Rafał Miłecki
From: Rafał Miłecki A new DT binding for describing environment data block has been added in Linux's commit 5db1c2dbc04c ("dt-bindings: nvmem: add U-Boot environment variables binding"). Once we get a proper Linux NVMEM driver it'll be possible to use Linux's binary in

[PATCH V4 2/2] nvmem: add driver handling U-Boot environment variables

2022-06-15 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot stores its setup as environment variables. It's a list of key-value pairs stored on flash device with a custom header. This commit adds an NVMEM driver that: 1. Provides NVMEM access to environment vars binary data 2. Extracts variables as NVMEM cells Current Li

[PATCH V4 1/2] mtd: allow getting MTD device associated with a specific DT node

2022-06-15 Thread Rafał Miłecki
From: Rafał Miłecki MTD subsystem API allows interacting with MTD devices (e.g. reading, writing, handling bad blocks). So far a random driver could get MTD device only by its name (get_mtd_device_nm()). This change allows getting them also by a DT node. This API is required for drivers

Re: [PATCH V3 2/2] nvmem: add driver handling U-Boot environment variables

2022-06-15 Thread Rafał Miłecki
On 14.06.2022 08:45, Ahmad Fatoum wrote: + if (err && !mtd_is_bitflip(err)) { + dev_err(dev, "Failed to read from mtd: %d\n", err); Nitpick: %pe My "err" variable in int, not a pointer (I don't use PTR_ERR()). +static int u_boot_env_add_cells(struct u_boot_env *priv, ui

Re: [PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node

2022-06-13 Thread Rafał Miłecki
On 13.06.2022 16:04, Miquel Raynal wrote: @@ -1154,6 +1154,34 @@ int __get_mtd_device(struct mtd_info *mtd) } EXPORT_SYMBOL_GPL(__get_mtd_device); +/** + * of_get_mtd_device_by_node - obtain an MTD device associated with a given node + * + * @np: device tree node + */ +struct mtd_info *o

[PATCH V3 1/2] mtd: allow getting MTD device associated with a specific DT node

2022-06-11 Thread Rafał Miłecki
From: Rafał Miłecki MTD subsystem API allows interacting with MTD devices (e.g. reading, writing, handling bad blocks). So far a random driver could get MTD device only by its name (get_mtd_device_nm()). This change allows getting them also by a DT node. This API is required for drivers

[PATCH V3 2/2] nvmem: add driver handling U-Boot environment variables

2022-06-11 Thread Rafał Miłecki
From: Rafał Miłecki U-Boot stores its setup as environment variables. It's a list of key-value pairs stored on flash device with a custom header. This commit adds an NVMEM driver that: 1. Provides NVMEM access to environment vars binary data 2. Extracts variables as NVMEM cells Current Li

Re: [PATCH V2] nvmem: add driver handling U-Boot environment variables

2022-05-04 Thread Rafał Miłecki
On 4.05.2022 11:23, Ahmad Fatoum wrote: Hello Rafał, On 03.05.22 18:56, Rafał Miłecki wrote: From: Rafał Miłecki U-Boot stores its setup as environment variables. It's a list of key-value pairs stored on flash device with a custom header. This commit adds an NVMEM driver that: 1. Pro

Re: Regression? [PATCH 1/2] mtd: call of_platform_populate() for MTD partitions

2022-05-04 Thread Rafał Miłecki
On 25.04.2022 03:20, Daniel Golle wrote: On Mon, Apr 11, 2022 at 11:00:32AM +0200, Miquel Raynal wrote: On Wed, 2022-04-06 at 14:32:24 UTC, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= wrote: From: Rafał Miłecki Until this change MTD subsystem supported handling partitions only with MTD partitions

  1   2   >