Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2650718pxb; Thu, 11 Feb 2021 19:32:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY65wUxp8kN2Q/C3mwmGuf+ClihvQXibfytE7215UnV15q+vV17PYgykTQKsDLd9oSudoo X-Received: by 2002:a17:906:8159:: with SMTP id z25mr988718ejw.270.1613100753416; Thu, 11 Feb 2021 19:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613100753; cv=none; d=google.com; s=arc-20160816; b=Y1u4WpEspgkLLzxErlEt645YHQZmJMnZK3x4uOn0jxBDoWwOJMfMndTCey7bAObC93 Xal0UaXjCiiQ7U3s4TOSPElC6mW9Xey4bCYHQjHeVvUUJGaNTtccZuStZMGuYoSEy87D n1NjDJRs11gZHrm8S9OU+J13nvaRhCEg65uW+o3X7mFS/YCQ3ye654ewfNng7VjIbDXf YGPP3PmodhUsydaL5h5wcOfUGW67YmGh2u7i8dLgTxgWe7KqOK9H9Uf0Agl3cYIVmiEi SCzadHuhF9r0fB4VxHF+RifKUAH5x2OE6CBid6QlN5Q4pQsiVvMJWW5rl9OvsYCQUhtu H+WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:message-id:date:to:cc:from:subject :references:in-reply-to:content-transfer-encoding:mime-version :dkim-signature; bh=z5jZZLKFl82ekSgdpWZ8cFEjdxbElVMYJro2T6/BlpQ=; b=XHshbTdLocaOm4OgeWIxPVjKKepJHoPhH/NaknsX9b0bWaoWLQG0cBTnKI9jx1yb6T MGvyxUeZcehv9ntGYW3PKzQ5ykn15WQ+tfhg5cgb7UTujf4ZvxUUSJftKlayfTM9yiM8 JipDgb8bW0OZ+HXT7hQ67FjqyBGpLucQz2ncZPVlFxASucaDCltTsN3JU2Y51rAB2/e/ xKUpKBjZMoCGUHF4gQrSZvm2lNX/YtyZGj4CSJ/TxbeYx9OJ6/nZxmT7hOkWj55AIaRr DrmgF+/qK40e4M+37iT6irmXgZeUGhNVieE77YrTijpBEwIkO5Rx5Vw3vNHZV7XDf9e8 BPCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b03ZFsRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si5400170ejd.722.2021.02.11.19.32.10; Thu, 11 Feb 2021 19:32:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b03ZFsRE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229733AbhBLDb3 (ORCPT + 99 others); Thu, 11 Feb 2021 22:31:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:55494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229547AbhBLDb3 (ORCPT ); Thu, 11 Feb 2021 22:31:29 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4155B60231; Fri, 12 Feb 2021 03:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613100648; bh=ugam9oRjHrtW+kW58+/nzrA/HAjnVYvAzMVFQMenhL8=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=b03ZFsREcxdYdDbXCEOrVGDbW9ssf/LODbDEekBwTb5nMnlapPHkLQuUJKzWShCRO zYadfIEcSxFGT5Ty9I8TTFe4DlXY0tWhTtfhotALNPJL6j9R1r9PVVJ0Ho9tQLbpAa dgh3eoysJB3QqMd+FF4/8LRFj0UIBZoL0SD4FFH33RMMYT4bdqwvr4y3nI4ViREK+u QDIIlbAENuP40QIFtKxWffew5H5r2MWWkcoFQOv9smG2XcRLnlx9EfxDxkFaZqoGjr l1YfrKreTfPBqPV86gKQ/1scEHRc5nrLhzh7dF8LvRwlhy44ICYWoYDnwQKakyGviZ rLowkfOxKekNw== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210106070436.14870-1-mike.looijmans@topic.nl> References: <20210106070436.14870-1-mike.looijmans@topic.nl> Subject: Re: [PATCH v2] clk-si5341: Support NVM programming through sysfs From: Stephen Boyd Cc: linux-kernel@vger.kernel.org, mturquette@baylibre.com, Mike Looijmans To: Mike Looijmans , linux-clk@vger.kernel.org, Srinivas Kandagatla Date: Thu, 11 Feb 2021 19:30:44 -0800 Message-ID: <161310064437.1254594.4211144292317753592@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. >=20 > 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. >=20 > Signed-off-by: Mike Looijmans > --- > v2: Add description in Documentation/ABI/ > Use regmap_read_poll_timeout() > Abort on sysfs_create_group error >=20 > .../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 >=20 > diff --git a/Documentation/ABI/testing/sysfs-devices-clk-si5341 b/Documen= tation/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 > +Description: Allows programming the NVM memory of the clock chip, so i= t boots > + up in the current configuration. This saves boot time (30= 0ms > + 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 t= he > + chip's current settings into its NVM storage. This magic = value > + is taken from the datasheet, it's the same value that mus= t be > + written to the hardware to program it. Programming can on= ly be > + done twice in the lifetime of the chip. > + > + Read the value to check the state of the chip. This retur= ns 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 typicall= y be > + used at the end of production stages.