All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: Dario Binacchi <dariobin@libero.it>, <u-boot@lists.denx.de>
Subject: Re: [PATCH 6/7] rtc: davinci: add driver model support
Date: Thu, 27 May 2021 15:34:40 +0530	[thread overview]
Message-ID: <440362b5-e887-b708-d3e5-aca4dcf1ee78@ti.com> (raw)
In-Reply-To: <20210507041509.4928-7-dariobin@libero.it>



On 07/05/21 9:45 am, Dario Binacchi wrote:
> Update the driver to support the device tree and the driver model.
> The read / write helpers in rtc_ops allow access to scratch registers
> only. The offset parameter is added to the address of the scratch0
> register.
> 
> Signed-off-by: Dario Binacchi <dariobin@libero.it>
> ---
> 
>  drivers/rtc/davinci.c | 373 ++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 363 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/rtc/davinci.c b/drivers/rtc/davinci.c
> index 82e5eb3b43..b0a077cba7 100644
> --- a/drivers/rtc/davinci.c
> +++ b/drivers/rtc/davinci.c
> @@ -2,20 +2,20 @@
>  /*
>   * (C) Copyright 2011 DENX Software Engineering GmbH
>   * Heiko Schocher <hs@denx.de>
> + * Copyright (C) 2021 Dario Binacchi <dariobin@libero.it>
>   */
>  #include <common.h>
>  #include <command.h>
> +#include <dm.h>
> +#include <clk.h>
>  #include <log.h>
>  #include <rtc.h>
>  #include <asm/io.h>
>  #include <asm/davinci_rtc.h>
>  #include <asm/arch/hardware.h>
> +#include <dm/device_compat.h>
>  #include <linux/delay.h>
>  
> -#if !defined(RTC_BASE) && defined(DAVINCI_RTC_BASE)
> -#define RTC_BASE DAVINCI_RTC_BASE
> -#endif
> -
>  static void davinci_rtc_lock(struct davinci_rtc *rtc)
>  {
>  	writel(0, &rtc->kick0r);
> @@ -52,9 +52,8 @@ static int davinci_rtc_wait_not_busy(struct davinci_rtc *rtc)
>  	return 0;
>  }
>  
> -int rtc_get(struct rtc_time *tmp)
> +static int davinci_rtc_get(struct davinci_rtc *rtc, struct rtc_time *tmp)

can we use use consistent naming? omap_rtc_<function>?

>  {
> -	struct davinci_rtc *rtc = (struct davinci_rtc *)RTC_BASE;
>  	unsigned long sec, min, hour, mday, wday, mon_cent, year;
>  	int ret;
>  
> @@ -92,9 +91,8 @@ int rtc_get(struct rtc_time *tmp)
>  	return 0;
>  }
>  
> -int rtc_set(struct rtc_time *tmp)
> +static int davinci_rtc_set(struct davinci_rtc *rtc, const struct rtc_time *tmp)
>  {
> -	struct davinci_rtc *rtc = (struct davinci_rtc *)RTC_BASE;
>  	int ret;
>  
>  	ret = davinci_rtc_wait_not_busy(rtc);
> @@ -119,10 +117,365 @@ int rtc_set(struct rtc_time *tmp)
>  	return 0;
>  }
>  
> +static void davinci_rtc_reset(struct davinci_rtc *rtc)
> +{
> +	/* run RTC counter */
> +	writeb(0x01, &rtc->ctrl);
> +}
> +
> +#if !CONFIG_IS_ENABLED(DM_RTC)

Are there any users of non-DM? If not can we just drop the support for non-DM?

Thanks and regards,
Lokesh

  reply	other threads:[~2021-05-27 10:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07  4:15 [PATCH 0/7] rtc: davinci: add driver model support Dario Binacchi
2021-05-07  4:15 ` [PATCH 1/7] rtc: davinci: enable compilation for omap architectures Dario Binacchi
2021-05-07  7:56   ` Pali Rohár
2021-05-08 10:40     ` Dario Binacchi
2021-05-27  9:59   ` Lokesh Vutla
2021-05-28 11:07     ` Dario Binacchi
2021-05-07  4:15 ` [PATCH 2/7] rtc: davinci: replace 32bit access with 8bit access Dario Binacchi
2021-05-07  4:15 ` [PATCH 3/7] rtc: davinci: check BUSY bit before set TC registers Dario Binacchi
2021-05-07  4:15 ` [PATCH 4/7] rtc: davinci: use unlock/lock mechanism Dario Binacchi
2021-05-07  4:15 ` [PATCH 5/7] arm: dts: sync rtc node of am335x boards with Linux 5.9-rc7 Dario Binacchi
2021-05-07  4:15 ` [PATCH 6/7] rtc: davinci: add driver model support Dario Binacchi
2021-05-27 10:04   ` Lokesh Vutla [this message]
2021-05-07  4:15 ` [PATCH 7/7] rtc: davinci: fix date loaded on reset Dario Binacchi

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=440362b5-e887-b708-d3e5-aca4dcf1ee78@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=dariobin@libero.it \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.