linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Keerthy <j-keerthy@ti.com>
Cc: Sekhar Nori <nsekhar@ti.com>,
	linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linux OMAP List <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] rtc: omap: Support scratch registers
Date: Wed, 8 Nov 2017 07:27:38 +0100	[thread overview]
Message-ID: <20171108062738.cml7qaek324rvc4e@piout.net> (raw)
In-Reply-To: <9a383f74-e049-885b-4705-93968f4c75d4@ti.com>

Hi,

On 08/11/2017 at 11:30:45 +0530, Keerthy wrote:
> >>> +static int omap_rtc_scratch_read(void *priv, unsigned int offset, void *_val,
> >>> +				 size_t bytes)
> >>> +{
> >>> +	struct omap_rtc	*rtc = priv;
> >>> +	u32 *val = _val;
> >>> +	int i;
> >>> +
> >>> +	for (i = 0; i < bytes / 4; i++)
> >>> +		val[i] = rtc_readl(rtc,
> >>> +				   OMAP_RTC_SCRATCH0_REG + offset + (i * 4));
> 
> Can the offset be the Scratch register number instead of bytes offset?
> More intuitive to me.
> 
> So that one can request using offset as 0, 1, 2 instead of 0, 4, 8?
> 

Well, the offset is coming from the nvmem core, itself getting it from
the Linux file API (and it is in bytes). However, you have the guarantee
that it will be aligned on a word, see:
http://elixir.free-electrons.com/linux/latest/source/drivers/nvmem/core.c#L88

> The above can be:
> rtc_readl(rtc, OMAP_RTC_SCRATCH0_REG + (offset + i) * 4), val[i]);
> 
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2017-11-08  6:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-31 16:27 [PATCH] rtc: omap: Support scratch registers Alexandre Belloni
2017-11-06  6:55 ` Sekhar Nori
2017-11-06  6:59   ` Keerthy
2017-11-06  7:02     ` Sekhar Nori
2017-11-08  6:00     ` Keerthy
2017-11-08  6:27       ` Alexandre Belloni [this message]
2017-11-08  7:08         ` Keerthy
2017-11-08  7:16           ` Alexandre Belloni
2017-11-08  8:06             ` Keerthy
2017-11-08  8:21               ` Alexandre Belloni
2017-11-08  8:31                 ` Keerthy
2017-11-08  8:32                   ` Keerthy
2017-11-08  8:35                     ` Alexandre Belloni
2017-11-08  8:48                       ` Keerthy

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=20171108062738.cml7qaek324rvc4e@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=nsekhar@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 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).