linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Keerthy <j-keerthy@ti.com>
To: Sekhar Nori <nsekhar@ti.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	<linux-rtc@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>,
	Linux OMAP List <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] rtc: omap: Support scratch registers
Date: Mon, 6 Nov 2017 12:29:15 +0530	[thread overview]
Message-ID: <4741d4c7-d6f7-ecdb-1eed-1293175f38d9@ti.com> (raw)
In-Reply-To: <600fd106-9f79-0f5a-a2fd-e6b067785c17@ti.com>



On Monday 06 November 2017 12:25 PM, Sekhar Nori wrote:
> + linux omap list
> 
> On Tuesday 31 October 2017 09:57 PM, Alexandre Belloni wrote:
>> Register an nvmem device to expose the 3 scratch registers (total of 12
>> bytes) to both userspace and kernel space.
>>
>> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> 
> Looks good to me.
> 
> Reviewed-by: Sekhar Nori <nsekhar@ti.com>
> 
> Curious on what you are using these registers for.

This is in response to this:
https://patchwork.kernel.org/patch/9684955/


> 
> Thanks,
> Sekhar
> 
>> ---
>>  drivers/rtc/rtc-omap.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 45 insertions(+)
>>
>> diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
>> index d56d937966dc..1d666ac9ef70 100644
>> --- a/drivers/rtc/rtc-omap.c
>> +++ b/drivers/rtc/rtc-omap.c
>> @@ -70,6 +70,10 @@
>>  #define OMAP_RTC_COMP_MSB_REG		0x50
>>  #define OMAP_RTC_OSC_REG		0x54
>>  
>> +#define OMAP_RTC_SCRATCH0_REG		0x60
>> +#define OMAP_RTC_SCRATCH1_REG		0x64
>> +#define OMAP_RTC_SCRATCH2_REG		0x68
>> +
>>  #define OMAP_RTC_KICK0_REG		0x6c
>>  #define OMAP_RTC_KICK1_REG		0x70
>>  
>> @@ -667,6 +671,45 @@ static struct pinctrl_desc rtc_pinctrl_desc = {
>>  	.owner = THIS_MODULE,
>>  };
>>  
>> +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));
>> +
>> +	return 0;
>> +}
>> +
>> +static int omap_rtc_scratch_write(void *priv, unsigned int offset, void *_val,
>> +				  size_t bytes)
>> +{
>> +	struct omap_rtc	*rtc = priv;
>> +	u32 *val = _val;
>> +	int i;
>> +
>> +	rtc->type->unlock(rtc);
>> +	for (i = 0; i < bytes / 4; i++)
>> +		rtc_writel(rtc,
>> +			   OMAP_RTC_SCRATCH0_REG + offset + (i * 4), val[i]);
>> +	rtc->type->lock(rtc);
>> +
>> +	return 0;
>> +}
>> +
>> +static struct nvmem_config omap_rtc_nvmem_config = {
>> +	.name = "omap_rtc_scratch",
>> +	.word_size = 4,
>> +	.stride = 4,
>> +	.size = OMAP_RTC_KICK0_REG - OMAP_RTC_SCRATCH0_REG,
>> +	.reg_read = omap_rtc_scratch_read,
>> +	.reg_write = omap_rtc_scratch_write,
>> +};
>> +
>>  static int omap_rtc_probe(struct platform_device *pdev)
>>  {
>>  	struct omap_rtc	*rtc;
>> @@ -804,6 +847,8 @@ static int omap_rtc_probe(struct platform_device *pdev)
>>  	}
>>  
>>  	rtc->rtc->ops = &omap_rtc_ops;
>> +	omap_rtc_nvmem_config.priv = rtc;
>> +	rtc->rtc->nvmem_config = &omap_rtc_nvmem_config;
>>  
>>  	/* handle periodic and alarm irqs */
>>  	ret = devm_request_irq(&pdev->dev, rtc->irq_timer, rtc_irq, 0,
>> -- 
>> 2.15.0.rc2
>>
> 

  reply	other threads:[~2017-11-06  6:59 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 [this message]
2017-11-06  7:02     ` Sekhar Nori
2017-11-08  6:00     ` Keerthy
2017-11-08  6:27       ` Alexandre Belloni
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=4741d4c7-d6f7-ecdb-1eed-1293175f38d9@ti.com \
    --to=j-keerthy@ti.com \
    --cc=alexandre.belloni@free-electrons.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).