linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Mike Looijmans <mike.looijmans@topic.nl>,
	linux-clk@vger.kernel.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: linux-kernel@vger.kernel.org, mturquette@baylibre.com,
	Mike Looijmans <mike.looijmans@topic.nl>
Subject: Re: [PATCH v2] clk-si5341: Support NVM programming through sysfs
Date: Thu, 11 Feb 2021 19:30:44 -0800	[thread overview]
Message-ID: <161310064437.1254594.4211144292317753592@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20210106070436.14870-1-mike.looijmans@topic.nl>

Quoting Mike Looijmans (2021-01-05 23:04:36)
> Export an attribute program_nvm_bank that when read reports the current
> bank value. To program the chip's current state into NVM, write the
> magic value 0xC7 into this attribute.
> 
> This allows the clock chip to be programmed "in system" to reduce boot
> time by 300ms and allows the clock to be up and running before the
> kernel boots (e.g. for bootloader usage). Some vendors initialize PLLs
> only in their bootloader and thus need the clock running at boot.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
> ---
> v2: Add description in Documentation/ABI/
>     Use regmap_read_poll_timeout()
>     Abort on sysfs_create_group error
> 
>  .../ABI/testing/sysfs-devices-clk-si5341      | 24 +++++++
>  drivers/clk/clk-si5341.c                      | 68 +++++++++++++++++++
>  2 files changed, 92 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-devices-clk-si5341
> 
> diff --git a/Documentation/ABI/testing/sysfs-devices-clk-si5341 b/Documentation/ABI/testing/sysfs-devices-clk-si5341
> new file mode 100644
> index 000000000000..7243b82a3729
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-devices-clk-si5341
> @@ -0,0 +1,24 @@
> +What:          /sys/bus/i2c/devices/.../clk-si534*/program_nvm_bank

I'm still curious why this is exposed here instead of through nvmem
framework. I think we talked about it before, but it would be great if
the commit text could quiet any concerns about that so we have a record
of why using the existing nvmem framework wasn't suitable.

> +Date:          Jan 2021
> +KernelVersion: 5.12
> +Contact:       Mike Looijmans <mike.looijmans@topic.nl>
> +Description:   Allows programming the NVM memory of the clock chip, so it boots
> +               up in the current configuration. This saves boot time (300ms
> +               clock initialization) and allows the clock to be available
> +               before the kernel boots (e.g. u-boot ethernet clock).
> +
> +               Write the magic value 0xc7 to this attribute to program the
> +               chip's current settings into its NVM storage. This magic value
> +               is taken from the datasheet, it's the same value that must be
> +               written to the hardware to program it. Programming can only be
> +               done twice in the lifetime of the chip.
> +
> +               Read the value to check the state of the chip. This returns the
> +               raw value as read from the hardware. Possible values:
> +               0x03: Not programmed
> +               0x0f: Programmed once
> +               0x3f: Programmed twice, can no longer be programmed
> +
> +Users:         User space applications for embedded boards equipped with one
> +               or more Si534x programmable clock devices. Would typically be
> +               used at the end of production stages.

      reply	other threads:[~2021-02-12  3:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06  7:04 [PATCH v2] clk-si5341: Support NVM programming through sysfs Mike Looijmans
2021-02-12  3:30 ` Stephen Boyd [this message]

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=161310064437.1254594.4211144292317753592@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=mturquette@baylibre.com \
    --cc=srinivas.kandagatla@linaro.org \
    /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).