public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: "Srinivas Kandagatla" <srinivas.kandagatla@linaro.org>,
	"Rafał Miłecki" <rafal@milecki.pl>
Cc: Tom Rini <trini@konsulko.com>,
	linux-arm-kernel@lists.infradead.org, u-boot@lists.denx.de,
	linux-kernel@vger.kernel.org,
	bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH] nvmem: u-boot-env: add Broadcom format support
Date: Fri, 11 Nov 2022 18:57:37 +0100	[thread overview]
Message-ID: <fe41146d-48f9-3e9c-1e5a-48e8488f4fee@gmail.com> (raw)
In-Reply-To: <20221017071722.32731-1-zajec5@gmail.com>

On 17.10.2022 09:17, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> 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 their custom format.
> 
> Ref: c34f9f5499278 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding")

This should be actually:
6b0584c19d87 ("dt-bindings: nvmem: u-boot,env: add Broadcom's variant binding")

Srinivas: could you fix it up while applying, please?


> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>   drivers/nvmem/u-boot-env.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c
> index 8e72d1bbd649..049330660fd7 100644
> --- a/drivers/nvmem/u-boot-env.c
> +++ b/drivers/nvmem/u-boot-env.c
> @@ -16,6 +16,7 @@
>   enum u_boot_env_format {
>   	U_BOOT_FORMAT_SINGLE,
>   	U_BOOT_FORMAT_REDUNDANT,
> +	U_BOOT_FORMAT_BROADCOM,
>   };
>   
>   struct u_boot_env {
> @@ -40,6 +41,13 @@ struct u_boot_env_image_redundant {
>   	uint8_t data[];
>   } __packed;
>   
> +struct u_boot_env_image_broadcom {
> +	__le32 magic;
> +	__le32 len;
> +	__le32 crc32;
> +	uint8_t data[0];
> +} __packed;
> +
>   static int u_boot_env_read(void *context, unsigned int offset, void *val,
>   			   size_t bytes)
>   {
> @@ -138,6 +146,11 @@ static int u_boot_env_parse(struct u_boot_env *priv)
>   		crc32_data_offset = offsetof(struct u_boot_env_image_redundant, mark);
>   		data_offset = offsetof(struct u_boot_env_image_redundant, data);
>   		break;
> +	case U_BOOT_FORMAT_BROADCOM:
> +		crc32_offset = offsetof(struct u_boot_env_image_broadcom, crc32);
> +		crc32_data_offset = offsetof(struct u_boot_env_image_broadcom, data);
> +		data_offset = offsetof(struct u_boot_env_image_broadcom, data);
> +		break;
>   	}
>   	crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset));
>   	crc32_data_len = priv->mtd->size - crc32_data_offset;
> @@ -202,6 +215,7 @@ static const struct of_device_id u_boot_env_of_match_table[] = {
>   	{ .compatible = "u-boot,env", .data = (void *)U_BOOT_FORMAT_SINGLE, },
>   	{ .compatible = "u-boot,env-redundant-bool", .data = (void *)U_BOOT_FORMAT_REDUNDANT, },
>   	{ .compatible = "u-boot,env-redundant-count", .data = (void *)U_BOOT_FORMAT_REDUNDANT, },
> +	{ .compatible = "brcm,env", .data = (void *)U_BOOT_FORMAT_BROADCOM, },
>   	{},
>   };
>   

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-11-11 17:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17  7:17 [PATCH] nvmem: u-boot-env: add Broadcom format support Rafał Miłecki
2022-11-11 17:57 ` Rafał Miłecki [this message]
2022-11-11 18:02   ` Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe41146d-48f9-3e9c-1e5a-48e8488f4fee@gmail.com \
    --to=zajec5@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox