All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Hauke Mehrtens <hauke@hauke-m.de>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	robh+dt@kernel.org
Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	rafal@milecki.pl, musashino.open@gmail.com
Subject: Re: [PATCH 1/2] mtd: parsers: trx: Allow to specify trx-magic in DT
Date: Thu, 18 Mar 2021 07:43:34 +0100	[thread overview]
Message-ID: <c596dbe2-a948-81c4-1e4e-e2d6c1b58b44@gmail.com> (raw)
In-Reply-To: <20210315170711.567358-2-hauke@hauke-m.de>

On 15.03.2021 18:07, Hauke Mehrtens wrote:
> Buffalo uses a different TRX magic for every device, to be able to use
> this trx parser, make it possible to specify the TRX magic in device
> tree. If no TRX magic is specified in device tree, the standard value
> will be used. This value should only be specified if a vendor chooses to
> use a non standard TRX magic.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   .../bindings/mtd/partitions/brcm,trx.txt      |  5 +++++
>   drivers/mtd/parsers/parser_trx.c              | 21 ++++++++++++++++++-
>   2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> index b677147ca4e1..715a18ca36bd 100644
> --- a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> @@ -28,6 +28,11 @@ detected by a software parsing TRX header.
>   Required properties:
>   - compatible : (required) must be "brcm,trx"
>   
> +Optional properties:
> +
> +- trx-magic: TRX magic, if it is different from the default magic
> +	     0x30524448 as a u32.

It may need to be brcm,trx-magic and ack for sending a separated bt-bindings patch.


> diff --git a/drivers/mtd/parsers/parser_trx.c b/drivers/mtd/parsers/parser_trx.c
> index 8541182134d4..fd424587caa4 100644
> --- a/drivers/mtd/parsers/parser_trx.c
> +++ b/drivers/mtd/parsers/parser_trx.c
> @@ -47,6 +47,24 @@ static const char *parser_trx_data_part_name(struct mtd_info *master,
>   	return "rootfs";
>   }
>   
> +static uint32_t parser_trx_get_magic(struct mtd_info *mtd)
> +{
> +	uint32_t trx_magic = TRX_MAGIC;
> +	struct device_node *np;
> +	int err;
> +
> +	np = mtd_get_of_node(mtd);
> +	if (!np)
> +		return trx_magic;

This check seems redundant, of_ returns -EINVAL also for NULL node.


> +	/* Get different magic from device tree if specified */
> +	err = of_property_read_u32(np, "trx-magic", &trx_magic);
> +	if (err != 0 && err != -EINVAL)
> +		pr_err("failed to parse \"trx-magic\" DT attribute, use default: %d\n", err);

I'm not native, but shouldn't that be s/use/using/ ?


> +
> +	return trx_magic;
> +}

WARNING: multiple messages have this Message-ID (diff)
From: "Rafał Miłecki" <zajec5@gmail.com>
To: Hauke Mehrtens <hauke@hauke-m.de>,
	miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	robh+dt@kernel.org
Cc: linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	rafal@milecki.pl, musashino.open@gmail.com
Subject: Re: [PATCH 1/2] mtd: parsers: trx: Allow to specify trx-magic in DT
Date: Thu, 18 Mar 2021 07:43:34 +0100	[thread overview]
Message-ID: <c596dbe2-a948-81c4-1e4e-e2d6c1b58b44@gmail.com> (raw)
In-Reply-To: <20210315170711.567358-2-hauke@hauke-m.de>

On 15.03.2021 18:07, Hauke Mehrtens wrote:
> Buffalo uses a different TRX magic for every device, to be able to use
> this trx parser, make it possible to specify the TRX magic in device
> tree. If no TRX magic is specified in device tree, the standard value
> will be used. This value should only be specified if a vendor chooses to
> use a non standard TRX magic.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   .../bindings/mtd/partitions/brcm,trx.txt      |  5 +++++
>   drivers/mtd/parsers/parser_trx.c              | 21 ++++++++++++++++++-
>   2 files changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> index b677147ca4e1..715a18ca36bd 100644
> --- a/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,trx.txt
> @@ -28,6 +28,11 @@ detected by a software parsing TRX header.
>   Required properties:
>   - compatible : (required) must be "brcm,trx"
>   
> +Optional properties:
> +
> +- trx-magic: TRX magic, if it is different from the default magic
> +	     0x30524448 as a u32.

It may need to be brcm,trx-magic and ack for sending a separated bt-bindings patch.


> diff --git a/drivers/mtd/parsers/parser_trx.c b/drivers/mtd/parsers/parser_trx.c
> index 8541182134d4..fd424587caa4 100644
> --- a/drivers/mtd/parsers/parser_trx.c
> +++ b/drivers/mtd/parsers/parser_trx.c
> @@ -47,6 +47,24 @@ static const char *parser_trx_data_part_name(struct mtd_info *master,
>   	return "rootfs";
>   }
>   
> +static uint32_t parser_trx_get_magic(struct mtd_info *mtd)
> +{
> +	uint32_t trx_magic = TRX_MAGIC;
> +	struct device_node *np;
> +	int err;
> +
> +	np = mtd_get_of_node(mtd);
> +	if (!np)
> +		return trx_magic;

This check seems redundant, of_ returns -EINVAL also for NULL node.


> +	/* Get different magic from device tree if specified */
> +	err = of_property_read_u32(np, "trx-magic", &trx_magic);
> +	if (err != 0 && err != -EINVAL)
> +		pr_err("failed to parse \"trx-magic\" DT attribute, use default: %d\n", err);

I'm not native, but shouldn't that be s/use/using/ ?


> +
> +	return trx_magic;
> +}

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2021-03-18  6:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 17:07 [PATCH 0/2] mtd: parsers: trx: Add support for Buffalo WSR-2533DHP2 Hauke Mehrtens
2021-03-15 17:07 ` Hauke Mehrtens
2021-03-15 17:07 ` [PATCH 1/2] mtd: parsers: trx: Allow to specify trx-magic in DT Hauke Mehrtens
2021-03-15 17:07   ` Hauke Mehrtens
2021-03-17  9:25   ` Miquel Raynal
2021-03-17  9:25     ` Miquel Raynal
2021-04-18 16:53     ` Hauke Mehrtens
2021-03-18  6:43   ` Rafał Miłecki [this message]
2021-03-18  6:43     ` Rafał Miłecki
2021-04-18 16:59     ` Hauke Mehrtens
2021-04-18 16:59       ` Hauke Mehrtens
2021-03-15 17:07 ` [PATCH 2/2] mtd: parsers: trx: Remove dependency to BRCM architectures Hauke Mehrtens
2021-03-15 17:07   ` Hauke Mehrtens
2021-03-18  6:45   ` Rafał Miłecki
2021-03-18  6:45     ` Rafał Miłecki
2021-04-18 17:03     ` Hauke Mehrtens
2021-04-18 17:03       ` Hauke Mehrtens

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=c596dbe2-a948-81c4-1e4e-e2d6c1b58b44@gmail.com \
    --to=zajec5@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hauke@hauke-m.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=musashino.open@gmail.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=vigneshr@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.