linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Varshini Rajendran <varshini.rajendran@microchip.com>
Cc: eugen.hristev@linaro.org, jic23@kernel.org,
	dlechner@baylibre.com,  nuno.sa@analog.com, andy@kernel.org,
	robh@kernel.org, krzk+dt@kernel.org,  conor+dt@kernel.org,
	nicolas.ferre@microchip.com,  alexandre.belloni@bootlin.com,
	claudiu.beznea@tuxon.dev, srini@kernel.org,
	 linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/15] nvmem: microchip-otpc: rework to access packets based on tag
Date: Mon, 4 Aug 2025 15:05:42 +0200	[thread overview]
Message-ID: <CAHp75VffH+tpqP3J+x-ybiwe2O6Mqm6PkaxTrVBgByMpS4Q26w@mail.gmail.com> (raw)
In-Reply-To: <20250804100219.63325-3-varshini.rajendran@microchip.com>

On Mon, Aug 4, 2025 at 12:03 PM Varshini Rajendran
<varshini.rajendran@microchip.com> wrote:
>
> Rework the driver to change the packet access technique based on the TAG
> instead of the currently in use "id".
>
> Since there is no way of knowing the OTP memory mapping in advance or the
> changes it can go through with time, the id based approach is not reliable.
> Accessing the packets based on the associated tags is a fail-proof
> approach. This method is aided by adding a table of contents to store the
> payload information which makes it easier to traverse through the OTP
> memory and read the data of the intended packet. The stride of the nvmem
> device is adjusted to 1 to support the TAG being treated as an offset.
> The only reliable way to recognize a packet without being aware of the
> flashed contents of the OTP memory is the TAG of the packet.

...

> +struct mchp_otpc_payload_info {
> +       u32 id;
> +       u32 packet_offset;
> +       u32 payload_length;
> +       u32 packet_type;
> +       u32 packet_tag;

Just wondering if these are okay to be in CPU endianess, i.o.w. is
this part of the protocol to HW, or is it simply Linux driver holding
values?

> +};

...

> +/**
> + * mchp_otpc_read() - Read the OTP packets and fill the buffer based on the TAG
> + *                   of the packet treated as the offset.
> + * @priv: Pointer to device structure.
> + * @off: offset of the OTP packet to be read. In this case, the TAG of the
> + *      corresponding packet.
> + * @val: Pointer to data buffer
> + * @bytes: length of the buffer
> + *
> + * A value of zero will be returned on success, a negative errno will be
> + * returned in error cases.

kernel-doc validator is not happy: Missing Return section.

>   */

...

> -       packet = mchp_otpc_id_to_packet(otpc, off / 4);
> +

Seems like a stray change (adding a blank line).

> +       packet = mchp_otpc_tag_to_packet(otpc, off);
>         if (!packet)
>                 return -EINVAL;

...

> +       writel_relaxed(0UL, otpc->base + MCHP_OTPC_AR);

Does UL give any value  / make any sense here?

...

> +       if (size == 0) {
> +               dev_err(otpc->dev, "Cannot access OTP memory !\n");
> +               if (!emul_enable)
> +                       dev_err(otpc->dev, "Boot packet not configured & Emulation mode not enabled !\n");

Stray space before the exclamation mark in both messages.

> +       }

-- 
With Best Regards,
Andy Shevchenko


  reply	other threads:[~2025-08-04 13:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-04 10:02 [PATCH 00/15] Add thermal management support for sama7d65 Varshini Rajendran
2025-08-04 10:02 ` [PATCH 01/15] ARM: dts: microchip: sama7d65: add cpu opps Varshini Rajendran
2025-08-04 10:02 ` [PATCH 02/15] nvmem: microchip-otpc: rework to access packets based on tag Varshini Rajendran
2025-08-04 13:05   ` Andy Shevchenko [this message]
2025-08-04 17:49   ` kernel test robot
2025-08-05  6:50   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 03/15] dt-bindings: microchip-otpc: update dt node example Varshini Rajendran
2025-08-05  6:49   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 04/15] iio: adc: at91-sama5d2_adc: update calibration index, validation condition Varshini Rajendran
2025-08-04 13:11   ` Andy Shevchenko
2025-08-06 15:26   ` Jonathan Cameron
2025-08-04 10:02 ` [PATCH 05/15] ARM: dts: microchip: sama7g5: add packet tag as offset for calib Varshini Rajendran
2025-08-05  6:51   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 06/15] dt-bindings: nvmem: microchip-otpc: remove stride details Varshini Rajendran
2025-08-05  6:54   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 07/15] iio: adc: at91-sama5d2_adc: add temp init function as callback Varshini Rajendran
2025-08-04 13:13   ` Andy Shevchenko
2025-08-04 10:02 ` [PATCH 08/15] dt-bindings: iio: adc: at91-sama5d2: document sama7d65 Varshini Rajendran
2025-08-05  6:55   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 09/15] iio: adc: at91-sama5d2_adc: adapt the driver for sama7d65 Varshini Rajendran
2025-08-04 13:19   ` Andy Shevchenko
2025-08-06 15:31   ` Jonathan Cameron
2025-08-04 10:02 ` [PATCH 10/15] ARM: dts: microchip: sama7d65: add node for the ADC Varshini Rajendran
2025-08-04 10:02 ` [PATCH 11/15] dt-bindings: microchip-otpc: document sama7d65 Varshini Rajendran
2025-08-05  6:53   ` Krzysztof Kozlowski
2025-08-04 10:02 ` [PATCH 12/15] ARM: dts: microchip: sama7d65: add otpc node Varshini Rajendran
2025-08-04 10:02 ` [PATCH 13/15] ARM: dts: microchip: sama7d65: add cells for temperature calibration Varshini Rajendran
2025-08-04 10:02 ` [PATCH 14/15] ARM: dts: microchip: sama7d65: add temperature sensor Varshini Rajendran
2025-08-04 10:02 ` [PATCH 15/15] ARM: dts: microchip: sama7d65: add thermal zones node Varshini Rajendran

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=CAHp75VffH+tpqP3J+x-ybiwe2O6Mqm6PkaxTrVBgByMpS4Q26w@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andy@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=eugen.hristev@linaro.org \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=varshini.rajendran@microchip.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).